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:
parent
162aeb9420
commit
60c75b6591
9 changed files with 2 additions and 17 deletions
|
|
@ -27,7 +27,6 @@ linters:
|
||||||
- gosec
|
- gosec
|
||||||
- grouper
|
- grouper
|
||||||
- importas
|
- importas
|
||||||
- ireturn
|
|
||||||
- makezero
|
- makezero
|
||||||
- misspell
|
- misspell
|
||||||
- nakedret
|
- nakedret
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,6 @@ func WithSkipPaths(paths ...string) MiddlewareOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHumaAPI creates a new Huma API with all routes registered
|
// 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 {
|
func NewHumaAPI(cfg *config.Config, registry service.RegistryService, mux *http.ServeMux, metrics *telemetry.Metrics) huma.API {
|
||||||
// Create Huma API configuration
|
// Create Huma API configuration
|
||||||
humaConfig := huma.DefaultConfig("MCP Registry API", "1.0.0")
|
humaConfig := huma.DefaultConfig("MCP Registry API", "1.0.0")
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ type fakeRegistryService struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFakeRegistryService creates a new fake registry service with pre-populated data
|
// NewFakeRegistryService creates a new fake registry service with pre-populated data
|
||||||
//
|
|
||||||
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
|
|
||||||
func NewFakeRegistryService() RegistryService {
|
func NewFakeRegistryService() RegistryService {
|
||||||
// Sample registry entries with updated model structure using ServerDetail
|
// Sample registry entries with updated model structure using ServerDetail
|
||||||
serverDetails := []*model.ServerDetail{
|
serverDetails := []*model.ServerDetail{
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ type registryServiceImpl struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRegistryServiceWithDB creates a new registry service with the provided database
|
// 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 {
|
func NewRegistryServiceWithDB(db database.Database) RegistryService {
|
||||||
return ®istryServiceImpl{
|
return ®istryServiceImpl{
|
||||||
db: db,
|
db: db,
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@ type DNSProvider struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDNSProvider creates a new DNS-based auth provider
|
// NewDNSProvider creates a new DNS-based auth provider
|
||||||
//
|
|
||||||
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
|
|
||||||
func NewDNSProvider(registryURL, domain, hexSeed string) Provider {
|
func NewDNSProvider(registryURL, domain, hexSeed string) Provider {
|
||||||
return &DNSProvider{
|
return &DNSProvider{
|
||||||
CryptoProvider: &CryptoProvider{
|
CryptoProvider: &CryptoProvider{
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,6 @@ type ServerHealthResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGitHubATProvider creates a new GitHub OAuth provider
|
// NewGitHubATProvider creates a new GitHub OAuth provider
|
||||||
//
|
|
||||||
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
|
|
||||||
func NewGitHubATProvider(forceLogin bool, registryURL string) Provider {
|
func NewGitHubATProvider(forceLogin bool, registryURL string) Provider {
|
||||||
return &GitHubATProvider{
|
return &GitHubATProvider{
|
||||||
forceLogin: forceLogin,
|
forceLogin: forceLogin,
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ type GitHubOIDCProvider struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGitHubOIDCProvider creates a new GitHub OIDC provider
|
// NewGitHubOIDCProvider creates a new GitHub OIDC provider
|
||||||
//
|
|
||||||
//nolint:ireturn // Factory function intentionally returns interface for dependency injection
|
|
||||||
func NewGitHubOIDCProvider(registryURL string) Provider {
|
func NewGitHubOIDCProvider(registryURL string) Provider {
|
||||||
return &GitHubOIDCProvider{
|
return &GitHubOIDCProvider{
|
||||||
registryURL: registryURL,
|
registryURL: registryURL,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ type HTTPProvider struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHTTPProvider creates a new HTTP-based auth provider
|
// NewHTTPProvider creates a new HTTP-based auth provider
|
||||||
//nolint:ireturn // Factory function returns interface by design
|
|
||||||
func NewHTTPProvider(registryURL, domain, hexSeed string) Provider {
|
func NewHTTPProvider(registryURL, domain, hexSeed string) Provider {
|
||||||
return &HTTPProvider{
|
return &HTTPProvider{
|
||||||
CryptoProvider: &CryptoProvider{
|
CryptoProvider: &CryptoProvider{
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ type TokenResponse struct {
|
||||||
ExpiresAt int64 `json:"expires_at"`
|
ExpiresAt int64 `json:"expires_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:ireturn // Factory function returns interface by design
|
|
||||||
func NewNoneProvider(registryURL string) Provider {
|
func NewNoneProvider(registryURL string) Provider {
|
||||||
return &NoneProvider{
|
return &NoneProvider{
|
||||||
registryURL: registryURL,
|
registryURL: registryURL,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue