Skip to content

Commit c55c5c8

Browse files
fix(lint): address wrapcheck and wsl issues
1 parent 30aa506 commit c55c5c8

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

internal/config/paths.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,24 @@ func ExpandPath(path string) (string, error) {
161161
if path == "" {
162162
return "", nil
163163
}
164+
164165
if path == "~" {
165-
return os.UserHomeDir()
166+
home, err := os.UserHomeDir()
167+
if err != nil {
168+
return "", fmt.Errorf("expand home dir: %w", err)
169+
}
170+
171+
return home, nil
166172
}
173+
167174
if strings.HasPrefix(path, "~/") {
168175
home, err := os.UserHomeDir()
169176
if err != nil {
170177
return "", fmt.Errorf("expand home dir: %w", err)
171178
}
179+
172180
return filepath.Join(home, path[2:]), nil
173181
}
182+
174183
return path, nil
175184
}

internal/config/paths_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ func TestExpandPath(t *testing.T) {
120120
t.Errorf("ExpandPath() error = %v, wantErr %v", err, tt.wantErr)
121121
return
122122
}
123+
123124
if got != tt.want {
124125
t.Errorf("ExpandPath() = %q, want %q", got, tt.want)
125126
}

0 commit comments

Comments
 (0)