-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Prysm import paths should include a virtual v2
version for go.mod semver support
#10006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Kind of related: #10046 |
Great! Looking forward :) Our of curiosity, do you know why $ go list -m -versions "github.com/prysmaticlabs/prysm/v2"
github.com/prysmaticlabs/prysm/v2 v2.0.1 |
Also interested in this! Without the |
@prestonvanloon - Has there been any progress on this, I would love to use the latest version of the code in my repo. |
Hi @abdulrabbani00 , the merge presents a great opportunity to release Prysm v3. We will most likely include this "feature" there, but not for v2. |
@rkapka - Okay, so does that mean we will have to wait until the merge happens or do you plan on have v3 released significantly prior to the merge? |
Hi @rkapka why adding /v2 to the module line in go.mod is a "feature"? This should allow
instead of
What is the downside in doing this? |
golang does not allow this in a require
|
why was this closed?
|
@nyetwurk Prysm is currently in |
Our current includes look like
How should they look in v3? |
Specifically // GetVersion returns the version string of the running beacon node.
func (c *Client) GetVersion(ctx context.Context) (res *ethv1.Version, err error) {
version, err := c.getVersionV1(ctx)
if err == nil {
return version.GetData(), nil
}
// Some nodes don't support the v1 endpoint yet. Fall back to v1alpha1.
alphaVersion, err2 := c.getVersionV1Alpha1(ctx)
if err2 != nil {
return nil, fmt.Errorf("both version endpoints failed. err1: %s; err2: %s", err, err2)
}
res = ðv1.Version{Version: alphaVersion.GetVersion()}
return res, nil
}
func (c *Client) getVersionV1Alpha1(ctx context.Context) (res *ethv1alpha1.Version, err error) {
res = new(ethv1alpha1.Version)
err = c.Get(ctx, res, "/eth/v1alpha1/node/version")
return
}
func (c *Client) getVersionV1(ctx context.Context) (res *ethv1.VersionResponse, err error) {
res = new(ethv1.VersionResponse)
err = c.Get(ctx, res, "/eth/v1/node/version")
return
} presumably something like
|
@nyetwurk That is correct, using the above format for |
💎 Issue
In order for users to specify prysm as a dependency in go.mod, using a version tag >=
v2.0.0
, we need to update our packages to correctly implement the go module system's special requirements for 2.0+ packages. This entails a change to go.mod and a sweeping rewrite of existing import paths. Until we've made this change, any consumer of prysm packages > 2.0.0 will need to pin prysm with a pseudo version specifying a specific commit hash, egrequire github.com/prysmaticlabs/prysm v0.0.0-20211018163532-a80b1c252a9b
.Background & Description
A quirk of go modules using semantic versioning is that
v1
is a special implicit version, but once you increment to v2 and beyond, you need to appendv2
to the package path declared in go.mod. Go does this to ensure that a version of a package with a breaking change has a different import path. In our case, themodule github.com/prysmaticlabs/prysm
directive in go.mod needs to be updated tomodule github.com/prysmaticlabs/prysm/v2
. Otherwise, any 3rd party trying to use our github tags like2.0.4
will mistakenly get the newest 1.x tag.The implication of that change is that every package import path within prysm itself will need to be rewritten. For instance:
needs to be rewritten as:
This was previously done with a sed one-liner in the branch
v2
for testing purposes here: f5956d3Note that we also need to update the proto annotation for the go import path: 596b3ac
Official go doc about moving packages to v2 and beyond:
https://go.dev/blog/v2-go-modules
The text was updated successfully, but these errors were encountered: