// resolveGoModFile walks up the directory tree starting from 'dir' until it
// finds a go.mod file. If go.mod is found it will return the related file
// object. If no go.mod file is found it will return an error.
resolveGoModFile walks up the directory tree starting from 'dir' until it
finds a go.mod file. If go.mod is found it will return the related file
object. If no go.mod file is found it will return an error.
// resolveGoModFile walks up the directory tree starting from ' dir ' until it // finds a go . mod file . If go . mod is found it will return the related file // object . If no go . mod file is found it will return an error .
func resolveGoModFile(dir string) (*os.File, string, error) {
	goModPath := filepath.Join(dir, "go.mod")
	f, err := os.Open(goModPath)
	if err != nil {
		if os.IsNotExist(err) && dir != filepath.Dir(dir) {
			return resolveGoModFile(filepath.Dir(dir))
		}
		return nil, "", err
	}
	return f, dir, nil
}
func resolveGoModFile ( dir string ) ( * os . File , string , error ) { goModPath := filepath . Join ( dir , " " ) f , err := os . Open ( goModPath ) if err != nil { if os . IsNotExist ( err ) && dir != filepath . Dir ( dir ) { return resolveGoModFile ( filepath . Dir ( dir ) ) } return nil , " " , err } return f , dir , nil }
resolveGoModFile walks up the directory tree starting from 'dir' until it
finds a go.mod file.
resolveGoModFile walks up the directory tree starting from ' dir ' until it finds a go . mod file .