Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

hyp chkcomment.md

maoxiaoyue edited this page Apr 14, 2026 · 1 revision

hyp chkcomment — 註解完整性檢查

掃描 Go 原始碼檔案,檢查所有 exported 區塊是否有標準文檔註解。

用法

hyp chkcomment <file.go> # 檢查並報告
hyp chkcomment --fix <file.go> # 自動加入建議註解

Flags

Flag 說明
--fix 自動加入建議註解(建立 .bak 備份)

檢查的區塊

類型 範例
Package package controllers
Type type UserController struct
Func func CreateUser(...)
Method func (ctrl *UserController) Create(...)
Const const MaxItems = 100
Var var ErrNotFound = ...

輸出範例

Comment Check: controllers/user.go
 ✅ package controllers
 ✅ type UserController
 ❌ func Create — missing comment
 Suggested: // Create handles the creation of User
 ❌ func Delete — missing comment
 Suggested: // Delete handles the deletion of User
Result: 2/4 blocks have comments (50%)

Annotation Protocol

檢查器識別 @ai: 標註:

// @ai:constraint max_items=100
// @ai:deprecated use V2 instead
// @ai:security requires_auth
// @ai:impact routes=/api/users
// @ai:owner team=backend

安全

  • 純 AST 分析,不執行程式碼
  • 只接受 .go 檔案,拒絕符號連結
  • --fix 先建立 .bak 備份再修改

相關命令

HypGo

繁體中文 | English


中文文件

設計文件

套件

AI 協作工具鏈

CLI 命令


English Docs

Design Docs

Packages

AI Collaboration Toolchain

CLI Commands

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /