Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Use init() to compile any regular expressions and store them as variables within that package

No need to resort to init() for regexps, simply use an unexported package level variable:

var validFoo = regexp.MustCompile(...)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: