I\'m trying to initialize a new go project with go module (using go 1.11). I don\'t plan to publish it in github or elsewhere, it is just a temporary/test project with only main
Is it not possible to init module without using git (or other VCS)? Or is there any workaround?
Yes, it is possible to init the modules without using VSC, initializing the module does not have to do anything with git or any other VCS.
This error occurs when the module name is not entered while init the module so to generate a module modulename write this command.
$ go mod init modulename
The content of the go.mod would be
module modulename
EDIT:
To use the modules from local repository use the replace directive
In your main module where you are checking your local module add the following lines
replace "X" v0.0.0 => "{location To your local module}"
require "X" v0.0.0
And then in your main project, import package util from module X you can simply do:
import "X/util"
Now when you will do go build it will look for this local module on the location you have given in the mod file of the main project.
For more explanation