{"id":19262242,"url":"https://github.com/radovskyb/inspect","last_synced_at":"2025-04-21T18:31:02.126Z","repository":{"id":118271156,"uuid":"68780898","full_name":"radovskyb/inspect","owner":"radovskyb","description":"inspect is a small Go package that makes it easy to inspect information about Go source code.","archived":false,"fork":false,"pushed_at":"2017-03-28T01:29:55.000Z","size":28,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T14:46:08.753Z","etag":null,"topics":[],"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/radovskyb.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":"2016-09-21T04:45:06.000Z","updated_at":"2019-07-15T12:36:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"4233b095-72b9-417b-8d6e-132b491e706e","html_url":"https://github.com/radovskyb/inspect","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/radovskyb%2Finspect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radovskyb%2Finspect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radovskyb%2Finspect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radovskyb%2Finspect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radovskyb","download_url":"https://codeload.github.com/radovskyb/inspect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250110851,"owners_count":21376544,"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":[],"created_at":"2024-11-09T19:30:26.486Z","updated_at":"2025-04-21T18:31:02.116Z","avatar_url":"https://github.com/radovskyb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inspect\n`inspect` is a small Go package that makes it easy to inspect information about `Go` source code.\n\n# Installation\n\n```shell\ngo get github.com/radovskyb/inspect\n```\n\n# Example\n\n#### Encode all standard library package's information into a single json file.\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"strings\"\n\n\t\"github.com/radovskyb/inspect\"\n)\n\nfunc main() {\n\t// Find the current Go intallation.\n\tgoroot, err := exec.Command(\"go\", \"env\", \"GOROOT\").Output()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Get the directory of the Go standard package library.\n\tpkgsRoot := filepath.Join(strings.TrimSpace(string(goroot)), \"src\")\n\n\t// Parse all Go packages, ignoring all test files and unexported functions.\n\tpkgs, err := inspect.ParsePackagesFromDir(pkgsRoot, true, inspect.FuncExported)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Delete any non-library, main package's.\n\tdelete(pkgs, \"main\")\n\n\t// Create a new json file to store all of Go's standard package library info.\n\tjsonFile, err := os.Create(\"packages.json\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer func() {\n\t\tif err := jsonFile.Close(); err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t}()\n\n\t// Create a new json encoder that writes to jsonFile and set it's\n\t// indentation formatting to a single tab.\n\tencoder := json.NewEncoder(jsonFile)\n\tencoder.SetIndent(\"\", \"\\t\")\n\n\t// Encode all of the Package's to the json file.\n\tif err := encoder.Encode(pkgs); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradovskyb%2Finspect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradovskyb%2Finspect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradovskyb%2Finspect/lists"}