Skip to content

feat(content): Add post about rewriting zvm from Go to Zig#115

Merged
jiacai2050 merged 3 commits intozigcc:mainfrom
lispking:main
Apr 15, 2026
Merged

feat(content): Add post about rewriting zvm from Go to Zig#115
jiacai2050 merged 3 commits intozigcc:mainfrom
lispking:main

Conversation

@lispking
Copy link
Copy Markdown
Contributor

Add a new blog post sharing practical experience of rewriting the zvm version manager from Go to Zig.

The post covers:

  • Core architecture and directory structure design (XDG Base Directory)
  • Windows junction vs symlink handling
  • Hand-written CLI parser using std.StaticStringMap
  • Network layer trade-offs (mirror speed test, proxy fallback)
  • Installation details (tar.xz/zip extraction, macOS 26 smoke test)
  • Configuration persistence and string lifetime management
  • Error handling and tagged union patterns in Zig
  • Binary size optimization and CI release matrix

Add a new blog post sharing practical experience of rewriting
the zvm version manager from Go to Zig.

The post covers:
- Core architecture and directory structure design (XDG Base Directory)
- Windows junction vs symlink handling
- Hand-written CLI parser using std.StaticStringMap
- Network layer trade-offs (mirror speed test, proxy fallback)
- Installation details (tar.xz/zip extraction, macOS 26 smoke test)
- Configuration persistence and string lifetime management
- Error handling and tagged union patterns in Zig
- Binary size optimization and CI release matrix
Apply autocorrect fixes to the newly added zvm post for consistent
formatting around operators and punctuation.

Changes:
- Add spaces around the plus operator in mirror speed test description
- Remove extra space before "pragmatic" after a Chinese period
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a blog post documenting the rewrite of the zvm version manager from Go to Zig, highlighting architectural changes, cross-platform challenges, and performance gains. Feedback points out a factual error concerning the macOS Sequoia version number and suggests enhancing the project link's formatting for better readability.

Comment thread content/post/2026-04-15-zvm.smd Outdated
Comment thread content/post/2026-04-15-zvm.smd Outdated
Update the zvm blog post for factual accuracy and cleaner formatting.

Changes:
- Remove incorrect "Sequoia" codename from macOS 26 reference,
  since Sequoia is actually macOS 15
- Convert the project repository link from a blockquote to an
  inline Markdown link for better readability
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new blog post documenting practical lessons learned while rewriting the zvm version manager from Go to Zig, focusing on real-world tooling concerns (filesystem quirks, networking, packaging, memory/error handling, and release engineering).

Changes:

  • Add a long-form post covering architecture decisions (XDG layout, Windows junction handling, CLI parsing).
  • Describe implementation trade-offs for networking, extraction/installation, and post-install verification.
  • Document Zig-specific patterns for config persistence, string lifetimes, error handling, and release optimization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Zig 官方发布的 tar 包解压后是 `zig-macos-x86_64-0.16.0/` 这种长名字,但用户只想看 `0.16.0/`。解压后要重命名。

坑在于:如果用户指定了 `--force` 强制重装,老目录要先删掉。但 deleteTree 是危险操作,万一路径拼接错了把家目录删了就完了。这里加了双重校验:
1. 只删版本号格式的目录(正则匹配 `\\d+\\.\\d+\\.\\d+`)
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline regex example appears double-escaped (\\d+\\.\\d+\\.\\d+). In inline code (not a string literal), this will render with extra backslashes and may confuse readers; consider showing the regex as \d+\.\d+\.\d+ (single escaping) or explicitly stating it’s a string-literal form.

Suggested change
1. 只删版本号格式的目录(正则匹配 `\\d+\\.\\d+\\.\\d+`)
1. 只删版本号格式的目录(正则匹配 `\d+\.\d+\.\d+`)

Copilot uses AI. Check for mistakes.
@jiacai2050 jiacai2050 merged commit 240da42 into zigcc:main Apr 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants