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

[Build] Could not build binary from source code. #5

Closed
MSavisko opened this issue May 12, 2018 · 5 comments
Closed

[Build] Could not build binary from source code. #5

MSavisko opened this issue May 12, 2018 · 5 comments

Comments

@MSavisko
Copy link
Contributor

MSavisko commented May 12, 2018

Problem:

Could not build the binary from source code.

  1. Clone repo.
  2. Go to folder.
  3. Try to build.
$ sh build.sh  
  1. Receive an error.
3 errors occurred:
--> darwin/amd64 error: exit status 1
Stderr: main.go:6:2: cannot find package "github.com/s0nerik/goloc/tree/master/goloc" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/tree/master/goloc (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/tree/master/goloc (from $GOPATH)
main.go:7:2: cannot find package "github.com/s0nerik/goloc/tree/master/platforms/resolver" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/tree/master/platforms/resolver (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/tree/master/platforms/resolver (from $GOPATH)
main.go:8:2: cannot find package "gopkg.in/alecthomas/kingpin.v2" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/gopkg.in/alecthomas/kingpin.v2 (from $GOROOT)
        /Users/MSavisko/go/src/gopkg.in/alecthomas/kingpin.v2 (from $GOPATH)
--> windows/amd64 error: exit status 1
Stderr: main.go:6:2: cannot find package "github.com/s0nerik/goloc/tree/master/goloc" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/tree/master/goloc (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/tree/master/goloc (from $GOPATH)
main.go:7:2: cannot find package "github.com/s0nerik/goloc/tree/master/platforms/resolver" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/tree/master/platforms/resolver (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/tree/master/platforms/resolver (from $GOPATH)
main.go:8:2: cannot find package "gopkg.in/alecthomas/kingpin.v2" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/gopkg.in/alecthomas/kingpin.v2 (from $GOROOT)
        /Users/MSavisko/go/src/gopkg.in/alecthomas/kingpin.v2 (from $GOPATH)
--> linux/amd64 error: exit status 1
Stderr: main.go:6:2: cannot find package "github.com/s0nerik/goloc/tree/master/goloc" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/tree/master/goloc (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/tree/master/goloc (from $GOPATH)
main.go:7:2: cannot find package "github.com/s0nerik/goloc/tree/master/platforms/resolver" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/tree/master/platforms/resolver (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/tree/master/platforms/resolver (from $GOPATH)
main.go:8:2: cannot find package "gopkg.in/alecthomas/kingpin.v2" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/gopkg.in/alecthomas/kingpin.v2 (from $GOROOT)
        /Users/MSavisko/go/src/gopkg.in/alecthomas/kingpin.v2 (from $GOPATH)  

Configuration:

1. OS: macOS High Sierra 10.13.4
2. GO: go1.10.2 darwin/amd64
3. Gox: stable 0.4.0 (bottled)
4. Source: v0.9
@s0nerik
Copy link
Owner

s0nerik commented May 12, 2018

Please try this:

  1. Open terminal
  2. cd to project's folder
  3. Run brew install dep
  4. Run dep ensure
  5. Try building the project again

@MSavisko
Copy link
Contributor Author

MSavisko commented May 12, 2018

@s0nerik

  • After dep ensure receive the message:
root project import: /Users/MSavisko/Documents/Projects/PET/goloc is not within any GOPATH/src
  • Then sh build.sh and the same error:
3 errors occurred:
--> darwin/amd64 error: exit status 1
Stderr: main.go:6:2: cannot find package "github.com/s0nerik/goloc/goloc" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/goloc (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/goloc (from $GOPATH)
main.go:7:2: cannot find package "github.com/s0nerik/goloc/platforms/resolver" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/platforms/resolver (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/platforms/resolver (from $GOPATH)
main.go:8:2: cannot find package "gopkg.in/alecthomas/kingpin.v2" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/gopkg.in/alecthomas/kingpin.v2 (from $GOROOT)
        /Users/MSavisko/go/src/gopkg.in/alecthomas/kingpin.v2 (from $GOPATH)
--> linux/amd64 error: exit status 1
Stderr: main.go:6:2: cannot find package "github.com/s0nerik/goloc/goloc" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/goloc (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/goloc (from $GOPATH)
main.go:7:2: cannot find package "github.com/s0nerik/goloc/platforms/resolver" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/platforms/resolver (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/platforms/resolver (from $GOPATH)
main.go:8:2: cannot find package "gopkg.in/alecthomas/kingpin.v2" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/gopkg.in/alecthomas/kingpin.v2 (from $GOROOT)
        /Users/MSavisko/go/src/gopkg.in/alecthomas/kingpin.v2 (from $GOPATH)
--> windows/amd64 error: exit status 1
Stderr: main.go:6:2: cannot find package "github.com/s0nerik/goloc/goloc" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/goloc (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/goloc (from $GOPATH)
main.go:7:2: cannot find package "github.com/s0nerik/goloc/platforms/resolver" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/github.com/s0nerik/goloc/platforms/resolver (from $GOROOT)
        /Users/MSavisko/go/src/github.com/s0nerik/goloc/platforms/resolver (from $GOPATH)
main.go:8:2: cannot find package "gopkg.in/alecthomas/kingpin.v2" in any of:
        /usr/local/Cellar/go/1.10.2/libexec/src/gopkg.in/alecthomas/kingpin.v2 (from $GOROOT)
        /Users/MSavisko/go/src/gopkg.in/alecthomas/kingpin.v2 (from $GOPATH)

@s0nerik
Copy link
Owner

s0nerik commented May 12, 2018

Probably the main problem is that you've cloned a project into an arbitrary folder, and not to GOPATH. To make sure that the project is cloned into the right directory, instead of cloning by hand you should run go get github.com/s0nerik/goloc. This will automatically put the project's folder into the folder inside GOPATH. On macOS (if you didn't change GOPATH by hand) the path to the project will be /Users/<username>/go/src/github.com/s0nerik/goloc. Please, let me know if the problem won't go away after using go get instead of cloning the repo by hand.

@MSavisko
Copy link
Contributor Author

MSavisko commented May 12, 2018

@s0nerik
go get works fine
PRs for documentation: #6, #7

@s0nerik
Copy link
Owner

s0nerik commented May 13, 2018

Glad go get worked. Thank you for the contributions!

@s0nerik s0nerik closed this as completed May 13, 2018
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

2 participants