GOLANG_DIGEST Telegram 104
Fixing For Loops in Go 1.22

https://go.dev/blog/loopvar-preview

David Chase и Russ Cox в официальном блоге Go рассказывают про проблему LoopVar (переменной цикла) и приводят конкретные примеры, в том числе из реального кейса проекта - Lets Encrypt.

Затем рассказывают, как именно эта проблема решается. Если кратко:

> change for loops to make these variables have per-iteration scope instead of per-loop scope

Как вы помните, эта фича уже есть в Go v1.21, но её нужно включить:

GOEXPERIMENT=loopvar go test

А в версии 1.22 она уже будет работать по-умолчанию

#go_1_22 #go_official
👍18😢5



tgoop.com/golang_digest/104
Create:
Last Update:

Fixing For Loops in Go 1.22

https://go.dev/blog/loopvar-preview

David Chase и Russ Cox в официальном блоге Go рассказывают про проблему LoopVar (переменной цикла) и приводят конкретные примеры, в том числе из реального кейса проекта - Lets Encrypt.

Затем рассказывают, как именно эта проблема решается. Если кратко:

> change for loops to make these variables have per-iteration scope instead of per-loop scope

Как вы помните, эта фича уже есть в Go v1.21, но её нужно включить:

GOEXPERIMENT=loopvar go test

А в версии 1.22 она уже будет работать по-умолчанию

#go_1_22 #go_official

BY Golang Дайджест




Share with your friend now:
tgoop.com/golang_digest/104

View MORE
Open in Telegram


Telegram News

Date: |

Step-by-step tutorial on desktop: “[The defendant] could not shift his criminal liability,” Hui said. Telegram offers a powerful toolset that allows businesses to create and manage channels, groups, and bots to broadcast messages, engage in conversations, and offer reliable customer support via bots. The public channel had more than 109,000 subscribers, Judge Hui said. Ng had the power to remove or amend the messages in the channel, but he “allowed them to exist.” As five out of seven counts were serious, Hui sentenced Ng to six years and six months in jail.
from us


Telegram Golang Дайджест
FROM American