Skip to content

Upgrade Go version from 1.24.7 to 1.25.8#334

Merged
schegi merged 13 commits into
mainfrom
upgrade/go-1.25.4
Apr 1, 2026
Merged

Upgrade Go version from 1.24.7 to 1.25.8#334
schegi merged 13 commits into
mainfrom
upgrade/go-1.25.4

Conversation

@schegi
Copy link
Copy Markdown
Contributor

@schegi schegi commented Nov 21, 2025

Summary

This PR upgrades the project from Go 1.24.7 to Go 1.25.8, the latest stable version. All tests pass and the codebase is fully compatible with no breaking changes.

Changes

Core Updates

  • ✅ Update go.mod to require Go 1.25
  • ✅ Update Dockerfile to use golang:1.25.4
  • ✅ Modernize slice deletion in network.go using slices.Delete
  • ✅ Remove deprecated tenv linter from .golangci.yml

Go 1.25 Features

  • sync.WaitGroup.Go: Replaced manual wg.Add(1) and defer wg.Done() patterns with wg.Go() for cleaner concurrent code
    • Updated TestLockerConcurrency and TestCurrentRequestByDatacenterAccessors in cluster_test.go
  • testing/synctest: Improved all locker tests to use deterministic concurrent testing
    • Removed polling-based waiting (time.Tick) in favor of synctest.Wait() for deterministic execution
    • All locker tests now use synctest.Test() wrapper for better concurrency control
    • Added comprehensive test coverage with 5 new test cases:
      • TestLockerMultipleKeysIsolation: Verifies locks for different keys don't interfere
      • TestLockerMultipleWaiters: Tests multiple goroutines waiting for same lock
      • TestLockerContextCanceledWhileWaiting: Tests cancellation during wait (not before)
      • TestLockerReacquisition: Tests lock re-acquisition after unlock
      • TestLockerCleanupAfterAllWaitersCancel: Tests cleanup when all waiters cancel

Test Suite Improvements

  • Better code organization: Added helper functions (newLockedLocker(), requireLockState()) for cleaner, more maintainable tests
  • Improved test coverage: Expanded from 7 to 12 tests with better edge case coverage
  • Better variable naming: Improved readability (e.g., lwclockState, chDonelockAcquired)
  • Comprehensive comments: Added detailed comments explaining test logic and behavior

Documentation

  • ✅ Update README.md with Go version requirement
  • ✅ Update docs/development.md with Go version in prerequisites

Testing

All tests pass successfully:

Test Category Result Details
Unit Tests ✅ PASS All packages pass, 70.4%+ coverage
Integration Tests ✅ PASS 90/90 specs passed
Build Test ✅ PASS Binary builds and runs correctly
Race Detector ✅ PASS No data races detected
HTTP Client ✅ PASS Compatible with HTTP/3 default
Debugging Tools ✅ PASS Delve 1.25.2 compatible with DWARF v5
Static Analysis ✅ PASS go vet and golangci-lint pass
Go 1.25 Features ✅ PASS sync.WaitGroup.Go and testing/synctest working correctly
Locker Test Suite ✅ PASS 12 tests (up from 7), improved coverage and organization

Compatibility

✅ Full Compatibility Confirmed

  • DWARF v5: Compatible (Delve 1.25.2 supports it)
  • HTTP/3: Compatible (automatic fallback to HTTP/1.1/HTTP/2)
  • Map optimizations: Automatic (no code changes needed)
  • Enhanced static analysis: Working correctly
  • All dependencies: Verified compatible
  • Go 1.25 features: sync.WaitGroup.Go and testing/synctest fully functional

Breaking Changes

None encountered - All Go 1.25.4 features work seamlessly with existing code.

Code Improvements

  1. Modernized slice deletion: Replaced manual append pattern with slices.Delete for better readability and maintainability.
  2. Linter cleanup: Removed deprecated tenv linter (replaced by usetesting in golangci-lint v1.64.0+).
  3. Concurrent code modernization: Using sync.WaitGroup.Go eliminates manual Add/Done management, reducing boilerplate and potential errors.
  4. Deterministic testing: Improved locker test suite with testing/synctest for reliable concurrent test execution with controlled time and goroutine scheduling.
  5. Enhanced test coverage: Added 5 new test cases covering edge cases and concurrent scenarios, improving overall test quality.

Impact

  • Risk: Low - No breaking changes, all tests pass
  • Performance: Improved (automatic optimizations in Go 1.25)
  • Compatibility: Full backward compatibility maintained
  • Code Quality: Improved with modern Go 1.25 features
  • Test Quality: Significantly improved with better coverage and organization

CI/CD

The CI workflow uses go-version-file: go.mod, so it will automatically use Go 1.25.8. No workflow changes needed.

Checklist

  • All tests pass
  • Code improvements applied
  • Go 1.25 features implemented (sync.WaitGroup.Go, testing/synctest)
  • Test suite improved (locker tests enhanced with better coverage)
  • Documentation updated
  • No breaking changes
  • Linter passes
  • Ready for review

This commit upgrades the project to use Go 1.25.4, the latest stable
version. All tests pass and the codebase is fully compatible.

Changes:
- Update go.mod to require Go 1.25
- Update Dockerfile to use golang:1.25.4
- Modernize slice deletion in network.go using slices.Delete
- Remove deprecated 'tenv' linter from .golangci.yml
- Update README.md with Go version requirement
- Update docs/development.md with Go version in prerequisites

Testing:
- All unit tests pass (70.4%+ coverage)
- All integration tests pass (90/90 specs)
- Build verification successful
- Race detector: no data races
- HTTP client: compatible with HTTP/3 default
- Debugging tools: Delve 1.25.2 compatible with DWARF v5

Compatibility:
- DWARF v5: Compatible (Delve supports it)
- HTTP/3: Compatible (automatic fallback)
- All dependencies verified compatible
- No breaking changes encountered
@schegi schegi marked this pull request as ready for review November 24, 2025 13:52
Copilot AI review requested due to automatic review settings November 24, 2025 13:52
Copy link
Copy Markdown

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

This PR upgrades the project's Go version from 1.24.7 to 1.25.4, modernizes slice operations using the standard library's slices package, and removes a deprecated linter configuration.

Key changes:

  • Go version bumped to 1.25.4 in build configuration and module requirements
  • Slice deletion modernized using slices.Delete instead of manual append operations
  • Deprecated tenv linter removed from configuration

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
go.mod Updates Go version requirement to 1.25
Dockerfile Updates base image to golang:1.25.4
internal/service/cloud/network.go Modernizes slice deletion using slices.Delete
README.md Adds Go version requirement documentation
.golangci.yml Removes deprecated tenv linter

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

Copy link
Copy Markdown

@tinashe-mundangepfupfu tinashe-mundangepfupfu left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread README.md
- Replace manual WaitGroup.Add/Done with sync.WaitGroup.Go
- Add testing/synctest for deterministic concurrent testing
- Update TestLockerConcurrency to use wg.Go()
- Update TestLockerLock to use wg.Go()
- Add TestLockerConcurrencyWithSynctest using testing/synctest
- Update TestCurrentRequestByDatacenterAccessors to use wg.Go()
- Fix linting issues (use require.NoError instead of assert.NoError)
Comment thread internal/util/locker/locker_test.go Outdated
Comment thread internal/util/locker/locker_test.go Outdated
Comment thread internal/util/locker/locker_test.go Outdated
…rage

This commit significantly improves the test suite for the locker package by:

1. **Better use of synctest for deterministic testing:**
   - Removed polling-based waiting (time.Tick) in TestLockerLock
   - Replaced with synctest.Wait() for deterministic execution
   - All tests now use synctest.Test() wrapper for better concurrency control

2. **Improved code organization:**
   - Added helper functions: newLockedLocker() and requireLockState()
   - Removed withTimeout() helper (no longer needed with synctest)
   - Better variable naming (lwc -> lockState, chDone -> lockAcquired)
   - Added comprehensive comments explaining test logic

3. **Enhanced test coverage:**
   - TestLockerMultipleKeysIsolation: Verifies locks for different keys don't interfere
   - TestLockerMultipleWaiters: Tests multiple goroutines waiting for same lock
   - TestLockerContextCanceledWhileWaiting: Tests cancellation during wait (not before)
   - TestLockerReacquisition: Tests lock re-acquisition after unlock
   - TestLockerCleanupAfterAllWaitersCancel: Tests cleanup when all waiters cancel

4. **Go 1.25 features:**
   - Uses sync.WaitGroup.Go() for cleaner goroutine management
   - Leverages testing/synctest for deterministic concurrent testing
   - Removed manual goroutine management patterns

The test suite now has:
- 12 tests (up from 7)
- Better coverage of edge cases and concurrent scenarios
- More maintainable code with helpers and clear comments
- All tests pass consistently
This commit refactors method names to follow Go naming conventions by
removing the 'get' prefix from exported methods. In Go, getters should
not have a 'get' prefix as it's considered redundant.

Changes:
- Renamed getLAN() to lan() in network.go
- Renamed getServerNICID() to serverNICID() in network.go
- Updated all call sites in network.go, ipblock.go, and server.go
- Updated corresponding test methods in network_test.go

This improves code consistency and follows Go best practices for
method naming.
The loop variable `i` was captured by reference in the closure, causing
all goroutines to write to `results[9]` instead of their respective
indices. This fix captures the loop variable by value to ensure each
goroutine uses the correct index.
@sonarqubecloud
Copy link
Copy Markdown

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Gaurav Gahlot <gaurav.gahlot@ionos.com>
Signed-off-by: Gaurav Gahlot <gaurav.gahlot@ionos.com>
@gauravgahlot gauravgahlot changed the title Upgrade Go version from 1.24.7 to 1.25.4 Upgrade Go version from 1.24.7 to 1.25.8 Mar 6, 2026
Comment thread internal/service/cloud/ipblock.go Outdated
Comment thread internal/service/cloud/network.go Outdated
Comment thread .golangci.yml
Comment thread internal/util/locker/locker_test.go
Comment thread internal/util/locker/locker_test.go Outdated
Comment thread internal/util/locker/locker_test.go Outdated
Comment thread internal/util/locker/locker_test.go Outdated
Comment thread internal/util/locker/locker_test.go Outdated
Comment thread internal/util/locker/locker_test.go Outdated
Comment thread internal/util/locker/locker_test.go Outdated
schegi and others added 2 commits March 6, 2026 21:44
- Revert function renames (getLAN, getServerNICID) as they were
  unrelated scope creep
- Rewrite locker tests per reviewer feedback: replace channels with
  bools, remove unnecessary goroutines, use single sync mechanism
  (synctest.Wait), remove redundant/duplicate tests
- Enable usetesting linter to replace removed tenv
- Replace context.Background() with t.Context() in all test files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add .devcontainer, .claude, CLAUDE.md, and .cursor to .gitignore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@piepmatz piepmatz left a comment

Choose a reason for hiding this comment

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

final change request

Comment thread internal/util/locker/locker_test.go Outdated
Comment thread internal/util/locker/locker_test.go Outdated
piepmatz
piepmatz previously approved these changes Mar 9, 2026
@schegi schegi enabled auto-merge (squash) March 9, 2026 13:19
@tinashe-mundangepfupfu
Copy link
Copy Markdown

Hi folks,
Can we get this moving ? @gauravgahlot

@sonarqubecloud
Copy link
Copy Markdown

@schegi schegi disabled auto-merge March 31, 2026 15:10
@schegi schegi enabled auto-merge (squash) March 31, 2026 15:10
@piepmatz piepmatz disabled auto-merge April 1, 2026 08:02
@schegi schegi merged commit 925c511 into main Apr 1, 2026
10 checks passed
@schegi schegi deleted the upgrade/go-1.25.4 branch April 1, 2026 08:39
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.

5 participants