Golang的包名

前端之家收集整理的这篇文章主要介绍了Golang的包名前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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.

原文链接:https://www.f2er.com/go/187084.html

猜你在找的Go相关文章