{"id":17196285,"url":"https://github.com/dundee/gogenerate","last_synced_at":"2025-08-03T19:08:56.554Z","repository":{"id":40891828,"uuid":"508083282","full_name":"dundee/gogenerate","owner":"dundee","description":"Source code for the \"go:generate\" talk","archived":false,"fork":false,"pushed_at":"2024-03-13T21:41:29.000Z","size":14,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T07:29:02.604Z","etag":null,"topics":["golang","meetup","talk"],"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/dundee.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":"2022-06-27T22:46:40.000Z","updated_at":"2023-09-08T18:35:45.000Z","dependencies_parsed_at":"2024-12-03T09:47:00.901Z","dependency_job_id":null,"html_url":"https://github.com/dundee/gogenerate","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dundee%2Fgogenerate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dundee%2Fgogenerate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dundee%2Fgogenerate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dundee%2Fgogenerate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dundee","download_url":"https://codeload.github.com/dundee/gogenerate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245423251,"owners_count":20612749,"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":["golang","meetup","talk"],"created_at":"2024-10-15T01:52:48.761Z","updated_at":"2025-03-25T08:14:46.363Z","avatar_url":"https://github.com/dundee.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# go:generate\n\nSource code for the [talk \"go:generate\"](https://www.youtube.com/watch?v=ClW_g1iDGi4) given on Prague Golang Meetup on 28th June 2022.\n\nThe talk demonstrared how to use protobuf's custom options for declaring how the message should be marshalled for logging.\nWe looked on possibilities how to process the proto message metadata and how to generate the code responsible for doing the marshalling.\n\n## Example\n\nHaving a protobuf message:\n\n```go\nmessage User {\n    uint64 id = 1 [(log.key) = \"user.id\"];\n    string name = 2 [(log.key) = \"user.name\"];\n    string email = 3;\n    string phone = 4 [(log.key) = \"user.phone\"];\n    string password = 5;\n}\n```\n\nwill generate method:\n\n```go\nfunc (u *User) MarshalLog() log.Fields {\n\treturn log.Fields{\n\t\t\"user.id\":   u.Id,\n\t\t\"user.name\":   u.Name,\n\t\t\"user.phone\":   u.Phone,\n\t}\n}\n```\n\nwhich will in the end create JSON log entry:\n\n```json\n{\"level\":\"info\",\"msg\":\"Received user\",\"time\":\"2022-06-29T13:53:04+02:00\",\"user.id\":1,\"user.name\":\"John Doe\",\"user.phone\":\"555\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdundee%2Fgogenerate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdundee%2Fgogenerate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdundee%2Fgogenerate/lists"}