{"id":48433262,"url":"https://github.com/gophercises/cyoa","last_synced_at":"2026-04-06T11:31:03.225Z","repository":{"id":28451951,"uuid":"106129842","full_name":"gophercises/cyoa","owner":"gophercises","description":"Ex 3 - Choose your own adventure stories","archived":false,"fork":false,"pushed_at":"2023-02-03T10:08:03.000Z","size":33,"stargazers_count":20,"open_issues_count":0,"forks_count":150,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-10T21:54:47.581Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gophercises.com","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/gophercises.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":"2017-10-07T20:53:38.000Z","updated_at":"2023-01-19T22:08:27.000Z","dependencies_parsed_at":"2023-02-18T05:45:56.912Z","dependency_job_id":null,"html_url":"https://github.com/gophercises/cyoa","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/gophercises/cyoa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gophercises%2Fcyoa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gophercises%2Fcyoa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gophercises%2Fcyoa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gophercises%2Fcyoa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gophercises","download_url":"https://codeload.github.com/gophercises/cyoa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gophercises%2Fcyoa/sbom","scorecard":{"id":441267,"data":{"date":"2025-08-11","repo":{"name":"github.com/gophercises/cyoa","commit":"070143bf424e1242dfe945eae43bfa4684ba6e91"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":4,"reason":"Found 6/14 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T05:37:47.336Z","repository_id":28451951,"created_at":"2025-08-19T05:37:47.336Z","updated_at":"2025-08-19T05:37:47.336Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31471460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-04-06T11:31:03.154Z","updated_at":"2026-04-06T11:31:03.217Z","avatar_url":"https://github.com/gophercises.png","language":"Go","readme":"# Exercise #3: Choose your own adventure\n\n[![exercise status: released](https://img.shields.io/badge/exercise%20status-released-green.svg?style=for-the-badge)](https://gophercises.com/exercises/cyoa) [![demo: -\u003e](https://img.shields.io/badge/demo-%E2%86%92-blue.svg?style=for-the-badge)](https://gophercises.com/demos/cyoa/)\n\n\n## Exercise details\n\n[Choose Your Own Adventure](https://en.wikipedia.org/wiki/Choose_Your_Own_Adventure) is (was?) a series of books intended for children where as you read you would occasionally be given options about how you want to proceed. For instance, you might read about a boy walking in a cave when he stumbles across a dark passage or a ladder leading to an upper level and the reader will be presented with two options like:\n\n- Turn to page 44 to go up the ladder.\n- Turn to page 87 to venture down the dark passage.\n\nThe goal of this exercise is to recreate this experience via a web application where each page will be a portion of the story, and at the end of every page the user will be given a series of options to choose from (or be told that they have reached the end of that particular story arc).\n\nStories will be provided via a JSON file with the following format:\n\n```json\n{\n  // Each story arc will have a unique key that represents\n  // the name of that particular arc.\n  \"story-arc\": {\n    \"title\": \"A title for that story arc. Think of it like a chapter title.\",\n    \"story\": [\n      \"A series of paragraphs, each represented as a string in a slice.\",\n      \"This is a new paragraph in this particular story arc.\"\n    ],\n    // Options will be empty if it is the end of that\n    // particular story arc. Otherwise it will have one or\n    // more JSON objects that represent an \"option\" that the\n    // reader has at the end of a story arc.\n    \"options\": [\n      {\n        \"text\": \"the text to render for this option. eg 'venture down the dark passage'\",\n        \"arc\": \"the name of the story arc to navigate to. This will match the story-arc key at the very root of the JSON document\"\n      }\n    ]\n  },\n  ...\n}\n```\n\n*See [gopher.json](https://github.com/gophercises/cyoa/blob/master/gopher.json) for a real example of a JSON story. I find that seeing the real JSON file really helps answer any confusion or questions about the JSON format.*\n\nYou are welcome to design the code however you want. You can put everything in a single `main` package, or you can break the story into its own package and use that when creating your http handlers.\n\nThe only real requirements are:\n\n1. Use the `html/template` package to create your HTML pages. Part of the purpose of this exercise is to get practice using this package.\n2. Create an `http.Handler` to handle the web requests instead of a handler function.\n3. Use the `encoding/json` package to decode the JSON file. You are welcome to try out third party packages afterwards, but I recommend starting here.\n\nA few things worth noting:\n\n- Stories could be cyclical if a user chooses options that keep leading to the same place. This isn't likely to cause issues, but keep it in mind.\n- For simplicity, all stories will have a story arc named \"intro\" that is where the story starts. That is, every JSON file will have a key with the value `intro` and this is where your story should start.\n- Matt Holt's JSON-to-Go is a really handy tool when working with JSON in Go! Check it out - \u003chttps://mholt.github.io/json-to-go/\u003e\n\n## Bonus\n\nAs a bonus exercises you can also:\n\n1. Create a command-line version of our Choose Your Own Adventure application where stories are printed out to the terminal and options are picked via typing in numbers (\"Press 1 to venture ...\").\n2. Consider how you would alter your program in order to support stories starting form a story-defined arc. That is, what if all stories didn't start on an arc named `intro`? How would you redesign your program or restructure the JSON? This bonus exercises is meant to be as much of a thought exercise as an actual coding one.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgophercises%2Fcyoa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgophercises%2Fcyoa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgophercises%2Fcyoa/lists"}