Git Product home page Git Product logo

Comments (10)

ddymko avatar ddymko commented on May 30, 2024

@dmitriz

Thanks for creating a ticket. I am unable to recreate the issue on my end.

Here is my console output:

➜  vultr-cli git:(master) make build_mac
building vultr-cli
env GOOS=darwin GOARCH=amd64 go build -gcflags=-trimpath=$GOPATH -o /Users/ddymko/Desktop/del/vultr-cli/builds/vultr-cli_darwin_amd64
built /Users/ddymko/Desktop/del/vultr-cli/builds/vultr-cli_darwin_amd64
➜  vultr-cli git:(master) go version
go version go1.12.7 darwin/amd64
➜  vultr-cli git:(master) gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

We are using go modules for this project and I noticed you are running on go 1.10 not sure if that may be causing issues on your end.

from vultr-cli.

dmitriz avatar dmitriz commented on May 30, 2024

I have never used go myself. I have downloaded the latest version 1.12.7 and followed installation instructions successfully, but could not detect any change in the path and calling go on my machine still runs the old version.

The page https://golang.org/doc/install suggests way of installing multiple versions but I was unable to follow them. If those instructions work correctly on your machine, maybe you could reproduce my errors running make along with go1.10.1, to see whether the error is caused by the older version or something else.

from vultr-cli.

ddymko avatar ddymko commented on May 30, 2024

@dmitriz

I will take a deeper dive into what your exact issue may be.

For now you can download a precompiled release for mac os from:

https://github.com/vultr/vultr-cli/releases

or if you are running homebrew on your mac you can run the follow two commands

brew tap vultr/vultr-cli
brew install vultr-cli

from vultr-cli.

ddymko avatar ddymko commented on May 30, 2024

@dmitriz

I noticed in your error that you are trying to build the go project outside of your GOPATH

env GOOS=darwin ... /Users/dmitrizaitsev/Repos/vultr-cli/builds/vultr-cli_darwin_amd64

and since you are go 1.10.1 go is trying to look up your GOPATH for the source code

/Users/dmitrizaitsev/go/src/github.com/vultr/vultr-cli/cmd (from $GOPATH)

If you move the code to /Users/dmitrizaitsev/Repos/vultr-cli/ over to /Users/dmitrizaitsev/go/src/github.com/vultr/ This will resolve your issue.

This is replicated on my machine with go 1.10.7 by moving the code outside of my gopath. As of go 1.11.x you could build outside of your gopath with gomodules

➜  vultr-cli git:(master) ✗ go1.10.7 version
go version go1.10.7 darwin/amd64
➜  vultr-cli git:(master) ✗ make build_mac
building vultr-cli
env GOOS=darwin GOARCH=amd64 go1.10.7 build -gcflags=-trimpath=$GOPATH -o /Users/ddymko/Desktop/vultr-cli/builds/vultr-cli_darwin_amd64
main.go:17:8: cannot find package "github.com/vultr/vultr-cli/cmd" in any of:
	/Users/ddymko/sdk/go1.10.7/src/github.com/vultr/vultr-cli/cmd (from $GOROOT)
	/Users/ddymko/go/src/github.com/vultr/vultr-cli/cmd (from $GOPATH)
make: *** [_build] Error 1

from vultr-cli.

dmitriz avatar dmitriz commented on May 30, 2024

Thank you very much for your help!

I have moved the project to the go subdirectory as you suggested and it had indeed solved some problems and allowed me to install go1.11.12 (I still could not install go1.12 on my OSX 10.8.5).

Also thanks for directing me to the precompiled release that I somehow missed earlier!

Not anymore critical for me, but that build error didn't go away even with 1.11.12:

→ go version
go version go1.11.12 darwin/amd64
→ make build_mac
building vultr-cli
env GOOS=darwin GOARCH=amd64 go build -gcflags=-trimpath=$GOPATH -o /Users/dmitrizaitsev/go/src/github.com/vultr/builds/vultr-cli_darwin_amd64
main.go:17:8: cannot find package "github.com/vultr/vultr-cli/cmd" in any of:
	/Users/dmitrizaitsev/go/src/github.com/vultr/vendor/github.com/vultr/vultr-cli/cmd (vendor tree)
	/Users/dmitrizaitsev/sdk/go1.11.12/src/github.com/vultr/vultr-cli/cmd (from $GOROOT)
	/Users/dmitrizaitsev/go/src/github.com/vultr/vultr-cli/cmd (from $GOPATH)
make: *** [Makefile:34: _build] Error 1

from vultr-cli.

ddymko avatar ddymko commented on May 30, 2024

Glad it helped a bit!

As for the issue of getting Go 1.12 on your macchine this is because your macOS version isn't supported.
Go 1.12 is the last release that will run on macOS 10.10 Yosemite. Go 1.13 will require macOS 10.11 El Capitan or later.
https://golang.org/doc/go1.12#darwin

I will take a look into the build error some time today (If i have a chance).

from vultr-cli.

dmitriz avatar dmitriz commented on May 30, 2024

As for the issue of getting Go 1.12 on your macchine this is because your macOS version isn't supported.

Sometimes these versions still work, so I tried anyway :)
The problem with Go it still reports success but fails later on with cryptic messages that do not refer to the real cause - my OS version if that is the one.

Generally I have been having a rough ride with any Go software, where errors have always been hard to understand. :(

Still don't quite understand how the $GOPATH works, it is currently unset for me, maybe that is one of the problems?

from vultr-cli.

jakimfett avatar jakimfett commented on May 30, 2024

Still don't quite understand how the $GOPATH works...

You're in good company here.

Part of the difficulty is that the official docs do a rather poor job of explaining what, why, and how to set the various $GO* environmental variable bits.
Also, there seem to be a couple of gotchas.

StackOverflow tries to explain but the values/locations seem conditional on things poorly defined.

As best I can tell, $GOROOT is where golang is installed, and $GOPATH is where golang looks for the fiddly bits that make it...actually go.

Can someone knowledgeable correct my (our?) misconceptions?

from vultr-cli.

ddymko avatar ddymko commented on May 30, 2024

@jakimfett

You are correct

$GOROOT is the location of your go installation

$GOPATH is where you could keep your compiled packages, executables, and source files.
Prior to go 1.11 you were required to build your go applications within your $GOPATH. This is due to go get || go install storing the requires files and packages into go your $GOPATH

However, with the introduction of of Gomodules you can build your applications outside of your gopath. This is due to the ability to vendor packages now as opposed to needing requiring them in your gopath

Hopefully this can clear it up a bit:

I would also suggest joining the gopher slack. Really helpful
https://invite.slack.golangbridge.org/

from vultr-cli.

pgaskin avatar pgaskin commented on May 30, 2024

Also, you can use modules in your GOPATH by either using Go 1.13+ or setting GO111MODULE=on.

from vultr-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.