2

I am having some issues cloning my go repository to my local machine.

I am running Ubuntu 18 and did a complete reinstall following these commands:

dpkg -l|grep golang  #  if you see any, run following cmd to remove
sudo apt-get purge golang-*

sudo rm -rf /usr/local/go 

ew_golang_ver=$(curl https://golang.org/VERSION?m=text 2> /dev/null)
cd /tmp
wget https://dl.google.com/go/${new_golang_ver}.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf  ${new_golang_ver}.linux-amd64.tar.gz

Added these to bashrc
export PATH=/usr/local/go/bin:${PATH}
export GOPATH=${HOME}/gopath  # typical value change at will
export PATH=${GOPATH}/bin:${PATH}

source ~/.bashrc  

go version

outputs

 go version go1.13 linux/amd64

Now I have a repository with a go project on AWS Code commit that I would like to Clone. These are the commands I tried and the output:

go get ssh://git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo
package ssh:/git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo: ssh:/git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo: invalid import path: malformed import path "ssh:/git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo": invalid char ':'

go get https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo
package https:/git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo: https:/git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo: invalid import path: malformed import path "https:/git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo": invalid char ':'

go get git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo
package git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo: unrecognized import path "git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo" (parse https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/myGoRepo?go-get=1: no go-import meta tags ())

I can do git clone just fine though.

So this leads me to two questions:

  1. Can I use go get command with AWS Code Commit at all?
  2. Can I use git clone command and then install the project in some other way? Where should I clone it? What go commands to use? In my project I have a setup.go file that generates some files as well as a cmd folder with another go file with my main function.
palle1
  • 31
  • 1
  • 3
  • You can clone whatever git repo you want but this is done via `git clone` and not via `go get`. Only some code hosting sites and sites with custom headers are go getable. And please installing Go from the official sources only. – Volker Sep 25 '19 at 09:16
  • And what do I do after I have cloned the repo? How do I install the dependencies? I have tried cd into the project and then running "go get ./..." but it results in "no install location for directory /home/me/projects/myGoRepo/cmd/history-parse outside GOPATH" – palle1 Sep 25 '19 at 09:34
  • Doing Go get./... is clean Nonsenses. Go get all the non-stdlib packages. – Volker Sep 25 '19 at 11:55

1 Answers1

-1

Clone the repositories with git clone. In order to do go get ./... inside 'myGoRepo' repository to install all its dependency packages, you need to place the repository somewhere inside the GOPATH which in your case is $HOME/gopath. e.g., $HOME/gopath/src/myGoRepo