Skip to content

Commit 60c75b6

Browse files
authored
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
1 parent 162aeb9 commit 60c75b6

File tree

9 files changed

+2
-17
lines changed

9 files changed

+2
-17
lines changed

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ linters:
2727
- gosec
2828
- grouper
2929
- importas
30-
- ireturn
3130
- makezero
3231
- misspell
3332
- nakedret

internal/api/router/router.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ func WithSkipPaths(paths ...string) MiddlewareOption {
9292
}
9393

9494
// NewHumaAPI creates a new Huma API with all routes registered
95-
//
96-
//nolint:ireturn // huma.API is the expected interface type for Huma APIs
9795
func NewHumaAPI(cfg *config.Config, registry service.RegistryService, mux *http.ServeMux, metrics *telemetry.Metrics) huma.API {
9896
// Create Huma API configuration
9997
humaConfig := huma.DefaultConfig("MCP Registry API", "1.0.0")

internal/service/fake_service.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ type fakeRegistryService struct {
1515
}
1616

1717
// NewFakeRegistryService creates a new fake registry service with pre-populated data
18-
//
19-
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
2018
func NewFakeRegistryService() RegistryService {
2119
// Sample registry entries with updated model structure using ServerDetail
2220
serverDetails := []*model.ServerDetail{
@@ -81,7 +79,7 @@ func (s *fakeRegistryService) List(cursor string, limit int) ([]model.ServerResp
8179
if err != nil {
8280
return nil, "", err
8381
}
84-
82+
8583
// Convert ServerRecord to ServerResponse format
8684
result := make([]model.ServerResponse, len(serverRecords))
8785
for i, record := range serverRecords {
@@ -151,4 +149,4 @@ func (s *fakeRegistryService) Publish(req model.PublishRequest) (*model.ServerRe
151149
// Close closes the in-memory database connection
152150
func (s *fakeRegistryService) Close() error {
153151
return s.db.Close()
154-
}
152+
}

internal/service/registry_service.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ type registryServiceImpl struct {
1818
}
1919

2020
// NewRegistryServiceWithDB creates a new registry service with the provided database
21-
//
22-
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
2321
func NewRegistryServiceWithDB(db database.Database) RegistryService {
2422
return &registryServiceImpl{
2523
db: db,

tools/publisher/auth/dns.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ type DNSProvider struct {
55
}
66

77
// NewDNSProvider creates a new DNS-based auth provider
8-
//
9-
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
108
func NewDNSProvider(registryURL, domain, hexSeed string) Provider {
119
return &DNSProvider{
1210
CryptoProvider: &CryptoProvider{

tools/publisher/auth/github-at.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ type ServerHealthResponse struct {
6363
}
6464

6565
// NewGitHubATProvider creates a new GitHub OAuth provider
66-
//
67-
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
6866
func NewGitHubATProvider(forceLogin bool, registryURL string) Provider {
6967
return &GitHubATProvider{
7068
forceLogin: forceLogin,

tools/publisher/auth/github-oidc.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ type GitHubOIDCProvider struct {
1515
}
1616

1717
// NewGitHubOIDCProvider creates a new GitHub OIDC provider
18-
//
19-
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
2018
func NewGitHubOIDCProvider(registryURL string) Provider {
2119
return &GitHubOIDCProvider{
2220
registryURL: registryURL,

tools/publisher/auth/http.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ type HTTPProvider struct {
55
}
66

77
// NewHTTPProvider creates a new HTTP-based auth provider
8-
//nolint:ireturn // Factory function returns interface by design
98
func NewHTTPProvider(registryURL, domain, hexSeed string) Provider {
109
return &HTTPProvider{
1110
CryptoProvider: &CryptoProvider{

tools/publisher/auth/none.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type TokenResponse struct {
1919
ExpiresAt int64 `json:"expires_at"`
2020
}
2121

22-
//nolint:ireturn // Factory function returns interface by design
2322
func NewNoneProvider(registryURL string) Provider {
2423
return &NoneProvider{
2524
registryURL: registryURL,

0 commit comments

Comments
 (0)