Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

unable to build #8

Closed
sberryman opened this issue Dec 17, 2014 · 3 comments
Closed

unable to build #8

sberryman opened this issue Dec 17, 2014 · 3 comments

Comments

@sberryman
Copy link
Contributor

You provide a command to build which doesn't appear to be working on at least two of the Macs I have.

$ go version
go version go1.4 darwin/amd64
$ git clone https://github.com/compose/transporter.git
$ cd transporter
$ go build -a ./cmd/...
cmd/transporter/javascript_builder.go:8:2: cannot find package "github.com/compose/transporter/pkg/adaptor" in any of:
    /usr/local/Cellar/go/1.4/libexec/src/github.com/compose/transporter/pkg/adaptor (from $GOROOT)
    ($GOPATH not set)
cmd/transporter/javascript_builder.go:9:2: cannot find package "github.com/compose/transporter/pkg/transporter" in any of:
    /usr/local/Cellar/go/1.4/libexec/src/github.com/compose/transporter/pkg/transporter (from $GOROOT)
    ($GOPATH not set)
cmd/transporter/command.go:7:2: cannot find package "github.com/mitchellh/cli" in any of:
    /usr/local/Cellar/go/1.4/libexec/src/github.com/mitchellh/cli (from $GOROOT)
    ($GOPATH not set)
cmd/transporter/javascript_builder.go:10:2: cannot find package "github.com/nu7hatch/gouuid" in any of:
    /usr/local/Cellar/go/1.4/libexec/src/github.com/nu7hatch/gouuid (from $GOROOT)
    ($GOPATH not set)
cmd/transporter/javascript_builder.go:11:2: cannot find package "github.com/robertkrimen/otto" in any of:
    /usr/local/Cellar/go/1.4/libexec/src/github.com/robertkrimen/otto (from $GOROOT)
    ($GOPATH not set)
cmd/transporter/config.go:9:2: cannot find package "gopkg.in/yaml.v2" in any of:
    /usr/local/Cellar/go/1.4/libexec/src/gopkg.in/yaml.v2 (from $GOROOT)
    ($GOPATH not set)

So I'm either stuck because everything isn't checked in, version conflict with go or I have no clue what I'm doing. Any guidance would be great!

Thanks for open sourcing this! I've been thinking about how I could take advantage of transporter on compose.io in production but wanted to build and test locally. This will solve the problem of designing and testing locally!

@sberryman
Copy link
Contributor Author

Apparently I missed this nice Caveats when installing go via homebrew.

==> Caveats
As of go 1.2, a valid GOPATH is required to use the `go get` command:
  http://golang.org/doc/code.html#GOPATH

Turns out setting the GOPATH or GOROOT didn't fix the problem. Here is the new error:

$ go build -a ./cmd/...
cmd/transporter/node.go:4:2: cannot find package "encoding/json" in any of:
    /usr/local/Cellar/go/1.4/src/encoding/json (from $GOROOT)
    /Users/ABC/.go/src/encoding/json (from $GOPATH)
cmd/transporter/command.go:4:2: cannot find package "flag" in any of:
    /usr/local/Cellar/go/1.4/src/flag (from $GOROOT)
    /Users/ABC/.go/src/flag (from $GOPATH)
cmd/transporter/command.go:5:2: cannot find package "fmt" in any of:
    /usr/local/Cellar/go/1.4/src/fmt (from $GOROOT)
    /Users/ABC/.go/src/fmt (from $GOPATH)
cmd/transporter/javascript_builder.go:8:2: cannot find package "github.com/compose/transporter/pkg/adaptor" in any of:
    /usr/local/Cellar/go/1.4/src/github.com/compose/transporter/pkg/adaptor (from $GOROOT)
    /Users/ABC/.go/src/github.com/compose/transporter/pkg/adaptor (from $GOPATH)
cmd/transporter/javascript_builder.go:9:2: cannot find package "github.com/compose/transporter/pkg/transporter" in any of:
    /usr/local/Cellar/go/1.4/src/github.com/compose/transporter/pkg/transporter (from $GOROOT)
    /Users/ABC/.go/src/github.com/compose/transporter/pkg/transporter (from $GOPATH)
cmd/transporter/command.go:7:2: cannot find package "github.com/mitchellh/cli" in any of:
    /usr/local/Cellar/go/1.4/src/github.com/mitchellh/cli (from $GOROOT)
    /Users/ABC/.go/src/github.com/mitchellh/cli (from $GOPATH)
cmd/transporter/javascript_builder.go:10:2: cannot find package "github.com/nu7hatch/gouuid" in any of:
    /usr/local/Cellar/go/1.4/src/github.com/nu7hatch/gouuid (from $GOROOT)
    /Users/ABC/.go/src/github.com/nu7hatch/gouuid (from $GOPATH)
cmd/transporter/javascript_builder.go:11:2: cannot find package "github.com/robertkrimen/otto" in any of:
    /usr/local/Cellar/go/1.4/src/github.com/robertkrimen/otto (from $GOROOT)
    /Users/ABC/.go/src/github.com/robertkrimen/otto (from $GOPATH)
cmd/transporter/config.go:9:2: cannot find package "gopkg.in/yaml.v2" in any of:
    /usr/local/Cellar/go/1.4/src/gopkg.in/yaml.v2 (from $GOROOT)
    /Users/ABC/.go/src/gopkg.in/yaml.v2 (from $GOPATH)
cmd/transporter/config.go:5:2: cannot find package "io/ioutil" in any of:
    /usr/local/Cellar/go/1.4/src/io/ioutil (from $GOROOT)
    /Users/ABC/.go/src/io/ioutil (from $GOPATH)
cmd/transporter/main.go:4:2: cannot find package "log" in any of:
    /usr/local/Cellar/go/1.4/src/log (from $GOROOT)
    /Users/ABC/.go/src/log (from $GOPATH)
cmd/transporter/config.go:6:2: cannot find package "os" in any of:
    /usr/local/Cellar/go/1.4/src/os (from $GOROOT)
    /Users/ABC/.go/src/os (from $GOPATH)
cmd/transporter/javascript_builder.go:5:2: cannot find package "path/filepath" in any of:
    /usr/local/Cellar/go/1.4/src/path/filepath (from $GOROOT)
    /Users/ABC/.go/src/path/filepath (from $GOPATH)
package ./cmd/transporter
    imports runtime: cannot find package "runtime" in any of:
    /usr/local/Cellar/go/1.4/src/runtime (from $GOROOT)
    /Users/ABC/.go/src/runtime (from $GOPATH)
cmd/transporter/config.go:7:2: cannot find package "time" in any of:
    /usr/local/Cellar/go/1.4/src/time (from $GOROOT)
    /Users/ABC/.go/src/time (from $GOPATH)

As you can tell I've never used go before :)

@codepope
Copy link
Contributor

I suggest firstly (for simplicity and a complete toolchain) that you uninstall the homebrew version of Go and install the Mac OS X binary build from https://golang.org/dl/ following instructions on http://golang.org/doc/install

Go has a required directory structure which the GOPATH needs to point to. It's a lot more formal than other languages and is detailed in http://golang.org/doc/code.html. In short, you have a go directory, in there a src, pkg and bin directory... in the src directory, you'll need a github.com directory, in that a compose directory. Go in there and git clone the repository. Why all the directories? So Go can handle retrieving all the dependencies. You should now step into the transporter directory and run 'go get' and it will get all the dependencies for you.

Now you should also be able to run the build command. I may have missed a step or two but hopefully this be enough to get you started.

@sberryman
Copy link
Contributor Author

Well that helped me get going on the right path for sure. A couple other gotcha's are having mercurial installed and using go get -a ./cmd/... followed by go build -a ./cmd/...

Also it helps adding $GOPATH/bin to PATH.

export GOPATH=$HOME/go
export PATH="$GOPATH/bin:$PATH"

Once all that was done I was able to successfully use transporter! Thanks for the help @codepope

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

No branches or pull requests

2 participants