Skip to content

CI: vet + modernize + race; fix progress bar math; move to slack-go/slack - #6

Merged
sfreiberg merged 4 commits into
masterfrom
ci-modernize
Oct 26, 2026
Merged

sfreiberg merged 4 commits into
masterfrom
ci-modernize

Conversation

@sfreiberg

@sfreiberg sfreiberg commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • CI: actions bumped to v7, permissions added, go vet and gopls modernize steps added (x/tools v0.52.0), and tests now run with -race.
  • Fixes, tested with a fake Slack client:
    • drawBar divided by the width instead of scaling. A Width under 10 panicked with a negative repeat count, Width 20 showed 5 of 20 segments at 100%, and multi-character fill strings broke the length.
    • A failed post cleared the channel, so every later update failed.
    • A failed update cleared the timestamp, so the next call posted a second bar. lastPct also wasn't set after the first post.
    • The percentage now uses integer maths. With float32, 53/100 showed as 52%.
  • Dependencies: nlopes/slack is archived. It is replaced by its successor, slack-go/slack v0.30.1, in a separate commit (928aa7d). Only the import path changed, and the client is unexported, so the public API is unaffected. Drop that commit if you'd rather not switch.

Test plan

  • gofmt, vet, modernize and go mod tidy are clean; go test -race ./... passes

Run go vet and the gopls modernize analyzer next to the gofmt check,
run tests with -race, update actions/checkout and actions/setup-go to
v7, and limit the workflow's GITHUB_TOKEN to read-only access.

Apply modernize's fix (interface{} -> any) so the new check passes.
- drawBar divided the percentage by Width instead of scaling it, so the
  bar was only right for Width 10: Width 20 at 100% showed 5 of 20
  segments, and any Width under 10 panicked with a negative
  strings.Repeat count near completion. It also used the rune length of
  the filled part, which is wrong for multi-character Fill strings such
  as emoji shortcodes.
- A failed chat.postMessage overwrote the channel with "", so every
  later Update failed. A failed chat.update cleared the timestamp, so
  the next Update posted a second progress bar. Only record state after
  a successful call, and record lastPct after the first post too.
- Compute the percentage with integer math; float32 rounding reported
  53/100 as 52%.
github.com/nlopes/slack v0.5.0 => v0.6.0 (its final release)
github.com/nlopes/slack is archived; development continues at
github.com/slack-go/slack. The APIs used here are unchanged, so this is
an import path swap. The slack client is unexported, so the package's
public API is unaffected.

github.com/nlopes/slack v0.6.0 => github.com/slack-go/slack v0.30.1
@sfreiberg
sfreiberg merged commit f59614c into master Oct 26, 2026
1 check passed
@sfreiberg
sfreiberg deleted the ci-modernize branch October 26, 2026 19:50
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