Skip to content

Advanced - #27

Open
harshadagawade wants to merge 3 commits into
LondheShubham153:masterfrom
harshadagawade:advanced
Open

Advanced#27
harshadagawade wants to merge 3 commits into
LondheShubham153:masterfrom
harshadagawade:advanced

Conversation

@harshadagawade

@harshadagawade harshadagawade commented Jun 25, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Chores
    • Added a new manual GitHub Actions workflow to run Go formatting and vet checks.
    • The workflow now validates the project against Go 1.22 and 1.23 using a matrix setup.
    • Build caching has been enabled to speed up repeated checks.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

A new GitHub Actions workflow file, matrix.yml, is added to run Go linting (go fmt and go vet) on the backend directory, triggered manually and executed across a matrix of Go versions 1.23 and 1.22 on Ubuntu.

Changes

Go Linter CI Workflow

Layer / File(s) Summary
Add Go Linter workflow
.github/workflows/matrix.yml
New manually-triggered workflow runs go fmt and go vet in the backend directory across a Go 1.23/1.22 matrix on Ubuntu, using go.mod/go.sum for setup and caching.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to describe the new Go linter workflow added in this pull request. Use a concise, specific title such as "Add Go lint workflow" or "Add Go fmt and vet matrix workflow".
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/matrix.yml (1)

17-18: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Drop go-version-file here. go-version already takes precedence, so go-version-file: 'go.mod' is ignored and only adds confusion alongside the version matrix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/matrix.yml around lines 17 - 18, The workflow
configuration for the Go setup is redundant because the matrix-driven go-version
already takes precedence over go-version-file. Remove the go-version-file
setting from the Go setup step and keep the version selection based on matrix.go
only, using the existing workflow job context to locate the relevant setup
action configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/matrix.yml:
- Around line 7-13: The workflow structure is invalid because `runs-on`,
`strategy`, and `steps` are currently placed directly under `jobs` instead of
under a single job id. Update the top-level job definition in the workflow so
these keys are nested beneath a named job (for example, the job that contains
the matrix for `go`), and re-indent all existing step entries under `steps` one
level deeper. Use the workflow’s job block and the `strategy`/`steps` section as
the fix location.
- Around line 14-19: The “Setup Go” step is using the wrong action, so replace
the current actions/checkout reference in the matrix workflow with
actions/setup-go@v6 and keep the Go-specific inputs on that step. Also ensure
the job still has a separate preceding actions/checkout step before Setup Go so
the repository source is available for the later go fmt and go vet steps.

---

Nitpick comments:
In @.github/workflows/matrix.yml:
- Around line 17-18: The workflow configuration for the Go setup is redundant
because the matrix-driven go-version already takes precedence over
go-version-file. Remove the go-version-file setting from the Go setup step and
keep the version selection based on matrix.go only, using the existing workflow
job context to locate the relevant setup action configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: db9c98dd-b0b1-4da0-be03-16f63d21f27d

📥 Commits

Reviewing files that changed from the base of the PR and between fac8884 and bf67596.

📒 Files selected for processing (1)
  • .github/workflows/matrix.yml

Comment on lines +7 to +13
jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: ['1.23','1.22']
steps:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Broken job structure — workflow won't parse.

runs-on, strategy, and steps need to be nested under a single job id (e.g. lint:), not treated as separate jobs. As flagged by actionlint, each is currently missing its own runs-on/steps, and fail-fast/matrix are invalid keys directly under jobs.

🛠️ Proposed fix
 jobs:
-  runs-on: ubuntu-latest
-  strategy:
-    fail-fast: false
-    matrix:
-      go: ['1.23','1.22']
-  steps:
+  lint:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        go: ['1.23','1.22']
+    steps:

Remaining step lines under steps: will also need to be re-indented one level deeper to nest correctly under the job.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: ['1.23','1.22']
steps:
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: ['1.23','1.22']
steps:
🧰 Tools
🪛 actionlint (1.7.12)

[error] 8-8: "runs-on" section is missing in job "runs-on"

(syntax-check)


[error] 8-8: "steps" section is missing in job "runs-on"

(syntax-check)


[error] 8-8: "runs-on" job is scalar node but mapping node is expected

(syntax-check)


[error] 9-9: "runs-on" section is missing in job "strategy"

(syntax-check)


[error] 9-9: "steps" section is missing in job "strategy"

(syntax-check)


[error] 10-10: unexpected key "fail-fast" for "job" section. expected one of "concurrency", "container", "continue-on-error", "defaults", "env", "environment", "if", "name", "needs", "outputs", "permissions", "runs-on", "secrets", "services", "snapshot", "steps", "strategy", "timeout-minutes", "uses", "with"

(syntax-check)


[error] 11-11: unexpected key "matrix" for "job" section. expected one of "concurrency", "container", "continue-on-error", "defaults", "env", "environment", "if", "name", "needs", "outputs", "permissions", "runs-on", "secrets", "services", "snapshot", "steps", "strategy", "timeout-minutes", "uses", "with"

(syntax-check)


[error] 13-13: "runs-on" section is missing in job "steps"

(syntax-check)


[error] 13-13: "steps" section is missing in job "steps"

(syntax-check)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/matrix.yml around lines 7 - 13, The workflow structure is
invalid because `runs-on`, `strategy`, and `steps` are currently placed directly
under `jobs` instead of under a single job id. Update the top-level job
definition in the workflow so these keys are nested beneath a named job (for
example, the job that contains the matrix for `go`), and re-indent all existing
step entries under `steps` one level deeper. Use the workflow’s job block and
the `strategy`/`steps` section as the fix location.

Source: Linters/SAST tools

Comment on lines +14 to +19
- name: Setup Go
uses: actions/checkout@v6
with:
go-version: ${{ matrix.go }}
go-version-file: 'go.mod'
cache-dependency-path: go.sum

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Wrong action used for Go setup.

Step is named "Setup Go" and passes go-version, go-version-file, and cache-dependency-path, but uses actions/checkout@v6 instead of actions/setup-go@v6. Go won't be installed/configured, and the subsequent go fmt/go vet steps will fail. The existing ci.yml workflow uses actions/setup-go@v6 with the same inputs for this exact purpose.

🛠️ Proposed fix
     - name: Setup Go
-      uses: actions/checkout@v6
+      uses: actions/setup-go@v6
       with:
         go-version: ${{ matrix.go }}   
         go-version-file: 'go.mod'
         cache-dependency-path: go.sum

Note this step also needs a preceding actions/checkout step, since setup-go alone won't check out the repo source for go fmt/go vet to operate on.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Setup Go
uses: actions/checkout@v6
with:
go-version: ${{ matrix.go }}
go-version-file: 'go.mod'
cache-dependency-path: go.sum
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
go-version-file: 'go.mod'
cache-dependency-path: go.sum
🧰 Tools
🪛 actionlint (1.7.12)

[error] 14-14: "steps" job is sequence node but mapping node is expected

(syntax-check)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/matrix.yml around lines 14 - 19, The “Setup Go” step is
using the wrong action, so replace the current actions/checkout reference in the
matrix workflow with actions/setup-go@v6 and keep the Go-specific inputs on that
step. Also ensure the job still has a separate preceding actions/checkout step
before Setup Go so the repository source is available for the later go fmt and
go vet steps.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants