Closed kortschak closed 4 years ago
Hi, gophernotes currently uses the vendor directory, which does not mix well with modules. See for example https://www.reddit.com/r/golang/comments/9ai79z/correct_usage_of_go_modules_vendor_still_connects/
This gives surprising results when packages have a go.mod/go.sum with services like my-binder that set GO111MODULE based on their existence.
Is there an intention to move from vendoring to a modules-based build?
I added go.mod
and go.sum
to upstream gomacro.
To @SpencerPark and @sbinet: what are your opinions about removing the vendor/ directory and declaring instead the exact versions of dependencies in go.mod
and go.sum
?
@cosmos72 Learned something new about go11 today and I am really liking it. Is this going to break things on older versions of go? Do we need to keep support for these versions? Can we keep both for a while so there are no issues with go11 using modules but 9 and 10 still have the vendor option?
Good point.
Go 1.9 and 1.10 would ignore the files go.mod
and go.sum
, and will either pick the vendor/
directory (if we keep it) or fetch the latest version of the dependencies (if we drop the vendor/
directory) without any control on which versions they actually fetch.
The latter is definitely not an ideal situation, and it's exactly what vendoring and modules attempt to solve.
Also, I have no idea what happens if you use Go 1.11 with modules together with a vendor/
directory.
Update: https://research.swtch.com/vgo-module#end_of_vendoring states that when Go modules are enabled, the vendor/
directory is ignored.
That's exactly what's needed for a smooth incremental migration:
go.mod
and go.sum
, and also keep the vendor/
directory: users compiling with old Go compilers (or modules disabled) will pick the dependencies from vendor/
, while users compiling with new Go compilers and modules enabled will automatically download the exact dependencies versions stated in go.mod
and go.sum
go.mod
and go.sum
in sync with vendor/
. This can happen many times during gophernotes development and maintenancevendor/
directory
I discovered this trying to set up a my-binder using gophernotes with a repo that has a go.mod file. Apparently my-binder sets
GO111MODULE=on
when this file exists and the Go version permits.This is the failure (replicated locally not in $GOPATH):
It looks like you need to tag a more recent version to ensure that users using modules will get a sufficiently recent version by default.