reflection work so far...
This commit is contained in:
32
internal/constmap/consts.go
Normal file
32
internal/constmap/consts.go
Normal file
@@ -0,0 +1,32 @@
|
||||
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>.+)")$`)
|
||||
)
|
||||
Reference in New Issue
Block a user