-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Pulumi-language-go and pulumi new now checks go version is at least 1.14.0 #5741
Conversation
a56bb7b
to
cca1d69
Compare
// will err if the project isn't using modules | ||
logging.V(5).Infof("GetRequiredPlugins: Error discovering plugin requirements: %s", err.Error()) | ||
return &pulumirpc.GetRequiredPluginsResponse{}, nil | ||
logging.V(5).Infof("GetRequiredPlugins: Error discovering plugin requirements using go modules: %s", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously returning an empty response essentially silently disabled plugin acquisition for users with glide or dep projects. We can reinstate the behavior if we feel we aren't ready for this breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards not introducing this break just yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards continuing to not error on the go list
command, at least for now.
Aside from that and some nits, LGTM.
sdk/go/pulumi-language-go/main.go
Outdated
cmd := exec.Command(gobin, "version") | ||
stdout, err := cmd.Output() | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to determine go version: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
return nil, fmt.Errorf("failed to determine go version: %w", err) | |
return nil, errors.Wrap(err, "determining go version") |
sdk/go/pulumi-language-go/main.go
Outdated
func checkMinimumGoVersion(goVersionOutput string) error { | ||
split := strings.Split(goVersionOutput, " ") | ||
if len(split) <= 2 { | ||
return fmt.Errorf("unexpected format for go version output: \"%s\"", goVersionOutput) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
return fmt.Errorf("unexpected format for go version output: \"%s\"", goVersionOutput) | |
return errors.Errorf("unexpected format for go version output: \"%s\"", goVersionOutput) |
sdk/go/pulumi-language-go/main.go
Outdated
|
||
currVersion, err := semver.ParseTolerant(version) | ||
if err != nil { | ||
return fmt.Errorf("parsing go version failed: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
return fmt.Errorf("parsing go version failed: %w", err) | |
return errors.Wrap(err, "parsing go version") |
sdk/go/pulumi-language-go/main.go
Outdated
} | ||
|
||
if currVersion.LT(minGoVersion) { | ||
return fmt.Errorf("go version must be %s or higher (%s detected)", minGoVersion.String(), version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
return fmt.Errorf("go version must be %s or higher (%s detected)", minGoVersion.String(), version) | |
return errors.Errorf("go version must be %s or higher (%s detected)", minGoVersion.String(), version) |
// will err if the project isn't using modules | ||
logging.V(5).Infof("GetRequiredPlugins: Error discovering plugin requirements: %s", err.Error()) | ||
return &pulumirpc.GetRequiredPluginsResponse{}, nil | ||
logging.V(5).Infof("GetRequiredPlugins: Error discovering plugin requirements using go modules: %s", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards not introducing this break just yet.
cca1d69
to
aa91d89
Compare
I decided to factor out the version check since I wanted to enforce this on |
2d64e3f
to
b2e2562
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #5724
This change enforces that the go version is at least 1.14.0 for go projects.
Now the following error is seen when running
pulumi up
on an incompatible version:and the following when
pulumi new
is invoked: