func ReadTarget() (string, error) {
	if target := os.Getenv("TSURU_TARGET"); target != "" {
		targets, err := getTargets()
		if err == nil {
			if val, ok := targets[target]; ok {
				return val, nil
			}
		}
		return target, nil
	}
	targetPath := JoinWithUserDir(".tsuru", "target")
	target, err := readTarget(targetPath)
	if err == errUndefinedTarget {
		copyTargetFiles()
		target, err = readTarget(JoinWithUserDir(".tsuru_target"))
	}
	return target, err
}
func ReadTarget() (string, error) {
	if target := os.Getenv("TSURU_TARGET"); target != "" {
		targets, err := getTargets()
		if err == nil {
			if val, ok := targets[target]; ok {
				return val, nil
			}
		}
		return target, nil
	}
	targetPath := JoinWithUserDir(".tsuru", "target")
	target, err := readTarget(targetPath)
	if err == errUndefinedTarget {
		copyTargetFiles()
		target, err = readTarget(JoinWithUserDir(".tsuru_target"))
	}
	return target, err
}
func ReadTarget ( ) ( string , error ) { if target := os . Getenv ( " " ) ; target != " " { targets , err := getTargets ( ) if err == nil { if val , ok := targets [ target ] ; ok { return val , nil } } return target , nil } targetPath := JoinWithUserDir ( " " , " " ) target , err := readTarget ( targetPath ) if err == errUndefinedTarget { copyTargetFiles ( ) target , err = readTarget ( JoinWithUserDir ( " " ) ) } return target , err }
// ReadTarget returns the current target, as defined in the TSURU_TARGET
// environment variable or in the target file.
ReadTarget returns the current target as defined in the TSURU_TARGET environment variable or in the target file .