go mod resolve common commands

1.go mod init

A go.mod initialization file to the current directory, the current directory is actually a mod created for the module.

If go.mod already have the error will be: go source code as follows:

	if _, err := os.Stat("go.mod"); err == nil {
		base.Fatalf("go mod init: go.mod already exists")
	}    

2.go mod tidy

Similarly maven update, by this command to download the project depends on third-party libraries, and it will not remove the associated libraries.

 3.Go facing towards

The third-party libraries are copied to the current vendor directory directory

4.go mod verify

Check the download of third-party libraries have no local changes, if there are changes, it returns a non-zero, otherwise the validation is successful.

Guess you like

Origin www.cnblogs.com/LittleLee/p/11441574.html