{"id":34583202,"url":"https://github.com/gawen/go-flow","last_synced_at":"2026-05-27T15:32:39.667Z","repository":{"id":57598033,"uuid":"375155567","full_name":"gawen/go-flow","owner":"gawen","description":"🌊  Data processing as streams with a bit of Go's reflection.","archived":false,"fork":false,"pushed_at":"2021-07-08T10:12:54.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T21:56:45.417Z","etag":null,"topics":["flow-based-programming","golang"],"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/gawen.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}},"created_at":"2021-06-08T21:59:27.000Z","updated_at":"2025-08-05T06:26:51.000Z","dependencies_parsed_at":"2022-08-28T10:22:01.623Z","dependency_job_id":null,"html_url":"https://github.com/gawen/go-flow","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gawen/go-flow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawen%2Fgo-flow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawen%2Fgo-flow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawen%2Fgo-flow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawen%2Fgo-flow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gawen","download_url":"https://codeload.github.com/gawen/go-flow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawen%2Fgo-flow/sbom","scorecard":{"id":420108,"data":{"date":"2025-08-11","repo":{"name":"github.com/gawen/go-flow","commit":"3f6c7cd9208c483131c44a1a8d8261bfa3351422"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/3 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":"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":"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":"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":"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":"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":"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":"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: 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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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":"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"}}]},"last_synced_at":"2025-08-19T00:58:50.742Z","repository_id":57598033,"created_at":"2025-08-19T00:58:50.742Z","updated_at":"2025-08-19T00:58:50.742Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33573250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"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":["flow-based-programming","golang"],"created_at":"2025-12-24T10:24:21.057Z","updated_at":"2026-05-27T15:32:39.661Z","avatar_url":"https://github.com/gawen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌊 `go-flow`\n\n*🦋 work in progress*\n\nData processing as streams with a bit of Go's reflection.\n\n```go\n// Map cities to their weather using the wttr.in API.\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\n\t\"github.com/gawen/go-flow\"\n)\n\ntype WttrinInfo struct {\n\tcity string\n\n\tCurrentCondition []struct {\n\t\tTemperatureC string `json:\"temp_C\"`\n\t} `json:\"current_condition\"`\n}\n\nfunc main() {\n    // declare a flow\n    f := flow.F(context.Background())\n\n    // build a stream (`chan string`) with some cities.\n    cities := f.Pipe(1, 0, func(cities chan string) {\n        cities \u003c- \"Paris\"\n        cities \u003c- \"San Francisco\"\n        cities \u003c- \"New York\"\n        // ...\n    })\n\n    // get weather info for each city. Request wttr.in with 8 parallel lanes.\n    wttrninInfos := cities.Pipe(8, 0, func(ctx context.Context, cities chan string, infos chan WttrinInfo) error {\n        for city := range cities {\n            url := fmt.Sprintf(\"https://wttr.in/%s?format=j1\", city)\n            req, err := http.NewRequestWithContext(ctx, \"GET\", url, nil)\n            if err != nil {\n                return err\n            }\n\n            res, err := http.DefaultClient.Do(req)\n            if err != nil {\n                return err\n            }\n            defer res.Body.Close()\n\n            buf, err := ioutil.ReadAll(res.Body)\n            if err != nil {\n                return err\n            }\n\n            var info WttrinInfo\n            if err := json.Unmarshal(buf, \u0026info); err != nil {\n                return err\n            }\n\n            info.city = city\n            infos \u003c- info\n        }\n\n        return nil\n    })\n\n    // consume weather infos and print them.\n    wttrninInfos.Consume(1, func(infos chan WttrinInfo) {\n        for info := range infos {\n            fmt.Printf(\"%+v\\n\", info)\n        }\n    })\n\n    // wait for the flow to finish and panic if an error happened.\n    if err := f.Wait(); err != nil {\n        panic(err.Error())\n    }\n}\n```\n\n## Features\n\nThe core method is\n\n```go\n// Pipe `inputs` to `outputs` with `kernel`. Run parallely `laneCount` times.\nfunc (*Flow) PipeN(\n    laneCount int,          // instance count of running `kernel`. \u003e=1.\n    outChannelBuf int,      // outputs's channel buffer size. \u003e=0.\n    outsCount int,          // count of outputs. \u003e=0.\n    inputs ...interface{},  // list of inputs. can be channels, array/slice, or *flow.Stream\n    kernel interface{},     // Kernel\n) (outputs []*Stream)\n```\n\nA kernel is a method where the first arguments are the inputs given to `PipeN`,\nand the rest the outputs. It can have an optional `context.Context` as first\nargument, being the flow's `context.Context`.\n\n```go\nf.PipeN(\n    8,                      // run 8 kernels simulatenously\n    0,                      // outputs's channel won't have any buffer\n    1,                      // only one output expected\n    []int{1,2,3},           // first input: an []int. will be translated to a chan int.\n    make(chan string),      // second input: an chan string.\n    func(                   // define kernel\n        inp1 chan int,      // first input\n        inp2 chan string,   // second input\n        out chan float,     // define one output, being a chan float\n    ) {\n        // consume inp1 and inp2 and output something in out.\n    },\n)\n```\n\nThe inputs types are checked at runtime. If they do not match, `go-flow` will panic.\n\n## Sugar\n\nSugar methods are provided to ease building flows.\n\n- `Flow.Consume` calls `Flow.PipeN` with no expected output;\n- `Flow.Pipe` does with one expected output;\n- `Flow.Pipe2` does with 2 expected outputs;\n- etc...\n\nA `Stream` also provides the same methods, to chain calls and ease flow writing.\n(see above example).\n\n## Error handling\n\nA kernel can return an optional error, which will kill the whole flow.\n\n```go\nf := flow.F(context.Background())\n\nf.RangeInt(0, 10, 1).Pipe(1, 0, func(in, out chan int) error {\n    for i := range in {\n        // dummy error\n        if i == 5 {\n            return errors.New(\"i don't like 5s\")\n        }\n\n        out \u003c- i\n    }\n\n    return nil\n}).Consume(1, func(in chan int) {\n    for i := range in {\n        println(i)\n    }\n})\n\nif err := f.Wait(); err != nil {\n    panic(err.Error())\n}\n\n// will print:\n// 0\n// 1\n// 2\n// 3\n// 4\n// panic: i don't like 5s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgawen%2Fgo-flow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgawen%2Fgo-flow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgawen%2Fgo-flow/lists"}