---
title: 筆記模板
type: note
status: draft
domain: go
lang: zh-Hant
---

容量為 1 的 channel，可以在接收者準備好之前暫存一個值：

```go
ch := make(chan int, 1)
ch <- 42
fmt.Println(<-ch) // 42
```

若在接收前再送一個值，就會阻塞。容量是上限，不是取消機制。

來源：[Go 規格 — Channel types](https://go.dev/ref/spec#Channel_types)。
