金庆的专栏

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  423 随笔 :: 0 文章 :: 454 评论 :: 0 Trackbacks
Golang的包名

(金庆的专栏 2018.6)

摘自:

https://talks.golang.org/2014/organizeio.slide#1

The name of a package

Keep package names short and meaningful.
Don't use underscores, they make package names long.

    io/ioutil not io/util
    suffixarray not suffix_array

Don't overgeneralize. A util package could be anything.

The name of a package is part of its type and function names.
On its own, type Buffer is ambiguous. But users see:

    buf := new(bytes.Buffer)

Choose package names carefully.

Choose good names for users.
posted on 2018-06-25 16:51 金庆 阅读(693) 评论(0)  编辑 收藏 引用 所属分类: 3. Golang

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理