1.14 لیست تایپ ها و توابع Builtin

1.14 لیست تایپ ها و توابع Builtin

در زیر لیست تایپ ها و توابع Builtin تا نسخه ۱.۱۹ را با توضیحات قرار دادیم.

  1// bool is the set of boolean values, true and false.  
  2type bool bool  
  3  
  4// true and false are the two untyped boolean values.  
  5const (  
  6   true  = 0 == 0 // Untyped bool.  
  7   false = 0 != 0 // Untyped bool.  
  8)  
  9  
 10// uint8 is the set of all unsigned 8-bit integers.  
 11// Range: 0 through 255.  
 12type uint8 uint8  
 13  
 14// uint16 is the set of all unsigned 16-bit integers.  
 15// Range: 0 through 65535.  
 16type uint16 uint16  
 17  
 18// uint32 is the set of all unsigned 32-bit integers.  
 19// Range: 0 through 4294967295.  
 20type uint32 uint32  
 21  
 22// uint64 is the set of all unsigned 64-bit integers.  
 23// Range: 0 through 18446744073709551615.  
 24type uint64 uint64  
 25  
 26// int8 is the set of all signed 8-bit integers.  
 27// Range: -128 through 127.  
 28type int8 int8  
 29  
 30// int16 is the set of all signed 16-bit integers.  
 31// Range: -32768 through 32767.  
 32type int16 int16  
 33  
 34// int32 is the set of all signed 32-bit integers.  
 35// Range: -2147483648 through 2147483647.  
 36type int32 int32  
 37  
 38// int64 is the set of all signed 64-bit integers.  
 39// Range: -9223372036854775808 through 9223372036854775807.  
 40type int64 int64  
 41  
 42// float32 is the set of all IEEE-754 32-bit floating-point numbers.  
 43type float32 float32  
 44  
 45// float64 is the set of all IEEE-754 64-bit floating-point numbers.  
 46type float64 float64  
 47  
 48// complex64 is the set of all complex numbers with float32 real and  
 49// imaginary parts.  
 50type complex64 complex64  
 51  
 52// complex128 is the set of all complex numbers with float64 real and  
 53// imaginary parts.  
 54type complex128 complex128  
 55  
 56// string is the set of all strings of 8-bit bytes, conventionally but not  
 57// necessarily representing UTF-8-encoded text. A string may be empty, but  
 58// not nil. Values of string type are immutable.  
 59type string string  
 60  
 61// int is a signed integer type that is at least 32 bits in size. It is a  
 62// distinct type, however, and not an alias for, say, int32.  
 63type int int  
 64  
 65// uint is an unsigned integer type that is at least 32 bits in size. It is a  
 66// distinct type, however, and not an alias for, say, uint32.  
 67type uint uint  
 68  
 69// uintptr is an integer type that is large enough to hold the bit pattern of  
 70// any pointer.  
 71type uintptr uintptr  
 72  
 73// byte is an alias for uint8 and is equivalent to uint8 in all ways. It is  
 74// used, by convention, to distinguish byte values from 8-bit unsigned  
 75// integer values.  
 76type byte = uint8  
 77  
 78// rune is an alias for int32 and is equivalent to int32 in all ways. It is  
 79// used, by convention, to distinguish character values from integer values.  
 80type rune = int32  
 81  
 82// any is an alias for interface{} and is equivalent to interface{} in all ways.  
 83type any = interface{}  
 84  
 85// comparable is an interface that is implemented by all comparable types  
 86// (booleans, numbers, strings, pointers, channels, arrays of comparable types,  
 87// structs whose fields are all comparable types).  
 88// The comparable interface may only be used as a type parameter constraint,  
 89// not as the type of a variable.  
 90type comparable interface{ comparable }  
 91  
 92// iota is a predeclared identifier representing the untyped integer ordinal  
 93// number of the current const specification in a (usually parenthesized)  
 94// const declaration. It is zero-indexed.  
 95const iota = 0 // Untyped int.  
 96  
 97// nil is a predeclared identifier representing the zero value for a  
 98// pointer, channel, func, interface, map, or slice type.  
 99var nil Type // Type must be a pointer, channel, func, interface, map, or slice type  
100// Type is here for the purposes of documentation only. It is a stand-in// for any Go type, but represents the same type for any given function  
101// invocation.  
102type Type int  
103  
104// Type1 is here for the purposes of documentation only. It is a stand-in// for any Go type, but represents the same type for any given function  
105// invocation.  
106type Type1 int  
107  
108// IntegerType is here for the purposes of documentation only. It is a stand-in// for any integer type: int, uint, int8 etc.  
109type IntegerType int  
110  
111// FloatType is here for the purposes of documentation only. It is a stand-in// for either float type: float32 or float64.  
112type FloatType float32  
113  
114// ComplexType is here for the purposes of documentation only. It is a// stand-in for either complex type: complex64 or complex128.  
115type ComplexType complex64  
116  
117// The append built-in function appends elements to the end of a slice. If  
118// it has sufficient capacity, the destination is resliced to accommodate the  
119// new elements. If it does not, a new underlying array will be allocated.  
120// Append returns the updated slice. It is therefore necessary to store the  
121// result of append, often in the variable holding the slice itself:  
122//  
123// slice = append(slice, elem1, elem2)  
124// slice = append(slice, anotherSlice...)  
125//  
126// As a special case, it is legal to append a string to a byte slice, like this:  
127//  
128// slice = append([]byte("hello "), "world"...)  
129func append(slice []Type, elems ...Type) []Type  
130  
131// The copy built-in function copies elements from a source slice into a  
132// destination slice. (As a special case, it also will copy bytes from a  
133// string to a slice of bytes.) The source and destination may overlap. Copy  
134// returns the number of elements copied, which will be the minimum of  
135// len(src) and len(dst).  
136func copy(dst, src []Type) int  
137  
138// The delete built-in function deletes the element with the specified key  
139// (m[key]) from the map. If m is nil or there is no such element, delete  
140// is a no-op.  
141func delete(m map[Type]Type1, key Type)  
142  
143// The len built-in function returns the length of v, according to its type:  
144//  
145// Array: the number of elements in v.  
146// Pointer to array: the number of elements in *v (even if v is nil).  
147// Slice, or map: the number of elements in v; if v is nil, len(v) is zero.  
148// String: the number of bytes in v.  
149// Channel: the number of elements queued (unread) in the channel buffer;  
150//          if v is nil, len(v) is zero.  
151//  
152// For some arguments, such as a string literal or a simple array expression, the  
153// result can be a constant. See the Go language specification's "Length and  
154// capacity" section for details.  
155func len(v Type) int  
156  
157// The cap built-in function returns the capacity of v, according to its type:  
158//  
159// Array: the number of elements in v (same as len(v)).  
160// Pointer to array: the number of elements in *v (same as len(v)).  
161// Slice: the maximum length the slice can reach when resliced;  
162// if v is nil, cap(v) is zero.  
163// Channel: the channel buffer capacity, in units of elements;  
164// if v is nil, cap(v) is zero.  
165//  
166// For some arguments, such as a simple array expression, the result can be a  
167// constant. See the Go language specification's "Length and capacity" section for  
168// details.  
169func cap(v Type) int  
170  
171// The make built-in function allocates and initializes an object of type  
172// slice, map, or chan (only). Like new, the first argument is a type, not a  
173// value. Unlike new, make's return type is the same as the type of its  
174// argument, not a pointer to it. The specification of the result depends on  
175// the type:  
176//  
177// Slice: The size specifies the length. The capacity of the slice is  
178// equal to its length. A second integer argument may be provided to  
179// specify a different capacity; it must be no smaller than the  
180// length. For example, make([]int, 0, 10) allocates an underlying array  
181// of size 10 and returns a slice of length 0 and capacity 10 that is  
182// backed by this underlying array.  
183// Map: An empty map is allocated with enough space to hold the  
184// specified number of elements. The size may be omitted, in which case  
185// a small starting size is allocated.  
186// Channel: The channel's buffer is initialized with the specified  
187// buffer capacity. If zero, or the size is omitted, the channel is  
188// unbuffered.  
189func make(t Type, size ...IntegerType) Type  
190  
191// The new built-in function allocates memory. The first argument is a type,  
192// not a value, and the value returned is a pointer to a newly  
193// allocated zero value of that type.  
194func new(Type) *Type  
195  
196// The complex built-in function constructs a complex value from two  
197// floating-point values. The real and imaginary parts must be of the same  
198// size, either float32 or float64 (or assignable to them), and the return  
199// value will be the corresponding complex type (complex64 for float32,  
200// complex128 for float64).  
201func complex(r, i FloatType) ComplexType  
202  
203// The real built-in function returns the real part of the complex number c.  
204// The return value will be floating point type corresponding to the type of c.  
205func real(c ComplexType) FloatType  
206  
207// The imag built-in function returns the imaginary part of the complex  
208// number c. The return value will be floating point type corresponding to  
209// the type of c.  
210func imag(c ComplexType) FloatType  
211  
212// The close built-in function closes a channel, which must be either  
213// bidirectional or send-only. It should be executed only by the sender,  
214// never the receiver, and has the effect of shutting down the channel after  
215// the last sent value is received. After the last value has been received  
216// from a closed channel c, any receive from c will succeed without  
217// blocking, returning the zero value for the channel element. The form  
218//  
219// x, ok := <-c  
220//  
221// will also set ok to false for a closed and empty channel.  
222func close(c chan<- Type)  
223  
224// The panic built-in function stops normal execution of the current  
225// goroutine. When a function F calls panic, normal execution of F stops  
226// immediately. Any functions whose execution was deferred by F are run in  
227// the usual way, and then F returns to its caller. To the caller G, the  
228// invocation of F then behaves like a call to panic, terminating G's  
229// execution and running any deferred functions. This continues until all  
230// functions in the executing goroutine have stopped, in reverse order. At  
231// that point, the program is terminated with a non-zero exit code. This  
232// termination sequence is called panicking and can be controlled by the  
233// built-in function recover.  
234func panic(v any)  
235  
236// The recover built-in function allows a program to manage behavior of a  
237// panicking goroutine. Executing a call to recover inside a deferred  
238// function (but not any function called by it) stops the panicking sequence  
239// by restoring normal execution and retrieves the error value passed to the  
240// call of panic. If recover is called outside the deferred function it will  
241// not stop a panicking sequence. In this case, or when the goroutine is not  
242// panicking, or if the argument supplied to panic was nil, recover returns  
243// nil. Thus the return value from recover reports whether the goroutine is  
244// panicking.  
245func recover() any  
246  
247// The print built-in function formats its arguments in an  
248// implementation-specific way and writes the result to standard error.  
249// Print is useful for bootstrapping and debugging; it is not guaranteed  
250// to stay in the language.  
251func print(args ...Type)  
252  
253// The println built-in function formats its arguments in an  
254// implementation-specific way and writes the result to standard error.  
255// Spaces are always added between arguments and a newline is appended.  
256// Println is useful for bootstrapping and debugging; it is not guaranteed  
257// to stay in the language.  
258func println(args ...Type)  
259  
260// The error built-in interface type is the conventional interface for  
261// representing an error condition, with the nil value representing no error.  
262type error interface {  
263   Error() string  
264}