Conversation
.github/workflows/lint.yml
Outdated
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] |
There was a problem hiding this comment.
@copilot Please using path ignore to ignore non related files update
There was a problem hiding this comment.
Added path filters to only run on Go-related files (*.go, go.mod, go.sum, .golangci.yml, and the workflow itself). Fixed in 8956d6a.
.github/workflows/lint.yml
Outdated
.github/workflows/lint.yml
Outdated
|
/label tide/merge-method-squash |
|
@copilot please remove using golangci-lint-action, we want to use explicit golangci-lint version. Please follow volcano-sh/kthena#43 |
Replaced golangci-lint-action with explicit version (v1.64.1) installed via Makefile, following the pattern from volcano-sh/kthena#43. The workflow now runs Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: hzxuzhonghu <13374016+hzxuzhonghu@users.noreply.github.com>
ee65f10 to
add96eb
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds automated Go code linting via golangci-lint to enforce code quality standards on pull requests. It introduces a GitHub Actions workflow that runs golangci-lint v1.64.1 on PRs to main and release-* branches, with path filters to run only when Go-related files change. The PR also includes comprehensive code fixes across the codebase to address existing linting issues.
Key Changes
- Added golangci-lint configuration enabling 11 linters (errcheck, govet, staticcheck, gosec, revive, etc.) with gosimple explicitly disabled
- Implemented GitHub Actions workflow to run linting on pull requests with appropriate path filters
- Fixed numerous linting issues including unused parameters, deprecated imports, naming conventions, dead code removal, and simplified error handling
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.golangci.yml |
Configuration file enabling 11 linters with 5-minute timeout and specific settings for complexity and type assertion checks |
.github/workflows/lint.yml |
GitHub Actions workflow running golangci-lint on PRs with path filters for Go files |
Makefile |
Added golangci-lint v1.64.1 installation target and updated lint target to use versioned binary from bin/ directory |
test/e2e/e2e_test.go |
Added nolint directives for unparam and gosec issues with explanatory comments; removed redundant type conversion |
pkg/workloadmanager/workload_builder.go |
Migrated from deprecated k8s.io/utils/pointer to k8s.io/utils/ptr; fixed variable naming from sessionId to sessionID |
pkg/workloadmanager/store.go |
Renamed unused parameters to underscore; captured return values from AddEventHandler; removed unused error return from convertSandboxToRedisCache |
pkg/workloadmanager/sandbox_controller.go |
Renamed unused ctx parameter to underscore in WatchSandboxOnce |
pkg/workloadmanager/k8s_client.go |
Removed unused token parameter from clientCache.Get(); added revive disable directive for SessionIdLabelKey naming |
pkg/workloadmanager/handlers.go |
Added nolint directive for gocyclo; simplified convertSandboxToRedisCache call by removing unused error handling |
pkg/workloadmanager/codeinterpreter_controller.go |
Renamed unused ci parameter to underscore in convertToPodTemplate |
pkg/workloadmanager/client_cache.go |
Removed unused token parameter from Get method; added nolint directives for errcheck on type assertions |
pkg/workloadmanager/auth.go |
Removed unused checkSandboxAccess function |
pkg/redis/client.go |
Removed unused loadSandboxesByIDs function |
pkg/agentd/agentd_test.go |
Fixed test function naming from TestAgentdReconciler_* to TestReconciler_* |
pkg/agentd/agentd.go |
Renamed AgentdReconciler struct to Reconciler for better naming convention |
cmd/agentd/main.go |
Updated struct reference from agentd.AgentdReconciler to agentd.Reconciler |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| // handleCreateSandbox handles sandbox creation requests | ||
| // nolint :gocyclo |
There was a problem hiding this comment.
The nolint directive has incorrect syntax. There should be no space between nolint and the colon. Change // nolint :gocyclo to // nolint:gocyclo for golangci-lint to properly recognize and apply the directive.
| // nolint :gocyclo | |
| // nolint:gocyclo |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Adds automated Go code linting via golangci-lint to enforce code quality standards on PRs.
Changes
.golangci.yml: Configuration enabling 12 linters (errcheck, govet, staticcheck, gosec, revive, etc.) with exclusions for generated client-go code.github/workflows/lint.yml: GitHub Actions workflow running golangci-lint on pull requests tomainandrelease-*branches with path filters for Go-related files onlyMakefile: Added golangci-lint v1.64.1 installation and updated lint target to use the versioned binaryConfiguration highlights
Workflow triggers
The lint workflow runs only on pull requests (not on push) and includes path filters to run only when Go-related files change:
**.go- Go source filesgo.mod,go.sum- Go module files.golangci.yml- Linter configuration.github/workflows/lint.yml- Workflow fileImplementation
Following the pattern from volcano-sh/kthena#43, the workflow uses an explicit golangci-lint version (v1.64.1) installed via Makefile rather than golangci-lint-action. The workflow runs
make lintwhich downloads and uses the versioned binary from thebin/directory, ensuring consistent linting across local development and CI environments.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.