Go get the workflow for forked repo

I use apexand installed it with go get github.com/apex/apex/cmd/apex. For me $GOPATH/bin/apex, that works great. I wanted to make some contribution to the top, so I forked it and ran it go get github.com/ajcrites/apex/cmd/apex. So far so good.

The problem arises when I want to check my local changes in the project. I see three questions:

  • Running go buildlocally does not work because the file is main.goimported directly from $GOPATH/src/github.com/apex. I need to import from $GOPATH/src/github.com/ajcritesfor testing
  • The main.gomanual change for importing from ajcritesis unsustainable because I cannot / should not make these changes. Moreover, despite the fact that it works with my files - I can say because it draws them - the binary file that is emitted does not work at all.
  • Changing $GOPATH/src/github.com/ajcritesup /apexand creating this method really works, but there are two problems:
    • The file system directory does not match the real repo name, which is strange
    • I still want to be able to use the actual binary from /apexwithout dropping it just for the purpose of testing local changes.

Is there a recommended way to clone forked gorepositories and build / test locally?

+4
2

, , GOPATH. , .

$GOPATH/src/github.com/apex/apex origin . , upstream, .

, go1.6, vendor/ . git , .

+1

, Gorilla GitHub:

$ go get github.com/gorilla/csrf
$ cd $GOPATH/src/github.com/gorilla/csrf

# Alternatively, you can git remote remove origin + re-add as SSH
$ git remote add elithrar git@github.com:elithrar/csrf.git

$ git checkout -b new-feature-X
$ <do some work on it>

# Install those changes.
$ go install ./...

. . , .

0

All Articles