-
Notifications
You must be signed in to change notification settings - Fork 216
style(ci): update ci style #922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
fix ci conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR standardizes Go style and CI tooling across the repo, focusing on replacing interface{} with any, refining error/log messages, and updating CI/lint workflows and configuration.
- Migrates interface{} to any across code and tests.
- Introduces Makefile tasks (fmt, lint) and modernizes CI workflows (format check, lint, license check).
- Updates golangci-lint configuration to the v2 schema.
Reviewed Changes
Copilot reviewed 59 out of 59 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
transcation/seata-go/triple/service/service.go | Replace interface{} with any in method signatures and map types. |
transcation/seata-go/triple/client/seata-client/seata.go | Replace interface{} with any for Prepare and TCC context maps. |
transcation/seata-go/triple/client/cmd/main.go | Replace interface{} with any for response var. |
transcation/seata-go/non-idl/server/service/user_provider.go | Replace interface{} with any in Prepare signature. |
transcation/seata-go/non-idl/client/service/service.go | Replace interface{} with any in provider function field. |
transcation/seata-go/non-idl/client/seata-client/seata.go | Replace interface{} with any in maps, params; update CallUnary args. |
rpc/multi-protocols/go-client/cmd/main.go | Replace []interface{} with []any in CallUnary calls. |
metrics/go-client/cmd/main.go | Consolidate imports; simplify loop for { ... }. |
logger/custom/cmd/main.go | Replace variadic interface{} with any in custom logger methods. |
llm/go-server/cmd/server.go | Clean imports; adjust base64 decode error handling; minor style tweaks. |
llm/go-client/frontend/handlers/chat.go | Improve stream close/recv error variable naming; minor style tweaks. |
llm/config/config.go | Refine error messages (lowercase, no trailing newline); clean imports. |
integrate_test/rpc/multi-protocols/tests/integration/multirpc_test.go | Replace []interface{} with []any in tests. |
integrate_test/filter/sentinel/tests/integration/sentinel_test.go | Replace interface{} with any in listener method signature. |
integrate_test/context/tests/integration/context_test.go | Replace map[string]interface{} with map[string]any. |
integrate_test/compatibility/rpc/triple/codec-extension/tests/integration/codec.go | Replace interface{} with any in codec Marshaler/Unmarshal sigs. |
integrate_test/compatibility/rpc/dubbo/tests/integration/main_test.go | Replace interface{} with any in Echo function field. |
integrate_test/compatibility/generic/default/tests/integration/userprovider_test.go | Replace interface{} with any in maps/slices assertions. |
integrate_test/compatibility/context/triple/tests/integration/userprovider_test.go | Replace map[string]interface{} with map[string]any. |
integrate_test/compatibility/context/dubbo/tests/integration/userprovider_test.go | Replace map[string]interface{} with map[string]any. |
filter/sentinel/go-server/cmd/main.go | Remove unused stateChangeTestListener and related imports. |
filter/sentinel/go-client/cmd/main.go | Replace interface{} with any in listener method signature. |
context/go-server/cmd/main.go | Replace map[string]interface{} with map[string]any. |
context/go-client/cmd/main.go | Replace map[string]interface{} with map[string]any in attachments. |
config_center/zookeeper/go-server/cmd/main.go | Remove unused helper (ensurePath); import cleanup. |
compatibility/tracing/jsonrpc/go-server/pkg/user.go | Replace []interface{} with []any in GetUser. |
compatibility/tracing/jsonrpc/go-client/pkg/user.go | Replace []interface{} with []any in provider field. |
compatibility/tracing/jsonrpc/go-client/cmd/client.go | Replace []interface{} with []any call arg. |
compatibility/tls/triple/codec/codec.go | Replace interface{} with any in codec Marshaler/Unmarshal sigs. |
compatibility/tls/dubbo/go-server/pkg/common_user_provider.go | Import alias tweak; style fix on equality. |
compatibility/tls/dubbo/go-client/pkg/user.go | Replace interface{} with any in Echo function field. |
compatibility/seata-go/tcc/server/service/user_provider.go | Replace interface{} with any in Prepare signature. |
compatibility/seata-go/tcc/client/service/user_provider.go | Replace interface{} with any in provider function field. |
compatibility/rpc/triple/codec-extension/codec/codec.go | Replace interface{} with any in codec Marshaler/Unmarshal sigs. |
compatibility/rpc/jsonrpc/go-server/pkg/user_provider2.go | Replace []interface{} with []any; adjust slice cast. |
compatibility/rpc/jsonrpc/go-server/pkg/user_provider1.go | Replace []interface{} with []any in GetUsers. |
compatibility/rpc/jsonrpc/go-server/pkg/user_provider.go | Replace []interface{} with []any; adjust slice cast. |
compatibility/rpc/jsonrpc/go-client/pkg/user.go | Replace []interface{} with []any in function fields. |
compatibility/rpc/jsonrpc/go-client/cmd/client.go | Replace []interface{} with []any in GetUsers call. |
compatibility/rpc/dubbo/go-server/pkg/common_user_provider.go | Import alias tweak; style fix on equality. |
compatibility/rpc/dubbo/go-client/pkg/user.go | Replace interface{} with any in Echo function field. |
compatibility/logger/custom/cmd/main.go | Replace variadic interface{} with any in custom logger methods. |
compatibility/game/pkg/pojo/result.go | Replace map[string]interface{} with map[string]any. |
compatibility/game/go-server-gate/pkg/provider.go | Replace map[string]interface{} with map[string]any in response. |
compatibility/game/go-server-game/pkg/provider.go | Replace map[string]interface{} with map[string]any in responses. |
compatibility/filter/tpslimit/go-server/pkg/reject_handler.go | Tweak error message text; import cleanup. |
compatibility/filter/custom/go-server/cmd/myfilter.go | Replace map[string]interface{} with map[string]any for attachments. |
compatibility/context/triple/go-server/cmd/server.go | Replace map[string]interface{} with map[string]any; doc comments unchanged. |
compatibility/context/triple/go-client/cmd/client.go | Replace map[string]interface{} with map[string]any. |
compatibility/context/dubbo/go-server/cmd/server.go | Replace map[string]interface{} with map[string]any in attachments cast. |
compatibility/context/dubbo/go-client/cmd/client.go | Replace map[string]interface{} with map[string]any in attachments. |
book-flight-ai-agent/go-server/tools/tool_base.go | Replace interface{} with any in helper signature. |
book-flight-ai-agent/go-server/model/ollama/ollama.go | Import cleanup; remove unused struct fields. |
book-flight-ai-agent/go-server/agents/task.go | Import cleanup; simplify variable initialization. |
book-flight-ai-agent/go-server/agents/cot_agent.go | Import cleanup; simplify variable initialization. |
Makefile | Add fmt/lint targets; run modernize tool; install linters; imports formatter. |
.golangci.yml | Switch to v2 config schema; reorganize linters and settings. |
.github/workflows/golangci-lint.yml | Quote cleanups; matrix uses Go 1.23. |
.github/workflows/github-actions.yml | Add license job; unify cache; add fmt/lint steps; update setup-go usage. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
version: "2" | ||
linters: | ||
disable-all: true | ||
default: none | ||
enable: | ||
- staticcheck | ||
- govet | ||
- ineffassign | ||
- misspell | ||
|
||
issues: | ||
exclude-dirs: | ||
- test/testdata_etc | ||
- pkg/golinters/goanalysis/(checker|passes) | ||
exclude-rules: | ||
- text: "weak cryptographic primitive" | ||
linters: | ||
- gosec | ||
- linters: | ||
- staticcheck | ||
text: "SA1019:" | ||
|
||
|
||
- staticcheck | ||
- unused | ||
settings: | ||
depguard: |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In golangci-lint v2, linter settings must be defined under the top-level 'settings' key, not nested under 'linters'. Move the entire 'settings' block (depguard, dupl, goconst, gocritic, gocyclo, govet, lll, misspell, etc.) out to a top-level 'settings' section so they are applied.
Copilot uses AI. Check for mistakes.
- name: Check License Header | ||
uses: apache/skywalking-eyes/header@main #NOSONAR | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
config: .licenserc.yaml |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pin the action to a specific version tag or commit SHA instead of 'main' to avoid supply-chain risks from upstream changes, e.g., 'apache/skywalking-eyes/header@'.
Copilot uses AI. Check for mistakes.
- name: Set Go version again to override skywalking | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go_version }} |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step's description references 'override skywalking', but the license check now runs in a separate job; the step is redundant. Remove this step or update its name to reflect its purpose.
Copilot uses AI. Check for mistakes.
# Cache key | ||
key: ${{ runner.os }}-go-${{ matrix.go_version }}-${{ hashFiles('**/go.sum') }} | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ matrix.go_version }}- | ||
${{ runner.os }}-go- |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include the Go version in the cache key to avoid cross-version cache collisions if/when multiple Go versions are added to the matrix (e.g., 'key: ${{ runner.os }}-go-${{ matrix.go_version }}-${{ hashFiles('**/go.sum') }}').
Copilot uses AI. Check for mistakes.
} | ||
|
||
func (srv *GreetTripleServer) Greet(ctx context.Context, req *greet.GreetRequest) (*greet.GreetResponse, error) { | ||
// map must be assert to map[string]interface, because of dubbo limitation |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment references map[string]interface but the code asserts to map[string]any. Update the comment to match (or note that any is an alias of interface{}) to avoid confusion.
// map must be assert to map[string]interface, because of dubbo limitation | |
// map must be asserted to map[string]any (any is an alias for interface{}), because of dubbo limitation |
Copilot uses AI. Check for mistakes.
// map must be assert to map[string]interface, because of dubbo limitation | ||
attachments := ctx.Value(constant.AttachmentKey).(map[string]interface{}) | ||
attachments := ctx.Value(constant.AttachmentKey).(map[string]any) |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment mentions map[string]interface while the code uses map[string]any. Please align the comment with the code (any is an alias of interface{}).
Copilot uses AI. Check for mistakes.
} | ||
|
||
func (s *GreeterProvider) SayHelloStream(svr api.Greeter_SayHelloStreamServer) error { | ||
// map must be assert to map[string]interface, because of dubbo limitation |
Copilot
AI
Oct 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: update the comment to reference map[string]any (or clarify the alias) to keep docs consistent with code.
// map must be assert to map[string]interface, because of dubbo limitation | |
// map must be asserted to map[string]any, because of dubbo limitation |
Copilot uses AI. Check for mistakes.
Update ci style.