Skip to content
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

capture std err when getting required plugins for go #4141

Merged
merged 3 commits into from
Mar 20, 2020

Conversation

EvanBoyle
Copy link
Contributor

Fixes #4139

When go programs have compile time errors, we aren't capturing the error output. We obscure the error behind a generic "get required plugins" failure.

The new output for a program with a compile-time error looks like:

Evans-MBP:go_aws_qs evanboyle$ pulumi up
Previewing update (dev):
     Type                 Name           Plan     Info
     pulumi:pulumi:Stack  go_aws_qs-dev           2 messages
 
Diagnostics:
  pulumi:pulumi:Stack (go_aws_qs-dev):
    # go_aws_qs
    ./main.go:19:30: cannot use name (type interface {}) as type string in argument to s3.NewBucket: need type assertion
 
error: failed to discover plugin requirements: failed to execute program cmd: exit status 2

Note that we're already capturing stdout in line 172, so we don't redirect it here.

@@ -167,6 +167,7 @@ func (host *goLanguageHost) GetRequiredPlugins(ctx context.Context,

cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "PULUMI_PLUGINS=true")
cmd.Stderr = os.Stderr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we intentionally not want to redirect SdOut as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the description:

Note that we're already capturing stdout in line 172, so we don't redirect it here.

If you try to capture stdout, cmd.Output() will return an error saying that stdout is already bound.

@EvanBoyle EvanBoyle merged commit c28c602 into master Mar 20, 2020
@pulumi-bot pulumi-bot deleted the evan/fixGoGetRequiredPlugins branch March 20, 2020 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Go programs with errors fail with no report on the errors
3 participants