{"id":21214291,"url":"https://github.com/goindow/toolbox","last_synced_at":"2025-03-15T00:19:44.250Z","repository":{"id":143903778,"uuid":"175565979","full_name":"goindow/toolbox","owner":"goindow","description":"Package toolbox 封装了一些开发调试工具","archived":false,"fork":false,"pushed_at":"2020-05-11T03:49:42.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T16:23:15.283Z","etag":null,"topics":["trace","var-dump"],"latest_commit_sha":null,"homepage":"","language":"Go","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/goindow.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-03-14T06:59:19.000Z","updated_at":"2023-09-18T14:46:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"c863afab-b876-4680-b09e-b6a759bc8bc0","html_url":"https://github.com/goindow/toolbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goindow%2Ftoolbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goindow%2Ftoolbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goindow%2Ftoolbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goindow%2Ftoolbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goindow","download_url":"https://codeload.github.com/goindow/toolbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243663598,"owners_count":20327310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["trace","var-dump"],"created_at":"2024-11-20T21:27:08.834Z","updated_at":"2025-03-15T00:19:44.226Z","avatar_url":"https://github.com/goindow.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# toolbox\nPackage toolbox 封装了一些开发中使用的工具\n\n## 索引\n- [Dump](#Dump)\n\n### 使用\n```go\nimport (\n    \"github.com/goindow/toolbox\"\n)\n```\n\n### Dump\n- 打印变量的类型和值，支持同时打印多个变量\n- 本质是调用 fmt.Printf()，每个变量格式为 \"[%T] %v\\n\"\n```go\ntoolbox.Dump(os.Getwd())\n\n// Output:\n// [string] /usr/local/var/go/src/github.com/goindow/toolbox\n// [\u003cnil\u003e] \u003cnil\u003e\n```\n\n### Trace\n- 计算函数/方法运行耗时\n- 接收返回值，ret := trace(func2)，ret 类型为 []reflect.value\n```go\n// 无参函数\ntrace(func1)\n// 有返回值\nret := trace(fun2)  // retInt := ret[0].Int()\n// 有参函数\ntrace(func4, 3, true)\n// 有参方法\ntrace(new(reflectStruct).func4, 5, false)\n\n// Output:\n// call: main.func1\n// time: 52.561µs\n// \n// call: main.func2\n// time: 57.324µs\n//\n// call: main.func4\n// time: 18.698µs\n//\n// call: main.(*reflectStruct).func4-fm\n// time: 4.168µs\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoindow%2Ftoolbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoindow%2Ftoolbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoindow%2Ftoolbox/lists"}