Skip to content

空struct引发的一些探索 | 朱晓峰 #9

Description

@shafferjohn

https://shaffer.cn/golang/insights-into-empty-struct/

背景偶然发现项目代码中有如下的写法: 12345678type Student struct { Name string Age int}func NewStudent(s Student) *Student { return &s} 我们且不去探讨“这样写法有什么作用”、“为什么要这样写”,我们先就代码本身讨论。 众所周知,从严格意义上来说,go

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions