Golang builtin Package

Golang | builtin Package: Here, we are going to learn about the Golang builtin package, its constants, variables, and functions with examples.

In Go language, the builtin package provides documentation for Go's predeclared identifiers. The items documented here are not actually in package builtin but their descriptions here allow godoc to present documentation for the language's special identifiers.

To use these builtin package constants, variables, and function – there is no need to import any package.

List of Golang builtin constants, variables, and functions

The following are the built-in constants, variables, and functions,


Constants Description
true, false The true and false are the two untyped boolean values, these are boolean constants.
iota It is a untyped int type of value that is a predeclared identifier (represents the untyped integer ordinal number of the current const specification in a (usually parenthesized) const declaration). It is zero-indexed.


Variables Description
nil It is a predeclared identifier representing the zero value for many types such as a pointer, channel, func, interface, map, or slice type.


Functions Descriptions
append() It is used to append elements to the end of a slice and returns an updated slice.
cap() It is used to get the capacity of the given slice.
close() It is used to close a channel, and the channel must be either bidirectional or send-only and should be executed only by the sender, never the receiver, and has the effect of shutting down the channel after the last sent value is received.
complex() It is used to construct a complex value from two floating-point values. The real and imaginary parts of the complex value must be of the same size (either float32 or float64), and the return value will be the corresponding complex type.
copy() It is used to copy the elements from a source slice into a destination slice and returns the number of copied elements copied.
delete() It is used to delete the element with the specified key from the map. If the map is nil or an empty map, delete is a no-op.
imag() It is used to get the imaginary part of the given complex number.
len() It is used to get the length of the given parameter, according to its type.
make() It is used to allocate and initializes an object of type slice, map, or chan (only). The return type of the make() function is the same as the type of its argument, not a pointer to it.


Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.