pcp icon indicating copy to clipboard operation
pcp copied to clipboard

Installation cannot find packages

Open lacker opened this issue 5 years ago • 1 comments

I might just be misunderstanding some basic gopath type thing, but I run into errors when attempting to follow the installation instructions:

$ go install cmd/pcp/pcp.go
cmd/pcp/pcp.go:9:2: cannot find package "github.com/dennis-tra/pcp/internal/log" in any of:
	/usr/lib/go-1.10/src/github.com/dennis-tra/pcp/internal/log (from $GOROOT)
	/home/lacker/go/src/github.com/dennis-tra/pcp/internal/log (from $GOPATH)
cmd/pcp/pcp.go:10:2: cannot find package "github.com/dennis-tra/pcp/pkg/initialize" in any of:
	/usr/lib/go-1.10/src/github.com/dennis-tra/pcp/pkg/initialize (from $GOROOT)
	/home/lacker/go/src/github.com/dennis-tra/pcp/pkg/initialize (from $GOPATH)
cmd/pcp/pcp.go:11:2: cannot find package "github.com/dennis-tra/pcp/pkg/receive" in any of:
	/usr/lib/go-1.10/src/github.com/dennis-tra/pcp/pkg/receive (from $GOROOT)
	/home/lacker/go/src/github.com/dennis-tra/pcp/pkg/receive (from $GOPATH)
cmd/pcp/pcp.go:12:2: cannot find package "github.com/dennis-tra/pcp/pkg/send" in any of:
	/usr/lib/go-1.10/src/github.com/dennis-tra/pcp/pkg/send (from $GOROOT)
	/home/lacker/go/src/github.com/dennis-tra/pcp/pkg/send (from $GOPATH)
cmd/pcp/pcp.go:7:2: cannot find package "github.com/urfave/cli/v2" in any of:
	/usr/lib/go-1.10/src/github.com/urfave/cli/v2 (from $GOROOT)
	/home/lacker/go/src/github.com/urfave/cli/v2 (from $GOPATH)

lacker avatar Feb 04 '21 17:02 lacker

Hi @lacker, cool that you're checking out the tool!

It looks like you're using Go 1.10 (at least it says go-1.10 in the paths). This Go version doesn't support Go modules yet, which I'm using for dependency management.

I could reproduce your issue with:

$ docker run --rm -it golang:1.10 bash
$ git clone https://github.com/dennis-tra/pcp.git
$ cd pcp && go install cmd/pcp/pcp.go
cmd/pcp/pcp.go:9:2: cannot find package "github.com/dennis-tra/pcp/internal/log" in any of:
	/usr/local/go/src/github.com/dennis-tra/pcp/internal/log (from $GOROOT)
	/go/src/github.com/dennis-tra/pcp/internal/log (from $GOPATH)
cmd/pcp/pcp.go:10:2: cannot find package "github.com/dennis-tra/pcp/pkg/initialize" in any of:
	/usr/local/go/src/github.com/dennis-tra/pcp/pkg/initialize (from $GOROOT)
	/go/src/github.com/dennis-tra/pcp/pkg/initialize (from $GOPATH)
cmd/pcp/pcp.go:11:2: cannot find package "github.com/dennis-tra/pcp/pkg/receive" in any of:
	/usr/local/go/src/github.com/dennis-tra/pcp/pkg/receive (from $GOROOT)
	/go/src/github.com/dennis-tra/pcp/pkg/receive (from $GOPATH)
cmd/pcp/pcp.go:12:2: cannot find package "github.com/dennis-tra/pcp/pkg/send" in any of:
	/usr/local/go/src/github.com/dennis-tra/pcp/pkg/send (from $GOROOT)
	/go/src/github.com/dennis-tra/pcp/pkg/send (from $GOPATH)
cmd/pcp/pcp.go:7:2: cannot find package "github.com/urfave/cli/v2" in any of:
	/usr/local/go/src/github.com/urfave/cli/v2 (from $GOROOT)
	/go/src/github.com/urfave/cli/v2 (from $GOPATH)

So I'm afraid that I can only recommend upgrading to a newer Go version 😕 Personally I'm using the latest Go 1.15.6:

$ go version
go version go1.15.6 darwin/amd64

Unfortunately I don't know the minimum Go version I'm supporting yet. It may work with Go 1.13.

The other thing is that I just added the option to downlod pre-built executables from the release page. If you're on macOS Catalina or later though, there may be notarization issues, so compiling it yourself may actually be the easier option.

EDIT: Compilation works when using the golang:1.13 Docker image. golang:1.12 does not work.

dennis-tra avatar Feb 04 '21 17:02 dennis-tra