From a7914062929b9121b7526964379438904370acd7 Mon Sep 17 00:00:00 2001 From: badkaktus Date: Mon, 7 Oct 2019 22:12:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=B0=D0=BD=D0=B0=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples.txt | 2 +- .../channel-directions/channel-directions.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples.txt b/examples.txt index 6a15cb3..1c34ad2 100644 --- a/examples.txt +++ b/examples.txt @@ -23,7 +23,7 @@ Switch Каналы (Channels) Буферизированный канал (Channel Buffering) Синхронизация канала (Channel Synchronization) -Channel Directions +Направления канала (Channel Directions) Select Timeouts Non-Blocking Channel Operations diff --git a/examples/channel-directions/channel-directions.go b/examples/channel-directions/channel-directions.go index 5f2786c..c5f4de0 100644 --- a/examples/channel-directions/channel-directions.go +++ b/examples/channel-directions/channel-directions.go @@ -1,21 +1,21 @@ -// When using channels as function parameters, you can -// specify if a channel is meant to only send or receive -// values. This specificity increases the type-safety of -// the program. +// При использовании каналов в качестве параметров +// функции вы можете указать, предназначен ли канал +// только для отправки или получения значений. Эта +// возможность повышает безопасность программы. package main import "fmt" -// This `ping` function only accepts a channel for sending -// values. It would be a compile-time error to try to -// receive on this channel. +// Функция `ping` принимает канал только для отправки +// значений. При попытке получения значений в этот канал +// в процессе компиляции возниканет ошибка. func ping(pings chan<- string, msg string) { pings <- msg } -// The `pong` function accepts one channel for receives -// (`pings`) and a second for sends (`pongs`). +// Функция `pong` принимает один канал для приема +// (`pings`) и второй для отправки (`pongs`). func pong(pings <-chan string, pongs chan<- string) { msg := <-pings pongs <- msg