Skip to content

Commit 542c5a2

Browse files
authored
fix(lint): extract pathActionMove constant to fix goconst warning (#117)
1 parent b0bdafb commit 542c5a2

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ permissions:
4848

4949
jobs:
5050
golangci-lint:
51-
name: Lint & Format Check
51+
name: Lint (${{ matrix.goos }})
5252
runs-on: ubuntu-latest
53+
strategy:
54+
matrix:
55+
goos: [linux, darwin, windows]
5356
steps:
5457
- name: Checkout code
5558
uses: actions/checkout@v4
@@ -66,12 +69,12 @@ jobs:
6669
golangci-lint --version
6770
6871
- name: Run golangci-lint
69-
run: golangci-lint run --timeout=5m --config=../.golangci.yml
72+
run: GOOS=${{ matrix.goos }} golangci-lint run --timeout=5m --config=../.golangci.yml
7073
working-directory: src
7174

7275
- name: Verify no linting issues
7376
if: success()
74-
run: echo "✅ All linting checks passed (errcheck, govet, ineffassign, unused, misspell, dupl, goconst, gocyclo, errorlint)"
77+
run: echo "✅ All linting checks passed for ${{ matrix.goos }} (errcheck, govet, ineffassign, unused, misspell, dupl, goconst, gocyclo, errorlint)"
7578

7679
go-mod:
7780
name: Dependencies Check

src/internal/path/path_windows.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ const (
2626
HWND_BROADCAST = 0xffff
2727
WM_SETTINGCHANGE = 0x001A
2828
SMTO_ABORTIFHUNG = 0x0002
29+
30+
// pathActionMove is used to indicate the shims directory needs to be moved to the beginning of PATH
31+
pathActionMove = "move"
2932
)
3033

3134
// AddToPath adds the shims directory to the System PATH on Windows.
@@ -80,7 +83,7 @@ func checkSystemPath(shimsDir string) (bool, string, error) {
8083
if foundAt == 0 {
8184
return false, "", nil // Already at beginning
8285
} else if foundAt > 0 {
83-
return true, "move", nil // Exists but not at beginning
86+
return true, pathActionMove, nil // Exists but not at beginning
8487
}
8588
return true, "add", nil // Not in PATH
8689
}
@@ -96,7 +99,7 @@ func isAdmin() bool {
9699

97100
// promptForElevation prompts the user to re-run dtvem init with admin privileges
98101
func promptForElevation(shimsDir, action string) error {
99-
if action == "move" {
102+
if action == pathActionMove {
100103
ui.Header("PATH Fix Required (Administrator)")
101104
ui.Warning("%s is in your System PATH but not at the beginning", shimsDir)
102105
ui.Info("It needs to be first to take priority over other installations")
@@ -196,7 +199,7 @@ func modifySystemPath(shimsDir, action string) error {
196199
// Broadcast WM_SETTINGCHANGE to notify running processes
197200
broadcastSettingChange()
198201

199-
if action == "move" {
202+
if action == pathActionMove {
200203
ui.Success("Moved %s to the beginning of your System PATH", shimsDir)
201204
} else {
202205
ui.Success("Added %s to your System PATH", shimsDir)

0 commit comments

Comments
 (0)