← 都来码 / Dolaima← 例程索引go/test/sysinfo.go原文

go/test/sysinfo.go · 1519 字节 · 下载原文

// sysinfo.go —— 全能接口 CALLJSON(#573) 自检:调用 sysinfo 并把返回的 JSON 整份打出来。

// sysinfo.go -- self-check for the all-purpose interface CALLJSON(#573): call sysinfo and print the whole returned JSON.


package main

// 显式引用 UI 库:`import "vmlui"` 会**真的去读** `Lib/go/vmlui/vmlui.go`

// Explicitly reference the UI library: `import "vmlui"` actually reads `Lib/go/vmlui/vmlui.go`

// (GenLib 生成、155 个 `ui_*` 声明),把符号登记进编译器的符号表。

// (generated by GenLib, 155 `ui_*` declarations), registering those symbols in the compiler's symbol table.

//

// ⚠ 删掉这一行就**编不过** —— 判据(实测):

// ⚠ Removing this line **fails to compile** - the measured criterion:

//   vmlcli <本文件>  ⇒  error: 未声明的函数 'ui_win_open'(它属于包 'vmlui'…)

//   vmlcli <this file>  =>  error: undeclared function 'ui_win_open' (it belongs to package 'vmlui' ...)

// 所以它是**强制**的,不是文档级的摆设。

// so it is **mandatory**, not documentation-only.

// ⚠ **2026-10-04 复验仍成立**:/tmp 副本删掉这行后实测 `✘ 编译失败`(本文件报「未声明的函数 'ui_call_json_s'」)。

// ⚠ **still holds on 2026-10-04**: a /tmp copy with this line removed measured `✘ compile failed` (this file reports 「undefined function 'ui_call_json_s'」).

import "vmlui"
func main() {
	ui_call_json_s("sysinfo", "")
	ui_call_json_print()
}