...

Text file src/cloud.google.com/go/migration.md

Documentation: cloud.google.com/go

     1# go-genproto to google-cloud-go message type migration
     2
     3The message types for all of our client libraries are being migrated from the
     4`google.golang.org/genproto` [module](https://pkg.go.dev/google.golang.org/genproto)
     5to their respective product specific module in this repository. For example
     6this asset request type that was once found in [genproto](https://pkg.go.dev/google.golang.org/genproto@v0.0.0-20220908141613-51c1cc9bc6d0/googleapis/cloud/asset/v1p5beta1#ListAssetsRequest)
     7can now be found in directly in the [asset module](https://pkg.go.dev/cloud.google.com/go/asset/apiv1p5beta1/assetpb#ListAssetsRequest).
     8
     9Although the type definitions have moved, aliases have been left in the old
    10genproto packages to ensure a smooth non-breaking transition.
    11
    12## How do I migrate to the new packages?
    13
    14The easiest option is to run a migration tool at the root of our project. It is
    15like `go fix`, but specifically for this migration. Before running the tool it
    16is best to make sure any modules that have the prefix of `cloud.google.com/go`
    17are up to date. To run the tool, do the following:
    18
    19```bash
    20go run cloud.google.com/go/internal/aliasfix/cmd/aliasfix@latest .
    21go mod tidy
    22```
    23
    24The tool should only change up to one line in the import statement per file.
    25This can also be done by hand if you prefer.
    26
    27## Do I have to migrate?
    28
    29Yes if you wish to keep using the newest versions of our client libraries with
    30the newest features -- You should migrate by the start of 2023. Until then we
    31will keep updating the aliases in go-genproto weekly. If you have an existing
    32workload that uses these client libraries and does not need to update its
    33dependencies there is no action to take. All existing written code will continue
    34to work.
    35
    36## Why are these types being moved
    37
    381. This change will help simplify dependency trees over time.
    392. The types will now be in product specific modules that are versioned
    40   independently with semver. This is especially a benefit for users that rely
    41   on multiple clients in a single application. Because message types are no
    42   longer mono-packaged users are less likely to run into intermediate
    43   dependency conflicts when updating dependencies.
    443. Having all these types in one repository will help us ensure that unintended
    45   changes are caught before they would be released.
    46
    47## Have questions?
    48
    49Please reach out to us on our [issue tracker](https://github.com/googleapis/google-cloud-go/issues/new?assignees=&labels=genproto-migration&template=migration-issue.md&title=package%3A+migration+help)
    50if you have any questions or concerns.

View as plain text