Skip to content

Apply go fix to codebase#7831

Open
nicholaspcr wants to merge 1 commit intov3.35from
feat/apply-go-fix
Open

Apply go fix to codebase#7831
nicholaspcr wants to merge 1 commit intov3.35from
feat/apply-go-fix

Conversation

@nicholaspcr
Copy link
Contributor

Summary

Apply go fix ./... to modernize the codebase.
https://go.dev/blog/gofix

Changes

  • Replace manual for loops with slices.Contains, slices.SortFunc, slices.Clone, etc.
  • Replace manual map iteration copies with maps.Copy and maps.Clone
  • Replace reflect.TypeOf((*T)(nil)).Elem() with reflect.TypeFor[T]()
  • Replace reflect.Ptr with reflect.Pointer
  • Replace for i := 0; i < n; i++ with for i := range n (integer range loops)
  • Remove ineffective omitempty on struct-typed JSON fields
  • Remove unnecessary blank imports and unused assignments

Testing

Steps

Run go build ./... and go test ./... to verify no regressions.

Results

The changes are all mechanical transformations applied by go fix.

Regressions
  • The omitempty removal on struct-typed JSON fields is behavior-preserving: omitempty was already a no-op for struct types in encoding/json.
  • All other changes (slices, maps, reflect.TypeFor, reflect.Pointer, integer range) are semantically equivalent to the replaced code.

Notes for Reviewers

All changes were generated by go fix ./.... No manual edits.

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md for the chosen target branch.
  • Documentation: Relevant documentation is added or updated.
  • Testing: The steps/process to test this feature are clearly explained including testing for regressions.
  • Infrastructure: If infrastructural changes (e.g., new RPC, configuration) are needed, a separate issue is created in the infrastructural repositories.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

@nicholaspcr nicholaspcr self-assigned this Feb 17, 2026
@nicholaspcr nicholaspcr requested review from a team as code owners February 17, 2026 20:44
@github-actions github-actions bot added c/join server This is related to the Join Server c/network server This is related to the Network Server c/console This is related to the Console c/identity server This is related to the Identity Server ui/cli This is related to ttn-lw-cli c/gateway server This is related to the Gateway Server c/application server This is related to the Application Server c/packet broker agent This is related to Packet Broker Agent security This is important for security compat/db This could affect Database compatibility c/gateway conf server This is related to the Gateway Configuration Server c/device converter ui/web This is related to a web interface compat/config This could affect Configuration compatibility labels Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/application server This is related to the Application Server c/console This is related to the Console c/device converter c/gateway conf server This is related to the Gateway Configuration Server c/gateway server This is related to the Gateway Server c/identity server This is related to the Identity Server c/join server This is related to the Join Server c/network server This is related to the Network Server c/packet broker agent This is related to Packet Broker Agent compat/config This could affect Configuration compatibility compat/db This could affect Database compatibility security This is important for security ui/cli This is related to ttn-lw-cli ui/web This is related to a web interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments