Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README guide not working correctly #317

Open
huornlmj opened this issue Apr 22, 2021 · 9 comments
Open

README guide not working correctly #317

huornlmj opened this issue Apr 22, 2021 · 9 comments

Comments

@huornlmj
Copy link

From the front page readme, the following section fails:

  1. $ go get -d github.com/dvyukov/go-fuzz-corpus
  2. $ cd $GOPATH/src/github.com/dvyukov/go-fuzz-corpus

Line 2 yields: "No such file or directory"

@cristaloleg
Copy link

What is your $GOPATH ?

@huornlmj
Copy link
Author

/home/{me}/go

@thepudds
Copy link
Collaborator

Try cd ~/go/src/github.com/dvyukov/go-fuzz-corpus (or something similar to that if you happen to be on windows).

@thepudds
Copy link
Collaborator

thepudds commented Apr 22, 2021

Also, if you are using Go modules, you might need to use git clone.

@huornlmj
Copy link
Author

I can get as far as ~/go/src/github.com and I see plenty of component directories that I have used over time (e.g. BurntSushi, go-logr, eclipse, google, hashicorp etc. etc) but no dvyukov directory. There was no error or output when I ran "go get -d github.com/dvyukov/go-fuzz-corpus". I ran "echo $?" just to see the go get return code and it was 0.

@cristaloleg
Copy link

cristaloleg commented Apr 22, 2021

Try GO111MODULE=auto go get -d github.com/dvyukov/go-fuzz-corpus

Sadly there is a 'problem' with fetching deps with go get and modules.

UPD: GO111MODULE=off should work too, outside the $GOPATH.
I'm trying to find exact line regarding naive fetch of deps here but haven't yet https://github.com/golang/go/wiki/Modules

@huornlmj
Copy link
Author

BTW -this is a on a fresh Go installation, following the steps in https://github.com/dvyukov/go-fuzz/blob/master/README.md#L101

@huornlmj
Copy link
Author

huornlmj commented Apr 22, 2021

I tried manually git cloning the go-fuzz-corpus and running go-fuzz-build within the png directory only to get:

could not resolve package ".": go [-e -json -compiled=false -test=false -export=false -deps=false -find=true -tags gofuzz -- .]: exit status 1: go: cannot find main module, but found .git/config in /home/jason/fuzzing/go-fuzz/go-fuzz-corpus
        to create a module there, run:
        cd .. && go mod init

My env:

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/jason/go/bin"
GOCACHE="/home/jason/.cache/go-build"
GOENV="/home/jason/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jason/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jason/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.16/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1559716842=/tmp/go-build -gno-record-gcc-switches"

@msooseth
Copy link

msooseth commented Jan 19, 2023

Hi,

I'm having trouble too. Managed to get a bit further. Some helpful stuff below:

The directory that eventually gets created is $GOPATH/pkg/mod/github.com/dvyukov/[email protected]/. So that needs to be updated in the README. Then the png directory is under there. Once I'm in the png directory, running go-fuzz-build produces:

could not resolve package ".": err: exit status 1: stderr: go: go.mod file not found in current directory or any parent directory; see 'go help modules'

Indeed, no go.mod files to be found anywhere: find ../ | grep go.mod produces empty output. However, the checkout seems fine, e.g. the png directory contains:

$ ls -lah
total 36K
dr-xr-xr-x  4 matesoos matesoos 4.0K Jan 19 13:56 .
dr-xr-xr-x 73 matesoos matesoos 4.0K Jan 19 13:56 ..
dr-xr-xr-x  2 matesoos matesoos  20K Jan 19 13:56 corpus
dr-xr-xr-x  2 matesoos matesoos 4.0K Jan 19 13:56 gen
-r--r--r--  1 matesoos matesoos  978 Jan 19 13:56 png.go

Which seems reasonable.

If I try the GO111MODULE=off hack from under png then:

$ export GO111MODULE=off
$ go-fuzz-build         
-: cannot find package "github.com/dvyukov/go-fuzz/go-fuzz-dep" in any of:
        /usr/lib/go/src/github.com/dvyukov/go-fuzz/go-fuzz-dep (from $GOROOT)
        /home/matesoos/go/src/github.com/dvyukov/go-fuzz/go-fuzz-dep (from $GOPATH)
typechecking of . failed

Note that /home/matesoos/go/src/github.com/dvyukov/go-fuzz/go-fuzz-dep is wrong, because the src directory doesn't even exist. As mentioned above, the command go get -d github.com/dvyukov/go-fuzz-corpus will download the source here: $GOPATH/pkg/mod/github.com/dvyukov/[email protected]/

Maybe the README needs to be revamped to match how go (and go-fuzz?) has changed over the years?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants