cookiecutter-go-web-app/{{cookiecutter.projectSlug}}/{{cookiecutter.mainPackageName}}/paths/paths.go
AKP 5f7c2f42ec
Refactor for use with Cookiecutter
Signed-off-by: AKP <tom@tdpain.net>
2022-10-02 21:26:54 +01:00

20 lines
292 B
Go

package paths
import (
"fmt"
"strings"
)
const (
Index = "/"
)
func Make(path string, replacements ...any) string {
x := strings.Split(path, "/")
for i, p := range x {
if strings.HasPrefix(p, ":") {
x[i] = "%s"
}
}
return fmt.Sprintf(strings.Join(x, "/"), replacements...)
}