Skip to content

Fix: issues in GoReport #11

@mrz1836

Description

@mrz1836

🧾 Go Report Card Summary

The latest Go Report Card shows several areas that need cleanup and refactoring to reach 100% compliance.


📦 Summary

Metric Score Description
gofmt 84% Some files not formatted with gofmt -s
go vet 100% ✅ No problems detected
gocyclo 73% Several functions exceed cyclomatic complexity threshold (>15)
ineffassign 96% A few ineffectual assignments detected
license 100% ✅ LICENSE file detected
misspell 100% ✅ No spelling issues found

🧹 gofmt (84%)

Run gofmt -s -w . to simplify and reformat the affected files.

Affected Files

  • examples/ship/main.go
  • pkg/advertiser/wallet_advertiser_test.go
  • pkg/slap/lookup_service_test.go
  • pkg/ship/lookup_service_test.go

⚙️ gocyclo (73%)

Consider refactoring these functions to reduce branching and simplify logic.
Threshold: complexity > 15

File Line Function Complexity
pkg/utils/validation.go 117 validateJS8CallURI() 21
pkg/ship/lookup_service.go 209 (*LookupService).validateQuery() 18
pkg/slap/lookup_service.go 209 (*LookupService).validateQuery() 17
pkg/ship/storage_test.go 69 (*TestSHIPStorage).FindRecord() 17
pkg/slap/topic_manager.go 365 (*TopicManager).IdentifyAdmissibleOutputs() 22
pkg/ship/topic_manager.go 291 (*TopicManager).IdentifyAdmissibleOutputs() 22
pkg/advertiser/wallet_advertiser.go 220 (*WalletAdvertiser).CreateAdvertisements() 21

⚠️ ineffassign (96%)

Remove or handle ineffectual assignments to avoid dead code.

File: pkg/advertiser/wallet_advertiser.go

  • Line 260: ineffectual assignment to err
  • Line 1177: ineffectual assignment to offset

✅ No Issues Found

  • go vet: No suspicious constructs
  • license: LICENSE file present
  • misspell: No misspellings detected

🧩 Next Steps

  1. Run format check:

    gofmt -s -w .
  2. Run linters locally before committing:

    golangci-lint run ./...
  3. Refactor high-complexity functions (see above list).

  4. Fix ineffassign warnings.


Goal:
📈 Bring Go Report Card score to 100% compliance across all metrics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions