go – What is the proper golang workflow for developing locally and pushing to github?-ThrowExceptions

Exception or error:

What is the proper workflow to develop locally and push golang code to github? Before the code is pushed to github, I won’t be able to reference those libraries in commands and I would prefer not to push half-baked code.

If I run go build, that does not install the module. Similarly, if I run go install, I don’t see any additional files created under my ~/go directory. It is only when I commit my changes and push to github followed by doing a go get -u github.com … that I see the packages being installed.

How to solve:

Use the ‘replace’ directive in your application go.mod file to specify modules that are local:

replace example.com/original/import/path => /your/forked/import/path

See: https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive

Answer´╝Ü

I simply needed to follow the directions here:

My workspace was not in the default location, no did I override the GOPATH … and so that caused some grief.

Leave a Reply

Your email address will not be published. Required fields are marked *