func Find(dir string) (string, error) {
	dir, err := filepath.Abs(dir)
	if err != nil {
		return "", err
	}

	for {
		_, err = os.Stat(filepath.Join(dir, workspaceFile))
		if err == nil {
			return dir, nil
		}
		if !os.IsNotExist(err) {
			return "", err
		}
		if strings.HasSuffix(dir, string(os.PathSeparator)) { // stop at root dir
			return "", os.ErrNotExist
		}
		dir = filepath.Dir(dir)
	}
}
func Find(dir string) (string, error) {
	dir, err := filepath.Abs(dir)
	if err != nil {
		return "", err
	}

	for {
		_, err = os.Stat(filepath.Join(dir, workspaceFile))
		if err == nil {
			return dir, nil
		}
		if !os.IsNotExist(err) {
			return "", err
		}
		if strings.HasSuffix(dir, string(os.PathSeparator)) { 
			return "", os.ErrNotExist
		}
		dir = filepath.Dir(dir)
	}
}
func Find ( dir string ) ( string , error ) { dir , err := filepath . Abs ( dir ) if err != nil { return " " , err } for { _ , err = os . Stat ( filepath . Join ( dir , workspaceFile ) ) if err == nil { return dir , nil } if ! os . IsNotExist ( err ) { return " " , err } if strings . HasSuffix ( dir , string ( os . PathSeparator ) ) { // stop at root dir return " " , os . ErrNotExist } dir = filepath . Dir ( dir ) } }
// Find searches from the given dir and up for the WORKSPACE file
// returning the directory containing it, or an error if none found in the tree.
Find searches from the given dir and up for the WORKSPACE file returning the directory containing it or an error if none found in the tree .