Skip to content

Commit baa220c

Browse files
fix: string baseDir = "api" has 3 occurrences, make it a constant (goconst)
1 parent b9c5b7f commit baa220c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkg/plugins/golang/v4/scaffolds/internal/templates/webhooks/webhook_test_template.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,17 @@ type WebhookTest struct {
4848
func (f *WebhookTest) SetTemplateDefaults() error {
4949
if f.Path == "" {
5050
// Deprecated: Remove me when remove go/v4
51-
//nolint:goconst
52-
baseDir := "api"
51+
52+
const baseDir = "api"
53+
pathAPI := baseDir
5354
if !f.IsLegacyPath {
54-
baseDir = filepath.Join("internal", "webhook")
55+
pathAPI = filepath.Join("internal", "webhook")
5556
}
5657

5758
if f.MultiGroup && f.Resource.Group != "" {
58-
f.Path = filepath.Join(baseDir, "%[group]", "%[version]", "%[kind]_webhook_test.go")
59+
f.Path = filepath.Join(pathAPI, "%[group]", "%[version]", "%[kind]_webhook_test.go")
5960
} else {
60-
f.Path = filepath.Join(baseDir, "%[version]", "%[kind]_webhook_test.go")
61+
f.Path = filepath.Join(pathAPI, "%[version]", "%[kind]_webhook_test.go")
6162
}
6263
}
6364
f.Path = f.Resource.Replacer().Replace(f.Path)

0 commit comments

Comments
 (0)