{"id":22351042,"url":"https://github.com/ewohltman/delve-example","last_synced_at":"2025-03-26T11:45:24.177Z","repository":{"id":91250054,"uuid":"212096682","full_name":"ewohltman/delve-example","owner":"ewohltman","description":"Example usage of the Delve Go debugger","archived":false,"fork":false,"pushed_at":"2019-10-02T04:03:13.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T13:13:05.476Z","etag":null,"topics":["debugger","debugging","delve","go","golang"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ewohltman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-01T12:59:08.000Z","updated_at":"2020-04-02T16:11:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"afbb0c6a-ee24-4203-823f-10d9db4e1141","html_url":"https://github.com/ewohltman/delve-example","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/ewohltman%2Fdelve-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ewohltman%2Fdelve-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ewohltman%2Fdelve-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ewohltman%2Fdelve-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ewohltman","download_url":"https://codeload.github.com/ewohltman/delve-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245650270,"owners_count":20650098,"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":["debugger","debugging","delve","go","golang"],"created_at":"2024-12-04T12:12:24.123Z","updated_at":"2025-03-26T11:45:24.150Z","avatar_url":"https://github.com/ewohltman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `delve-example`\n\nDelve: [https://github.com/go-delve/delve](https://github.com/go-delve/delve)\n\n---\n\n## Debugging main application\n\n### Start Delve\n```\ndlv debug delve-example.go\n```\n\n### Set breakpoints\n```\n(dlv) break delve-example.go:30\nBreakpoint 1 set at 0x4ac131 for main.main() ./delve-example.go:30\n```\n\n```\n(dlv) break delve-example.go:21\nBreakpoint 2 set at 0x4abeaf for main.output() ./delve-example.go:21\n```\n\n### Run until first breakpoint\n```\n(dlv) continue\n\u003e main.main() ./delve-example.go:30 (hits goroutine(1):1 total:1) (PC: 0x4ac131)\n    25:\t\texamples := makeExampleSlice()\n    26:\t\n    27:\t\texampleSlice1 := append(examples, example{exampleValue: \u0026exampleValue{value: 1}})\n    28:\t\texampleSlice2 := append(examples, example{exampleValue: \u0026exampleValue{value: 2}})\n    29:\t\n=\u003e  30:\t\toutput(\"example1\", exampleSlice1)\n    31:\t\toutput(\"example2\", exampleSlice2)\n    32:\t}\n```\n\n#### List function local variables\n```\n(dlv) locals\nexamples = []main.example len: 2, cap: 2, [...]\nexampleSlice2 = []main.example len: 3, cap: 4, [...]\nexampleSlice1 = []main.example len: 3, cap: 4, [...]\n```\n\n#### Print value of local variable\n```\n(dlv) print exampleSlice1[2]\nmain.example {\n\texampleValue: *main.exampleValue {value: 1},}\n```\n\n### Run until second breakpoint\n```\n(dlv) continue\n\u003e main.output() ./delve-example.go:21 (hits goroutine(1):1 total:1) (PC: 0x4abeaf)\n    16:\t\t\t{exampleValue: \u0026exampleValue{value: 0}},\n    17:\t\t}\n    18:\t}\n    19:\t\n    20:\tfunc output(name string, exampleSlice []example) {\n=\u003e  21:\t\tfmt.Printf(\"%s: %+v\\n\", name, exampleSlice)\n    22:\t}\n    23:\t\n    24:\tfunc main() {\n    25:\t\texamples := makeExampleSlice()\n    26:\n```\n\n#### List function arguments\n```\n(dlv) args\nname = \"example1\"\nexampleSlice = []main.example len: 3, cap: 4, [...]\n```\n\n#### Print value of function argument\n```\n(dlv) print exampleSlice[2]\nmain.example {\n\texampleValue: *main.exampleValue {value: 1},}\n```\n\n---\n\n## Debugging tests\n\n### Start Delve\n```\ndlv test ./internal/pkg/example/\n```\n\n### Set breakpoints\n```\n(dlv) break example_test.go:9\nBreakpoint 1 set at 0x547e5f for github.com/ewohltman/delve-example/internal/pkg/example.TestNew() ./internal/pkg/example/example_test.go:9\n```\n\n```\n(dlv) break example_test.go:29\nBreakpoint 2 set at 0x5480a0 for github.com/ewohltman/delve-example/internal/pkg/example.TestNewSlice() ./internal/pkg/example/example_test.go:29\n```\n\n### See remaining examples under `Debugging main application`\n\n---\n\n## Exit Delve\n```\n(dlv) exit\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fewohltman%2Fdelve-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fewohltman%2Fdelve-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fewohltman%2Fdelve-example/lists"}