Build and Historic build updates

Modified GOPATH to not modify build with go.mod
Updated go.mod to version 1.12
Updated harness to setup listener before killing process
Updated notvendored flag to --no-vendor
Updated command_config to ensure no-vendor can be build
Added additional checks in source path lookup
This commit is contained in:
notzippy@gmail.com
2020-05-02 12:03:17 -07:00
parent 9d3a554bec
commit 49eef29bb5
10 changed files with 125 additions and 155 deletions

View File

@@ -322,7 +322,8 @@ func Empty(dirname string) bool {
// Find the full source dir for the import path, uses the build.Default.GOPATH to search for the directory
func FindSrcPaths(appPath string, packageList []string, packageResolver func(pkgName string) error) (sourcePathsmap map[string]string, err error) {
sourcePathsmap, missingList, err := findSrcPaths(appPath, packageList)
if err != nil && packageResolver != nil {
if err != nil && packageResolver != nil || len(missingList)>0 {
Logger.Info("Failed to find package, attempting to call resolver for missing packages","missing packages",missingList)
for _, item := range missingList {
if err = packageResolver(item); err != nil {
return
@@ -351,22 +352,28 @@ func findSrcPaths(appPath string, packagesList []string) (sourcePathsmap map[str
Dir:appPath,
}
sourcePathsmap = map[string]string{}
Logger.Infof("Environment path %s root %s config env %s", os.Getenv("GOPATH"), os.Getenv("GOROOT"),config.Env)
pkgs, err := packages.Load(config, packagesList...)
Logger.Infof("Environment path %s root %s config env %s", os.Getenv("GOPATH"), os.Getenv("GOROOT"),config.Env)
Logger.Info("Loaded packages ", "len results", len(pkgs), "error", err, "basedir", appPath)
for _, packageName := range packagesList {
found := false
found := false
log := Logger.New("seeking", packageName)
for _, pck := range pkgs {
log.Info("Found package", "package", pck.ID)
if pck.ID == packageName {
if pck.Errors != nil && len(pck.Errors) > 0 {
log.Info("Error ", "count", len(pck.Errors), "App Import Path", pck.ID, "errors", pck.Errors)
continue
}
//a,_ := pck.MarshalJSON()
log.Info("Found ", "count", len(pck.GoFiles), "App Import Path", pck.ID, "apppath", appPath)
sourcePathsmap[packageName] = filepath.Dir(pck.GoFiles[0])
found = true
if len(pck.GoFiles)>0 {
sourcePathsmap[packageName] = filepath.Dir(pck.GoFiles[0])
found = true
}
}
}
if !found {
@@ -378,5 +385,6 @@ func findSrcPaths(appPath string, packagesList []string) (sourcePathsmap map[str
missingList = append(missingList, packageName)
}
}
return
}