We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f07445b commit 0755e37Copy full SHA for 0755e37
golink.go
@@ -353,6 +353,7 @@ type expandEnv struct {
353
var expandFuncMap = texttemplate.FuncMap{
354
"PathEscape": url.PathEscape,
355
"QueryEscape": url.QueryEscape,
356
+ "TrimSuffix": strings.TrimSuffix,
357
}
358
359
// expandLink returns the expanded long URL to redirect to, executing any
golink_test.go
@@ -68,6 +68,12 @@ func TestExpandLink(t *testing.T) {
68
remainder: "a+b",
69
want: "http://host.com/a%2Bb",
70
},
71
+ {
72
+ name: "template-with-trimsuffix-func",
73
+ long: `http://host.com/{{TrimSuffix .Path "/"}}`,
74
+ remainder: "a/",
75
+ want: "http://host.com/a",
76
+ },
77
78
for _, tt := range tests {
79
t.Run(tt.name, func(t *testing.T) {
0 commit comments