Skip to content

make NewTools return *Tools for consistency with NewMessages#32

Merged
x2d7 merged 2 commits intodevfrom
chat-consistent-constructor
Feb 22, 2026
Merged

make NewTools return *Tools for consistency with NewMessages#32
x2d7 merged 2 commits intodevfrom
chat-consistent-constructor

Conversation

@x2d7
Copy link
Owner

@x2d7 x2d7 commented Feb 22, 2026

Summary

NewMessages() returns *Messages, but NewTools() returned Tools by value — forcing callers to take the address manually with &toolList.
Since both types contain a mutex internally, returning by pointer is also the correct choice to prevent accidental copies.

Changes

  • NewTools() now returns *Tools instead of Tools
  • All test setup updated to remove manual & dereference
// before
toolList := tools.NewTools()
c := chat.Chat{Tools: &toolList}

// after
c := chat.Chat{Tools: tools.NewTools()}

@x2d7 x2d7 merged commit 4e17e74 into dev Feb 22, 2026
1 check passed
@x2d7 x2d7 deleted the chat-consistent-constructor branch February 22, 2026 12:49
@x2d7 x2d7 added the refactor label Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant