The Go standard library contains a large number of packages, providing a wide range of functional features. This provides an overview that is simply selective and very simple. The content of the standard library may continue to grow after this article is published, so it is advisable to get the latest information through an online lookup library API or use Godoc (included in the Go release package) and to fully understand the capabilities of each package.
The EXP package (experimental) is where the packages that may be added to the standard library in the future start, so you should not use the packages below unless you want to participate in the development of these packages (by testing, discussing, submitting patches). The EXP package usually exists only in the source package that is checked out from the Google Go source tree, but is not generally included in the pre-built package. Other packages can be assured to use, although in the writing of this moment, many packages are still not complete.
Archive (archive) and compression (compressed) packages
Go supports reading and writing tarball and. zip files. The packages associated with this are Archive/tar and Archive/zip, and Compress/gzip and compress/bzip2 for compressing tarball.
Go also supports other compression formats, such as the Lempel-ziv-welch (COMPRESS/LZW) format for TIFF images and PDF files.
Bytes (Byte) and string (string) related packages
Bytes and strings packages have many of the same functions, but the former operates on a value of the]byte type, which operates on a string of values. The strings package provides all the most useful functional functions, such as finding substrings, replacing substrings, splitting strings, culling strings, and capitalization transformations. The StrConv package provides the ability to convert numeric and Boolean types to and from string types.
FMT Bag
Provides a number of useful print and scan functions, which are described in the first and second sections of this series of tutorials.
Unicode Package
Provides functions for determining character attributes, such as determining whether a character is printable, or whether it is a number. Unicode/utf8 and UNICODE/UTF16 These two packages provide the encoding and decoding capabilities of rune (i.e. Unicode code points/characters).
Text/template and Html/template Packs
Can be used to create templates that generate text-form output (such as HTML) based on the data that is filled in. Here is a small and simple example of the use of text/template packages.
1 2 3 4 5 6 7 8 9 10 11 12 13-14 |
Type Giniindex struct {Country string Index float64} gini: = []giniindex{{"Japan", 54.7}, {"55.0" }, {"U.S.A." |