{"id":42640817,"url":"https://github.com/spatialcurrent/go-lazy","last_synced_at":"2026-01-29T06:14:41.740Z","repository":{"id":44677563,"uuid":"238122935","full_name":"spatialcurrent/go-lazy","owner":"spatialcurrent","description":"A lazy reader that allows delayed opening of a resource until the first read.","archived":false,"fork":false,"pushed_at":"2022-01-31T15:06:49.000Z","size":28,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-21T18:58:19.816Z","etag":null,"topics":["big-data","bigdata"],"latest_commit_sha":null,"homepage":"","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/spatialcurrent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-04T04:28:39.000Z","updated_at":"2024-06-21T18:58:19.817Z","dependencies_parsed_at":"2022-09-15T21:31:47.035Z","dependency_job_id":null,"html_url":"https://github.com/spatialcurrent/go-lazy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spatialcurrent/go-lazy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-lazy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-lazy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-lazy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-lazy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatialcurrent","download_url":"https://codeload.github.com/spatialcurrent/go-lazy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-lazy/sbom","scorecard":{"id":840530,"data":{"date":"2025-08-11","repo":{"name":"github.com/spatialcurrent/go-lazy","commit":"47315cc003d10616c654c75aafa660c705aa8aa5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"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":"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":"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":"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":0,"reason":"Found 0/7 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":"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":"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":"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: MIT License: 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":"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":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"}},{"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":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0635","Warn: Project is vulnerable to: GO-2022-0646","Warn: Project is vulnerable to: GO-2022-0493 / GHSA-p782-xgp4-8hr8","Warn: Project is vulnerable to: GO-2022-0603 / GHSA-hp87-p4gw-j4gq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T20:23:04.558Z","repository_id":44677563,"created_at":"2025-08-23T20:23:04.558Z","updated_at":"2025-08-23T20:23:04.558Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28865711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T05:56:06.453Z","status":"ssl_error","status_checked_at":"2026-01-29T05:55:57.668Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["big-data","bigdata"],"created_at":"2026-01-29T06:14:40.850Z","updated_at":"2026-01-29T06:14:41.731Z","avatar_url":"https://github.com/spatialcurrent.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/spatialcurrent/go-lazy/tree/master.svg?style=svg)](https://circleci.com/gh/spatialcurrent/go-lazy/tree/master) [![Go Report Card](https://goreportcard.com/badge/spatialcurrent/go-lazy)](https://goreportcard.com/report/spatialcurrent/go-lazy)  [![PkgGoDev](https://pkg.go.dev/badge/github.com/spatialcurrent/go-lazy)](https://pkg.go.dev/github.com/spatialcurrent/go-lazy) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://github.com/spatialcurrent/go-lazy/blob/master/LICENSE.md)\n\n# go-lazy\n\n## Description\n\n**go-lazy** is a library that includes a lazy reader and writer that allows delayed opening of a resource.  The `LazyReader` and `LazyReadCloser` can be used to delay opening a resource until the resource is actually read.  The `LazyWriterAt` and `LazyWriteCloser` can be used to delay creating a resource until the first byte is actually written.  The `LazyFile` can be used to delay opening a file and allocating a file descriptor until it is required.\n\n# Usage\n\n**Go**\n\nYou can import **go-lazy** as a library with:\n\n```go\nimport (\n  \"github.com/spatialcurrent/go-lazy/pkg/lazy\"\n)\n```\n\nThe easiest pattern is to simply use a closure function to open up a file or remote data source, so that you can delay opening the resource until it is actually needed.\n\n```go\nreturn lazy.NewReader(func() (io.Reader, error) {\n  // open up a file or remote data source and return as a reader.\n})\n```\n\n```go\nreturn lazy.NewReadCloser(func() (io.ReadCloser, error) {\n  // open up a file or remote data source and return as a reader.\n})\n```\n\n```go\nwriter := lazy.NewLazyWriteCloser(func() (io.WriterAt, error) {\n  // open up a pipe\n})\n```\n\n```go\nwriter := lazy.NewLazyWriterAt(func() (io.WriterAt, error) {\n  // open up a file or byte buffer\n})\n```\n\nA good use case is for reading multiple gzip files in sequential order.  The gzip reader can automatically read through multiple files.  This approach keeps the number of file descriptors open to 1 at a time while still using an io.MultiReader for convenience.\n\n```go\nr, err := gzip.NewReader(io.MultiReader(\n  NewLazyReader(func() (io.Reader, error) {\n    return first file\n  }),\n  NewLazyReader(func() (io.Reader, error) {\n    // return second file\n  }),\n))\n```\n\nThe LazyFile can also be used to delay opening or stating a file if it is passed to a callback.  LazyFile matches the `os.File` API when possible, but is not a drop in replacement.  The API is identical for `Read`, `Stat`, and `Close` methods, but the `Fd` method now returns the file descriptor with an error if any.\n\n```go\nf := lazy.NewLazyFile(name, os.O_RDONLY, 0)\nerr := callback(f)\nif err != nil {\n  return err\n}\n// do something with the file\n```\n\nAnother good use case if for using the [s3manager](https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager) Downloader to concurrently download multiple files.  To avoid many empty files for downloads that haven't started yet, use `LazyWriterAt`.\n\n```\nwriter := lazy.NewLazyWriterAt(func() (io.WriterAt, error) {\n  file, err := os.Create(input.Path)\n  if err != nil {\n    return nil, fmt.Errorf(\"error creating destination file %q: %w\", input.Path, err)\n  }\n  return file, nil\n})\n_, err = downloader.DownloadWithContext(input.Context, writer, \u0026s3.GetObjectInput{\n  Bucket: aws.String(input.Bucket),\n  Key:    aws.String(input.Key),\n})\n```\n\nSee [go.dev](https://pkg.go.dev/github.com/spatialcurrent/go-lazy/) for information on how to use Go API.\n\n# Testing\n\nTo run Go tests use `make test_go` (or `bash scripts/test.sh`), which runs unit tests, `go vet`, `go vet with shadow`, [errcheck](https://github.com/kisielk/errcheck), [ineffassign](https://github.com/gordonklaus/ineffassign), [staticcheck](https://staticcheck.io/), and [misspell](https://github.com/client9/misspell).\n\n# Contributing\n\n[Spatial Current, Inc.](https://spatialcurrent.io) is currently accepting pull requests for this repository.  We'd love to have your contributions!  Please see [Contributing.md](https://github.com/spatialcurrent/go-lazy/blob/master/CONTRIBUTING.md) for how to get started.\n\n# License\n\nThis work is distributed under the **MIT License**.  See **LICENSE** file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatialcurrent%2Fgo-lazy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatialcurrent%2Fgo-lazy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatialcurrent%2Fgo-lazy/lists"}