Skip to content

Commit ef9ebda

Browse files
committed
fix: normalize snippet placeholders
Update golang.org/x/mod to v0.34.0 and change the generated snippet replacements so that `<YOUR_INDEX_NAME>` and the hardcoded helper names consistently map to `INDEX_NAME`, while also fixing the placeholder replacements for the application and admin keys.
1 parent fb404cf commit ef9ebda

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/spf13/cobra v1.10.2
99
github.com/spf13/pflag v1.0.10
1010
go.yaml.in/yaml/v4 v4.0.0-rc.4
11-
golang.org/x/mod v0.33.0
11+
golang.org/x/mod v0.34.0
1212
)
1313

1414
require (

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ go.yaml.in/yaml/v4 v4.0.0-rc.4 h1:UP4+v6fFrBIb1l934bDl//mmnoIZEDK0idg1+AIvX5U=
3030
go.yaml.in/yaml/v4 v4.0.0-rc.4/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
3131
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
3232
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
33+
golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
34+
golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
3335
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
3436
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
3537
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

mise.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ goreleaser = "2.14.3"
55

66
[tasks.build]
77
description = "Build the project"
8-
run = "go build"
8+
# If I run inside worktrees
9+
run = "go build -buildvcs=false"
910

1011
[tasks.lint]
1112
description = "Lint the code with golangci-lint"

pkg/cmd/generate/guides/guides.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,17 @@ func generateMarkdownSnippet(snippet map[string]string) string {
113113
dictionary.NormalizeLang(lang),
114114
utils.GetLanguageName(lang),
115115
)
116-
replaced := strings.ReplaceAll(snippet[lang], "<YOUR_INDEX_NAME>", "ALGOLIA_INDEX_NAME")
116+
replaced := strings.ReplaceAll(snippet[lang], "<YOUR_INDEX_NAME>", "INDEX_NAME")
117117
replaced = strings.ReplaceAll(
118118
replaced,
119119
"cts_e2e_deleteObjects_javascript",
120-
"ALGOLIA_INDEX_NAME",
120+
"INDEX_NAME",
121121
)
122+
replaced = strings.ReplaceAll(replaced, "YOUR_INDEX_NAME", "INDEX_NAME")
123+
replaced = strings.ReplaceAll(replaced, "YourApplicationID", "ALGOLIA_APPLICATION_ID")
124+
replaced = strings.ReplaceAll(replaced, "YourAdminAPIKey", "ALGOLIA_API_KEY")
125+
replaced = strings.ReplaceAll(replaced, "<YOUR_SEARCH_QUERY>", "SEARCH_QUERY")
126+
replaced = strings.ReplaceAll(replaced, "YOUR_TASK_ID", "TASK_ID")
122127
result += replaced
123128
result += "\n```\n"
124129
}

pkg/cmd/generate/snippets/snippets.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,14 @@ func generateMarkdownSnippet(snippet map[string]string) string {
110110
dictionary.NormalizeLang(lang),
111111
utils.GetLanguageName(lang),
112112
)
113-
replaced := strings.ReplaceAll(snippet[lang], "<YOUR_INDEX_NAME>", "ALGOLIA_INDEX_NAME")
113+
replaced := strings.ReplaceAll(snippet[lang], "<YOUR_INDEX_NAME>", "INDEX_NAME")
114114
replaced = strings.ReplaceAll(
115115
replaced,
116116
"cts_e2e_deleteObjects_javascript",
117-
"ALGOLIA_INDEX_NAME",
117+
"INDEX_NAME",
118118
)
119+
replaced = strings.ReplaceAll(replaced, "<YOUR_QUERY>", "SEARCH_QUERY")
120+
replaced = strings.ReplaceAll(replaced, "uniqueID", "OBJECT_ID")
119121
result += replaced
120122
result += "\n```\n"
121123
}

0 commit comments

Comments
 (0)