go get on Stash repository

Mark Petrovic July 27, 2015

Hello.

I am evaluating Stash 2.12.3 for use as a repository for Go source code packages.  The standard way to retrieve a Go package for use as a dependency of another Go package is to issue "go get" against the host / path part of the Git repository URL.  For example:

$ go get git.example.com/scm/inf/testpackage

where the actual https public repository URL for this package is 

https://git.example.com/scm/inf/testpackage.git

Here is the reference for this technique:  https://golang.org/doc/code.html#remote

However, when I execute this go get command against my Stash repository, I get this:

$ go get git.example.com/scm/inf/testpackage

package git.example.com/scm/inf/testpackage: unrecognized import path "git.example.com/scm/inf/testpackage"

 

tcpflow for this interaction shows (after https fails, go-get falls back to http, where we can see this output) this


010.001.035.008.49712-010.007.024.054.00080: GET /scm/inf/testpackage?go-get=1 HTTP/1.1
Host: git.example.com
User-Agent: Go 1.1 package http
Accept-Encoding: gzip


write error to stdout

010.007.024.054.00080-010.001.035.008.49712: HTTP/1.1 501 Not Implemented
Server: Apache-Coyote/1.1
X-AREQUESTID: 681x2525072x2
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Content-Length: 109
Date: Mon, 27 Jul 2015 18:21:32 GMT
Connection: close

Invalid request from host 10.7.24.252: Note that Stash does not support Git's legacy HTTP transport protocol.
write error to stdout

 

Does Stash support what go-get is trying to do?  github.com, does, of course, as a large number of developers working Go know.

 

Thanks for your help.

Mark

 

 

1 answer

5 votes
Stefan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 27, 2015

Hi Mark,

https://jira.atlassian.com/browse/STASH-5380

Support for go get on a Stash repository was added in 3.8.0. From this version of Stash onward, you should be able to go get a package by

go get {hostname}/{project_key}/{repository_slug}

Prior to 3.8.0, you are still able to use go get, but must specify the full HTTP/S URL, with VCS suffix, i.e.

go get {hostname}/scm/{project_key}/{repository_slug}.git

Kind regards,
Stefan Petrucev
Atlassian Stash

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events