From 7be95a5c4de7769b3eac7476b433ad89d030be7e Mon Sep 17 00:00:00 2001 From: rafaelDev0ps Date: Thu, 31 Oct 2024 18:33:08 -0300 Subject: [PATCH] Fix error message and remove matchProjectDirectory method --- cli/htmgo/tasks/astgen/entry.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/cli/htmgo/tasks/astgen/entry.go b/cli/htmgo/tasks/astgen/entry.go index e45c835..acea9bc 100644 --- a/cli/htmgo/tasks/astgen/entry.go +++ b/cli/htmgo/tasks/astgen/entry.go @@ -401,7 +401,7 @@ func GetModuleName() string { modPath := filepath.Join(wd, "go.mod") if HasModuleFile(modPath) == false { - fmt.Fprintf(os.Stderr, "Module not found: go.mod file does not exists.") + fmt.Fprintf(os.Stderr, "Module not found: go.mod file does not exist.") return "" } @@ -414,18 +414,6 @@ func GetModuleName() string { return modName } -func matchProjectDirectory() bool { - wd := process.GetWorkingDir() - dirs := strings.Split(wd, "/") - - projectDir := dirs[len(dirs)-1] - - if GetModuleName() == projectDir { - return true - } - return false -} - func GenAst(flags ...process.RunFlag) error { if GetModuleName() == "" { if slices.Contains(flags, process.ExitOnError) { @@ -453,9 +441,5 @@ func GenAst(flags ...process.RunFlag) error { `, ChiModuleName) }) - if matchProjectDirectory() == false { - return fmt.Errorf("The project directory does not match with the project name.") - } - return nil }