@@ -229,7 +229,7 @@ func (cmd *getCmd) doGet(reposPathList []pathutil.ReposPath, lockJSON *lockjson.
229
229
} else {
230
230
added := cmd .updateReposVersion (lockJSON , r .reposPath , r .reposType , r .hash , profile )
231
231
if added && strings .Contains (status , "already exists" ) {
232
- status = fmt .Sprintf (fmtAddedRepos , statusPrefixInstalled , r .reposPath )
232
+ status = fmt .Sprintf (fmtAddedRepos , r .reposPath )
233
233
}
234
234
updatedLockJSON = true
235
235
}
@@ -291,21 +291,19 @@ type getParallelResult struct {
291
291
}
292
292
293
293
const (
294
- statusPrefixFailed = "!"
295
- statusPrefixNoChange = "#"
296
- statusPrefixInstalled = "+"
297
- statusPrefixUpgraded = "*"
298
- )
299
-
300
- const (
301
- fmtInstallFailed = "%s %s > install failed > %s"
302
- fmtUpgradeFailed = "%s %s > upgrade failed > %s"
303
- fmtNoChange = "%s %s > no change"
304
- fmtAlreadyExists = "%s %s > already exists"
305
- fmtAddedRepos = "%s %s > added repository to current profile"
306
- fmtInstalled = "%s %s > installed"
307
- fmtRevUpdate = "%s %s > updated lock.json revision (%s..%s)"
308
- fmtUpgraded = "%s %s > upgraded (%s..%s)"
294
+ statusPrefixFailed = "!"
295
+ // Failed
296
+ fmtInstallFailed = "! %s > install failed > %s"
297
+ fmtUpgradeFailed = "! %s > upgrade failed > %s"
298
+ // No change
299
+ fmtNoChange = "# %s > no change"
300
+ fmtAlreadyExists = "# %s > already exists"
301
+ // Installed
302
+ fmtAddedRepos = "+ %s > added repository to current profile"
303
+ fmtInstalled = "+ %s > installed"
304
+ // Upgraded
305
+ fmtRevUpdate = "* %s > updated lock.json revision (%s..%s)"
306
+ fmtUpgraded = "* %s > upgraded (%s..%s)"
309
307
)
310
308
311
309
// This function is executed in goroutine of each plugin.
@@ -344,7 +342,7 @@ func (cmd *getCmd) installPlugin(reposPath pathutil.ReposPath, repos *lockjson.R
344
342
}
345
343
done <- getParallelResult {
346
344
reposPath : reposPath ,
347
- status : fmt .Sprintf (fmtInstallFailed , statusPrefixFailed , reposPath , result .Error ()),
345
+ status : fmt .Sprintf (fmtInstallFailed , reposPath , result .Error ()),
348
346
err : result ,
349
347
}
350
348
return
@@ -361,7 +359,7 @@ func (cmd *getCmd) installPlugin(reposPath pathutil.ReposPath, repos *lockjson.R
361
359
msg := "-u was specified but repos == nil"
362
360
done <- getParallelResult {
363
361
reposPath : reposPath ,
364
- status : fmt .Sprintf (fmtUpgradeFailed , statusPrefixFailed , reposPath , msg ),
362
+ status : fmt .Sprintf (fmtUpgradeFailed , reposPath , msg ),
365
363
err : errors .New ("failed to upgrade plugin: " + msg ),
366
364
}
367
365
return
@@ -378,13 +376,13 @@ func (cmd *getCmd) installPlugin(reposPath pathutil.ReposPath, repos *lockjson.R
378
376
}
379
377
done <- getParallelResult {
380
378
reposPath : reposPath ,
381
- status : fmt .Sprintf (fmtUpgradeFailed , statusPrefixFailed , reposPath , err .Error ()),
379
+ status : fmt .Sprintf (fmtUpgradeFailed , reposPath , err .Error ()),
382
380
err : result ,
383
381
}
384
382
return
385
383
}
386
384
if err == git .NoErrAlreadyUpToDate {
387
- status = fmt .Sprintf (fmtNoChange , statusPrefixNoChange , reposPath )
385
+ status = fmt .Sprintf (fmtNoChange , reposPath )
388
386
} else {
389
387
upgraded = true
390
388
}
@@ -401,14 +399,14 @@ func (cmd *getCmd) installPlugin(reposPath pathutil.ReposPath, repos *lockjson.R
401
399
}
402
400
done <- getParallelResult {
403
401
reposPath : reposPath ,
404
- status : fmt .Sprintf (fmtInstallFailed , statusPrefixFailed , reposPath , result .Error ()),
402
+ status : fmt .Sprintf (fmtInstallFailed , reposPath , result .Error ()),
405
403
err : result ,
406
404
}
407
405
return
408
406
}
409
- status = fmt .Sprintf (fmtInstalled , statusPrefixInstalled , reposPath )
407
+ status = fmt .Sprintf (fmtInstalled , reposPath )
410
408
} else {
411
- status = fmt .Sprintf (fmtAlreadyExists , statusPrefixNoChange , reposPath )
409
+ status = fmt .Sprintf (fmtAlreadyExists , reposPath )
412
410
checkRevision = true
413
411
}
414
412
@@ -426,7 +424,7 @@ func (cmd *getCmd) installPlugin(reposPath pathutil.ReposPath, repos *lockjson.R
426
424
}
427
425
done <- getParallelResult {
428
426
reposPath : reposPath ,
429
- status : fmt .Sprintf (fmtInstallFailed , statusPrefixFailed , reposPath , result .Error ()),
427
+ status : fmt .Sprintf (fmtInstallFailed , reposPath , result .Error ()),
430
428
err : result ,
431
429
}
432
430
return
@@ -435,11 +433,11 @@ func (cmd *getCmd) installPlugin(reposPath pathutil.ReposPath, repos *lockjson.R
435
433
436
434
// Show old and new revisions: "upgraded ({from}..{to})".
437
435
if upgraded {
438
- status = fmt .Sprintf (fmtUpgraded , statusPrefixUpgraded , reposPath , fromHash , toHash )
436
+ status = fmt .Sprintf (fmtUpgraded , reposPath , fromHash , toHash )
439
437
}
440
438
441
439
if checkRevision && repos != nil && repos .Version != toHash {
442
- status = fmt .Sprintf (fmtRevUpdate , statusPrefixUpgraded , reposPath , repos .Version , toHash )
440
+ status = fmt .Sprintf (fmtRevUpdate , reposPath , repos .Version , toHash )
443
441
}
444
442
445
443
done <- getParallelResult {
@@ -464,7 +462,7 @@ func (cmd *getCmd) installPlugconf(reposPath pathutil.ReposPath, pluginResult *g
464
462
}
465
463
done <- getParallelResult {
466
464
reposPath : reposPath ,
467
- status : fmt .Sprintf (fmtInstallFailed , statusPrefixFailed , reposPath , result .Error ()),
465
+ status : fmt .Sprintf (fmtInstallFailed , reposPath , result .Error ()),
468
466
err : result ,
469
467
}
470
468
return
0 commit comments