go 註解介紹

語法

/*
   多行註解
*/

// 單航註解

註解撰寫方式

  • 函數的註解開頭要寫函數名稱
package objects

// Object is a generic something.
type Object struct {}

// Bar will bar Object, returning error if un-barable.
func (o Object) Bar() error {
    return nil
}

// List contains all currently registered Objects.
var List []Object

// MaxCount determines maximum number of objects allowed
const MaxCount = 50