Closed tdeo closed 6 years ago
This works for me (the build works), just done:
[user@myhost ~]$ mkdir -p src/ps-top/src/github.com/sjmudd
[user@myhost ~]$ cd src/ps-top/src/github.com/sjmudd
[user@myhost ~/src/ps-top/src/github.com/sjmudd]$ export GOPATH=~/src/ps-top
[user@myhost ~/src/ps-top/src/github.com/sjmudd]$ go get github.com/sjmudd/ps-top/cmd/ps-top
[user@myhost ~/src/ps-top/src/github.com/sjmudd]$ cd ps-top/cmd/ps-top
[user@myhost ~/src/ps-top/src/github.com/sjmudd/ps-top/cmd/ps-top]$ go build
[user@myhost ~/src/ps-top/src/github.com/sjmudd/ps-top/cmd/ps-top]$ ls
ps-top ps-top.go
[user@myhost ~/src/ps-top/src/github.com/sjmudd/ps-top/cmd/ps-top]$ ./ps-top
2017/09/06 18:15:00 dial tcp 127.0.0.1:3306: getsockopt: connection refused
[user@myhost ~/src/ps-top/src/github.com/sjmudd/ps-top/cmd/ps-top]$
I don't have MySQL running now but I think you get the idea. Please try and see if it works for you.
Obviously you need to configure access credentials to the system you want to use. I usually use a MySQL defaults file to avoid explicitly passing passwords on the command line. YMMV.
Also notice that you do not need to explicitly pull in the dependencies as they included in the git tree and are handled under the vendor
directory.
Trying the same steps as you do, I'm getting the same problem:
$ go get github.com/sjmudd/ps-top/cmd/ps-top
# github.com/go-sql-driver/mysql
../gocode/src/github.com/go-sql-driver/mysql/utils.go:806: undefined: atomic.Value
I looked a bit online, and it seems it can be related to go version, which one are you running ? I have 1.2.1
Yes. Go 1.2 does not support the "vendor branching" which was introduced in 1.5. (See: https://blog.gopheracademy.com/advent-2015/vendor-folder/ for a reference.) This basically makes it possible to keep a copy of external dependencies and without that you'd need to pull in outside dependencies as you've done. However, you don't control this way exactly which version of the external git repos you are using and this is not tracked which is why the external vendor facility was added. If upstream change their code then code that depends on this may break. I think that's what you're suffering from.
My suggestion to you is to download the latest go (1.9 is the latest version atm) but anything newer than 1.6 should be good) and try again.
Closing in housekeeping - thanks for your help
Hi @sjmudd,
I'm running into this issue while trying to install ps-top since a few weeks:
Would you know how to solve this ? Thanks