Skip to content

Comments

WIP: make go1.20 compatible, do not merge#61

Open
daniel-garcia wants to merge 4 commits intomainfrom
go1.20
Open

WIP: make go1.20 compatible, do not merge#61
daniel-garcia wants to merge 4 commits intomainfrom
go1.20

Conversation

@daniel-garcia
Copy link
Contributor

No description provided.

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

This PR is a work-in-progress refactoring to make the hotload library compatible with Go 1.20 while decoupling Prometheus dependencies from the core module. The changes involve significant architectural improvements including a provider pattern for metrics, removal of external dependencies, and migration from ginkgo/gomega to standard library testing.

Key changes:

  • Downgrade from Go 1.23 to Go 1.20 and remove external dependencies (google/uuid, pkg/errors, teivah/onecontext)
  • Introduce metrics provider abstraction layer to decouple Prometheus from core library
  • Create separate prometheusmetrics submodule for optional Prometheus support
  • Replace custom implementations: internal/randstring for UUID, internal/contextutil for context merging
  • Migrate tests from ginkgo/gomega to standard library testing framework

Reviewed Changes

Copilot reviewed 41 out of 45 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
go.mod Downgrades to Go 1.20, removes all external dependencies except fsnotify
metrics/provider.go Introduces provider interface for pluggable metrics implementations
prometheusmetrics/* New submodule providing optional Prometheus metrics support
internal/randstring/randstring.go Custom random string generator replacing google/uuid
internal/contextutil/contextutil.go Custom context merger replacing teivah/onecontext
fsnotify/errors_compat.go Custom error comparison (unnecessary - Go 1.20 has errors.Is)
conn.go Replaces onecontext.Merge with contextutil.Merge
transaction.go Updates to use new metrics provider abstraction
*_test.go Migrates from ginkgo/gomega to standard library testing
Makefile Updates test commands to include unit_tests build tag
Dockerfile.* Updates Go version from 1.23 to 1.24

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

Comment on lines 121 to 127
}
c.incExecStmtsCounter() //increment the exec counter to keep track of the number of exec calls
c.logf("managedConn.ExecContext", "calling underlying conn.ExecContext()")
mergedCtx, cancel := onecontext.Merge(c.ctx, ctx)
mergedCtx, cancel := contextutil.Merge(c.ctx, ctx)
defer cancel()
return conn.ExecContext(mergedCtx, query, args)
}
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The change from onecontext.Merge to contextutil.Merge is good for removing external dependencies. However, the QueryContext method (line 187 in the file) still doesn't merge contexts like ExecContext does, creating an asymmetry in context handling that could lead to inconsistent behavior between query and exec operations.

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.

1 participant