{"id":15387293,"url":"https://github.com/rhysd/go-fakeio","last_synced_at":"2025-09-04T07:36:39.132Z","repository":{"id":57490308,"uuid":"154659255","full_name":"rhysd/go-fakeio","owner":"rhysd","description":"Small Go library to fake stdout/stderr/stdin mainly for unit testing","archived":false,"fork":false,"pushed_at":"2019-11-15T03:29:41.000Z","size":15,"stargazers_count":25,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T19:49:17.417Z","etag":null,"topics":["capture","fake","golang","stderr","stdin","stdout"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/rhysd/go-fakeio","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/rhysd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-25T11:26:12.000Z","updated_at":"2024-09-07T13:24:51.000Z","dependencies_parsed_at":"2022-09-06T11:11:21.686Z","dependency_job_id":null,"html_url":"https://github.com/rhysd/go-fakeio","commit_stats":null,"previous_names":["rhysd/fakeio"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rhysd/go-fakeio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fgo-fakeio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fgo-fakeio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fgo-fakeio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fgo-fakeio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhysd","download_url":"https://codeload.github.com/rhysd/go-fakeio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fgo-fakeio/sbom","scorecard":{"id":774590,"data":{"date":"2025-08-11","repo":{"name":"github.com/rhysd/go-fakeio","commit":"74c5f2f2f476ff25d47a94c78d4819a3a42208b9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/26 approved changesets -- score normalized to 0","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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"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":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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"}}]},"last_synced_at":"2025-08-23T03:12:03.109Z","repository_id":57490308,"created_at":"2025-08-23T03:12:03.109Z","updated_at":"2025-08-23T03:12:03.109Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273573719,"owners_count":25129882,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["capture","fake","golang","stderr","stdin","stdout"],"created_at":"2024-10-01T14:53:32.276Z","updated_at":"2025-09-04T07:36:39.109Z","avatar_url":"https://github.com/rhysd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"`fakeio` pacakge for Go\n=======================\n[![Linux/macOS Build Status](https://travis-ci.org/rhysd/go-fakeio.svg?branch=master)](https://travis-ci.org/rhysd/go-fakeio)\n[![Windows Build status](https://ci.appveyor.com/api/projects/status/5b9t6932m5dt2e23/branch/master?svg=true)](https://ci.appveyor.com/project/rhysd/go-fakeio/branch/master)\n[![Documentation](https://godoc.org/github.com/rhysd/go-fakeio?status.svg)](http://godoc.org/github.com/rhysd/go-fakeio)\n\n[`fakeio`](https://github.com/rhysd/go-fakeio) is a small library to fake stdout/stderr/stdin.\nThis is mainly for unit testing of CLI applications. Please see [documentation](https://godoc.org/github.com/rhysd/go-fakeio)\nfor more details.\n\n## Installation\n\n```\n$ go get github.com/rhysd/go-fakeio\n```\n\n## Usage\n\nBasic usage:\n\n```go\nimport (\n    \"bufio\"\n    \"github.com/rhysd/go-fakeio\"\n)\n\n// Fake stdout and input 'hello' to stdin\nfake := fakeio.Stdout().Stdin(\"hello!\")\ndefer fake.Restore()\n\n// Do something...\n\n// \"hello!\" is stored to variable `i`\ni, err := bufio.NewReader(os.Stdin).ReadString('!')\n\n// At this point, this line outputs nothing\nfmt.Print(\"bye\")\n\n// \"bye\" is stored to variable `o`\no, err := fake.String()\n```\n\n### Faking stdout/stderr/stdin\n\nFaking stderr:\n\n```go\nfake := fakeio.Stderr()\ndefer fake.Restore()\n```\n\nFaking stdin:\n\n```go\nfake, err := fakeio.Stdin(\"hello\")\ndefer fake.Restore()\n```\n\nFaking stderr/stdout/stdin\n\n```go\nfake := fakeio.Stderr().Stdout().Stdin(\"Faked input to stdin\")\ndefer fake.Restore()\n```\n\n### Read bufferred stdout/stderr\n\nReading as string:\n\n```go\ns, err := fake.String()\nif err != nil {\n    // Faking IO failed\n    panic(err)\n}\nfmt.Println(s)\n```\n\nReading as bytes:\n\n```go\nb, err := fake.Bytes()\nif err != nil {\n    // Faking IO failed\n    panic(err)\n}\nfmt.Println(b)\n```\n\nReading via `io.Reader` interface:\n\n```go\ns := bufio.NewScanner(fake)\nfor s.Scan() {\n    // Reading line by line\n    line := s.Text()\n    fmt.Println(line)\n}\nif s.Err() != nil {\n    // Error happened while reading\n    panic(s.Err)\n}\n```\n\n### Shortcut\n\n`.Do()` is a shortcut\n\n```go\ns, err := fakeio.Stderr().Stdout().Do(func () {\n    // Do something\n\n    // Faked stderr and stdout are restored at exit of this scope\n})\nif err != nil {\n    // Faking IO failed\n    panic(err)\n}\nfmt.Println(s)\n```\n\n### Examples\n\nPlease see [examples](example_test.go) for actual examples.\n\n## Repository\n\nhttps://github.com/rhysd/go-fakeio\n\n## License\n\n[MIT License](LICENSE.txt)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Fgo-fakeio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhysd%2Fgo-fakeio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Fgo-fakeio/lists"}