From d9ae0dc371fac4f9a3fdd339116d112e475650c4 Mon Sep 17 00:00:00 2001 From: Sagar-Kap <69609200+Sagar-Kap@users.noreply.github.com> Date: Sun, 24 May 2026 11:42:41 +0300 Subject: [PATCH 1/3] chore: add qa checks --- .github/workflows/qa-checks.yml | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/qa-checks.yml diff --git a/.github/workflows/qa-checks.yml b/.github/workflows/qa-checks.yml new file mode 100644 index 0000000..ad083fb --- /dev/null +++ b/.github/workflows/qa-checks.yml @@ -0,0 +1,69 @@ +name: QA Checks + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +jobs: + go: + name: Go checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Verify go.mod is tidy + run: | + go mod tidy + if ! git diff --quiet go.mod go.sum; then + echo "::error::go.mod or go.sum is not tidy. Run 'go mod tidy' and commit the result." + git diff go.mod go.sum + exit 1 + fi + + - name: go vet + run: go vet ./... + + - name: go test + run: go test -race ./... + + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v2.2.2 + + docs: + name: Docs lint + runs-on: ubuntu-latest + defaults: + run: + working-directory: docs + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 11 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + cache-dependency-path: docs/pnpm-lock.yaml + + - run: pnpm install --frozen-lockfile + + - name: Generate Nuxt types + run: pnpm exec nuxt prepare + + - name: ESLint + run: pnpm lint From 5614da84ff6cc13ec15629c657ed16ecad258bd9 Mon Sep 17 00:00:00 2001 From: Sagar-Kap <69609200+Sagar-Kap@users.noreply.github.com> Date: Sun, 24 May 2026 11:48:42 +0300 Subject: [PATCH 2/3] chore: fix broken tests --- .github/workflows/qa-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/qa-checks.yml b/.github/workflows/qa-checks.yml index ad083fb..fa31f5d 100644 --- a/.github/workflows/qa-checks.yml +++ b/.github/workflows/qa-checks.yml @@ -37,7 +37,7 @@ jobs: run: go test -race ./... - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v7 with: version: v2.2.2 From 916cde3369ceb479c248002e480526e7b01422b3 Mon Sep 17 00:00:00 2001 From: Sagar-Kap <69609200+Sagar-Kap@users.noreply.github.com> Date: Sun, 24 May 2026 11:55:45 +0300 Subject: [PATCH 3/3] chore: fix broken test --- cmd/clean.go | 4 ++-- cmd/list.go | 4 ++-- internal/template/clean.go | 4 ++-- internal/template/list.go | 2 +- internal/template/scaffold.go | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/clean.go b/cmd/clean.go index caa50c5..688a13b 100644 --- a/cmd/clean.go +++ b/cmd/clean.go @@ -26,8 +26,8 @@ var cleanCmd = &cobra.Command{ Long: cleanLongUsage, Example: "terox clean\nterox gc\nterox cleanup", Args: cobra.NoArgs, - Run: func(cmd *cobra.Command, args []string) { - template.Clean() + RunE: func(cmd *cobra.Command, args []string) error { + return template.Clean() }, } diff --git a/cmd/list.go b/cmd/list.go index d172f6e..a9900d3 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -34,8 +34,8 @@ var listCmd = &cobra.Command{ Example: listExample, Long: listCmdLongHelp, Args: cobra.NoArgs, - Run: func(cmd *cobra.Command, args []string) { - template.List() + RunE: func(cmd *cobra.Command, args []string) error { + return template.List() }, } diff --git a/internal/template/clean.go b/internal/template/clean.go index 498b84f..21b9ca4 100644 --- a/internal/template/clean.go +++ b/internal/template/clean.go @@ -19,7 +19,7 @@ func Clean() error { // Read the contents of the template directory to check for templates if templates, err := os.ReadDir(templateDir); err != nil { return fmt.Errorf( - "Failed to find any templates at %s: %w", + "failed to find any templates at %s: %w", templateDir, err, ) @@ -30,7 +30,7 @@ func Clean() error { fmt.Printf("%s\n", template.Name()) if err := os.RemoveAll(path); err != nil { return fmt.Errorf( - "Failed to remove %s: %w", + "failed to remove %s: %w", template.Name(), err, ) diff --git a/internal/template/list.go b/internal/template/list.go index 75665a7..877e33e 100644 --- a/internal/template/list.go +++ b/internal/template/list.go @@ -18,7 +18,7 @@ func List() error { // Check if any template exists locally, if yes, list them to STDOUT if templates, err := os.ReadDir(templateDir); err != nil { return fmt.Errorf( - "Failed to read the contents of %s directory: %w", + "failed to read the contents of %s directory: %w", templateDir, err, ) diff --git a/internal/template/scaffold.go b/internal/template/scaffold.go index 3410a66..93d599c 100644 --- a/internal/template/scaffold.go +++ b/internal/template/scaffold.go @@ -74,7 +74,7 @@ func downloadTemplate(repo string) (string, error) { if err != nil { return "", fmt.Errorf("download %s: %w", url, err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { return "", fmt.Errorf("bad server response: %d", resp.StatusCode) @@ -100,7 +100,7 @@ func extractTemplate(zipfile, dest string) (string, error) { if err != nil { return "", fmt.Errorf("open zip: %w", err) } - defer r.Close() + defer func() { _ = r.Close() }() var topLevelFolder string for _, f := range r.File {