主页 | Web版 | 订阅 | 归档 | Feed

GopherDaily

20250826

每日一谚:Go is not magical


Go技术生态

告别性能猜谜:一份Go并发操作的成本层级清单
最近,我读到一篇5年前的,名为《A Concurrency Cost Hierarchy》的C++性能分析文章,该文通过精妙的实验,为并发操作的性能成本划分了六个清晰的、成本呈数量级递增的层级。这个模型如同一份性能地图, 为我们提供了告别猜谜、走向系统化优化的钥匙。

Go 中的默认方法
Go 的接口非常有趣。 它们不是像 Java 或 Rust 中那样显式实现的,而仅仅是具体类型必须碰巧拥有的方法(“方法集”)的集合。 这被称为结构类型,与标称类型相反。 Go 接口非常可爱,但这种概念上的简单性导致了很多实现问题(老实说,这是 Go 的一个主题)。 它消除了很多来自实现接口的意图,而且没有规范的方法来记录 A 满足 B,您也无法避免符合接口,尤其是一个接口在您身上强制使用特定方法时。 对于语言运行时,它也有非常奇怪的结果。 要将接口值转换为另一种接口类型(通过类型断言语法 a.(B)),运行时本质上必须使用反射来遍历 a 的具体类型的方法集。 我在这里详细介绍了如何实现这一点。 由于其结构性质,这也意味着您无法在不破坏现有代码的情况下向接口添加新方法,因为无法将默认实现附加到接口方法。 这会导致非常愚蠢的 API,因为有人搞砸了接口。

用 Go 制作游戏:3 个月没有 LLM vs 3 天有 LLM!
作者分享了他使用Go语言制作卡牌游戏的经验,对比了在没有LLM(大型语言模型)和使用LLM的情况下开发游戏的速度差异。他用3个月的时间在没有LLM的情况下制作了Truco游戏,而使用LLM则在3天内完成了Escoba游戏的开发。文章还提供了制作游戏的逐步指南,包括后端和前端的开发,以及使用TinyGo编译WASM的说明。

Fuzz 测试 Go HTTP 服务
作为一名开发人员,您无法预见您的程序或函数可能收到的所有可能输入。 即使您可以定义主要的极端情况,您仍然无法预测您的程序在某些奇怪的意外输入的情况下将如何表现。 换句话说,您只能找到您期望找到的错误。 这就是模糊测试或模糊测试发挥作用的地方。

Atomic vs Mutex vs Cond vs Channels: Benchmarking the Hot Path with Go Primitives
选择适合您用例的同步原语并非工作的终点。在大多数系统中,同步机制最终会成为瓶颈。许多开发人员认为,除非他们构建的系统中的每一滴性能都很重要,否则他们对此无能为力。实际上,虽然探索新的同步机制是一种选择,但在许多情况下,所选择的原语可能已经是最合适的,真正的改进必须在其他地方找到。

Introducing MakerCAD
MakerCAD是一款针对创客的新型CAD软件。它是免费的开源软件,由创客为其他所有创客设计。MakerCAD目前包括以下功能:创建基本图形、布尔运算、在表面/平面上绘图、2D约束求解、拉伸和旋转、拓扑探索、倒角和倒圆角、模型导出以及用Golang进行开发等。

云原生技术

Use Envoy Gateway as the Unified Ingress Gateway and Waypoint Proxy for Ambient Mesh
在本文中,我们将探讨如何将 Envoy Gateway(一个 Envoy 项目开源解决方案)与 Istio 结合使用,以便在 Ambient 模式下运行。 这使您可以轻松利用 Envoy 的 L7 功能,通过易于使用的 CRD 来管理网格中的 Ingress 和东西向流量。

杰克·多西的 Vibe 编程技巧
从观察杰克·多尔西使用 AI 工具进行 Vibe 编程中获得的见解

理解和减轻微服务中的高能耗问题
由于分布式开销,微服务通常比单体应用消耗更多的能源。架构师可以做出改进可持续性的设计决策。本文介绍了几种技术,例如定义清晰的服务边界、优化服务粒度、使用节能的部署区域以及整合工作负载。

开发者阻塞
Writer’s block is the paralysis induced by a blank page, but software developers experience a similar block and it can even get worse over time. 让我们来看看不同类型的开发者阻塞、导致它们的原因以及如何解决阻塞问题。

An Illustrated Guide to OAuth - by Aditya Bhargava
OAuth was first introduced in 2007.

Linux 上 NTP 精度的限制
最近,我一直在尝试寻找(并理解)Linux 系统之间的时间同步的限制。你能获得多高的精度?需要什么才能实现这一点?哪些因素容易增加可测量的时间误差?经过大约一个月的时间 (!),我开始理解一些事情。

AI

如何修复你的上下文
关于修复上下文和交付更好的代理的 6 种策略。正如 Karpathy 所说,构建由 LLM 驱动的应用程序意味着学习“正确打包上下文窗口”——智能地部署工具、管理信息和维护上下文卫生。

流行工具与项目

0xJacky/nginx-ui
Yet another WebUI for Nginx

kedacore/keda
KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes

stretchr/testify
A toolkit with common assertions and mocks that plays nicely with the standard library

open-telemetry/opentelemetry-collector
OpenTelemetry Collector

ibnaleem/gosearch
🔍 Search anyone's digital footprint across 300+ websites

argoproj/argo-cd
Declarative Continuous Deployment for Kubernetes

google/pprof
pprof is a tool for visualization and analysis of profiling data

open-policy-agent/opa
Open Policy Agent (OPA) is an open source, general-purpose policy engine.

vitessio/vitess
Vitess is a database clustering system for horizontal scaling of MySQL.

go-playground/validator
💯Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving

testcontainers/testcontainers-go
Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.

kopia/kopia
Cross-platform backup tool for Windows, macOS & Linux with fast, incremental backups, client-side end-to-end encryption, compression and data deduplication. CLI and GUI included.

gdy666/lucky
软硬路由公网神器,ipv6/ipv4 端口转发,反向代理,DDNS,WOL,ipv4 stun内网穿透,cron,acme,阿里云盘,ftp,webdav,filebrowser

openbao/openbao
OpenBao exists to provide a software solution to manage, store, and distribute sensitive data including secrets, certificates, and keys.

grafana/mimir
Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.

goharbor/harbor
An open source trusted cloud native registry project that stores, signs, and scans content.

karmada-io/karmada
Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration

k3s-io/k3s
Lightweight Kubernetes

bytedance/sonic
A blazingly fast JSON serializing & deserializing library

jackc/pgx
PostgreSQL driver and toolkit for Go

grpc/grpc-go
The Go language implementation of gRPC. HTTP/2 based RPC

juicedata/juicefs
JuiceFS is a distributed POSIX file system built on top of Redis and S3.


编辑:Tony Bai

编辑主页:tonybai.com

GopherDaily项目:github.com/bigwhite/gopherdaily

Copyright 2019-2024 GopherDaily