I've recently had occasion to do a fair amount of work with Go modules and vendoring, and I've had trouble finding simple how-tos for doing some (to me) basic things. It turns out they aren't that complicated, but they do involve multiple systems working together which may not be obvious to Go newbies (like me!). I'm writing this down both for my own reference and in the hopes that maybe it will help someone else get started with this stuff. I make no promises as to the accuracy of these steps, but they did what I needed.
Here are some things you might want to do and how to do them, all run from the directory of the project doing the vendoring:
For pulling in new features or bugfixes.go get github.com/example/module
go mod vendor
For pulling in new features or bugfixes on branchesgo get github.com/example/module@branch
go mod vendor
go get -u
go mod vendor
For when you need to test a local change that is vendored in another project.go mod edit -replace github.com/example/module=/path/to/local/source
go mod vendor
Looking back at this I guess it's pretty clear that the whole process boils down to "do a thing that affects the module config of the project then run go mod vendor
", but again I had trouble finding a resource that actually covered those things at the same time. The fact that vendoring has changed rather significantly in Go doesn't help either because half of the documents I found were horribly out of date (as this one will no doubt be in short order ;-).
Anyway, hope this helps. If you have corrections or suggestions for other things to include, let me know.