#3644·go-github

在适当的情况下,重构代码库,使用值参数而不是指针

作者: alexandear创建于 2025年7月24日更新于 2026年8月5日
标签enhancementgood first issueBreaking API Change

代码库中的许多方法,例如:

go
func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error)

即使函数不修改输入,也使用指针参数(例如 *RepositoryRelease)。这似乎是一种约定或复制粘贴的结果,而不是基于性能的选择。

内容来源: google/go-github