What to do when you encounter the “Module name missing in go.mod file” error ?

Summary

What to do when you encounter the “Module name missing in go.mod file” error ?

Solution

This error can occur due to the use of an old version of vgo client that created a go.mod file when an older client of vgo builds the project which will create a go.mod file that contains the following:

module "github.com/you/hello"

The following format of the go.mod file, contains double quotes in the module name that will cause the JFrog CLI to not recognize the module name as it will parse the name by spaces.

To overcome this issue please do the following:

1 – Remove the created go.mod file and create an empty one.

2 – Update the vgo client to the latest version with $ go get -u golang.org/x/vgo

3 – Run $ vgo build and now the .mod file should not contain double quotes in the module name.