-
Notifications
You must be signed in to change notification settings - Fork 4
Add godoc comments to exported types and functions #18
Description
Summary
Many exported types and functions lack godoc comments, reducing code discoverability and documentation quality.
Current State
```go
// internal/storage/interface.go - Missing godoc
type Client struct {
ID string `json:"id"`
Secret string `json:"secret"`
// ...
}
type Store interface {
Connect(ctx context.Context, cfg Config) error
// ...
}
```
Expected Outcome
Add godoc comments following Go conventions:
```go
// Client represents an OAuth 2.0 client registered with the server.
// Clients are identified by their ID and authenticated using their Secret.
type Client struct {
// ID is the unique identifier for this client.
ID string `json:"id"`
// Secret is the client's authentication credential.
// This should be stored securely and never exposed in logs.
Secret string \`json:"secret"\`
// Name is a human-readable name for the client.
Name string \`json:"name"\`
// RedirectURIs are the allowed callback URLs for this client.
RedirectURIs []string \`json:"redirect_uris"\`
// GrantTypes specifies which OAuth grant types this client can use.
// Common values: "authorization_code", "refresh_token", "client_credentials"
GrantTypes []string \`json:"grant_types"\`
// ResponseTypes specifies allowed response types.
// Common values: "code", "token"
ResponseTypes []string \`json:"response_types"\`
// Scope defines the default scope for this client.
Scope string \`json:"scope"\`
// CreatedAt is when this client was registered.
CreatedAt time.Time \`json:"created_at"\`
}
// Store defines the interface for persistent storage operations.
// Implementations must be safe for concurrent use.
type Store interface {
// Connect establishes a connection to the storage backend.
// It should be called before any other operations.
Connect(ctx context.Context, cfg Config) error
// Disconnect closes the connection to the storage backend.
// It should be called during graceful shutdown.
Disconnect(ctx context.Context) error
// IsHealthy returns true if the storage backend is responsive.
IsHealthy(ctx context.Context) bool
// ... more methods with docs
}
```
Files to Update
Priority order:
- `internal/storage/interface.go` - Core types
- `internal/errors/errors.go` - Error types
- `internal/config/config.go` - Config struct
- `pkg/mcpprotocol/types.go` - Protocol types
- `internal/mcp/server.go` - Server types
Acceptance Criteria
- All exported types have godoc comments
- All exported functions have godoc comments
- Comments follow Go conventions (start with type/function name)
- `go doc` produces useful output
- No `golint` warnings about missing comments