{"id":16686235,"url":"https://github.com/oldratlee/my-go-playground","last_synced_at":"2025-03-13T15:18:01.322Z","repository":{"id":65527702,"uuid":"591333577","full_name":"oldratlee/my-go-playground","owner":"oldratlee","description":"🦫 my Go playground","archived":false,"fork":false,"pushed_at":"2023-01-30T11:20:51.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-06T10:03:03.246Z","etag":null,"topics":["channel","go","goroutine","panic","playground","rune","slice","string"],"latest_commit_sha":null,"homepage":"https://github.com/oldratlee/my-go-playground","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/oldratlee.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}},"created_at":"2023-01-20T14:01:06.000Z","updated_at":"2023-01-27T14:47:36.000Z","dependencies_parsed_at":"2023-02-15T08:31:13.601Z","dependency_job_id":null,"html_url":"https://github.com/oldratlee/my-go-playground","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/oldratlee%2Fmy-go-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oldratlee%2Fmy-go-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oldratlee%2Fmy-go-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oldratlee%2Fmy-go-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oldratlee","download_url":"https://codeload.github.com/oldratlee/my-go-playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243428436,"owners_count":20289317,"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":["channel","go","goroutine","panic","playground","rune","slice","string"],"created_at":"2024-10-12T15:05:03.207Z","updated_at":"2025-03-13T15:18:01.303Z","avatar_url":"https://github.com/oldratlee.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🦫 my Go playground\n\nMy Go playground while learning Go. 🧑‍🚒  \nso be cautious that the codes is not sophisticated and may not follow the best practice.\n\nRun playground simply by `go test`: 🚀\n\n```sh\ngo test ./...\n```\n\n## 🛝 Playground List\n\n- [`nil_empty_playground.go`](internal/nil_empty_playground.go) | [`nil_empty_playground_test.go`](internal/nil_empty_playground_test.go)\n  - check the behavior of `nil`/empty slice\n  - check the behavior of `nil`/empty map\n    - put new elements into nil map, PANIC!\n  - check the behavior of `nil` function/lambda\n    - call nil function/lambda, PANIC!\n- [`string_playground.go`](internal/string_playground.go) | [`string_playground_test.go`](internal/string_playground_test.go)\n  - check the difference between `len` and `rune count` of string\n  - conversion of\n    - `string` \u003c=\u003e `[]rune`\n    - `rune` =\u003e `string`\n    - `string` \u003c=\u003e `[]byte`\n    - `byte` =\u003e `string`\n    - `[]rune` \u003c=\u003e `[]byte`\n  - string iteration\n    - `for-range` loop iteration return RUNE value with BYTE index, NOT return byte value,  \n      make mistakes very easily, need caution!\n    - iterate with byte index only of string by `for-range` loop, lose bytes! NONSENSE!!\n  - check memory struct of string by `SizeOf`\n- [`goroutine_channel_playground.go`](internal/goroutine_channel_playground.go) | [`goroutine_channel_playground_test.go`](internal/goroutine_channel_playground_test.go)\n  - read channel by `for-range` loop, very convenient\n  - read channel by `comma-ok` pattern, more tedious but safe too\n- [`goroutine_channel_pattern_playground.go`](internal/goroutine_channel_pattern_playground.go) | [`goroutine_channel_pattern_playground_test.go`](internal/goroutine_channel_pattern_playground_test.go)\n  - operation(read/write) to multiply channels with `select statement` avoid starvation/deadlock\n  - `done channel pattern` aka. a channel only used to publish close event\n  - `cancel function pattern` to terminate a goroutine\n  - `nilify the case channel pattern` to turning off a case in a select\n  - `time after case pattern` to time out code\n- [`when_go_runtime_panic_playground.go`](internal/when_go_runtime_panic_playground.go) | [`when_go_runtime_panic_playground_test.go`](internal/when_go_runtime_panic_playground_test.go)\n  - `array operation` panic\n  - `slice operation` panic\n  - `channel operation` panic\n  - `function value operation`, call nil function value panic\n  - call `value receiver method` with nil point receiver panic\n  - call `method of nil interface` panic\n  - call `method of interface with nil value` panic\n  - `pointer operation`, dereference a nil pointer panic\n  - `type assertions` panic\n\n## 😈 My common functions and go design experiments\n\n- [`commons.go`](internal/commons.go)\n  - in my personal opinion,  \n    `type voidT = struct{}` and `var void = voidT{}`  \n    definitions seems interesting and COOL\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foldratlee%2Fmy-go-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foldratlee%2Fmy-go-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foldratlee%2Fmy-go-playground/lists"}