小红花·文摘
首页
广场
排行榜
🏆
直播
FAQ
首页
详情
sulinehk's blog
·
2024-03-12T03:37:46Z
Golang 1.22 语言规范改动
💡
原文中文,约1800字,阅读约需5分钟。
📝
内容提要
Golang 1.22语言规范变更:默认修复了循环变量的意外共享,新增整数范围支持和函数迭代器支持。
🎯
关键要点
Golang 1.22 默认修复了循环变量的意外共享问题。
在 Go 1.22 中,循环变量每次迭代都会创建新的地址,避免了意外共享。
新增 range 支持整数,可以直接在 range 后面写整数进行循环。
range 支持函数迭代器,允许通过函数实现反向打印切片值的功能。
使用 GOEXPERIMENT=rangefunc 可以启用函数迭代器的支持。
🏷️
标签
1.22
Golang
循环变量
整数范围
语言规范
阅读原文
生成长图
分享链接
已复制链接
➡️
继续阅读
I buried 20 problems in a fake P&L to see if Claude for Small Business could find them
Anthropic launched Claude for Small Business this month, adding native connec...
What Happens When You Give AI Agents the Map of Your Code’s Coverage?
When you ask an AI agent to write a new feature, a good agent will eventually...
Why enterprise AI keeps stalling — and how data streaming could unlock it
Enterprise AI is running into a problem. But it has more to do with data infr...
Rider 2026.2 EAP 3: Cost-effective Agentic Test Coverage, Code Change Previews, GameDev Templates, and NuGet Improvements
JetBrains Rider 2026.2 EAP 3 is out! You can download this version from our w...
雨云 浙江绍兴BGP 100G高防VPS,2核4G 100兆 仅需77元/月
雨云浙江绍兴BGP高防VPS,2核4G,年付叠加优惠后仅77.28元/月。采用AMD EPYC处理器,性能出色。产品分大带宽限流量与不限流量型,用完流量会...
Gemma 4的简易代理工具调用
In this tutorial, we will give Gemma 4 two new tools and watch the model deci...
👤 个人中心
在公众号发送验证码完成验证
去登录
登录验证
在本设备完成一次验证即可继续使用
×
完成下面两步后,将自动完成登录并继续当前操作。
1
关注公众号
小红花技术领袖
如果当前 App 无法识别二维码,请在
微信
搜索并关注该公众号
2
发送验证码
在公众号对话中发送下面 4 位验证码