@@ -240,6 +240,7 @@ func (g githubGoPR) buildSecrets() map[string]string {
240
240
const hidden = "{hidden}"
241
241
ret := map [string ]string {
242
242
g .context .GithubAccessToken : hidden ,
243
+ g .analysisGUID : hidden ,
243
244
}
244
245
if g .newWorkspaceInstaller == nil {
245
246
ret [g .gw .Gopath ()] = "$GOPATH"
@@ -383,9 +384,16 @@ func (g githubGoPR) Process(ctx context.Context) error {
383
384
return fmt .Errorf ("can't get pull request: %s" , err )
384
385
}
385
386
387
+ g .setCommitStatus (ctx , github .StatusPending , "GolangCI is reviewing your Pull Request..." )
388
+
386
389
if g .newWorkspaceInstaller == nil {
387
390
g .gw = workspaces .NewGo (g .exec , g .infoFetcher )
388
391
if err = g .gw .Setup (ctx , g .getRepo (), "github.com" , g .context .Repo .Owner , g .context .Repo .Name ); err != nil {
392
+ publicError := fmt .Sprintf ("failed to setup workspace: %s" , err )
393
+ publicError = escapeErrorText (publicError , g .buildSecrets ())
394
+ g .updateAnalysisState (ctx , nil , github .StatusError , publicError )
395
+ g .setCommitStatus (ctx , github .StatusError , "failed to setup" )
396
+
389
397
return fmt .Errorf ("can't setup go workspace: %s" , err )
390
398
}
391
399
defer g .gw .Clean (ctx )
@@ -394,7 +402,12 @@ func (g githubGoPR) Process(ctx context.Context) error {
394
402
startedAt := time .Now ()
395
403
exec , resLog , err := g .newWorkspaceInstaller .Setup (ctx , g .getRepo (), "github.com" , g .context .Repo .Owner , g .context .Repo .Name ) //nolint:govet
396
404
if err != nil {
397
- return errors .Wrap (err , "can't setup workspace" )
405
+ publicError := fmt .Sprintf ("failed to setup workspace: %s" , err )
406
+ publicError = escapeErrorText (publicError , g .buildSecrets ())
407
+ g .updateAnalysisState (ctx , nil , github .StatusError , publicError )
408
+ g .setCommitStatus (ctx , github .StatusError , "failed to setup" )
409
+
410
+ return errors .Wrap (err , "failed to setup setup workspace" )
398
411
}
399
412
g .exec = exec
400
413
g .resLog = resLog
@@ -413,7 +426,6 @@ func (g githubGoPR) Process(ctx context.Context) error {
413
426
return fmt .Errorf ("can't store patch: %s" , err )
414
427
}
415
428
416
- g .setCommitStatus (ctx , github .StatusPending , "GolangCI is reviewing your Pull Request..." )
417
429
curState , err := g .state .GetState (ctx , g .context .Repo .Owner , g .context .Repo .Name , g .analysisGUID )
418
430
if err != nil {
419
431
analytics .Log (ctx ).Warnf ("Can't get current state: %s" , err )
0 commit comments