Closed brother0k closed 4 years ago
Have you tried installing it with go modules turned on?
go.mod
file specified v0.6.0
version constraint for the php-parser but it looks like you got a master branch installed.
What version of Go are you using? Outputs of go version
and go env
would be useful.
You may also try a binary release. I'll do a newer release this week with mac os binary included (so windows+linux+macos will have binaries).
Have you tried installing it with go modules turned on?
go.mod
file specifiedv0.6.0
version constraint for the php-parser but it looks like you got a master branch installed.What version of Go are you using? Outputs of
go version
andgo env
would be useful.
go version go1.14.2 linux/amd64
GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/user/.cache/go-build" GOENV="/home/user/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/user/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/go-1.14" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" 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-build720251244=/tmp/go-build -gno-record-gcc-switches"
You're encouraged to try v0.7.0 release.
If you're using VS Code, check out phpgrep extension as well. :)
Same error on MacOS while compiling go version go1.14.3 darwin/amd64
$ go get -v github.com/quasilyte/phpgrep/cmd/phpgrep
github.com/quasilyte/phpgrep
# github.com/quasilyte/phpgrep
../../go/src/github.com/quasilyte/phpgrep/utils.go:180:37: cannot use bytes.NewReader(code) (type *bytes.Reader) as type []byte in argument to php7.NewParser
I guess we can solve a problem with go build
without modules with vendor, I guess.
go.mod
has a pinned version, but if you're building under GOPATH, Go won't use modules AFAIK.
go install ./cmd/phpgrep/
go: downloading github.com/z7zmey/php-parser v0.6.0
go: downloading github.com/cznic/golex v0.0.0-20181122101858-9c343928389c
If modules are on (GO111MODULE=on
or building outside of GOPATH) Go will install the correct version and build will succeed.
@guycalledseven, could you try building again? I added dependencies to the vendor
.
@quasilyte just an follow up.
I managed to build it after running go mod vendor
in src folder:
cd $HOME/go/src/github.com/quasilyte/phpgrep"
go mod vendor
go get -v github.com/quasilyte/phpgrep/cmd/phpgrep
is it possible to automate this somehow? so that just go get -v github.com/quasilyte/phpgrep/cmd/phpgrep
works?
go get -v github.com/quasilyte/phpgrep/cmd/phpgrep github.com/quasilyte/phpgrep (download) github.com/z7zmey/php-parser (download) github.com/quasilyte/phpgrep
github.com/quasilyte/phpgrep
go/src/github.com/quasilyte/phpgrep/utils.go:180:37: cannot use bytes.NewReader(code) (type *bytes.Reader) as type []byte in argument to php7.NewParser