# 02 基本类型

Go支持你对静态语言所预期的所有基本数据类型：

| 类型称呼 | 类型(Type)                                                      | 字面量(Literal)        |
| ---- | ------------------------------------------------------------- | ------------------- |
| 布尔值  | bool                                                          | true, false         |
| 整数   | int, int8, uint8, int16, uint16, int32, uint32, int64, uint64 | 38                  |
| 浮点数  | float64, float32 (浮点数)                                        | 23.5, 2e-12         |
| 字节   | byte (uint8, 1个char)                                          | 'a'                 |
| 符文   | rune (int32, 1个Unicode字符)                                     | 'p'                 |
| 字符串  | string                                                        | "foo", \`bar\`      |
| 常量   | constants                                                     | const a = 8         |
| 结构体  | structs                                                       | type Foo struct {}  |
| 切片   | slice (可变长向量)                                                 | \[]int = {1, -3, 4} |
| 数组   | array (固定长度向量)                                                | \[2]int = {2, -3}   |
| 映射   | map (其他语言中称为字典dict或哈希表hash table)                             | map\[string]int     |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://denglj.gitbook.io/essential-go/02-basic-types.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
