shurcooL / Go-Package-Store

An app that displays updates for the Go packages in your GOPATH.
MIT License
899 stars 29 forks source link

Support install from git (ssh) protocol #45

Closed philcluff closed 8 years ago

philcluff commented 8 years ago

Great tool!

I, like many others have my git configured such that go get github.com/someone/somepackage will fetch using the git (ssh) protocol. This is achieved by the following configuration in ~/.gitconfig

[url "git@github.com:"]
    insteadOf = https://github.com/

Installing Go-Package-Store using this mechanic fails with the following output:

➜  ~  go get -u github.com/shurcooL/Go-Package-Store
package github.com/shurcooL/Go-Package-Store
    imports azul3d.org/semver.v2
    imports github.com/google/go-github/github
    imports github.com/google/go-querystring/query
    imports github.com/shurcooL/Go-Package-Store/presenter: github.com/shurcooL/Go-Package-Store is a custom import path for https://github.com/shurcooL/Go-Package-Store, but /Users/philc/go/src/github.com/shurcooL/Go-Package-Store is checked out from git@github.com:shurcooL/Go-Package-Store
package github.com/shurcooL/Go-Package-Store
    imports azul3d.org/semver.v2
    imports github.com/google/go-github/github
    imports github.com/google/go-querystring/query
    imports github.com/shurcooL/go/exp/13
    imports github.com/shurcooL/go/gists/gist7802150
    imports github.com/shurcooL/go/vcs
    imports github.com/shurcooL/go/gists/gist5258650: github.com/shurcooL/go is a custom import path for https://github.com/shurcooL/go, but /Users/philc/go/src/github.com/shurcooL/go is checked out from git@github.com:shurcooL/go
package github.com/shurcooL/Go-Package-Store
    imports azul3d.org/semver.v2
    imports github.com/google/go-github/github
    imports github.com/google/go-querystring/query
    imports github.com/shurcooL/go/exp/13
    imports github.com/shurcooL/go/gists/gist7802150
    imports github.com/shurcooL/go/vcs
    imports github.com/shurcooL/go/trim: github.com/shurcooL/go is a custom import path for https://github.com/shurcooL/go, but /Users/philc/go/src/github.com/shurcooL/go is checked out from git@github.com:shurcooL/go
package github.com/shurcooL/Go-Package-Store
    imports azul3d.org/semver.v2
    imports github.com/google/go-github/github
    imports github.com/google/go-querystring/query
    imports github.com/shurcooL/go/exp/13
    imports github.com/shurcooL/go/gists/gist7802150
    imports github.com/shurcooL/go/vcs
    imports golang.org/x/tools/go/vcs
    imports github.com/shurcooL/go/exp/14
    imports github.com/shurcooL/go/gists/gist5504644: github.com/shurcooL/go is a custom import path for https://github.com/shurcooL/go, but /Users/philc/go/src/github.com/shurcooL/go is checked out from git@github.com:shurcooL/go
package github.com/shurcooL/Go-Package-Store
    imports azul3d.org/semver.v2
    imports github.com/google/go-github/github
    imports github.com/google/go-querystring/query
    imports github.com/shurcooL/go/exp/13
    imports github.com/shurcooL/go/gists/gist7802150
    imports github.com/shurcooL/go/vcs
    imports golang.org/x/tools/go/vcs
    imports github.com/shurcooL/go/exp/14
    imports github.com/shurcooL/go/gists/gist7480523
    imports github.com/shurcooL/go/exp/12: github.com/shurcooL/go is a custom import path for https://github.com/shurcooL/go, but /Users/philc/go/src/github.com/shurcooL/go is checked out from git@github.com:shurcooL/go
package github.com/shurcooL/Go-Package-Store
    imports azul3d.org/semver.v2
    imports github.com/google/go-github/github
    imports github.com/google/go-querystring/query
    imports github.com/shurcooL/go/exp/13
    imports github.com/shurcooL/go/gists/gist7802150
    imports github.com/shurcooL/go/vcs
    imports golang.org/x/tools/go/vcs
    imports github.com/shurcooL/go/exp/14
    imports github.com/shurcooL/go/gists/gist7480523
    imports github.com/shurcooL/go/gists/gist7651991
    imports github.com/shurcooL/go/gists/gist8018045: github.com/shurcooL/go is a custom import path for https://github.com/shurcooL/go, but /Users/philc/go/src/github.com/shurcooL/go is checked out from git@github.com:shurcooL/go
package github.com/shurcooL/Go-Package-Store
    imports azul3d.org/semver.v2
    imports github.com/google/go-github/github
    imports github.com/google/go-querystring/query
    imports github.com/shurcooL/go/exp/13
    imports github.com/shurcooL/go/gists/gist7802150
    imports github.com/shurcooL/go/vcs
    imports golang.org/x/tools/go/vcs
    imports github.com/shurcooL/go/exp/14
    imports github.com/shurcooL/go/gists/gist7480523
    imports github.com/shurcooL/go/gists/gist7651991
    imports github.com/shurcooL/go/gzip_file_server
    imports github.com/shurcooL/go/u/u4
    imports github.com/shurcooL/go/vfs/httpfs/html/vfstemplate
    imports github.com/shurcooL/go/vfs/httpfs/path/vfspath: github.com/shurcooL/go is a custom import path for https://github.com/shurcooL/go, but /Users/philc/go/src/github.com/shurcooL/go is checked out from git@github.com:shurcooL/go
package github.com/shurcooL/Go-Package-Store
    imports azul3d.org/semver.v2
    imports github.com/google/go-github/github
    imports github.com/google/go-querystring/query
    imports github.com/shurcooL/go/exp/13
    imports github.com/shurcooL/go/gists/gist7802150
    imports github.com/shurcooL/go/vcs
    imports golang.org/x/tools/go/vcs
    imports github.com/shurcooL/go/exp/14
    imports github.com/shurcooL/go/gists/gist7480523
    imports github.com/shurcooL/go/gists/gist7651991
    imports github.com/shurcooL/go/gzip_file_server
    imports github.com/shurcooL/go/u/u4
    imports github.com/shurcooL/go/vfs/httpfs/html/vfstemplate
    imports github.com/shurcooL/go/vfs/httpfs/vfsutil: github.com/shurcooL/go is a custom import path for https://github.com/shurcooL/go, but /Users/philc/go/src/github.com/shurcooL/go is checked out from git@github.com:shurcooL/go

It'd be nice to support this setup as its fairly common.

Cheers,

slimsag commented 8 years ago

I think this is an issue with Go itself not with G-P-S. Can you run go get -u github.com/shurcooL/go/vfs/httpfs/vfsutil without the same error message, for example? (note: I am not a maintainer, so I could be wrong)

philcluff commented 8 years ago

That works just fine, and the remote for that project ends up being a git remote:

➜  ~  go get -u github.com/shurcooL/go/vfs/httpfs/vfsutil
➜  go  cd $GOPATH/src/github.com/shurcooL/go/vfs/httpfs/vfsutil
➜  vfsutil git:(master) ls
total 24
-rw-r--r--  1 philc  staff   1.2K 21 Sep 13:07 helpers.go
-rw-r--r--  1 philc  staff   3.4K 21 Sep 13:07 walk.go
-rw-r--r--  1 philc  staff   1.9K 21 Sep 13:07 walk_test.go
➜  vfsutil git:(master) git remote -v
origin  git@github.com:shurcooL/go (fetch)
origin  git@github.com:shurcooL/go (push)
dmitshur commented 8 years ago

I, like many others have my git configured such that go get github.com/someone/somepackage will fetch using the git (ssh) protocol. This is achieved by the following configuration in ~/.gitconfig

[url "git@github.com:"]
    insteadOf = https://github.com/

Is doing this still supported in Go 1.5? I thought it wasn't, or you had to use -f flag with go get:

The -f flag, valid only when -u is set, forces get -u not to verify that each package has been checked out from the source control repository implied by its import path. This can be useful if the source is a local fork of the original.

(Source is https://golang.org/cmd/go/#hdr-Download_and_install_packages_and_dependencies.)

That could be wrong, I'm not sure.

Thanks for reporting this issue, I will take a closer look later today and see if it's possible to resolve it.

dmitshur commented 8 years ago

@GeneticGenesis, can you confirm if this is still an issue?

I'm doing a very simple thing to update the repositories, and it should be identical to what the Go tool does. See here:

https://github.com/shurcooL/Go-Package-Store/blob/ee9b46d7d17c2ab649bdccdb47e79bfdba479f81/repo/gopath.go#L15

dmitshur commented 8 years ago

I think this was an issue with the local setup, and it would've given same error if doing go get -u. I'll close it because there's no issue in Go Package Store to fix. Please reopen otherwise.