-
-
Save tarsius/74656beeaf3ca53eef20b10e9a991833 to your computer and use it in GitHub Desktop.
You wanted a banana but what you got was a gorilla holding the banana and the entire jungle. |
sudo mkdir /usr/local/go
sudo chown jonas:jonas /usr/local/go
go install github.com/apenwarr/git-subtrac
can't load package: package github.com/apenwarr/git-subtrac: cannot find package "github.com/apenwarr/git-subtrac" in any of:
/usr/local/go/src/github.com/apenwarr/git-subtrac (from $GOROOT)
/home/jonas/git/src/go/src/github.com/apenwarr/git-subtrac (from $GOPATH)
Cannot find X in Y!
Of course not, I am trying to put X into Y. At least that's what I thought I was doing.
But okay I do it myself.
$ mkdir -p /usr/local/go/src/github.com/apenwarr/
$ git clone [email protected]:apenwarr/git-subtrac.git /usr/local/go/src/github.com/apenwarr/git-subtrac
$ go install github.com/apenwarr/git-subtrac
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:4:2: cannot find package "bufio" in any of:
/usr/local/go/src/bufio (from $GOROOT)
/home/jonas/git/src/go/src/bufio (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/git-subtrac.go:4:2: cannot find package "fmt" in any of:
/usr/local/go/src/fmt (from $GOROOT)
/home/jonas/git/src/go/src/fmt (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/git-subtrac.go:5:2: cannot find package "github.com/pborman/getopt" in any of:
/usr/local/go/src/github.com/pborman/getopt (from $GOROOT)
/home/jonas/git/src/go/src/github.com/pborman/getopt (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/git-subtrac.go:6:2: cannot find package "gopkg.in/src-d/go-git.v4" in any of:
/usr/local/go/src/gopkg.in/src-d/go-git.v4 (from $GOROOT)
/home/jonas/git/src/go/src/gopkg.in/src-d/go-git.v4 (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:7:2: cannot find package "gopkg.in/src-d/go-git.v4/config" in any of:
/usr/local/go/src/gopkg.in/src-d/go-git.v4/config (from $GOROOT)
/home/jonas/git/src/go/src/gopkg.in/src-d/go-git.v4/config (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:8:2: cannot find package "gopkg.in/src-d/go-git.v4/plumbing" in any of:
/usr/local/go/src/gopkg.in/src-d/go-git.v4/plumbing (from $GOROOT)
/home/jonas/git/src/go/src/gopkg.in/src-d/go-git.v4/plumbing (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:9:2: cannot find package "gopkg.in/src-d/go-git.v4/plumbing/filemode" in any of:
/usr/local/go/src/gopkg.in/src-d/go-git.v4/plumbing/filemode (from $GOROOT)
/home/jonas/git/src/go/src/gopkg.in/src-d/go-git.v4/plumbing/filemode (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:10:2: cannot find package "gopkg.in/src-d/go-git.v4/plumbing/object" in any of:
/usr/local/go/src/gopkg.in/src-d/go-git.v4/plumbing/object (from $GOROOT)
/home/jonas/git/src/go/src/gopkg.in/src-d/go-git.v4/plumbing/object (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/git-subtrac.go:7:2: cannot find package "log" in any of:
/usr/local/go/src/log (from $GOROOT)
/home/jonas/git/src/go/src/log (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/git-subtrac.go:8:2: cannot find package "os" in any of:
/usr/local/go/src/os (from $GOROOT)
/home/jonas/git/src/go/src/os (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:11:2: cannot find package "path/filepath" in any of:
/usr/local/go/src/path/filepath (from $GOROOT)
/home/jonas/git/src/go/src/path/filepath (from $GOPATH)
package github.com/apenwarr/git-subtrac
imports runtime: cannot find package "runtime" in any of:
/usr/local/go/src/runtime (from $GOROOT)
/home/jonas/git/src/go/src/runtime (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:12:2: cannot find package "sort" in any of:
/usr/local/go/src/sort (from $GOROOT)
/home/jonas/git/src/go/src/sort (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:13:2: cannot find package "strconv" in any of:
/usr/local/go/src/strconv (from $GOROOT)
/home/jonas/git/src/go/src/strconv (from $GOPATH)
/usr/local/go/src/github.com/apenwarr/git-subtrac/subtrac.go:14:2: cannot find package "strings" in any of:
/usr/local/go/src/strings (from $GOROOT)
/home/jonas/git/src/go/src/strings (from $GOPATH)
RTFM I guess.
Goto https://golang.org/doc/install
Linux, macOS, and FreeBSD tarballs
Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example:
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
Well thank you very much. I already did install using apt
.
I don't want to use the very latest version. I just want to use a little application written in your favorite language. Why can't the documentation cover that? This makes potential users feel stupid. Obviously thousands, millions of people already use it and for them it just worked tm because they were less stupid, so this doesn't have to be documented.
If you are still banging your head on the wall and feeling bitter:
I got some lines for you, I follow the following on my arch Linux box:
Hey, rather than installing go system-wide, It is also preferable to install go using tools like https://github.com/travis-ci/gimme which makes it easy to install and switch go versions.
It's pretty much like in other languages:
- nvm - in node
- rbenv - in ruby
So the steps are pretty much straight fwd:
- install the gimme or equivalent, instructions on README
- install go with gimme, instructions are there, make sure your
go env
cmd works fine before you start pulling other pkgs from the internet. - then just go get your package.
I am getting more and more pissed off. (Not at you.)
I removed the versions I had previously installed with apt and then I tried the instructions at https://linuxize.com/post/how-to-install-go-on-debian-9/. Same error.
Then I removed the result of that and tried gimme as instructed. Same error.
So lets look at that again. (The actual paths are different in each case, but the error essentially is:)
$ go install github.com/apenwarr/git-subtrac
can't load package: package github.com/apenwarr/git-subtrac: cannot find package "github.com/apenwarr/git-subtrac" in any of:
/home/jonas/.gimme/versions/go1.13.4.linux.amd64/src/github.com/apenwarr/git-subtrac (from $GOROOT)
/home/jonas/git/src/go/src/github.com/apenwarr/git-subtrac (from $GOPATH)
As a mere mortal I interpret this as follows:
Me: Hey package-manager-of-go, please install for me the package that you can get from the git repository at https://github.com/apenwarr/git-subtrac.git
Package-manager-of-go: I cannot load "github.com/apenwarr/git-subtrac" because "github.com/apenwarr/git-subtrac" isn't already installed.
Me: ...
Me: I know that it cannot be loaded yet because it isn't installed yet. I want to change that. That's why I asked you to install it. I did not ask you to load it.
Me: (sobs)
I would be thankful to anyone who could guide me from my current understand to the correct understanding. Start by explaining to me why the above interpretation is incorrect/incomplete/"wrong".
I am thankful for instructions that actually work, but I would also like to understand. Please do not just tell me to use XY or read guide foobar, if those things do not lead to understanding. I can use a search engine myself, randomly pick some instructions, and hope that they don't make things worse.
Obviously things don't just work. Therefore I need to understand them. Please be my guide on the road to understanding.
Obviously things don't just work. Therefore I need to understand them.
That's why I am pissed off. I don't intend to learn go and write code in that language myself. I just want to use a tool that happens to be written in that language and hasn't been packaged for my distribution yet. I wouldn't mind doing some research, possibly spending a day before actually being able to do anything, if I wanted to learn the language. But I don't and I don't really care what language this tool is written in.
And the sad think is that I wanted to use this tool because it could possibly solve the primary soul-crushing complication of my own package manager (borg for emacs). But I cannot even try it because the package manager of some other language is so utterly beginner hostile. My package manager at least is explicitly targeted at experts.
Try go get github.com/apenwarr/git-subtrac
Then cd $HOME/.local/share/go/src/github.com/apenwarr/git-subtrac && go build
Depending on $GOPATH it might be a different directory.
Disclaimer: Not a Go expert at all :)
Thanks. It works now with go get ...
(provided I manually install the latest go
).
[git-subtrac author here] Thanks for pointing me at this discussion. I'm not exactly a go expert either, and didn't know the difference between go get and go install (mostly that go install has only very recently learned how to download things, and it still finicky about it). I'll update the README to recommend go get instead.
git-subtrac is really new, so I apologize that the README doesn't yet answer the most common questions in the most useful way.
@apenwarr Thanks for the update!
So I would like to give https://github.com/apenwarr/git-subtrac a try and the installation instructions are simple enough:
So I do: