In the root of your project run, for example:
This creates a go.mod whose first line is
(If you’re not pushing to GitHub, you can use any globally unique path—e.g. module example.com/go-jwt.)
Update your imports
Anywhere you wrote
change it to
and similarly for common, db, initializers, router, etc.
Rebuild
Now go build / go run will use the module path and any other developer can clone from your repo and build without needing your local $GOPATH layout.
No comments:
Post a Comment