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