Closed komuw closed 3 years ago
After merging https://github.com/komuw/ote/pull/37 ; if you have a modfile like;
module testdata/mod1 require ( github.com/frankban/quicktest v1.12.1 github.com/go-ole/go-ole v1.2.5 // indirect github.com/shirou/gopsutil v2.20.9+incompatible //PriorComment rsc.io/quote v1.5.2 ) exclude golang.org/x/net v1.2.3 retract ( v1.0.1 // Contains retractions only. v1.0.0 // Published accidentally. )
ote produces a modfile like;
ote
module testdata/mod1 require ( github.com/go-ole/go-ole v1.2.5 // indirect rsc.io/quote v1.5.2 ) exclude golang.org/x/net v1.2.3 retract ( v1.0.1 // Contains retractions only. v1.0.0 // Published accidentally. ) require ( github.com/frankban/quicktest v1.12.1 // test github.com/shirou/gopsutil v2.20.9+incompatible // test; PriorComment )
ie, the require block of test-only dependencies is last. Instead it should come immediately after the last require block, ie; before the exclude
exclude
see: https://github.com/golang/mod/blob/0f08993efd8a8ec67e75bcccf86b0e1569b0ab0a/modfile/rule.go#L965-L1000
note; we do not have to do this. Even gotip/go1.17 does not organise the require block of indirect dependencies to be immediately after the require block of direct dependencies
gotip
go1.17
After merging https://github.com/komuw/ote/pull/37 ; if you have a modfile like;
ote
produces a modfile like;ie, the require block of test-only dependencies is last. Instead it should come immediately after the last require block, ie; before the
exclude