关于go:go-const-常量几种好习惯用法

2次阅读

共计 198 个字符,预计需要花费 1 分钟才能阅读完成。

一、把同一类的用 () 括起来

type scope uint8
const (
    scopeInterfaceLocal scope = 0x1
    scopeLinkLocal      scope = 0x2
    scopeAdminLocal     scope = 0x4
    scopeSiteLocal      scope = 0x5
    scopeOrgLocal       scope = 0x8
    scopeGlobal         scope = 0xe
)

这是 go 语言源码包对于 scope 的几种常量设置。

正文完
 0