go mod vendor 只用于一种情况,那就是:你的代码要在一个不能访问外网的环境下编译的时候,可以在外网 go mod vendro 然后打包,拷贝到内网编译。

一般可以访问外部网络的环境,我的过程是:
go mod init xxxx.xxx/xxx/xxx
touch main.go
实现功能,过程中如果要增加新的依赖,可以用 go get xxxx.xxxx/xxxx/xxx
写完用 go mod tidy 自动更新 go.mod
go build

一般会写 Makefile ,我有一个仓库,用写了一些常用的 make 指令 ,用于构建 Go 项目:
https://github.com/cloudfstrife/gomake