diff --git a/g/internal/cmdenv/cmdenv.go b/g/internal/cmdenv/cmdenv.go index 067310142..9b843ce00 100644 --- a/g/internal/cmdenv/cmdenv.go +++ b/g/internal/cmdenv/cmdenv.go @@ -4,6 +4,7 @@ // If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. +// Package cmdenv provides access to certain variable for both command options and environment. package cmdenv import ( @@ -28,10 +29,13 @@ func init() { } } -// 获取指定名称的命令行参数,当不存在时获取环境变量参数,皆不存在时,返回给定的默认值。 -// 规则: -// 1、命令行参数以小写字母格式,使用: gf.包名.变量名 传递; -// 2、环境变量参数以大写字母格式,使用: GF_包名_变量名 传递; +// Get returns the command line argument of the specified . +// If the argument does not exist, then it returns the environment variable with specified . +// It returns the default value if none of them exists. +// +// Fetching Rules: +// 1. Command line arguments are in lowercase format, eg: gf..; +// 2. Environment arguments are in uppercase format, eg: GF__; func Get(key string, def...interface{}) *gvar.Var { value := interface{}(nil) if len(def) > 0 { diff --git a/g/internal/empty/empty.go b/g/internal/empty/empty.go index a0a31d3d2..bd73c8483 100644 --- a/g/internal/empty/empty.go +++ b/g/internal/empty/empty.go @@ -4,15 +4,16 @@ // If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. +// Package empty provides checks for empty variables. package empty import ( "reflect" ) -// 判断给定的变量是否为空。 -// 整型为0, 布尔为false, slice/map长度为0, 其他为nil的情况,都为空。 -// 为空时返回true,否则返回false。 +// IsEmpty checks whether given empty. +// It returns true if is in: 0, nil, false, "", len(slice/map/chan) == 0. +// Or else it returns true. func IsEmpty(value interface{}) bool { if value == nil { return true diff --git a/g/internal/mutex/mutex.go b/g/internal/mutex/mutex.go index ef041d94c..f16fed5b2 100644 --- a/g/internal/mutex/mutex.go +++ b/g/internal/mutex/mutex.go @@ -4,11 +4,11 @@ // If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. +// Package mutex provides switch for sync.Mutex for concurrent safe feature. package mutex import "sync" -// Mutex的封装,支持对并发安全开启/关闭的控制。 type Mutex struct { sync.Mutex safe bool diff --git a/g/internal/rwmutex/rwmutex.go b/g/internal/rwmutex/rwmutex.go index 62f933192..903275d30 100644 --- a/g/internal/rwmutex/rwmutex.go +++ b/g/internal/rwmutex/rwmutex.go @@ -4,6 +4,7 @@ // If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. +// Package rwmutex provides switch for sync.RWMutex for concurrent safe feature. package rwmutex import "sync" diff --git a/g/util/gpage/gpage.go b/g/util/gpage/gpage.go index d00c3a274..31e18072b 100644 --- a/g/util/gpage/gpage.go +++ b/g/util/gpage/gpage.go @@ -5,8 +5,6 @@ // You can obtain one at https://github.com/gogf/gf. // Package gpage provides useful paging functionality for web pages. -// -// 分页管理. package gpage import (