true/false判断
当明确expr为bool类型时,禁止使用==或!=与true/false比较,应该使用expr或!expr
当明确expr为整型时,禁止使用!expr,应该使用expr == 0
Receiver
Receiver Type
{RULE003} 如果receiver是map、函数或者chan类型,类型不可以是指针
{RULE004} 如果receiver是slice,并且方法不会进行reslice或者重新分配slice,类型不可以是指针
{RULE005} 如果receiver是struct,且包含sync.Mutex类型字段,则必须使用指针避免拷贝。
命名
简短有意义
func (c Client) done() error {
}
Layout
golang程序结构
/* Copyright 2015 Baidu Inc. All Rights Reserved. */
/* bfe_server.go - the main structure of bfe-server */
/*
modification history
--------------------
2014/6/5, by Zhang San, create
*/
/*
DESCRIPTION
This file contains the most important struct 'BfeServer' of go-bfe and new/init method of the struct.
*/
package bfe_server
// imports
<