{"id":16484743,"url":"https://github.com/damdo/vcs","last_synced_at":"2025-06-19T02:43:55.750Z","repository":{"id":57704687,"uuid":"498410105","full_name":"damdo/vcs","owner":"damdo","description":"Go (1.18+) package to get the vcs info from the running binary","archived":false,"fork":false,"pushed_at":"2022-05-31T22:06:36.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T14:30:39.312Z","etag":null,"topics":[],"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/damdo.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":"2022-05-31T16:16:43.000Z","updated_at":"2022-05-31T17:31:11.000Z","dependencies_parsed_at":"2022-09-26T21:21:08.605Z","dependency_job_id":null,"html_url":"https://github.com/damdo/vcs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damdo%2Fvcs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damdo%2Fvcs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damdo%2Fvcs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damdo%2Fvcs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damdo","download_url":"https://codeload.github.com/damdo/vcs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241255563,"owners_count":19934889,"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-10-11T13:18:07.485Z","updated_at":"2025-02-28T22:24:17.049Z","avatar_url":"https://github.com/damdo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## vcs\nRead the vcs information (BuildInfo data) embedded in the running go binary.\n\n#### requirements\nNote: Go BuildInfo's VCS data to be available in the running binary the following requirements must be satisfied:\n- Binary must be built with Go 1.18 or greater\n- When the binary is built, the build context folder must already be initialized by the vcs system (e.g. for git, `git init`)\n- The `go build ...` invocation must include the whole directory and not just specific go files (e.g. `go build .`)\n\n#### usage\n\n```go\npackage main\n\nimport (\n\t\"github.com/damdo/vcs\"\n\t\"fmt\"\n)\n\nfunc main() {\n\tv, ok := vcs.ReadInfo()\n\tif ok {\n\t\tfmt.Println(v.Vcs, v.Revision, v.Time, v.Modified)\n\t}\n}\n```\n\nor if you prefer to gather BuildInfo on your own:\n\n```go\npackage main\n\nimport (\n\t\"github.com/damdo/vcs\"\n\t\"fmt\"\n\t\"runtime/debug\"\n)\n\nfunc main() {\n\tb, ok := debug.ReadBuildInfo()\n\tif ok {\n\t\tv, ok := vcs.FromBuildInfo(b)\n\t\tif ok {\n\t\t\tfmt.Println(v.Vcs, v.Revision, v.Time, v.Modified)\n\t\t}\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamdo%2Fvcs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamdo%2Fvcs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamdo%2Fvcs/lists"}