Skip to content

chore: modernize Go toolchain and dependencies - #3

Merged
0xcfff merged 5 commits into
mainfrom
chore/modernize-go-and-deps
Aug 18, 2026
Merged

chore: modernize Go toolchain and dependencies#3
0xcfff merged 5 commits into
mainfrom
chore/modernize-go-and-deps

Conversation

@0xcfff

@0xcfff 0xcfff commented Aug 18, 2026

Copy link
Copy Markdown
Owner

What

Modernize the hostsctl project from its 2022-era dependency graph to current tooling:

  1. fix(iotools): Fix line splitter for Go 1.22+ — bufio.Scanner changed so ErrFinalToken with a nil token no longer emits the final token. Switch to non-nil sentinel.
  2. chore: Bump go directive 1.20 → 1.26; replace golang.org/x/exp/{slices,maps} with stdlib; drop unused sirupsen/logrus; promote liggitt/tabwriter + yaml.v3 to direct; bump CI GO_VERSION 1.21 → 1.26.
  3. chore(deps): Update cobra 1.5.0→1.10.2, afero 1.9.2→1.15.0, testify 1.8.0→1.12.0, x/text 0.3.7→0.41.0 (clears GO-2022-1059 + GO-2026-5970), mousetrap 1.1.0, pflag 1.0.9.
  4. fix: Repair malformed struct tag in commands/block/model.go rejected by newer go vet.

Verification

  • go build ./...
  • go test ./... ✅ (all 6 test packages pass)
  • go vet ./...
  • go mod verify
  • Built and tested with Go 1.26.6 on linux/arm64

0xcfff added 5 commits August 18, 2026 00:18
Go 1.22 changed bufio.Scanner so ErrFinalToken carrying a nil token no
longer emits the final token. Return a non-nil empty slice instead so the
trailing-newline line is preserved. Behavior is unchanged on Go < 1.22.
- Bump go directive from 1.20 to 1.26 (latest stable).
- Replace golang.org/x/exp/{slices,maps} with stdlib.
  Go 1.23+ maps.Keys returns an iterator; use slices.Sorted to convert.
- Drop sirupsen/logrus — declared but never imported.
- Hoist liggitt/tabwriter and yaml.v3 from indirect to direct.
- Update CI (.github/workflows/ci.yaml) GO_VERSION from 1.21 to 1.26.
- Run gofmt.
- spf13/cobra v1.5.0 -> v1.10.2
- spf13/afero v1.9.2 -> v1.15.0
- stretchr/testify v1.8.0 -> v1.12.0
- golang.org/x/text v0.3.7 -> v0.41.0 (clears GO-2022-1059, GO-2026-5970)
- indirect: mousetrap v1.1.0, pflag v1.0.9

No API breakage; build and full test suite pass.
The SystemAliasesCount field tag mixed literal tabs into the raw tag
string, which newer go vet rejects as invalid reflect.StructTag syntax.
Replace with spaces to match the alignment of the neighboring fields.
- actions/upload-artifact: v3 -> v4 (v3 hard-deprecated, auto-fails)
- actions/download-artifact: v3 -> v4 (same deprecation)
- actions/setup-go: v4 -> v5 (deprecated)
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Complexity Health
github.com/0xcfff/hostsctl/cmd/hostsctl 0% 0
github.com/0xcfff/hostsctl/commands/alias 81% 0
github.com/0xcfff/hostsctl/commands/block 81% 0
github.com/0xcfff/hostsctl/commands/cmdtest 0% 0
github.com/0xcfff/hostsctl/commands/common 0% 0
github.com/0xcfff/hostsctl/commands/database 45% 0
github.com/0xcfff/hostsctl/commands 0% 0
github.com/0xcfff/hostsctl/commands/version 0% 0
github.com/0xcfff/hostsctl/hosts/dom 42% 0
github.com/0xcfff/hostsctl/hosts 0% 0
github.com/0xcfff/hostsctl/hosts/syntax 52% 0
github.com/0xcfff/hostsctl/iotools 0% 0
github.com/0xcfff/hostsctl/iptools 100% 0
Summary 55% (1410 / 2582) 0

@0xcfff 0xcfff left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Good to go

@0xcfff
0xcfff merged commit 718ab74 into main Aug 18, 2026
6 checks passed
@0xcfff
0xcfff deleted the chore/modernize-go-and-deps branch August 18, 2026 07:40
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