mirror of
https://github.com/fosrl/newt.git
synced 2026-07-15 21:16:40 -05:00
[GH-ISSUE #359] Go Report Card findings: reduce cyclomatic complexity and fix typo #4079
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @marcschaeferger on GitHub (May 15, 2026).
Original GitHub issue: https://github.com/fosrl/newt/issues/359
Originally assigned to: @marcschaeferger on GitHub.
Summary
Go Report Card currently reports no issues for
gofmt,go vet,ineffassign, and license checks. However, there are severalgocyclowarnings for functions with cyclomatic complexity above the recommended threshold of15, plus one minor spelling issue.https://goreportcard.com/report/github.com/fosrl/newt
Current status
Passing checks
gofmt: 100%gofmt -sgo vet: 100%ineffassign: 100%license: 100%Issues to address
High cyclomatic complexity
Go Report Card warns for functions with cyclomatic complexity greater than
15.websocket/client.go(*Client).getToken()websocket/client.go(*Client).establishConnection()wgnetstack/wgnetstack.go(*WireGuardService).calculatePeerBandwidth()proxy/manager.go(*ProxyManager).handleUDPProxy()main.gomain()main.govalidateTLSConfig()util.gostartPingCheck()docker/client.goListContainers()wg/wg.go(*WireGuardService).handleUpdatePeer()The most important target is
main()inmain.go, which currently has a complexity of165. This should probably be split into smaller functions for configuration loading, validation, dependency initialization, service startup, signal handling, and shutdown logic.Idea
main.go, especiallymain(), because it is by far the largest complexity outlier.Minor typo
misspellreports one typo:wg/wg.goexisingexistingAcceptance criteria
wg/wg.go.main().gofmt -spasses.go vetpasses.ineffassignpasses.gocycloormisspellwarnings.