{"id":18636721,"url":"https://github.com/andream16/tree","last_synced_at":"2025-11-04T14:30:23.127Z","repository":{"id":57578742,"uuid":"154390882","full_name":"andream16/tree","owner":"andream16","description":"Go Project to Tree","archived":false,"fork":false,"pushed_at":"2019-04-25T21:28:41.000Z","size":1244,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T14:53:56.966Z","etag":null,"topics":["go","go-ast","go-tree","tree"],"latest_commit_sha":null,"homepage":"","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/andream16.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}},"created_at":"2018-10-23T20:15:09.000Z","updated_at":"2020-05-11T06:53:52.000Z","dependencies_parsed_at":"2022-09-26T19:13:55.355Z","dependency_job_id":null,"html_url":"https://github.com/andream16/tree","commit_stats":null,"previous_names":["andream16/adviser"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andream16%2Ftree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andream16%2Ftree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andream16%2Ftree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andream16%2Ftree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andream16","download_url":"https://codeload.github.com/andream16/tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239433908,"owners_count":19637806,"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":["go","go-ast","go-tree","tree"],"created_at":"2024-11-07T05:31:35.281Z","updated_at":"2025-11-04T14:30:23.022Z","avatar_url":"https://github.com/andream16.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tree [![CircleCI](https://circleci.com/gh/nauplio/tree.svg?style=svg)](https://circleci.com/gh/nauplio/tree) [![GoDoc](https://godoc.org/github.com/andream16/tree?status.svg)](https://godoc.org/github.com/andream16/tree) [![Go Report Card](https://goreportcard.com/badge/github.com/andream16/tree)](https://goreportcard.com/report/github.com/andream16/tree) [![MIT Licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/andream16/tree/master/LICENSE)\n\nSimple go project to tree structure. It supports only go files.\n\n# ???\n\n![alt text](https://raw.githubusercontent.com/AndreaM16/tree/master/assets/structure.png)\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"go/ast\"\n\n\t\"github.com/andream16/tree\"\n)\n\nfunc main() {\n\n\tout, err := tree.Get(\"examples/example\", \u0026tree.Node{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(out.Name)                   // example\n\tfmt.Println(out.Leafs[0].Name)          // somefile.go\n\tfmt.Println(out.Leafs[0].Path)          // examples/example/somefile.go\n\tfmt.Println(out.Nodes[0].Name)          // example/subexample\n\tfmt.Println(out.Nodes[0].Leafs[0].Name) // someotherfile.go\n\tfmt.Println(out.Nodes[0].Leafs[0].Path) // examples/example/subexample/someotherfile.go\n\n\terr = out.Leafs[0].Ast()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tast.Inspect(out.Leafs[0].SyntaxTree, func(n ast.Node) bool {\n\t\tvar s string\n\t\tswitch x := n.(type) {\n\t\tcase *ast.BasicLit:\n\t\t\ts = x.Value\n\t\tcase *ast.Ident:\n\t\t\ts = x.Name\n\t\t}\n\t\tif s != \"\" {\n\t\t\tfmt.Printf(\"%s\\n\", s) // example\n\t\t}\n\t\treturn true\n\t})\n\n\t// example\n\t// |       somefile.go\n\t// example/subexample\n\t// |       someotherfile.go\n\tout.Print()\n\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandream16%2Ftree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandream16%2Ftree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandream16%2Ftree/lists"}