Reference 80327035
The solution for finding a dependent package path is as follows:
- The vendor directory under the current package.
- Locate the parent directory until you find the vendor directory under SRC.
- Look for dependent packages under Gopath.
- Look in the Goroot directory
Some of the recommendations in using vendor are as follows:
- A library project (a package that does not contain main) should not store external packages in the vendor directory in its own version control unless they have special reasons and know why.
- In one application, (containing the package for main), it is recommended that there is only one vendor directory at the code base level.
The reasons for the above recommendations are as follows:
- An instance of each package in the directory structure, even the same version of the same package, will hit the final binary, and if everyone stores their own dependencies individually, it will quickly lead to a binary burst of makefile (binary bloat)
- One of the pacage types in a directory is not compatible with the same package but in different directory types, even the same version of the package, which means that loggers, database connections, and other shared instances are not working.
Go Vendor Catalog