Skip to content

Commit

Permalink
Add opt-in go-fuzz modules support
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevgeny Pats committed Oct 7, 2019
1 parent 3901820 commit 9085030
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ This will produce png-fuzz.zip archive.
Note that go-fuzz [does not support modules yet](https://github.com/dvyukov/go-fuzz/issues/195).
`go-fuzz-build` disables modules by setting environment variable `GO111MODULE=off` during the build.


Now we are ready to go:
```
$ go-fuzz
Expand Down
8 changes: 7 additions & 1 deletion go-fuzz-build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ func makeTags() string {
// that clients can then modify and use for calls to go/packages.
func basePackagesConfig() *packages.Config {
cfg := new(packages.Config)
cfg.Env = append(os.Environ(), "GO111MODULE=off")
goFuzzModule, isGoFuzzModuleSet := os.LookupEnv("GOFUZZ111MODULE")

if isGoFuzzModuleSet {
cfg.Env = append(os.Environ(), "GO111MODULE=" + goFuzzModule)
} else {
cfg.Env = append(os.Environ(), "GO111MODULE=off")
}
return cfg
}

Expand Down

0 comments on commit 9085030

Please sign in to comment.