From 2ce47d414a633e207b38887d03d3c9ef4f1eed1e Mon Sep 17 00:00:00 2001 From: Munir Khakhi Date: Tue, 13 Jun 2023 17:27:08 +0530 Subject: [PATCH] Fixed panic in case of local module --- util/mod.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/util/mod.go b/util/mod.go index e792542..71984b1 100644 --- a/util/mod.go +++ b/util/mod.go @@ -55,7 +55,6 @@ func (m *ModDepManager) AddDependency(flogoImport Import) error { return err } - err = ExecCmd(exec.Command("go", "mod", "verify"), m.srcDir) if err == nil { err = ExecCmd(exec.Command("go", "mod", "download", flogoImport.ModulePath()), m.srcDir) @@ -225,7 +224,7 @@ func (m *ModDepManager) GetAllImports() (map[string]Import, error) { return result, nil } -//This function converts capotal letters in package name +// This function converts capotal letters in package name // to !(smallercase). Eg C => !c . As this is the way // go.mod saves every repository in the $GOPATH/pkg/mod. func toLower(s []string) []string { @@ -304,12 +303,12 @@ func (m *ModDepManager) AddReplacedContribForBuild() error { //If the length of mods is more than 4 it contains the versions of package //so it is stating to use different version of pkg rather than // the local pkg. - if len(mods) < 5 { - - m.localMods[mods[1]] = mods[3] - } else { - - m.localMods[mods[1]] = filepath.Join(os.Getenv("GOPATH"), "pkg", "mod", mods[3]+"@"+mods[4]) + if len(mods) >= 4 { + if len(mods) < 5 { + m.localMods[mods[1]] = mods[3] + } else { + m.localMods[mods[1]] = filepath.Join(os.Getenv("GOPATH"), "pkg", "mod", mods[3]+"@"+mods[4]) + } } }