Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/agent/container/codeserver_async.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewCodeServerAsyncCmd() *cobra.Command {

// Run runs the command logic.
func (cmd *CodeServerAsyncCmd) Run(_ *cobra.Command, _ []string) error {
log.Debugf("Start setting up container...")
log.Debugf("Start setting up container")
decompressed, err := compress.Decompress(cmd.SetupInfo)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/container/openvscode_async.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewOpenVSCodeAsyncCmd() *cobra.Command {

// Run runs the command logic.
func (cmd *OpenVSCodeAsyncCmd) Run(_ *cobra.Command, _ []string) error {
log.Debugf("Start setting up container...")
log.Debugf("Start setting up container")
decompressed, err := compress.Decompress(cmd.SetupInfo)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/workspace/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func (w *workspaceInitializer) tryConfigureDockerDaemon() {
if err := configureDockerDaemon(w.ctx); err != nil {
log.Warn(
"could not find docker daemon config file, if using the registry cache, " +
"please ensure the daemon is configured with containerd-snapshotter=true, " +
"ensure the daemon is configured with containerd-snapshotter=true, " +
"more info at https://docs.docker.com/engine/storage/containerd/",
)
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/context/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (cmd *CreateCmd) Run(ctx context.Context, context string) error {
if err != nil {
return err
} else if devsyConfig.Contexts[context] != nil {
return fmt.Errorf("context '%s' already exists", context)
return fmt.Errorf("context %q already exists", context)
}

// verify name
Expand Down Expand Up @@ -78,7 +78,7 @@ func setOptions(devsyConfig *config.Config, context string, options []string) er
if err != nil {
return err
} else if devsyConfig.Contexts[context] == nil {
return fmt.Errorf("context '%s' doesn't exist", context)
return fmt.Errorf("context %q doesn't exist", context)
}

newValues := map[string]config.OptionValue{}
Expand All @@ -103,15 +103,15 @@ func parseOptions(options []string) (map[string]config.OptionValue, error) {
for _, option := range options {
splitted := strings.Split(option, "=")
if len(splitted) == 1 {
return nil, fmt.Errorf("invalid option '%s', expected format KEY=VALUE", option)
return nil, fmt.Errorf("invalid option %q, expected format KEY=VALUE", option)
}

key := strings.ToUpper(strings.TrimSpace(splitted[0]))
value := strings.Join(splitted[1:], "=")
contextOption, ok := contextOptions[key]
if !ok {
return nil, fmt.Errorf(
"invalid option '%s', allowed options are: %v",
"invalid option %q, allowed options are: %v",
key,
allowedOptions,
)
Expand All @@ -121,7 +121,7 @@ func parseOptions(options []string) (map[string]config.OptionValue, error) {
found := slices.Contains(contextOption.Enum, value)
if !found {
return nil, fmt.Errorf(
"invalid value '%s' for option '%s', has to match one of the following values: %v",
"invalid value %q for option %q, has to match one of the following values: %v",
value,
key,
contextOption.Enum,
Expand Down
4 changes: 2 additions & 2 deletions cmd/context/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewDeleteCmd(flags *flags.GlobalFlags) *cobra.Command {
Short: "Delete a Devsy context",
RunE: func(cobraCmd *cobra.Command, args []string) error {
if len(args) > 1 {
return fmt.Errorf("please specify the context to delete")
return fmt.Errorf("specify the context to delete")
}

devsyContext := ""
Expand All @@ -50,7 +50,7 @@ func (cmd *DeleteCmd) Run(ctx context.Context, context string) error {
if context == "" {
context = devsyConfig.DefaultContext
} else if devsyConfig.Contexts[context] == nil {
return fmt.Errorf("context '%s' doesn't exist", context)
return fmt.Errorf("context %q doesn't exist", context)
}

// check for default context
Expand Down
4 changes: 2 additions & 2 deletions cmd/context/set_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewSetOptionsCmd(flags *flags.GlobalFlags) *cobra.Command {
Short: "Set options for a Devsy context",
RunE: func(cobraCmd *cobra.Command, args []string) error {
if len(args) > 1 {
return fmt.Errorf("please specify the context")
return fmt.Errorf("specify the context")
}

devsyContext := ""
Expand Down Expand Up @@ -54,7 +54,7 @@ func (cmd *SetOptionsCmd) Run(ctx context.Context, context string) error {
if context == "" {
context = devsyConfig.DefaultContext
} else if devsyConfig.Contexts[context] == nil {
return fmt.Errorf("context '%s' doesn't exist", context)
return fmt.Errorf("context %q doesn't exist", context)
}

// check if there are setOptions options set
Expand Down
4 changes: 2 additions & 2 deletions cmd/context/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewUseCmd(flags *flags.GlobalFlags) *cobra.Command {
Short: "Set a Devsy context as the default",
RunE: func(cobraCmd *cobra.Command, args []string) error {
if len(args) != 1 {
return fmt.Errorf("please specify the context to use")
return fmt.Errorf("specify the context to use")
}

return cmd.Run(cobraCmd.Context(), args[0])
Expand All @@ -44,7 +44,7 @@ func (cmd *UseCmd) Run(ctx context.Context, context string) error {
if err != nil {
return err
} else if devsyConfig.Contexts[context] == nil {
return fmt.Errorf("context '%s' doesn't exist", context)
return fmt.Errorf("context %q doesn't exist", context)
}

// check if there are use options set
Expand Down
2 changes: 1 addition & 1 deletion cmd/helper/http/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (cmd *RequestCmd) Run(ctx context.Context, args []string) error {
for _, header := range cmd.Headers {
splitted := strings.Split(header, ":")
if len(splitted) == 1 {
return fmt.Errorf("unexpected header '%s', expected form 'HEADER: VALUE'", header)
return fmt.Errorf("unexpected header %q, expected form 'HEADER: VALUE'", header)
}

httpHeader.Add(
Expand Down
2 changes: 1 addition & 1 deletion cmd/helper/ssh_git_clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewSSHGitCloneCmd() *cobra.Command {
func (cmd *SSHGitClone) Run(ctx context.Context, args []string) error {
if len(args) < 2 {
return fmt.Errorf(
"expected args in format: {user}@{host} {commands...}, received \"%s\"",
"expected args in format: {user}@{host} {commands...}, received %q",
strings.Join(args, " "),
)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ide/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewOptionsCmd(flags *flags.GlobalFlags) *cobra.Command {
Short: "Get IDE options",
RunE: func(cobraCmd *cobra.Command, args []string) error {
if len(args) != 1 {
return fmt.Errorf("please specify the ide")
return fmt.Errorf("specify the ide")
}

return cmd.Run(cobraCmd.Context(), args[0])
Expand Down
2 changes: 1 addition & 1 deletion cmd/ide/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ starting it. The change is persisted to the workspace config and used on the
next 'devsy workspace up'. Available IDEs can be listed with 'devsy ide list'.`,
RunE: func(cobraCmd *cobra.Command, args []string) error {
if len(args) != 1 {
return fmt.Errorf("please specify the ide")
return fmt.Errorf("specify the ide")
}
return cmd.Run(cobraCmd.Context(), args[0])
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/ide/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Available IDEs can be listed with 'devsy ide list'`,
RunE: func(cobraCmd *cobra.Command, args []string) error {
if len(args) != 1 {
return fmt.Errorf(
"please specify the ide to use, list available IDEs with 'devsy ide list'",
"specify the ide to use, list available IDEs with 'devsy ide list'",
)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/machine/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func (cmd *DeleteCmd) Run(ctx context.Context, args []string) error {
for _, workspace := range workspaces {
if workspace.Machine.ID == machineClient.Machine() {
return fmt.Errorf(
"cannot delete machine '%s', because workspace '%s' is still using it. "+
"Please delete the workspace '%s' before deleting the machine",
"cannot delete machine %q, because workspace %q is still using it. "+
"Delete the workspace %q before deleting the machine",
workspace.Machine.ID,
workspace.ID,
workspace.ID,
Expand Down
8 changes: 4 additions & 4 deletions cmd/machine/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ func (cmd *StatusCmd) Run(ctx context.Context, args []string) error {
switch machineStatus {
case client.StatusStopped:
log.Infof(
"Machine '%s' is '%s', you can start it via 'devsy machine start %s'",
"Machine %q is %q, you can start it via 'devsy machine start %s'",
machineClient.Machine(),
machineStatus,
machineClient.Machine(),
)
case client.StatusBusy:
log.Infof(
"Machine '%s' is '%s', which means its currently unaccessible. "+
"Machine %q is %q, which means its currently unaccessible. "+
"This is usually resolved by waiting a couple of minutes",
machineClient.Machine(),
machineStatus,
)
case client.StatusNotFound:
log.Infof("Machine '%s' is '%s'", machineClient.Machine(), machineStatus)
log.Infof("Machine %q is %q", machineClient.Machine(), machineStatus)
default:
log.Infof("Machine '%s' is '%s'", machineClient.Machine(), machineStatus)
log.Infof("Machine %q is %q", machineClient.Machine(), machineStatus)
}
case output.ModeJSON:
out, err := json.Marshal(struct {
Expand Down
8 changes: 4 additions & 4 deletions cmd/pro/cluster/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (cmd *ClusterCmd) Run(ctx context.Context, args []string) error {
kubeConfig, err := kubeClientConfig.RawConfig()
if err != nil {
return fmt.Errorf(
"there is an error loading your current kube config (%w), please make sure you have access "+
"there is an error loading your current kube config (%w), make sure you have access "+
"to a kubernetes cluster and the command `kubectl get namespaces` is working",
err,
)
Expand All @@ -249,7 +249,7 @@ func (cmd *ClusterCmd) Run(ctx context.Context, args []string) error {
config, err := kubeClientConfig.ClientConfig()
if err != nil {
return fmt.Errorf(
"there is an error loading your current kube config (%w), please make sure you have access "+
"there is an error loading your current kube config (%w), make sure you have access "+
"to a kubernetes cluster and the command `kubectl get namespaces` is working",
err,
)
Expand All @@ -269,7 +269,7 @@ func (cmd *ClusterCmd) Run(ctx context.Context, args []string) error {
helmCmd.Stderr = log.Writer(log.LevelDebug)
helmCmd.Stdin = os.Stdin

log.Info("Installing agent...")
log.Info("Installing agent")
log.Debugf("Running helm command: %v", helmCmd.Args)

err = helmCmd.Run()
Expand All @@ -286,7 +286,7 @@ func (cmd *ClusterCmd) Run(ctx context.Context, args []string) error {
}

if cmd.Wait {
log.Info("Waiting for the cluster to be initialized...")
log.Info("Waiting for the cluster to be initialized")
waitErr := wait.PollUntilContextTimeout(
ctx,
time.Second,
Expand Down
2 changes: 1 addition & 1 deletion cmd/pro/cluster/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (cmd *ListClustersCmd) Run(
Stdout: &buf,
})
if err != nil {
return fmt.Errorf("list clusters with provider \"%s\": %w", provider.Name, err)
return fmt.Errorf("list clusters with provider %q: %w", provider.Name, err)
}

headers := []string{proutil.HeaderName, proutil.HeaderDisplayName, "Online"}
Expand Down
2 changes: 1 addition & 1 deletion cmd/pro/daemon/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func withGracefulShutdown(ctx context.Context) (context.Context, func()) {
for {
select {
case sig := <-sigChan:
log.Infof("Received signal %s, starting graceful shutdown...", sig)
log.Infof("Received signal %s, starting graceful shutdown", sig)

cancel()
case <-ctx.Done():
Expand Down
2 changes: 1 addition & 1 deletion cmd/pro/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (cmd *HealthCmd) Run(
Stderr: log.Writer(log.LevelError),
})
if err != nil {
return fmt.Errorf("check health with provider \"%s\": %w", provider.Name, err)
return fmt.Errorf("check health with provider %q: %w", provider.Name, err)
}

fmt.Println(buf.String())
Expand Down
6 changes: 3 additions & 3 deletions cmd/pro/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (cmd *LoginCmd) Run(ctx context.Context, fullURL string) error {

func (cmd *LoginCmd) normalizeURL(fullURL string) (string, error) {
if strings.HasPrefix(fullURL, "http://") {
return "", fmt.Errorf("http is not supported for Devsy Pro, please use https:// instead")
return "", fmt.Errorf("http is not supported for Devsy Pro, use https:// instead")
}
if !strings.HasPrefix(fullURL, "https://") {
return "https://" + fullURL, nil
Expand Down Expand Up @@ -163,7 +163,7 @@ func (cmd *LoginCmd) resolveNewProviderName(devsyConfig *config.Config, host str
cmd.Provider = provider.ToProInstanceID(config.BinaryName + "-" + host)
if providers[cmd.Provider] != nil {
return fmt.Errorf(
"provider %s already exists, please choose a different name via --provider",
"provider %s already exists, choose a different name via --provider",
cmd.Provider,
)
}
Expand Down Expand Up @@ -277,7 +277,7 @@ func (cmd *LoginCmd) addLoftProvider(
}

// add the provider
log.Infof("Add Devsy Pro provider...")
log.Infof("Add Devsy Pro provider")

// is development?
if cmd.ProviderSource == config.RepoSlug+"@v0.0.0" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/pro/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewLogoutCmd(flags *proflags.GlobalFlags) *cobra.Command {
//nolint:cyclop,funlen // logout sequences provider/daemon teardown; complexity reflects domain workflow
func (cmd *LogoutCmd) Run(ctx context.Context, args []string) error {
if len(args) != 1 {
return fmt.Errorf("please specify a pro instance to log out of")
return fmt.Errorf("specify a pro instance to log out of")
}

devsyConfig, err := config.LoadConfig(cmd.Context, cmd.Provider)
Expand Down
2 changes: 1 addition & 1 deletion cmd/pro/project/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (cmd *ListProjectsCmd) Run(
Stdout: &buf,
})
if err != nil {
return fmt.Errorf("watch workspaces with provider \"%s\": %w", provider.Name, err)
return fmt.Errorf("watch workspaces with provider %q: %w", provider.Name, err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix mismatched error context in project listing path.

Line 74 says "watch workspaces..." inside listProjects; this is misleading when troubleshooting failures. Use wording aligned to the invoked command.

Suggested fix
-		return fmt.Errorf("watch workspaces with provider %q: %w", provider.Name, err)
+		return fmt.Errorf("list projects with provider %q: %w", provider.Name, err)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return fmt.Errorf("watch workspaces with provider %q: %w", provider.Name, err)
return fmt.Errorf("list projects with provider %q: %w", provider.Name, err)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/pro/project/list.go` at line 74, The error message in listProjects is
misleading — replace the context string "watch workspaces with provider %q: %w"
with wording matching the invoked command (e.g., "list projects with provider
%q: %w") so failures in listProjects report the correct action; update the
fmt.Errorf call that uses provider.Name and err in the listProjects function to
reflect this corrected message.

}

headers := []string{proutil.HeaderName, proutil.HeaderDisplayName, "Description"}
Expand Down
2 changes: 1 addition & 1 deletion cmd/pro/provider/list/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func Projects(ctx context.Context, client client.Client) (*managementv1.ProjectL
return projectList, fmt.Errorf("list projects: %w", err)
} else if len(projectList.Items) == 0 {
return projectList, fmt.Errorf(
"you don't have access to any projects, please make sure you have at least access to 1 project",
"you don't have access to any projects, make sure you have at least access to 1 project",
)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/pro/provider/list/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func Templates(
} else if len(templateList.DevsyWorkspaceTemplates) == 0 {
return templateList, fmt.Errorf(
"seems like there is no template allowed in project %s, "+
"please make sure to at least have a single template available",
"make sure to at least have a single template available",
projectName,
)
}
Expand All @@ -108,7 +108,7 @@ func FindTemplate(
} else if len(templateList.DevsyWorkspaceTemplates) == 0 {
return nil, fmt.Errorf(
"seems like there is no Devsy template allowed in project %s, "+
"please make sure to at least have a single template available",
"make sure to at least have a single template available",
projectName,
)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/pro/provider/list/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (cmd *WorkspacesCmd) Run(ctx context.Context) error {
return fmt.Errorf("list projects: %w", err)
} else if len(projectList.Items) == 0 {
return fmt.Errorf(
"you don't have access to any projects within Devsy Pro, please make sure you have at least access to 1 project",
"you don't have access to any projects within Devsy Pro, make sure you have at least access to 1 project",
)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/pro/provider/rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewRebuildCmd(globalFlags *flags.GlobalFlags) *cobra.Command {

func (cmd *RebuildCmd) Run(ctx context.Context, args []string) error {
if len(args) == 0 {
return fmt.Errorf("please provide a workspace name")
return fmt.Errorf("provide a workspace name")
}
targetWorkspace := args[0]

Expand Down
Loading
Loading