{"id":46329932,"url":"https://github.com/goark/fetch","last_synced_at":"2026-05-09T13:30:49.431Z","repository":{"id":54361035,"uuid":"328939594","full_name":"goark/fetch","owner":"goark","description":"Fetch Data from URL","archived":false,"fork":false,"pushed_at":"2025-11-21T05:07:38.000Z","size":140,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-02T16:40:11.458Z","etag":null,"topics":["golang","golang-package"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-01-12T09:45:09.000Z","updated_at":"2025-11-21T05:04:15.000Z","dependencies_parsed_at":"2024-06-21T15:34:48.555Z","dependency_job_id":"e3cf7c85-5947-451a-8ba7-bc284efa9f5a","html_url":"https://github.com/goark/fetch","commit_stats":null,"previous_names":["spiegel-im-spiegel/fetch"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/goark/fetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Ffetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Ffetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Ffetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Ffetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goark","download_url":"https://codeload.github.com/goark/fetch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Ffetch/sbom","scorecard":{"id":432791,"data":{"date":"2025-08-11","repo":{"name":"github.com/goark/fetch","commit":"b5482c57df3b84cf5b6b53b5672ddd17218fc2ef"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/13 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:31","Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:30","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/lint.yml:9","Warn: no topLevel permission defined: .github/workflows/vulns.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/lint.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/lint.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/lint.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/vulns.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/vulns.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/vulns.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/vulns.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/vulns.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/fetch/vulns.yml/main?enable=pin","Warn: goCommand not pinned by hash: .github/workflows/lint.yml:49","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   1 goCommand dependencies pinned"],"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":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE: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":"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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 21 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-19T03:46:00.758Z","repository_id":54361035,"created_at":"2025-08-19T03:46:00.759Z","updated_at":"2025-08-19T03:46:00.759Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32821090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["golang","golang-package"],"created_at":"2026-03-04T17:31:16.040Z","updated_at":"2026-05-09T13:30:49.419Z","avatar_url":"https://github.com/goark.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [fetch] -- Fetch Data from URL\n\n[![ci status](https://github.com/goark/fetch/workflows/ci/badge.svg)](https://github.com/goark/fetch/actions)\n[![codeql status](https://github.com/goark/fetch/workflows/CodeQL/badge.svg)](https://github.com/goark/fetch/actions)\n[![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/goark/fetch/main/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/goark/fetch.svg)](https://github.com/goark/fetch/releases/latest)\n\n`fetch` is a focused helper package for downloading data from URL endpoints.\nIt wraps common `net/http` idioms so callers can handle download flows with less boilerplate and safer defaults.\n\n## Design goals\n\n- Keep application code simple for one-shot data fetching.\n- Hide repetitive `net/http` handling patterns.\n- Keep API surface small and composable.\n- Use `context.Context` based operations as the default style.\n\n## Development\n\n### Requirements\n\n- Go 1.25 or later\n- [Task](https://taskfile.dev/) command (local tool for this repository)\n\n### Local validation\n\n```text\ntask test\ntask govulncheck\n```\n\nRun all maintenance tasks:\n\n```text\ntask\n```\n\n## CI Workflows\n\n- `ci`: lint (`golangci-lint` with `gosec`), tests, and `govulncheck`\n- `CodeQL`: scheduled and push/PR static analysis\n\n## Usage\n\n### Install and import\n\n```bash\ngo get github.com/goark/fetch@latest\n```\n\n```go\nimport \"github.com/goark/fetch\"\n```\n\n### Sample programs\n\nAll sample files under `sample/` use the `run` build tag.\n\n```text\ngo run -tags run ./sample/sample.go\n```\n\n- Basic GET download: [sample/sample.go](sample/sample.go)\n\n### GET request\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"fmt\"\n  \"io\"\n  \"os\"\n\n  \"github.com/goark/fetch\"\n)\n\nfunc main() {\n  u, err := fetch.URL(\"https://github.com/spiegel-im-spiegel.gpg\")\n  if err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    return\n  }\n\n  resp, err := fetch.New().GetWithContext(context.Background(), u)\n  if err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    return\n  }\n  defer resp.Close()\n\n  if _, err := io.Copy(os.Stdout, resp.Body()); err != nil {\n    fmt.Fprintln(os.Stderr, err)\n  }\n}\n```\n\n### POST request\n\n```go\npayload := strings.NewReader(\"name=alice\")\nresp, err := fetch.New().PostWithContext(ctx, u, payload,\n  fetch.WithRequestHeaderSet(\"Content-Type\", \"application/x-www-form-urlencoded\"),\n)\nif err != nil {\n  return err\n}\ndefer resp.Close()\n```\n\n### Public API\n\n- `fetch.URL(raw string)` parses and validates URL input.\n- `fetch.New(opts ...fetch.ClientOpts)` creates a fetch client.\n- `Client.GetWithContext(ctx, u, opts...)` performs GET request.\n- `Client.PostWithContext(ctx, u, payload, opts...)` performs POST request.\n- `fetch.WithHTTPClient(cli)` injects custom `*http.Client`.\n- `fetch.WithRequestHeaderAdd(name, value)` and `fetch.WithRequestHeaderSet(name, value)` apply request headers.\n\n### Error handling\n\nThe package wraps errors, so use `errors.Is` for checks against:\n\n- `fetch.ErrInvalidURL`\n- `fetch.ErrInvalidRequest`\n- `fetch.ErrHTTPStatus`\n\n```go\nif err != nil {\n  switch {\n  case errors.Is(err, fetch.ErrInvalidURL):\n    // invalid URL input\n  case errors.Is(err, fetch.ErrHTTPStatus):\n    // non-success HTTP status (\u003e= 400)\n  }\n}\n```\n\n### Response lifecycle\n\nAlways close the response:\n\n- `defer resp.Close()` for streaming use.\n- Use `resp.DumpBodyAndClose()` when you need body bytes at once.\n\n### Modules Requirement Graph\n\n[![dependency.png](./dependency.png)](./dependency.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoark%2Ffetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoark%2Ffetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoark%2Ffetch/lists"}