Skip to content

Add godoc comments to exported types and functions #18

@NP-compete

Description

@NP-compete

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:

  1. `internal/storage/interface.go` - Core types
  2. `internal/errors/errors.go` - Error types
  3. `internal/config/config.go` - Config struct
  4. `pkg/mcpprotocol/types.go` - Protocol types
  5. `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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions