Skip to content

refactor: remove unnecessary API wrapper methods in cfl #20

@rianjs

Description

@rianjs

Summary

Remove redundant HTTP method wrappers in cfl's API client that duplicate Go's automatic method promotion from embedded types.

Current State

tools/cfl/api/client.go (lines 23-41) has wrapper methods that just call the embedded client:

type Client struct {
    *client.Client  // embedded type
}

// These wrappers are unnecessary - embedding already promotes these methods
func (c *Client) Get(ctx context.Context, path string) ([]byte, error) {
    return c.Client.Get(ctx, path)
}
func (c *Client) Post(ctx context.Context, path string, body interface{}) ([]byte, error) {
    return c.Client.Post(ctx, path, body)
}
func (c *Client) Put(ctx context.Context, path string, body interface{}) ([]byte, error) {
    return c.Client.Put(ctx, path, body)
}
func (c *Client) Delete(ctx context.Context, path string) error {
    return c.Client.Delete(ctx, path)
}

Proposed Changes

Delete lines 23-41. Go embedding automatically promotes the embedded *client.Client methods to the outer Client type.

Impact

~20 lines removed, 1 file changed

Note

Verify no code relies on method signatures that differ from the embedded type before removing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions