Skip to content

Commit 123e5b1

Browse files
committed
Make sentinel errors unexported per review feedback
1 parent c521579 commit 123e5b1

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

internal/librarian/java/pom.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ const (
3636
)
3737

3838
var (
39-
// ErrInvalidDistributionName is returned when the distribution name format is invalid.
40-
ErrInvalidDistributionName = errors.New("invalid distribution name")
39+
// errInvalidDistributionName is returned when the distribution name format is invalid.
40+
errInvalidDistributionName = errors.New("invalid distribution name")
4141

42-
// ErrAPIConfigNotFound is returned when the API config cannot be found.
43-
ErrAPIConfigNotFound = errors.New("failed to find api config")
42+
// errAPIConfigNotFound is returned when the API config cannot be found.
43+
errAPIConfigNotFound = errors.New("failed to find api config")
4444
)
4545

4646
// grpcProtoPomData holds the data for rendering POM templates.
@@ -114,7 +114,7 @@ func collectModules(library *config.Library, libraryDir, googleapisDir, monorepo
114114
distName := deriveDistributionName(library)
115115
parts := strings.SplitN(distName, ":", 2)
116116
if len(parts) != 2 {
117-
return nil, fmt.Errorf("%w %q: expected format groupID:artifactID", ErrInvalidDistributionName, distName)
117+
return nil, fmt.Errorf("%w %q: expected format groupID:artifactID", errInvalidDistributionName, distName)
118118
}
119119
gapicGroupID := parts[0]
120120
gapicArtifactID := parts[1]
@@ -132,7 +132,7 @@ func collectModules(library *config.Library, libraryDir, googleapisDir, monorepo
132132

133133
apiCfg, err := serviceconfig.Find(googleapisDir, api.Path, config.LanguageJava)
134134
if err != nil {
135-
return nil, fmt.Errorf("%w for %s: %w", ErrAPIConfigNotFound, api.Path, err)
135+
return nil, fmt.Errorf("%w for %s: %w", errAPIConfigNotFound, api.Path, err)
136136
}
137137
transport := apiCfg.Transport(config.LanguageJava)
138138

internal/librarian/java/pom_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ func TestCollectModules_Error(t *testing.T) {
124124
if !errors.Is(err, test.wantErr) {
125125
t.Errorf("collectModules() error = %v, want %v", err, test.wantErr)
126126
}
127-
if !errors.Is(err, test.wantErr) {
128-
t.Errorf("collectModules() error = %v, want %v", err, test.wantErr)
129-
>>>>>>> 5025b898 (refactor: use sentinel errors with errors.Is for error validation)
130-
}
131127
})
132128
}
133129
}

0 commit comments

Comments
 (0)