You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require somedep master within child's go.mod file should be an error, since that is a branch name rather than a canonical version. (Best case, it might resolve to a //indirect dependency within parent, but I don't think that even that makes sense in terms of build reproducibility.)
(If you find that is not the case, please file an issue.)
As documented, “Exclude and replace apply only in the main module's go.mod and are ignored in dependencies.”
The version selected for the main module is the minimal version that satisfies the requirements of its (transitive) dependencies.
A replace directive in the main module replaces the source code for the named module with the source code found at the named replacement location. (That is not always what you want, but it's what we've implemented so far: see cmd/go: allow replacement modules to alias other active modules #26904.)
@bcmills by master I meant the latest commit in master, which will be resolved to a (pseudo-)version by go. I should have specified that in the issue text.
Assuming that the go command derives them correctly (see #27171), pseudo-versions sort in between the nearby tagged versions using the usual semantic-version comparisons.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Scenario:
parent
,child
, andsomedep
are all go modules.parent
depends onchild
; it hasrequire child v0.1.0
in itsgo.mod
.child
releasev0.1.0
depends onsomedep
; it hasrequire somedep master
andreplace somedep => somedep v0.2.0
in itsgo.mod
.somedep
’s latest release isv0.3.0
, andmaster
is a few commits beyond that.parent
also depends onsomedep
; it hasrequire somedep master
but no replace forsomedep
.A few questions that need clarification:
somedep
will be resolved whengo build
is run inparent
?replace
line inchild
'sgo.mod
overrideparent
'srequire
?parent
has norequire somedep master
(no direct dependency onsomedep
) in itsgo.mod
, all else the same as in the above scenario?parent
hasreplace somedep => somedep v0.3.0
in itsgo.mod
, all else the same as in the above scenario?If these questions can be answered by documentation, please point me in the right direction. Thanks!
What did you expect to see?
Not sure.
What did you see instead?
The text was updated successfully, but these errors were encountered: