Reputation: 368
I have added a new switch (-xml) to the go cover tool to generate an XML doc that is consumable by Atlassian clover so the bamboo builds of our go projects can report simple coverage statistics. I would like this local version to be accessible to the build agents using go get <importpath>.
These are the steps I've tried:
- setup $GOPATH
- created $GOPATH/src/stash.example.com/scm/x
- cd $GOPATH/src/stash.example.com/scm/x
- git clone --bare https://go.goolesource.com/tools
and then basically followed the steps for importing an existing git project into stash as described in https://confluence.atlassian.com/display/STASH/Importing+code+from+an+existing+project#Importingcodefromanexistingproject-ImportanexistingGitprojectintoStash
If I then 'rm -rf tools' followed by 'go get -d stash.example.com/scm/x/tools' I get "unrecognized import path stash.example.com/scm/x/tools". It works if I type 'go get -d stash.example.com/scm/x/tools.git' (providing the vcs hint to go get), but the resulting subdirectory is named 'test.git'. The alternative to providing the vcs hint in the path is to return a <meta> tag in the html from the stash server, but I have no idea how to create that.
I should add that 'cd $GOPATH/src/stash.example.com/scm/x' + 'git clone http://[email protected]/scm/x/tools.git' creates the tools subdirectory as expected.
I must host this on a local server inside my firewall, so github is not an option. Any advice?
Upvotes: 2
Views: 933
Reputation: 93044
What does curl http://stash.example.com/scm/x/tools
yield? What servers are listening on stash.example.com
? Generally, a go get
-able path either contains a component with a suffix denoting the revision control system used (e.g. example.com/repository.git/package
) or a certain meta-tag exists in one of the directory layers that tells go get
where to get the source.
go get
is an unsophisticated mechanism and if I recall correctly it doesn't work with git when the server requires authentication.
Have a look here for the relevant documentation on how import paths work with go get
. I'm not going to cite out of this as it's rather long, unlikely to go down and you can retrieve it on your local machine by installing godoc
and running
godoc -http=:8080 # or some other port
and then pointing your browser to
http://localhost:8080/cmd/go/#hdr-Relative_import_paths.
Upvotes: 1