dvyukov/go-fuzz

`go:embed` breaks with go-fuzz-build

howardjohn opened this issue · 4 comments

It seems like go:embeding is broken for go-fuzz-build. I am guessing some working directory is somehow modified/wrong?

Reproduction steps:

$ git clone http://github.com/istio/istio; cd istio
$ docker run -v $PWD:$PWD -w $PWD -it --init golang:1.16
... within docker ...
# go get -u github.com/dvyukov/go-fuzz/go-fuzz \
    github.com/dvyukov/go-fuzz/go-fuzz-dep \
    github.com/dvyukov/go-fuzz/go-fuzz-build
# cd tests/fuzz
# go-fuzz-build -func FuzzConfigValidation2
failed to execute go build: exit status 1
/tmp/go-fuzz-build274238060/gopath/src/istio.io/istio/manifests/manifest.go:32:12: pattern charts/*: no matching files found
# go build ./...
... no errors ...

When adding -x, it looks like we are only copying .go files:

# find /tmp/go-fuzz-build914901545/gopath/src/istio.io/istio/manifests
/tmp/go-fuzz-build914901545/gopath/src/istio.io/istio/manifests
/tmp/go-fuzz-build914901545/gopath/src/istio.io/istio/manifests/manifest.go

The manifest.go file looks like:

package manifests

import (
        "embed"
        "io/fs"
        "os"
)

// FS embeds the manifests
//go:embed charts/* profiles/*
var FS embed.FS

Yeah, I think the code rewriter isn’t preserving the go:embed comment. It’s probably not too hard to fix, but no one is actively working on go-fuzz-build now.

Yeah, I think the code rewriter isn’t preserving the go:embed comment. It’s probably not too hard to fix, but no one is actively working on go-fuzz-build now.

Is it because of go 1.18 native support for fuzzing? If not I wouldn't mind taking a look at it to fix the issue. I would probably need some help.

Is it because of go 1.18 native support for fuzzing?

Yep. We figure that's the future, so there's no need to keep maintaining go-fuzz. Plus the maintainers of go-fuzz are all rather distracted with other things.

Is it because of go 1.18 native support for fuzzing?

Yep. We figure that's the future, so there's no need to keep maintaining go-fuzz. Plus the maintainers of go-fuzz are all rather distracted with other things.

Makes sense. Thanks