Skip to content

Modernize for Go 1.27.2 and pin GitHub Actions - #62

Open
mr-pmillz wants to merge 1 commit into
tmaxmax:masterfrom
mr-pmillz:master
Open

mr-pmillz wants to merge 1 commit into
tmaxmax:masterfrom
mr-pmillz:master

Conversation

@mr-pmillz

Copy link
Copy Markdown

Upgrade the module and CI to Go 1.27.2, apply modernizers to a fixpoint, and migrate lint tooling. Pin workflow actions to verified stable release commits.

Validated build, vet, tests, race tests, lint, formatting, and actionlint.

Upgrade the module and CI to Go 1.27.2, apply modernizers to a fixpoint, and migrate lint tooling. Pin workflow actions to verified stable release commits.

Validated build, vet, tests, race tests, lint, formatting, and actionlint.

@tmaxmax tmaxmax left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

we should also add an ## Unreleased section to the changelog which should document that the minimum supported version will be 1.26.

Comment thread .github/workflows/go.yml
Comment on lines +32 to +33
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

any reason for not using just the version, e.g. actions/setup-go@v7?

Comment thread go.mod
@@ -1,3 +1,3 @@
module github.com/tmaxmax/go-sse

go 1.22

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Should be 1.26.0

Comment thread cmd/complex/main.go
Comment on lines -164 to +162
sctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
sctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), time.Second*10)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Unnecessary since the Shutdown call gives no opportunity for using context values.

Comment thread cmd/complex/main.go
@@ -37,11 +37,9 @@ func newSSE() *sse.Server {
topics = r.URL.Query()["topic"]
for _, topic := range topics {
if topic != topicRandomNumbers && topic != topicMetrics {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Let's not clutter this PR with unrelated example code changes.

Comment thread .github/workflows/go.yml
Comment on lines -39 to -40
test-old:
name: Test (previous major)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Should not remove.

Comment thread README.md
If you are not familiar with the protocol or not sure how it works, read [MDN's guide for using server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events). [The spec](https://html.spec.whatwg.org/multipage/server-sent-events.html) is also useful read!

`go-sse` promises to support the [Go versions supported by the Go team](https://go.dev/doc/devel/release#policy) – that is, the 2 most recent major releases.
`go-sse` requires Go 1.27.2 or later.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We shouldn't change the support promise.

Comment thread README.md
return true // or false to stop iteration
})
```
This feature uses Go's [range-over-function iterators](https://go.dev/blog/range-functions).

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can remove this line fully, range-over-func is normal today.

Comment thread event.go
}

if err != nil && !(ignoreEOF && isEOF) {
if err != nil && (!ignoreEOF || !isEOF) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Unrelated, let's not change.

Comment thread .github/workflows/go.yml
Comment on lines +26 to +27
- name: Check formatting
run: golangci-lint fmt --diff

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Not needed. golangci-lint run, executed by default, already checks formatting.

Comment thread joe.go
Comment on lines -174 to +178
pub := publishedMessage{replayerErr: errs}
pub.message = msg
pub.topics = topics
pub := publishedMessage{
replayerErr: errs,
message: msg,
topics: topics,
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Since for now go1.26 is the intended minimum target we should remove this class of changes.

@tmaxmax

tmaxmax commented Oct 9, 2026

Copy link
Copy Markdown
Owner

As part of this PR, could you also remove the Go report badge from README?

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