(2) GO Lang-source code structure

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.




The standard go code base contains a large number of packages, and most will be installed with the go. Liu
View the $goroot/src/pkg directory and look at those packages will be very inspiring. cannot be explained for each package, but the next
These are worth discussing:
FMT
Package FMT implements formatted I/O functions, similar to C's printf and scanf. Formatting phrases derived from C
。 Some phrases (%-sequences) are used like this:
%v
The default format value. When the structure is printed, the plus sign (%+V) increases the field name;
% #v
Go-style value expression;
%T
A value expression with a type of go style;
io
This package provides the original I/O operation interface. Its primary task is to seal the original I/O to the OS package
Add some other correlation, so that it has abstract functionality for use on public interfaces.
Bufio
This package implements buffered I/O. It is encapsulated in IO. Reader and IO. Writer object, creating another object
(Reader and writer) provide some functionality for text I/O while providing buffering.
Sort
The sort package provides the original sorting functionality for arrays and user-defined collections.


StrConv
The StrConv package provides the conversion of a string to a base data type, or a conversion from a base data type to a string
The function.
OS
The OS package provides an interface to the platform-independent operating system functionality. Its design is in the form of UNIX.
Sync
The sync package provides a basic synchronization primitive, such as a mutex.
Flag
The flag package implements command-line parsing. See "Command-Line arguments" on page 92nd.
JSON
The JSON package implements the JSON object defined by encoding and decoding RFC 4627 [22].
Template
A data-driven template for generating text output, such as HTML.
The template is associated to a data structure for parsing. The template content points to the elements of the data structure (usually
A field or map key) controls parsing and determines that a value is displayed. The template scans the structure for parsing, and
The "cursor" @ determines the value of the current position in the structure.
http
HTTP implements HTTP request, response, and URL parsing, and provides extensible HTTP service and basic
HTTP client.
unsafe
The unsafe package contains all unsafe operations on the data type in the GO program. This is not usually necessary.
reflect
The reflect package implements run-time reflection, allowing the program to manipulate objects through abstract types. Typically used to handle static classes
Type interface{}, and the dynamic type information is resolved through typeof, usually returning a connected
The type of the port. Contains a pointer to a type, *structtype, *inttype, and so on, describing
More information about the underlying type. Can be used for type conversions or type assignments. See 6, section "Introspection and reflection"
Section.
exec
The Exec package executes the external command.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.