From 67a1d701b3bc90386094df9039c380a1f9a0e3dd Mon Sep 17 00:00:00 2001 From: Ujstor Date: Sun, 2 Mar 2025 22:27:57 +0100 Subject: [PATCH 1/5] linter --- .github/workflows/linter.yml | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..cfa8367 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,52 @@ +name: linter + +on: + push: + paths: + - '**.go' + - go.sum + - go.mod + # form now we can keep push to main, remove after pun release + # branches-ignore: + # - main + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23.x' + + - name: Deps cache + id: cache-go-deps + uses: actions/cache@v4 + env: + cache-name: go-deps-cache + with: + path: ~/godeps + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + + - if: ${{ steps.cache-go-deps.outputs.cache-hit != 'true' }} + name: List the state of go modules + continue-on-error: true + run: go mod graph + + - name: Install dependencies + run: | + go mod tidy + go mod download + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4 + + - name: Run golangci-lint + run: golangci-lint run + + # - name: Run tests + # run: | + # go test ./... From bc8f280884709a02977fde5ea00daee8c223dc90 Mon Sep 17 00:00:00 2001 From: Ujstor Date: Mon, 3 Mar 2025 00:38:51 +0100 Subject: [PATCH 2/5] lint ver --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index cfa8367..36a66d6 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -42,7 +42,7 @@ jobs: run: | go mod tidy go mod download - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.5 - name: Run golangci-lint run: golangci-lint run From aa453db3d2c5cae5c4081875be4582359c17f02b Mon Sep 17 00:00:00 2001 From: Ujstor Date: Mon, 3 Mar 2025 00:39:57 +0100 Subject: [PATCH 3/5] docs --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 36a66d6..17135b2 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -6,7 +6,7 @@ on: - '**.go' - go.sum - go.mod - # form now we can keep push to main, remove after pun release + # for now we can keep push to main, remove after full release # branches-ignore: # - main pull_request: From e1dd84dff83827e10bb89a800f2c674d7c426180 Mon Sep 17 00:00:00 2001 From: Ujstor Date: Sun, 9 Mar 2025 00:32:39 +0100 Subject: [PATCH 4/5] fix linter --- .github/workflows/linter.yml | 9 ++------- internal/setup/model.go | 2 +- internal/utils/utils.go | 5 +++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 17135b2..cdcdc6a 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -6,9 +6,8 @@ on: - '**.go' - go.sum - go.mod - # for now we can keep push to main, remove after full release - # branches-ignore: - # - main + branches-ignore: + - main pull_request: jobs: @@ -46,7 +45,3 @@ jobs: - name: Run golangci-lint run: golangci-lint run - - # - name: Run tests - # run: | - # go test ./... diff --git a/internal/setup/model.go b/internal/setup/model.go index f0461f7..e54dc6c 100644 --- a/internal/setup/model.go +++ b/internal/setup/model.go @@ -132,7 +132,7 @@ After adding to PATH, restart your terminal or run: highlightStyle.Render(m.shimPath), highlightStyle.Render(fmt.Sprintf("echo 'export PATH=\"$HOME/.govm/shim:$PATH\"' >> %s", shellConfigFile)), shellConfigFile, - highlightStyle.Render(fmt.Sprintf("export PATH=\"$HOME/.govm/shim:$PATH\"")), + highlightStyle.Render("export PATH=\"$HOME/.govm/shim:$PATH\""), highlightStyle.Render(fmt.Sprintf("source %s", shellConfigFile))) } diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 7091754..ba6a455 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -318,7 +318,9 @@ func DownloadAndInstall(version GoVersion) tea.Cmd { if runtime.GOOS != "windows" { goBin := filepath.Join(versionDir, "bin", "go") if _, err := os.Stat(goBin); err == nil { - os.Chmod(goBin, 0755) + if err := os.Chmod(goBin, 0755); err != nil { + return ErrMsg(fmt.Errorf("failed to set executable permissions: %v", err)) + } } } @@ -424,4 +426,3 @@ func SwitchVersion(version GoVersion) tea.Cmd { } } } - From 4bf4127488cb301c8b5d6365438489ed7586e84f Mon Sep 17 00:00:00 2001 From: Ujstor Date: Sun, 9 Mar 2025 00:34:34 +0100 Subject: [PATCH 5/5] test --- .github/workflows/linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index cdcdc6a..0c44fcb 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -45,3 +45,4 @@ jobs: - name: Run golangci-lint run: golangci-lint run +