{"id":38000968,"url":"https://github.com/0x00b/vscode-go-comment","last_synced_at":"2026-01-16T19:13:11.345Z","repository":{"id":47127038,"uuid":"387666554","full_name":"0x00b/vscode-go-comment","owner":"0x00b","description":"vscode plugin ,  auto generate comment for golang.","archived":false,"fork":false,"pushed_at":"2024-11-19T03:22:17.000Z","size":9403,"stargazers_count":31,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-19T04:24:36.186Z","etag":null,"topics":["autocomment","go","vscode"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0x00b.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-20T03:59:51.000Z","updated_at":"2024-11-19T03:22:20.000Z","dependencies_parsed_at":"2024-11-11T08:19:49.588Z","dependency_job_id":"715c9306-de80-4a27-8961-c72bdca8936e","html_url":"https://github.com/0x00b/vscode-go-comment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0x00b/vscode-go-comment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x00b%2Fvscode-go-comment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x00b%2Fvscode-go-comment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x00b%2Fvscode-go-comment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x00b%2Fvscode-go-comment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0x00b","download_url":"https://codeload.github.com/0x00b/vscode-go-comment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x00b%2Fvscode-go-comment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28481550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autocomment","go","vscode"],"created_at":"2026-01-16T19:13:10.843Z","updated_at":"2026-01-16T19:13:11.339Z","avatar_url":"https://github.com/0x00b.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoComment\n\n\u003c!-- Plugin description --\u003e\n**GoComment** is a VSCode extension that automatically generates comments for GO functions, variables, structs. It can auto fix function name etc.\n使用默认模版可以生成满足golint要求的注释，可以根据函数名的相似度来纠正拼写错误或者修改的函数名，变量名，参数名等。需要注意的是当参数名之间很相似的时候，可能会获取到错误的注释。\n可在vscode扩展插件中搜索 GoComment。\n本仓库(https://github.com/0x00b/vscode-go-comment\n)是vscode版本，对应的goland版本地址 https://github.com/0x00b/golandanno 。\n\u003cbr/\u003e\n\n## \u003ct1\u003eHow to use\u003c/t1\u003e\n+ **control + command + / (For windows: control + alt + /)**\n   \n## config template\n+ 1. shift+command+p -\u003e open setting (`json`)\n+ 2. add line `\"functionTemplate\": \"// ${func_name} \\n//\\t@param ${param_name} \\n//\\t@return ${return_name} \"`,\n+ 3. add line `\"typeTemplate\": \"// ${type_name} \"` \n\n***建议：模板中的缩进使用\\t***\n\n\u003cbr/\u003e\n推荐使用默认注释，满足Golang godoc注释规范，满足golint默认扫描规则。\u003cbr/\u003e\n\n![](resources/intro.gif)\n\n使用godoc查看注释效果如下：\n\n```shell\ngodoc -http=localhost:6060\n```\n![](resources/img_1.png)\n\n![](resources/godoc.gif)\n\n\n\u003c!-- Plugin description end --\u003e\n \n# Getting started\n\n## 模板说明\n如果开启了保存时自动格式化代码，则对模板有一定要求。\n比如下面的模板，可能在保存时会被改变：\n```json\n{\n    \"functionTemplate\": \"// ${func_name} \\n//  @receiver ${receiver_name} \\n//  @param ${param_name} \\n//  @return ${return_name} \\n//  @author ${git_name} \\n//  @date ${date}\",\n}\n```\n原因是第一行的注释是 \"// \", 后面是一个空格，后面的行的注释开头//后面是两个空格，gofmt认为第一行的注释和后面的注释风格不一样，会被gofmt主动加上tab键，导致最终格式变化。\n\n### QA \n为了防止保存时自动格式化不会修改注释的格式，该怎么办？\n\n答案很简单，保持需要挨在一起的行之间使用相同的缩进。\n\n比如下面的注释在保存时会被自动重新格式化，导致图案混乱，图案每一行开头的空格数都不一样，并且在输入过程中有些使用了\\t，有些使用了空格，导致自动保存时认为注释缩进不一样，会重新格式化注释，导致图案混乱。\n\n***为了区别空格和\\t，用 → 代替 \\t***\n\n```go\n// Error 报错显示\n// ***************************************************\n// **************** Mercy Buddha *********************\n//\n//→                    _oo0oo_\n//                    o8888888o\n//→→\t              88  .  88\n//\t                  (| -_- |)\n//→                   0\\\\  =  /0\n//→→\t           ___/ --- \\\\___\n//→\t              .' \\\\\\\\|     |// '.\n//               / \\\\\\\\|||  :  |||// \\\\\n//→\t            / _||||| --- |||||- \\\\\n//             |   | \\\\\\\\\\\\  -  /// |   |\n//→\t           | \\\\_| ”\\\\\\\\---//”  |_/ |\n//\t            \\\\  .-\\\\__  '-'  ___/-. /\n// →          ___'. .'  /--.--\\\\   . .'___\n//→→\t       .  '\u003c   .___\\\\_\u003c|\u003e_/___.' \u003e'    .\n//\t        | |       \\\\ .; \\\\     ;.         | |\n//→\t      \\\\  \\\\   .   \\\\ - -\\\\  --   - -.-  /  /\n//\t   ===== -.____ .___ \\\\_____/___.- ___.-'=====\n//→\t                     =---='\n//\n// ***************************************************\n// ***************************************************\n//\n//\t@param ctx\n//\t@param req\n//\t@return rsp\n//\t@return err\nfunc Error(ctx context.Context, req *pb.IndexRequest) (rsp *pb.IndexReply, err error)\n```\n\n解决方案：\n在图案每行开头都使用相同的缩进 \"// *\", 使得每一行的缩进都相同，则不会被重新格式化，如下：\n```go\n// Error ERR 报错显示\n// *************************************************************\n// ********************* Mercy Buddha **************************\n// *                                                           *\n// *                       _oo0oo_                             *\n// *                      o8888888o                            *\n// *                      88  .  88                            *\n// *                      (| -_- |)                            *\n// *                      0\\\\  =  /0                           *\n// *                    ___/ --- \\\\___                         *\n// *                  .' \\\\\\\\|     |// '.                      *\n// *                 / \\\\\\\\|||  :  |||// \\\\                    *\n// *                / _||||| --- |||||- \\\\                     *\n// *               |   | \\\\\\\\\\\\  -  /// |   |                  *\n// *               | \\\\_| ”\\\\\\\\---//”  |_/ |                   *\n// *               \\\\  .-\\\\__  '-'  ___/-. /                   *\n// *             ___'. .'  /--.--\\\\   . .'___                  *\n// *           .  '\u003c   .___\\\\_\u003c|\u003e_/___.' \u003e'    .               *\n// *         | |       \\\\ .; \\\\     ;.         | |             *\n// *         \\\\  \\\\   .   \\\\ - -\\\\  --   - -.-  /  /           *\n// *     ===== -.____ .___ \\\\_____/___.- ___.-'=====           *\n// *                        =---='                             *\n// *                                                           *\n// *************************************************************\n// *************************************************************\n//\n//\t@param ctx\n//\t@param req\n//\t@return rsp\n//\t@return err\nfunc Error(ctx context.Context, req *pb.IndexRequest) (rsp *pb.IndexReply, err error)\n```\n\n## How to install\n1.vscode plugins marketplace(search GoComment)\n\n### special tag, represent beginning of a special line.\n* @receiver ： golang function receiver\n* @param ： golang function parameter \n* @return ： golang function return parameter\n* @author ： author name, or use ${git_name}\n* @date ： use ${date}, if not set, use current date\n* @update ： update tag, maybe config as `\"${git_name} ${date}\"`, update `\"${date}\"` always\n\n### support variable\n```go\nfunc (r receiver)Foo(i interface{}) (e error)\n```\n```\n* ${func_name} : function name is \"Foo\".\n* ${receiver_name} : will be replaced by \"r\".\n* ${receiver_type} : will be replaced by \"receiver\".\n* ${receiver_name_type} :  will be replaced by \"r receiver\".\n* ${param_name} : \"i\"\n* ${param_type} : \"interface{}\"\n* ${param_name_type} : \"i interface{}\"\n* ${return_name} : \"e\"\n* ${return_type} : \"error\"\n* ${return_name_type} : \"e error\"\n* ${package_name} : package name\n* ${type_name} : type Int int64,  ${type_name} is \"Int\"\n* ${var_name} : var n int, ${var_name} is \"n\"\n* ${var_type} : var n int, ${var_type} is \"int\"\n* ${date} : date\n* ${git_name}: git config name\n```\n\n### how to build and publish\n```shell\nvsce login publisher #login first, if need\nvsce package\nvsce publish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x00b%2Fvscode-go-comment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0x00b%2Fvscode-go-comment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x00b%2Fvscode-go-comment/lists"}