33 lines
829 B
Go
33 lines
829 B
Go
package main
|
|
|
|
import (
|
|
_ `embed`
|
|
`text/template`
|
|
|
|
`github.com/oriser/regroup`
|
|
)
|
|
|
|
const (
|
|
pfx string = "Param"
|
|
matchType string = "tlsUriParam"
|
|
)
|
|
|
|
var (
|
|
//go:embed "tpl/consts_param_map.go.tpl"
|
|
constmapTplBytes []byte
|
|
tpl = template.Must(template.New("consts").Parse(string(constmapTplBytes)))
|
|
)
|
|
|
|
var (
|
|
// If we restructure, these paths will need to be changed.
|
|
// constsPath string = filepath.Join("..", "..", "consts.go")
|
|
// outPath string = filepath.Join("..", "..", "consts_param_map.go")
|
|
constsPath string = "consts.go"
|
|
outPath string = "consts_param_map.go"
|
|
)
|
|
|
|
var (
|
|
// The most complex part about this pattern is it has to quote the backticks as their own string addition.
|
|
stripQuotesPtrn *regroup.ReGroup = regroup.MustCompile(`^(` + "`" + `(?P<m1>.+)` + "`" + `|"(?P<m2>.+)")$`)
|
|
)
|