{"id":17179643,"url":"https://github.com/maxmcd/goa-timeslice-poc","last_synced_at":"2025-03-24T23:38:32.176Z","repository":{"id":179025520,"uuid":"662729461","full_name":"maxmcd/goa-timeslice-poc","owner":"maxmcd","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-05T19:46:19.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T20:12:00.402Z","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/maxmcd.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":"2023-07-05T18:58:14.000Z","updated_at":"2023-07-05T18:58:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"8988bb32-505f-41bd-adb3-0cff07cb4985","html_url":"https://github.com/maxmcd/goa-timeslice-poc","commit_stats":null,"previous_names":["maxmcd/goa-timeslice-poc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fgoa-timeslice-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fgoa-timeslice-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fgoa-timeslice-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fgoa-timeslice-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxmcd","download_url":"https://codeload.github.com/maxmcd/goa-timeslice-poc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245372217,"owners_count":20604488,"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-15T00:27:03.332Z","updated_at":"2025-03-24T23:38:32.153Z","avatar_url":"https://github.com/maxmcd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GOA Timeslice bug POC\n\nMinimal POC of Goa breaking when dealing with custom type slices.\n\nYou'll need to clone the https://github.com/goadesign/goa repo and make sure it's at the path `../../goadesign/goa` relative to this repo.\n\nFrom there you can run `make build` to reproduce the build failure.\n\nThat command will first run generate with the relative repo:\n\n```\ngo run goa.design/goa/v3/cmd/goa gen github.com/maxmcd/goa-timeslice-poc/design\n```\n\nAnd then builds the generated code to demonstrate the compiler error:\n\n```\ngo build ./...\n```\n\nThis is the problematic generated code:\n```\n\t\tvar zero []time.Time\n\t\tif body.Timeslice == zero {\n\t\t\tbody.Timeslice = []time.Time{}\n\t\t}\n```\n\nCreates the compiler error:\n```\ngen/http/service/server/types.go:36:6: invalid operation: body.Timeslice == zero (slice can only be compared to nil)\n```\n\nThe code that generates that code is here: https://github.com/goadesign/goa/blob/da7f936afdd523f475bd05c76612850d3cf96ab6/codegen/go_transform.go#L278-L292\n\nNot sure how to fix. `if body.Timeslice == nil` would work, but I'm not sure how to check if the type cannot be compared to a zero value, is that just maps and slices?. A more general fix would be `reflect.DeepEqual(body.Timeslice, zero)`, but that might be frowned upon for an ugly use of reflection.\n\nHere is an example fix by checking if the type is a map or slice by looking for a prefix of `[]` or `map[`: https://github.com/goadesign/goa/compare/v3...maxmcd:goa:timeslice-fix?expand=1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmcd%2Fgoa-timeslice-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxmcd%2Fgoa-timeslice-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmcd%2Fgoa-timeslice-poc/lists"}