Golang的包名

匿名 (未验证) 提交于 2019-12-03 00:34:01

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.

文章来源: Golang的包名
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!