Skip to content

Instantly share code, notes, and snippets.

@v0lkan
Created September 25, 2022 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v0lkan/ae60f6748265b1ec3e6649d9a9d67eb3 to your computer and use it in GitHub Desktop.
Save v0lkan/ae60f6748265b1ec3e6649d9a9d67eb3 to your computer and use it in GitHub Desktop.
Use `replace` in `go.mod` for local development.

If you don’t want to push your dependencies and tag them all the time and just want to use whatever the local version of code you have to speed up local development and also not break anyone’s code by merging unstable stuff to main, then you can use replace in your go.mod.

The replace line goes above your require statements, as follows:

module github.com/zerotohero-dev/sample-go-app

replace github.com/zerotohero-dev/potato => /Users/volkan/Desktop/WORKSPACE/potato

require (
	github.com/zerotohero-dev/potato v1.0.0
)

Just don’t forget to remove the replace before pushing your final pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment