sanitize: Move global variables to top of file

This commit is contained in:
UlisseMini 2019-01-25 12:39:21 -05:00 committed by Andrey Petrov
parent 4c968fc966
commit c1a8912297

View File

@ -2,7 +2,10 @@ package sanitize
import "regexp"
var reStripName = regexp.MustCompile("[^\\w.-]")
var (
reStripName = regexp.MustCompile("[^\\w.-]")
reStripData = regexp.MustCompile("[^[:ascii:]]|[[:cntrl:]]")
)
const maxLength = 16
@ -17,8 +20,6 @@ func Name(s string) string {
return s
}
var reStripData = regexp.MustCompile("[^[:ascii:]]|[[:cntrl:]]")
// Data returns a string with only allowed characters for client-provided metadata inputs.
func Data(s string, maxlen int) string {
if len(s) > maxlen {