Disable ireturn linter rule (#307)

## Summary

- Disable the `ireturn` linter rule in golangci-lint configuration
- Remove all related `nolint:ireturn` comments from the codebase

The `ireturn` rule was flagging factory functions that intentionally
return interfaces for dependency injection, which is a common and valid
Go pattern. Since this pattern is used extensively throughout the
codebase for good architectural reasons, it makes sense to disable this
rule entirely.

It also seems buggy, and seems to conflict with other lint rules -
causing unnecessary toil.See:
https://stackoverflow.com/questions/72385337/golang-linter-always-complains
This commit is contained in:
adam jones 2025-08-26 15:16:43 +01:00 • committed by GitHub
commit 60c75b6591
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 17 deletions

View file

@ -92,8 +92,6 @@ func WithSkipPaths(paths ...string) MiddlewareOption {
}
// NewHumaAPI creates a new Huma API with all routes registered
//
//nolint:ireturn // huma.API is the expected interface type for Huma APIs
func NewHumaAPI(cfg *config.Config, registry service.RegistryService, mux *http.ServeMux, metrics *telemetry.Metrics) huma.API {
// Create Huma API configuration
humaConfig := huma.DefaultConfig("MCP Registry API", "1.0.0")

View file

@ -15,8 +15,6 @@ type fakeRegistryService struct {
}
// NewFakeRegistryService creates a new fake registry service with pre-populated data
//
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
func NewFakeRegistryService() RegistryService {
// Sample registry entries with updated model structure using ServerDetail
serverDetails := []*model.ServerDetail{
@ -81,7 +79,7 @@ func (s *fakeRegistryService) List(cursor string, limit int) ([]model.ServerResp
if err != nil {
return nil, "", err
}
// Convert ServerRecord to ServerResponse format
result := make([]model.ServerResponse, len(serverRecords))
for i, record := range serverRecords {
@ -151,4 +149,4 @@ func (s *fakeRegistryService) Publish(req model.PublishRequest) (*model.ServerRe
// Close closes the in-memory database connection
func (s *fakeRegistryService) Close() error {
return s.db.Close()
}
}

View file

@ -18,8 +18,6 @@ type registryServiceImpl struct {
}
// NewRegistryServiceWithDB creates a new registry service with the provided database
//
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
func NewRegistryServiceWithDB(db database.Database) RegistryService {
return &registryServiceImpl{
db: db,