Package builtin

import "builtin"

Overview

Index

Overview ▾

Package builtin 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.

Index ▾

Constants

func append(slice []Type, elems ...Type) []Type

func cap(v Type) int

func close(c chan<- Type)

func complex(r, i FloatType) ComplexType

func copy(dst, src []Type) int

func delete(m map[Type]Type1, key Type)

func imag(c ComplexType) FloatType

func len(v Type) int

func make(Type, size IntegerType) Type

func new(Type) *Type

func panic(v interface{})

func real(c ComplexType) FloatType

func recover() interface{}

type ComplexType

type FloatType

type IntegerType

type Type

type Type1

type bool

type byte

type complex128

type complex64

type error

type float32

type float64

type int

type int16

type int32

type int64

type int8

type rune

type string

type uint

type uint16

type uint32

type uint64

type uint8

type uintptr

Package files

builtin.go

Constants

const (
true = 0 == 0 // Untyped bool.
false = 0 != 0 // Untyped bool.
)

true and false are the two untyped boolean values.

const iota = 0 // Untyped int.

iota is a predeclared identifier representing the untyped integer ordinal number of the current const specification in a (usually parenthesized) const declaration. It is zero-indexed.

func append

func append(slice []Type, elems ...Type) []Type

The append built-in function appends elements to the end of a slice. If it has sufficient capacity, the destination is resliced to accommodate the new elements. If it does not, a new underlying array will be allocated. Append returns the updated slice. It is therefore necessary to store the result of append, often in the variable holding the slice itself:

slice = append(slice, elem1, elem2)
slice = append(slice, anotherSlice...)

As a special case, it is legal to append a string to a byte slice, like this:

slice = append([]byte("hello "), "world"...)

func cap

func cap(v Type) int

The cap built-in function returns the capacity of v, according to its type:

Array: the number of elements in v (same as len(v)).
Pointer to array: the number of elements in *v (same as len(v)).
Slice: the maximum length the slice can reach when resliced;
if v is nil, cap(v) is zero.
Channel: the channel buffer capacity, in units of elements;
if v is nil, cap(v) is zero.

func close

func close(c chan<- Type)

The close built-in function closes a channel, which must be either bidirectional or send-only. It 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. After the last value has been received from a closed channel c, any receive from c will succeed without blocking, returning the zero value for the channel element. The form

x, ok := <-c

will also set ok to false for a closed channel.

func complex

func complex(r, i FloatType) ComplexType

The complex built-in function constructs a complex value from two floating-point values. The real and imaginary parts must be of the same size, either float32 or float64 (or assignable to them), and the return value will be the corresponding complex type (complex64 for float32, complex128 for float64).

func copy

func copy(dst, src []Type) int

The copy built-in function copies elements from a source slice into a destination slice. (As a special case, it also will copy bytes from a string to a slice of bytes.) The source and destination may overlap. Copy returns the number of elements copied, which will be the minimum of len(src) and len(dst).

func delete

func delete(m map[Type]Type1, key Type)

The delete built-in function deletes the element with the specified key (m[key]) from the map. If m is nil or there is no such element, delete is a no-op.

func imag

func imag(c ComplexType) FloatType

The imag built-in function returns the imaginary part of the complex number c. The return value will be floating point type corresponding to the type of c.

func len

func len(v Type) int

The len built-in function returns the length of v, according to its type:

Array: the number of elements in v.
Pointer to array: the number of elements in *v (even if v is nil).
Slice, or map: the number of elements in v; if v is nil, len(v) is zero.
String: the number of bytes in v.
Channel: the number of elements queued (unread) in the channel buffer;
if v is nil, len(v) is zero.

func make

func make(Type, size IntegerType) Type

The make built-in function allocates and initializes an object of type slice, map, or chan (only). Like new, the first argument is a type, not a value. Unlike new, make's return type is the same as the type of its argument, not a pointer to it. The specification of the result depends on the type:

Slice: The size specifies the length. The capacity of the slice is
equal to its length. A second integer argument may be provided to
specify a different capacity; it must be no smaller than the
length, so make([]int, 0, 10) allocates a slice of length 0 and
capacity 10.
Map: An initial allocation is made according to the size but the
resulting map has length 0. The size may be omitted, in which case
a small starting size is allocated.
Channel: The channel's buffer is initialized with the specified
buffer capacity. If zero, or the size is omitted, the channel is
unbuffered.

func new

func new(Type) *Type

The new built-in function allocates memory. The first argument is a type, not a value, and the value returned is a pointer to a newly allocated zero value of that type.

func panic

func panic(v interface{})

The panic built-in function stops normal execution of the current goroutine. When a function F calls panic, normal execution of F stops immediately. Any functions whose execution was deferred by F are run in the usual way, and then F returns to its caller. To the caller G, the invocation of F then behaves like a call to panic, terminating G's execution and running any deferred functions. This continues until all functions in the executing goroutine have stopped, in reverse order. At that point, the program is terminated and the error condition is reported, including the value of the argument to panic. This termination sequence is called panicking and can be controlled by the built-in function recover.

func real

func real(c ComplexType) FloatType

The real built-in function returns the real part of the complex number c. The return value will be floating point type corresponding to the type of c.

func recover

func recover() interface{}

The recover built-in function allows a program to manage behavior of a panicking goroutine. Executing a call to recover inside a deferred function (but not any function called by it) stops the panicking sequence by restoring normal execution and retrieves the error value passed to the call of panic. If recover is called outside the deferred function it will not stop a panicking sequence. In this case, or when the goroutine is not panicking, or if the argument supplied to panic was nil, recover returns nil. Thus the return value from recover reports whether the goroutine is panicking.

type ComplexType

type ComplexType complex64

ComplexType is here for the purposes of documentation only. It is a stand-in for either complex type: complex64 or complex128.

type FloatType

type FloatType float32

FloatType is here for the purposes of documentation only. It is a stand-in for either float type: float32 or float64.

type IntegerType

type IntegerType int

IntegerType is here for the purposes of documentation only. It is a stand-in for any integer type: int, uint, int8 etc.

type Type

type Type int

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 invocation.

var nil Type // Type must be a pointer, channel, func, interface, map, or slice type

nil is a predeclared identifier representing the zero value for a pointer, channel, func, interface, map, or slice type.

type Type1

type Type1 int

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 invocation.

type bool

type bool bool

bool is the set of boolean values, true and false.

type byte

type byte byte

byte is an alias for uint8 and is equivalent to uint8 in all ways. It is used, by convention, to distinguish byte values from 8-bit unsigned integer values.

type complex128

type complex128 complex128

complex128 is the set of all complex numbers with float64 real and imaginary parts.

type complex64

type complex64 complex64

complex64 is the set of all complex numbers with float32 real and imaginary parts.

type error

type error interface {
Error() string
}

The error built-in interface type is the conventional interface for representing an error condition, with the nil value representing no error.

type float32

type float32 float32

float32 is the set of all IEEE-754 32-bit floating-point numbers.

type float64

type float64 float64

float64 is the set of all IEEE-754 64-bit floating-point numbers.

type int

type int int

int is a signed integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, int32.

type int16

type int16 int16

int16 is the set of all signed 16-bit integers. Range: -32768 through 32767.

type int32

type int32 int32

int32 is the set of all signed 32-bit integers. Range: -2147483648 through 2147483647.

type int64

type int64 int64

int64 is the set of all signed 64-bit integers. Range: -9223372036854775808 through 9223372036854775807.

type int8

type int8 int8

int8 is the set of all signed 8-bit integers. Range: -128 through 127.

type rune

type rune rune

rune is an alias for int32 and is equivalent to int32 in all ways. It is used, by convention, to distinguish character values from integer values.

type string

type string string

string is the set of all strings of 8-bit bytes, conventionally but not necessarily representing UTF-8-encoded text. A string may be empty, but not nil. Values of string type are immutable.

type uint

type uint uint

uint is an unsigned integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, uint32.

type uint16

type uint16 uint16

uint16 is the set of all unsigned 16-bit integers. Range: 0 through 65535.

type uint32

type uint32 uint32

uint32 is the set of all unsigned 32-bit integers. Range: 0 through 4294967295.

type uint64

type uint64 uint64

uint64 is the set of all unsigned 64-bit integers. Range: 0 through 18446744073709551615.

type uint8

type uint8 uint8

uint8 is the set of all unsigned 8-bit integers. Range: 0 through 255.

type uintptr

type uintptr uintptr

uintptr is an integer type that is large enough to hold the bit pattern of any pointer.

Go - 内置函数大全的更多相关文章

  1. Orace内置函数大全[转:http://www.cnblogs.com/lfx0692/articles/2395950.html]

    NewProgramer   Oracle SQL 内置函数大全(转) SQL中的单记录函数 1.ASCII 返回与指定的字符对应的十进制数;SQL> select ascii('A') A,a ...

  2. python3内置函数大全(顺序排列)

    python3内置函数大全 内置函数 (1)abs(),   绝对值或复数的模 1 print(abs(-6))#>>>>6 (2)all() 接受一个迭代器,如果迭代器的所有 ...

  3. python内置函数大全(分类)

    python内置函数大全 python内建函数 最近一直在看python的document,打算在基础方面重点看一下python的keyword.Build-in Function.Build-in ...

  4. mysql 内置函数大全 mysql内置函数大全

    mysql 内置函数大全 2013年01月15日 19:02:03 阅读数:4698 对于针对字符串位置的操作,第一个位置被标记为1. ASCII(str) 返回字符串str的最左面字符的ASCII代 ...

  5. Python 集合内置函数大全(非常全!)

    Python集合内置函数操作大全 集合(s).方法名 等价符号 方法说明 s.issubset(t) s <= t 子集测试(允许不严格意义上的子集):s 中所有的元素都是 t 的成员   s ...

  6. (MariaDB)MySQL内置函数大全

    html { font-family: sans-serif } body { margin: 0 } article,aside,details,figcaption,figure,footer,h ...

  7. 【学习笔记】--- 老男孩学Python,day14 python内置函数大全

    参考:  https://www.cnblogs.com/pyyu/p/6702896.html http://www.runoob.com/python3/python3-built-in-func ...

  8. python类与对象的内置函数大全(BIF)

    关于类与对象的一些常用BIF(内置函数) 1.issubclass(class,classinfo) 含义:如果class是classinfo的子类,则返回True,否则返回false,用来判断子类关 ...

  9. python3内置函数大全

    由于面试的时候有时候会问到python的几个基本内置函数,由于记不太清,就比较难受,于是呕心沥血总结了一下python3的基本内置函数 Github源码:        https://github. ...

  10. python 之 内置函数大全

    一.罗列全部的内置函数 戳:https://docs.python.org/2/library/functions.html 二.range.xrange(迭代器) 无论是range()还是xrang ...

随机推荐

  1. POJ 2559 Largest Rectangle in a Histogram(单调栈)

    传送门 Description A histogram is a polygon composed of a sequence of rectangles aligned at a common ba ...

  2. 第二次作业——C++学习

    课程选择: 以往在自学的过程就比较留意一些自学的网站,所以这次"C++自学"感觉找课程还是比较轻松的. 因为之前网页等学习都是在慕课网(视频学习个人感觉有时挺费时间的,特别是有时以 ...

  3. 数据库中Count是什么意思和SUM有什么区别?

    今天早上在做数据库的练习, 我是这样写的: 得出是: 后来才知道是: 结果是: 后来我意识到区别,于是查资料得到: 数据库中的count,是用来统计你查询出来的记录数,比如学生表中有十条记录:sele ...

  4. maven工程直接部署在tomcat上

    http://www.cnblogs.com/guodefu909/p/4874549.html (现在用的是第三点.)

  5. css3之自定义字体

    使用@font-face自定义字体 我们在浏览国外的一些个人网站时,总是可以发现一些非常个性的字体,比如

  6. mybatis的批量删除

    公司工程用的是Mybatis的example的类,自动生成了对数据库的操作,批量操作的今天用到了,两种方式,一种需要拓展它生成的类,另一种自带的. 批量删除的id是以集合List传递 id以List& ...

  7. 【原】ajaxupload.js上传报错处理方法

    相信大家在工作中经常用到文件上传的操作,因为我是搞前端的,所以这里主要是介绍ajax在前端中的操作.代码我省略的比较多,直接拿js那里的 $.ajaxFileUpload({ url:'www.cod ...

  8. Linux系统信息查看命令大全

    系统# uname -a # 查看内核/操作系统/CPU信息# head -n 1 /etc/issue # 查看操作系统版本# cat /proc/cpuinfo # 查看CPU信息# hostna ...

  9. .Net中使用OracleDataAdapter

    本来只想简单记录一下OracleDataAdapter的批量增加和修改用法的,在园子里看到一篇比较详细的就在这分享了(Oracle Data Provider for .NET),虽然用的是 Upda ...

  10. 虚拟机NUMA和内存KSM

    KSM技术可以合并相同的内存页,即使是不同的NUMA节点,如果需要关闭跨NUMA节点的内存合并,设置/sys/kernel/mm/ksm/merge_across_nodes参数为0.或者可以关闭特定 ...