Go Report Card currently reports no issues for gofmt, go vet, ineffassign, and license checks. However, there are several gocyclo warnings for functions with cyclomatic complexity above the recommended threshold of 15, plus one minor spelling issue.
Go Report Card warns for functions with cyclomatic complexity greater than 15.
File
Line
Function
Complexity
websocket/client.go
218
(*Client).getToken()
19
websocket/client.go
336
(*Client).establishConnection()
17
wgnetstack/wgnetstack.go
786
(*WireGuardService).calculatePeerBandwidth()
17
proxy/manager.go
290
(*ProxyManager).handleUDPProxy()
17
main.go
128
main()
165
main.go
1261
validateTLSConfig()
17
util.go
232
startPingCheck()
25
docker/client.go
159
ListContainers()
25
wg/wg.go
601
(*WireGuardService).handleUpdatePeer()
19
The most important target is main() in main.go, which currently has a complexity of 165. This should probably be split into smaller functions for configuration loading, validation, dependency initialization, service startup, signal handling, and shutdown logic.
Idea
Refactor large functions into smaller, testable helper functions.
Prioritize main.go, especially main(), because it is by far the largest complexity outlier.
Avoid behavior changes during the refactor.
Add or adjust tests where possible to make sure the refactoring does not change runtime behavior.
Keep the public API and configuration behavior unchanged unless explicitly required.
Minor typo
misspell reports one typo:
File
Line
Current
Suggested
wg/wg.go
329
exising
existing
Acceptance criteria
Fix the typo in wg/wg.go.
Reduce cyclomatic complexity of the listed functions where reasonably possible.
At minimum, significantly reduce the complexity of main().
Keep existing behavior unchanged.
gofmt -s passes.
go vet passes.
ineffassign passes.
Go Report Card no longer reports avoidable gocyclo or misspell warnings.
Originally created by @marcschaeferger on GitHub (May 15, 2026).
Original GitHub issue: https://github.com/fosrl/newt/issues/359
### Summary
Go Report Card currently reports no issues for `gofmt`, `go vet`, `ineffassign`, and license checks. However, there are several `gocyclo` warnings for functions with cyclomatic complexity above the recommended threshold of `15`, plus one minor spelling issue.
https://goreportcard.com/report/github.com/fosrl/newt
### Current status
#### Passing checks
- `gofmt`: 100%
- Code is formatted with `gofmt -s`
- `go vet`: 100%
- No suspicious constructs detected
- `ineffassign`: 100%
- No ineffectual assignments detected
- `license`: 100%
- LICENSE file exists
### Issues to address
#### High cyclomatic complexity
Go Report Card warns for functions with cyclomatic complexity greater than `15`.
| File | Line | Function | Complexity |
|---|---:|---|---:|
| `websocket/client.go` | 218 | `(*Client).getToken()` | 19 |
| `websocket/client.go` | 336 | `(*Client).establishConnection()` | 17 |
| `wgnetstack/wgnetstack.go` | 786 | `(*WireGuardService).calculatePeerBandwidth()` | 17 |
| `proxy/manager.go` | 290 | `(*ProxyManager).handleUDPProxy()` | 17 |
| `main.go` | 128 | `main()` | 165 |
| `main.go` | 1261 | `validateTLSConfig()` | 17 |
| `util.go` | 232 | `startPingCheck()` | 25 |
| `docker/client.go` | 159 | `ListContainers()` | 25 |
| `wg/wg.go` | 601 | `(*WireGuardService).handleUpdatePeer()` | 19 |
The most important target is `main()` in `main.go`, which currently has a complexity of `165`. This should probably be split into smaller functions for configuration loading, validation, dependency initialization, service startup, signal handling, and shutdown logic.
### Idea
- Refactor large functions into smaller, testable helper functions.
- Prioritize `main.go`, especially `main()`, because it is by far the largest complexity outlier.
- Avoid behavior changes during the refactor.
- Add or adjust tests where possible to make sure the refactoring does not change runtime behavior.
- Keep the public API and configuration behavior unchanged unless explicitly required.
### Minor typo
`misspell` reports one typo:
| File | Line | Current | Suggested |
|---|---:|---|---|
| `wg/wg.go` | 329 | `exising` | `existing` |
### Acceptance criteria
- [ ] Fix the typo in `wg/wg.go`.
- [ ] Reduce cyclomatic complexity of the listed functions where reasonably possible.
- [ ] At minimum, significantly reduce the complexity of `main()`.
- [ ] Keep existing behavior unchanged.
- [ ] `gofmt -s` passes.
- [ ] `go vet` passes.
- [ ] `ineffassign` passes.
- [ ] Go Report Card no longer reports avoidable `gocyclo` or `misspell` warnings.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @marcschaeferger on GitHub (May 15, 2026).
Original GitHub issue: https://github.com/fosrl/newt/issues/359
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.