Added additional pattern to test against

Another different missing pacakge error thrown that can be detected and added
This error occurs because a package may have been stripped down when originally loaded
This commit is contained in:
notzippy@gmail.com
2022-03-05 09:10:51 -08:00
parent 3cd5ebbde2
commit bb926f396a
3 changed files with 8 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ import (
var importErrorPattern = regexp.MustCompile("cannot find package \"([^\"]+)\"")
var importErrorPattern2 = regexp.MustCompile("no required module provides package ([^;]+)+")
var addPackagePattern = regexp.MustCompile(`to add:\n\tgo get (.*)\n`)
type ByString []*model.TypeInfo
@@ -214,6 +215,10 @@ func Build(c *model.CommandConfig, paths *model.RevelContainer) (_ *App, err err
if matches == nil {
matches = importErrorPattern2.FindAllStringSubmatch(stOutput, -1)
}
if matches == nil {
matches = addPackagePattern.FindAllStringSubmatch(stOutput, -1)
}
utils.Logger.Info("Build failed checking for missing imports", "message", stOutput, "missing_imports", len(matches))
if matches == nil {
utils.Logger.Info("Build failed no missing imports", "message", stOutput)