Skip to content

Commit dbd1ba9

Browse files
authored
chore(internal/config): remove VersionSuffix from Go configuration (#4283)
With the import path and client package refactoration in #4251, `VersionSuffix` is no longer needed to build the import path. A follow up PR will remove `ClientPackageOverride`. For #3617
1 parent 3a9563a commit dbd1ba9

6 files changed

Lines changed: 3 additions & 23 deletions

File tree

doc/config-schema.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ This document describes the schema for the librarian.yaml.
131131
| `no_rest_numeric_enums` | bool | Determines whether to use numeric enums in REST requests. The "No" prefix is used because the default behavior (when this field is `false` or omitted) is to generate numeric enums |
132132
| `path` | string | Is the source path. |
133133
| `proto_package` | string | Is the proto package name. |
134-
| `version_suffix` | string | Is an optional suffix appended to the version part of the GAPIC import path. |
135134

136135
## GoModule Configuration
137136

internal/config/language.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ type GoAPI struct {
5858
Path string `yaml:"path,omitempty"`
5959
// ProtoPackage is the proto package name.
6060
ProtoPackage string `yaml:"proto_package,omitempty"`
61-
// VersionSuffix is an optional suffix appended to the version part of the GAPIC import path.
62-
VersionSuffix string `yaml:"version_suffix,omitempty"`
6361
}
6462

6563
// RustDefault contains Rust-specific default configuration.

internal/librarian/golang/generate.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ func buildGAPICOpts(apiPath string, library *config.Library, goAPI *config.GoAPI
224224
}
225225

226226
func buildGAPICImportPath(library *config.Library, goAPI *config.GoAPI) string {
227-
importPath := goAPI.ImportPath
228-
if goAPI.VersionSuffix != "" {
229-
importPath = fmt.Sprintf("%s/%s", importPath, goAPI.VersionSuffix)
230-
}
231227
clientPkg := goAPI.ClientDirectory
232228
if goAPI.ClientPackageOverride != "" {
233229
clientPkg = goAPI.ClientPackageOverride
@@ -237,7 +233,7 @@ func buildGAPICImportPath(library *config.Library, goAPI *config.GoAPI) string {
237233
modulePathVersion = "/" + library.Go.ModulePathVersion
238234
}
239235
return fmt.Sprintf("cloud.google.com/go/%s%s;%s",
240-
importPath, modulePathVersion, clientPkg)
236+
goAPI.ImportPath, modulePathVersion, clientPkg)
241237
}
242238

243239
// fixVersioning moves {name}/{version}/* up to {name}/ for versioned modules.

internal/librarian/golang/generate_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -628,19 +628,6 @@ func TestBuildGAPICImportPath(t *testing.T) {
628628
},
629629
want: "cloud.google.com/go/storage/internal/apiv2;storage",
630630
},
631-
{
632-
name: "version suffix",
633-
library: &config.Library{
634-
Name: "monitoring",
635-
},
636-
goAPI: &config.GoAPI{
637-
ClientDirectory: "monitoring",
638-
ImportPath: "monitoring/apiv3",
639-
Path: "google/monitoring/v3",
640-
VersionSuffix: "v2",
641-
},
642-
want: "cloud.google.com/go/monitoring/apiv3/v2;monitoring",
643-
},
644631
} {
645632
t.Run(test.name, func(t *testing.T) {
646633
got := buildGAPICImportPath(test.library, test.goAPI)

internal/librarian/golang/repometadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func generateRepoMetadata(api *serviceconfig.API, library *config.Library) error
4848
LibraryType: repometadata.GAPICAutoLibraryType,
4949
ReleaseLevel: level,
5050
}
51-
return metadata.Write(filepath.Join(library.Output, goAPI.ImportPath, goAPI.VersionSuffix))
51+
return metadata.Write(filepath.Join(library.Output, goAPI.ImportPath))
5252
}
5353

5454
// clientDocURL builds the client documentation URL for Go SDK.

internal/librarian/golang/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func generateClientVersionFile(library *config.Library, apiPath string) (err err
6969
// Therefore, version.go does not need to be generated.
7070
return nil
7171
}
72-
dir := filepath.Join(library.Output, goAPI.ImportPath, goAPI.VersionSuffix)
72+
dir := filepath.Join(library.Output, goAPI.ImportPath)
7373
if err := os.MkdirAll(dir, 0755); err != nil {
7474
return err
7575
}

0 commit comments

Comments
 (0)