'go get' is no longer supported outside a module.

PS E:\goproject\src\demo1> go get -u github.com/gin-gonic/gin
go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.

1.17之后,不应该用go get下载安装命令(即可执行程序),如果使用goget安装命令,就会提示上述警告,

也就是说go get只能下载普通的包,如果下载安装程序需要用go install

PS E:\goproject\src\demo1> go install github.com/gin-gonic/gin@latest

完美解决gin包安装失败的问题!

如果解决了你的问题帮忙点个小心心