Skip to content

golang: remove redundant path duplication between apis and go.go_apis #5471

@julieqiu

Description

@julieqiu

https://github.com/googleapis/google-cloud-go/blob/a1a30091f329a3b22e8510e5089c0d95fc632e9d/librarian.yaml currently requires duplicating the same API path in both apis and go.go_apis, for example:

- name: apiregistry
  version: 0.5.0
  apis:
    - path: google/cloud/apiregistry/v1
    - path: google/cloud/apiregistry/v1beta
  go:
    go_apis:
      - enabled_generator_features:
          - F_open_telemetry_attributes
        path: google/cloud/apiregistry/v1
      - enabled_generator_features:
          - F_open_telemetry_attributes
        path: google/cloud/apiregistry/v1beta

We should restructure the config to move these under each API entry to eliminate duplication and prevent drift:

- name: apiregistry
  version: 0.5.0
  apis:
    - path: google/cloud/apiregistry/v1
      go:
        enabled_generator_features:
          - F_open_telemetry_attributes
    - path: google/cloud/apiregistry/v1beta
      go:
        enabled_generator_features:
          - F_open_telemetry_attributes

If a default is shared across all Go APIs, it should be supported using a top-level go block:

apis:
  - path: google/cloud/apiregistry/v1
  - path: google/cloud/apiregistry/v1beta 
go:
  default_enabled_generator_features:
    - F_open_telemetry_attributes

We should only override per-API when needed. librarian tidy should be updated to check for this.

Note that this change requires maintaining backwards compatibility, until google-cloud-go has been migrated.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions