Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

gocheckregex

Build Status Codecov Go Report Card

Check that regular expressions in global MustCompile calls are valid.

Why

It's a common practice to compile regexs on application start by using the regexp.MustCompile function to build the regular expression and store it in a global variable. The MustCompile function will panic then on startup if the regular expression can't be compiled. It would be great if we found out sooner without running the application if the regex we've written is invalid.

Install

go get 4d63.com/gocheckregex

Usage

gocheckregex
gocheckregex ./...
gocheckregex [path] [path] [path] [etc]

Note: Paths are only inspected recursively if the Go /... recursive path suffix is appended to the path.

Limitations

  • Does not pickup on regexp usage if package regexp is aliased.
  • Only looks at MustCompile calls that's argument is a string literal.

About

Check that regular expressions in global `MustCompile` calls are valid.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages