Go文档查看帮助很方便,主要可以通过以下两种方式查看
第一种,Go本地运行(参考:#Go语言安装#)起来后,References下面:
Package
Go标准函数库说明。
Command
Go工具说明。
Language Specification
Go官方语言规范说明。
第二种,命令行中执行查看,如
godoc image NewRGBA
文档说明 image.NewRGBA()函数功能,输出结果如下:
PACKAGE
package image
import "image"TYPES
type RGBA struct {
// Pix holds the image's pixels, in R, G, B, A order. The pixel at
// (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*4].
Pix []uint8
// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
Stride int
// Rect is the image's bounds.
Rect Rectangle
}
RGBA is an in-memory image whose At method returns color.RGBA values.func NewRGBA(r Rectangle) *RGBA
NewRGBA returns a new RGBA with the given bounds.SUBDIRECTORIES
color
draw
gif
jpeg
pnggodoc image/png
输出整个 image/png包,输出结果如下:
PACKAGE
package png
import "image/png"Package png implements a PNG image decoder and encoder.
The PNG specification is at http://www.w3.org/TR/PNG/.
FUNCTIONS
func Decode(r io.Reader) (image.Image, error)
Decode reads a PNG image from r and returns it as an image.Image. The
type of Image returned depends on the PNG contents.func DecodeConfig(r io.Reader) (image.Config, error)
DecodeConfig returns the color model and dimensions of a PNG image
without decoding the entire image.func Encode(w io.Writer, m image.Image) error
Encode writes the Image m to w in PNG format. Any Image may be encoded,
but images that are not image.NRGBA might be encoded lossily.TYPES
type FormatError string
A FormatError reports that the input is not a valid PNG.func (e FormatError) Error() string
type UnsupportedError string
An UnsupportedError reports that the input uses a valid but
unimplemented PNG feature.func (e UnsupportedError) Error() string