gomodfuzz
gomodfuzz is a program which assists testing of Go program compatibility with 1.11+ module support.
It runs the input program with permutations of GO111MODULE
, GOFLAGS
, GOPATH
, and working directory traits (GOMOD
, under GOPATH
, etc.).
Use Case
Testing programs which rely on parts of the Go toolchain such as golang.org/x/tools/go/packages to load packages.
It was originally made to assert that aws-mockery could load packages from as many file location scenarios as possible.
Permutation values
- working directory's is inside a module's file tree (
WD
in the output)
- working directory's relationship to
GOPATH
(IN_MODULE
in the output)
- inside
GOPATH
- outside
GOPATH
GO111MODULE
GOFLAGS
GOPATH
- empty
- a path which will contain the working directory if the "working directory's relationship to
GOPATH
" permutation value is "inside GOPATH
"
- a path which will never contain the working directory
Usage
To install: go get -v github.com/codeactual/gomodfuzz/cmd/gomodfuzz
Examples
Usage:
gomodfuzz --help
Basic test:
gomodfuzz -- /path/to/subject --subject_flag0 --subject_flag1 subject_arg0 subject_arg1
Run subject command with a timeout of 10 seconds:
gomodfuzz --timeout 10 -- /path/to/subject
Display verbose results (passes, full errors, etc.)
gomodfuzz -v -- /path/to/subject
Development
License
Mozilla Public License Version 2.0 (About, FAQ)
Contributing
- Please feel free to submit issues, PRs, questions, and feedback.
- Although this repository consists of snapshots extracted from a private monorepo using transplant, PRs are welcome. Standard GitHub workflows are still used.