Skip to content

ci(sdk-go): add CI workflow and fix test helper#22

Closed
Divkix wants to merge 2 commits intomainfrom
Divkix/fix-ci-lint-errors
Closed

ci(sdk-go): add CI workflow and fix test helper#22
Divkix wants to merge 2 commits intomainfrom
Divkix/fix-ci-lint-errors

Conversation

@Divkix
Copy link
Owner

@Divkix Divkix commented Feb 27, 2026

Add GitHub Actions CI workflow for the Go SDK with lint (go vet + golangci-lint), tests across Go 1.21-1.23 with race detection, coverage reporting, and build verification.

Also rename client_test_helpers.go to client_test_helpers_test.go to fix compilation by allowing access to test-only declarations in other _test.go files.

And fix all errcheck violations from golangci-lint by properly handling unchecked error returns in transport and test code.

Add GitHub Actions CI workflow for the Go SDK with lint (go vet +
golangci-lint), tests across Go 1.21-1.23 with race detection,
coverage reporting, and build verification.

Also rename client_test_helpers.go to client_test_helpers_test.go
so it can access test-only types (testServer, validAPIKey) defined
in other _test.go files. Without this fix, the package fails to
compile under `go test`.
Suppress unchecked error returns flagged by errcheck:
- resp.Body.Close() in transport.go wrapped in defer closure
- json.NewEncoder().Encode() calls in test server handlers
- client.Shutdown() calls in defer statements across all test files
- Replace nil context with context.TODO() in test helper
Copilot AI review requested due to automatic review settings February 27, 2026 00:16
@Divkix Divkix closed this Feb 27, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a dedicated GitHub Actions workflow to run CI for the Go SDK and updates Go transport/tests to satisfy errcheck (and fix a test helper compilation/access issue via _test.go naming).

Changes:

  • Add .github/workflows/sdk-go.yml to run linting, tests (Go 1.21–1.23, race), coverage output, and build verification for sdks/go.
  • Update Go transport + tests to explicitly handle previously-ignored error returns (Close(), Encode(), Shutdown()).
  • Rename/add Go test helper file as _test.go so test-only declarations are visible to other _test.go files.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdks/go/logwell/transport_test.go Ignore/handle JSON encoder errors in test HTTP handlers to satisfy errcheck.
sdks/go/logwell/transport.go Ignore/handle resp.Body.Close() return value to satisfy errcheck.
sdks/go/logwell/client_test_helpers_test.go Fix Shutdown(nil) by passing a context and make helpers available to other tests.
sdks/go/logwell/client_test.go Ignore/handle Shutdown() and JSON encoder errors to satisfy errcheck.
.github/workflows/sdk-go.yml Introduce Go SDK CI workflow (lint/test/coverage/build).
Comments suppressed due to low confidence (1)

sdks/go/logwell/client_test_helpers_test.go:123

  • This test helper uses context.TODO() for Shutdown. Elsewhere in the Go SDK tests, Shutdown is consistently called with context.Background(). Using Background here would keep context usage consistent and avoid TODO-style placeholders in test code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- name: Check go.mod is tidy
run: |
go mod tidy
git diff --exit-code go.mod
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

The “Check go.mod is tidy” step only fails on changes to go.mod, but go mod tidy can also modify go.sum. This can let an untidy go.sum slip through CI. Consider checking both go.mod and go.sum (or just git diff --exit-code after running tidy) so the job fails if either file changes.

Suggested change
git diff --exit-code go.mod
git diff --exit-code go.mod go.sum

Copilot uses AI. Check for mistakes.
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