Fix error message and remove matchProjectDirectory method

This commit is contained in:
rafaelDev0ps 2024-10-31 18:33:08 -03:00
parent 80871fc02a
commit 7be95a5c4d

View file

@ -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
}