-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implements NewAnalyzer with Setting struct
- Loading branch information
Showing
3 changed files
with
117 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"strings" | ||
|
||
"github.com/raeperd/recvcheck" | ||
"golang.org/x/tools/go/analysis/singlechecker" | ||
) | ||
|
||
func main() { | ||
singlechecker.Main(recvcheck.Analyzer) | ||
var ( | ||
excludeMethod string | ||
noBuiltinExcludeMethod bool | ||
) | ||
flag.StringVar(&excludeMethod, "exclude-method", "", | ||
"exclude the method signature from the check, seperated by '/'") | ||
flag.BoolVar(&noBuiltinExcludeMethod, "no-builtin-exclude-method", false, | ||
`disables the default exclude methods such as "MarshalText() ([]byte, error)"`) | ||
flag.Parse() | ||
|
||
setting := recvcheck.Setting{ | ||
NoBuiltinExcludeMethod: noBuiltinExcludeMethod, | ||
ExcludeMethod: strings.Split(excludeMethod, "/"), | ||
} | ||
singlechecker.Main(recvcheck.NewAnalyzer(setting)) | ||
} |