package app import ( "fmt" "strings" ) func missingSessionConfigError(searched []string, remoteDetail string) error { ordered := append([]string(nil), searched...) if len(ordered) == 0 { if strings.TrimSpace(remoteDetail) != "" { return fmt.Errorf("no session config path provided and no default locations configured; %s", remoteDetail) } return fmt.Errorf("no session config path provided and no default locations configured") } msg := fmt.Sprintf( "no session config path provided and no default session config found; searched: %s", strings.Join(ordered, ", "), ) if strings.TrimSpace(remoteDetail) != "" { msg += "; " + strings.TrimSpace(remoteDetail) } msg += "; pass --session to use an explicit path" return fmt.Errorf("%s", msg) }