$ go build -o build/xenstore ./xenstore
go: finding module for package golang.org/x/sys/unix
xenstore/xenstore.go:11:2: cannot query module due to -mod=vendor
(Go version in go.mod is at least 1.14 and vendor directory exists.)
Either removing the vendor/modules.txt file or keeping all vendor files will make go command happy.
$ rm -r vendor/
$ go build -o build/xenstore ./xenstore
$ go mod vendor
$ ls vendor/golang.org/x/sys/
AUTHORS CONTRIBUTORS internal LICENSE PATENTS unix
$ go build -o build/xenstore ./xenstore
The vendor dir https://github.com/xenserver/xe-guest-utilities/tree/master/vendor only has modules.txt files, without the vendor sources.
This makes plain
go
command fail to operate.Either removing the vendor/modules.txt file or keeping all vendor files will make
go
command happy.