Does Stash have Go support?

Can I make Stash provide Go packages?

For example, I'd like import code as follows:

import ""

This page describes how to add such support:

4 answers

Don't like the .git suffix in folders. Stash should add the go meta tag in response.

I also don't like .git and /scm/.

Hi George,

Yep! You can. You just need to use the HTTP/S URL in your import statement, i.e.:

import "{hostname}/scm/{project_key}/{repository_slug}.git"

For example, to import the repository "newmath" from the project "TEST" on I used:

import ""

There does seem to be a deficiency in Go that prevents you from having ~ in the URL, which means you won't be able to use packages hosted in personal repositories (as they contain /~username/) but repositories hosted in projects work just fine.

GO nuts ;)



This solution does "work", but is far from desirable IMO. The scm in the path can be omitted. The problem is that all your directories will have .git in them as a suffix. It would be really nice to see Atlassian have real support using the http header solution.

The good package path is: import "{hostname}/{project_key}/{repository_slug}"

The extra stuff required in the path when working with go projects in Atlasssian does indeed drive me nuts, so "GO nuts" is a perfect directive. ;-) Any chance we might see a stash improvement in this area soon?

"Any chance we might see a stash improvement in this area soon?" +1

Yes, the fact that I cannot have a `/~username/` in my repository path is indeed driving me nuts as others have stated.  So it is very fitting to direct users to "GO nuts".

All kidding aside,  it'd be great to be able to use `go get` as intended with **all** Atlassian / Bitbucket repositories, especially and including user "personal repositories".  This bug is holding me back on any real hackathon progress, and the constraints of needing a private repo for company owned code plus needing a personal repo is very much also driving me to "GO nuts".  Maybe I should just publish the company code in a public git repo in order to actually get something done.... oh wait, except that would be personal suicide according to the rules of NDA + capitalist corporatism as dictated by most companies in my country.  Oh well, I guess it's back to working on other private code I can't own with minutes of my life that I'm not allowed to decide what to do with either.

Maybe it's good that this bug is not fixed... maybe enough people will be convinced that sharing is better than keeping things private & to oneself or one company.  Until then... here's to hoping for change.

On second thought, perhaps my time is better spent trying to shift cultural value memes from the "Orange value meme" of ego-driven unhealthy & isolating consumerist capitalism "up the spiral" towards some sort of more spiritually fulfilling endeavor.  If only society could allow its members to escape the mundane debt-based point system in order to have a place to live.

You're either trolling or crazy.


Anyway, my fix was to get rid of Atlassian products and just switch to Gitlab.


I've been happy ever since.

Hehe, well I was just frustrated working on a late night hackathon project with very little sleep, and getting stuck on a yak shaving rabbit hole that should've been an easy thing to work around.  All while thinking about the deeper cultural significance that tied into my current problem caused by a private repo, which was a requirement caused by the current cultural paradigm of society, caused by money system, caused by need for food & resources, etc...


Anyway, good news:  I was able to figure out how to get this mostly working using the Bitbucket personal repo "~username" path.  Unfortunately, it means you must reference the package name in "import" statements everywhere in your code the same way:


import "{hostname}/scm/~{username}/{repository_slug}.git"
import "{hostname}/scm/~{username}/{repository_slug}.git/lib/some-library"
import "{hostname}/scm/~{username}/{repository_slug}.git/lib/some-other-library"

The .git at the end apparently is important, which happened to be my problem.  The other issue now is with this path not matching how glide vendors libraries in the same project, although the project is probably not doing things quite right anyway.

As Tim Pettersen's answer stated, it seems to be a deficiency in go, as without the ".git", it will try to get package metadata by calling the url with "?go-get=1".  For atlassian however, this metadata appeared to not work properly and was somehow messing up the path with a "~username" url.  Additionally, if I tried to use the "git config" "insteadOf" url rewriting capability, it got more confusing.

Anyway, sadly I'm not sure Gitlab is an option for me and sadly I ended up having nothing to show for hackathon this time, but cheers!


Hi James,

Further support for "go get" was added to Bitbucket Server (previously Stash) in version 3.8.0 (BSERVDEV-5380), including being able to use a clean import path (i.e. correct metadata is returned for the Go tools to parse). This means you should be able to use an import path without needing to specify the VCS suffix.

Please note that an import path of this form (using metadata to retrieve the clone URL, instead of explitcily stating the clone URL) should not include "/scm".

go get {hostname}/{project_key}/{repo_slug}

It also seems that "go get" now works properley with a tilda (~) in the import path. I did some manual testing (with Stash 3.8.0, when this feature was added, and Bitbucket Server 5.0.1, the latest version), using the latest version of Go tools (1.8.1), and I was able to succesfully use "go get" to install a go package from a personal repository.

Please let me know if you have any further questions.

Kind regards,
Stefan Petrucev
Atlassian Bitbucket

Further support for go get was added in Stash 3.8.0.

Kind regards,
Stefan Petrucev
Atlassian Stash

Suggest an answer

Log in or Register to answer