Skip to content

Commit ef089be

Browse files
committed
safe assign
1 parent 9c1bf01 commit ef089be

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

agent/agentcontainers/devcontainer.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@ func devcontainerStartupScript(dc codersdk.WorkspaceAgentDevcontainer, script co
6464
}
6565

6666
func expandDevcontainerPaths(logger slog.Logger, expandPath func(string) (string, error), dc codersdk.WorkspaceAgentDevcontainer) codersdk.WorkspaceAgentDevcontainer {
67-
var err error
68-
if dc.WorkspaceFolder, err = expandPath(dc.WorkspaceFolder); err != nil {
67+
if wf, err := expandPath(dc.WorkspaceFolder); err != nil {
6968
logger.Warn(context.Background(), "expand devcontainer workspace folder failed", slog.Error(err))
69+
} else {
70+
dc.WorkspaceFolder = wf
7071
}
7172
if dc.ConfigPath != "" {
72-
if dc.ConfigPath, err = expandPath(dc.ConfigPath); err != nil {
73+
if cp, err := expandPath(dc.ConfigPath); err != nil {
7374
logger.Warn(context.Background(), "expand devcontainer config path failed", slog.Error(err))
75+
} else {
76+
dc.ConfigPath = cp
7477
}
7578
}
7679
return dc

0 commit comments

Comments
 (0)