Show HN:Proton – 一个纯 Go、即时模式 GUI 库(零 CGO)
2 分•作者: CzaxTanmay•3 个月前
大家好,
我一直在开发 Proton,旨在解决 Go 生态系统中一个特定的痛点:在不牺牲“Web 开发”的便利性或 CGO 的复杂性的情况下,构建原生 GUI。
如果您尝试过使用 Go 构建桌面应用程序,您很可能经历过 CGO 依赖、臃肿的构建流程,或者感觉自己只是在编写一个简单的浏览器封装器所带来的挫败感。
Proton 旨在通过一种简洁、纯 Go 的方法来解决这个问题:
* **零 CGO:** 可在任何机器上无缝地交叉编译到 Windows 和 macOS。
* **立即模式 API:** 无需 `setState`,无需复杂的组件树,也无需 XML。您只需编写绘制函数,它就会在每一帧运行。
* **API 免疫:** 公共 API 与底层渲染引擎(基于 Gio 构建)隔离。即使后端发生变化,您的代码也无需修改。
* **全功能集:** 包括输入、列表、覆盖层、警报以及 46 种内置主题(或轻松自定义十六进制颜色样式)。
该项目目前正在为 v0.4.0 进行开发,但它已经足够稳定,可以用于跨平台应用程序,甚至开箱即用地支持 Android 部署。
我非常希望能听到您的想法,特别是如果您一直在寻找一种更“Go 原生”的方式来处理 GUI。
代码库:https://github.com/CzaxStudio/proton
查看原文
Hi everyone,<p>I’ve been building Proton to solve a specific pain point in the Go ecosystem: building native GUIs without the "web dev" trade-offs or CGO complexity.<p>If you’ve tried to build desktop apps in Go, you’ve likely dealt with the frustration of CGO dependencies, bloated build pipelines, or feeling like you’re just writing a thin wrapper around a browser.<p>Proton aims to fix this with a clean, pure-Go approach:<p>Zero CGO: Cross-compile to Windows and macOS seamlessly from any machine.<p>Immediate-Mode API: No setState, no complex component trees, and no XML. You just write your draw function, and it runs every frame.<p>API Immunity: The public API is shielded from the underlying rendering engine (built on top of Gio). If the backend changes, your code remains untouched.<p>Full Feature Set: Includes inputs, lists, overlays, alerts, and 46 built-in themes (or easy custom hex-code styling).<p>It’s currently in development for v0.4.0, but it’s stable enough for cross-platform apps and even supports Android deployment out of the box.<p>I’d love to hear what you think, especially if you’ve been looking for a more "Go-native" way to handle GUIs.<p>Repo: <a href="https://github.com/CzaxStudio/proton" rel="nofollow">https://github.com/CzaxStudio/proton</a>