-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Description
script/setup/install-cni, which is called by make install-deps and a few other ways, expects "$GOPATH"/src/github.com/containerd/containerd/go.mod to exist and for that folder to be the location of the containerd source that is being built. It uses the contents of this file to determine the appropriate version of https://github.com/containernetworking/plugins.git to install to match the containerd module being developed.
I believe that the use of "$GOPATH"/src was generally deprecated between golang 1.13 and 1.17. While many developers may still keep their go module sources in that location, this is no longer standardized or required. Commands like go install and go get have changed behavior and functionality since this change. Official tooling can now put the module source in a path that looks like "$GOPATH"/pkg/mod/github.com/containerd/[email protected]/. At the very least, this script should be assembling that path with the version number to use.
Further, I don't think it's reasonable for the build scripts in any arbitrary location to expect to rely on sources in the GOPATH. These scripts should be looking at the location the script is being run from, or a path passed in from the user or the Makefile, in order to target the correct version. If my local branch of containerd has been modified to have different dependencies, those dependencies should be honored when I'm running scripts in my branch. This script should be referring to ../../go.mod, probably described via environment variables set by the Makefile where possible, then by the location of the script, and only with a direct relative path from the cwd as a last resort.
Steps to reproduce the issue
make install-deps
Describe the results you received and expected
received: grep: /home/clrnc/go/src/github.com/containerd/containerd/go.mod: No such file or directory
expected: grep produces the appropriate version number and installation proceeds
What version of containerd are you using?
1.6.8
Any other relevant information
The Makefile should also be supplying the GOPATH to this script if it wasn't supplied by the user, as it already provides it for other steps and targets.
Show configuration if it is related to CRI plugin.
No response