{"id":16027577,"url":"https://github.com/followtheprocess/gowc","last_synced_at":"2025-04-10T05:30:29.669Z","repository":{"id":172063318,"uuid":"648760141","full_name":"FollowTheProcess/gowc","owner":"FollowTheProcess","description":"Toy clone of coreutils wc in Go","archived":false,"fork":false,"pushed_at":"2025-03-31T12:22:14.000Z","size":1201,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T13:35:56.958Z","etag":null,"topics":["cli","go","unix-shell"],"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/FollowTheProcess.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}},"created_at":"2023-06-02T18:37:24.000Z","updated_at":"2025-03-31T12:22:17.000Z","dependencies_parsed_at":"2024-05-21T11:17:16.418Z","dependency_job_id":"67bc865f-6ea0-4d91-b357-85ba38164c19","html_url":"https://github.com/FollowTheProcess/gowc","commit_stats":{"total_commits":69,"total_committers":3,"mean_commits":23.0,"dds":0.4782608695652174,"last_synced_commit":"4656c1776ba93f0c62afd5381891014b1ce55bf9"},"previous_names":["followtheprocess/gowc"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fgowc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fgowc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fgowc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fgowc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FollowTheProcess","download_url":"https://codeload.github.com/FollowTheProcess/gowc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248162900,"owners_count":21057832,"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","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":["cli","go","unix-shell"],"created_at":"2024-10-08T20:22:30.425Z","updated_at":"2025-04-10T05:30:29.619Z","avatar_url":"https://github.com/FollowTheProcess.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gowc\n\n[![License](https://img.shields.io/github/license/FollowTheProcess/gowc)](https://github.com/FollowTheProcess/gowc)\n[![Go Report Card](https://goreportcard.com/badge/github.com/FollowTheProcess/gowc)](https://goreportcard.com/report/github.com/FollowTheProcess/gowc)\n[![GitHub](https://img.shields.io/github/v/release/FollowTheProcess/gowc?logo=github\u0026sort=semver)](https://github.com/FollowTheProcess/gowc)\n[![CI](https://github.com/FollowTheProcess/gowc/workflows/CI/badge.svg)](https://github.com/FollowTheProcess/gowc/actions?query=workflow%3ACI)\n[![codecov](https://codecov.io/gh/FollowTheProcess/gowc/branch/main/graph/badge.svg)](https://codecov.io/gh/FollowTheProcess/gowc)\n\nToy clone of [coreutils] [wc] in Go\n\n## Project Description\n\n`gowc` is a toy reimplementation of [wc] in Go, mainly written for fun 😃. It's perfectly functional, well tested and correct but there's no real\nbenefit over using it vs the original (aside from maybe the JSON flag).\n\nThe main reason I chose to write it was that I discovered you can (sort of) abuse the [io.Writer] interface to count lines, words etc. The primary benefit being\nyou can then leverage [io.Copy] from either files or stdin (both of which implement [io.Reader]).\n\nUsing [io.Copy] means large files automatically get chunked into 32kb blocks and streamed through your program so `gowc` works seamlessly on enormous files!\n\nSo this was a fun experiment to see how far you can take it.\n\n## Installation\n\nCompiled binaries for all supported platforms can be found in the [GitHub release]. There is also a [homebrew] tap:\n\n```shell\nbrew install FollowTheProcess/homebrew-tap/gowc\n```\n\n## Quickstart\n\n### Pipe from stdin\n\n```shell\ngowc \u003c moby_dick.txt\n\n# Or\ncat moby_dick.txt | gowc\n```\n\n```plain\nFile          Bytes   Chars   Lines Words\nmoby_dick.txt 1232922 1232922 23243 214132\n```\n\n### Read from file\n\n```shell\ngowc moby_dick.txt\n```\n\n```plain\nFile          Bytes   Chars   Lines Words\nmoby_dick.txt 1232922 1232922 23243 214132\n```\n\n### Multiple files\n\nMultiple files are counted concurrently using a worker pool 🚀\n\n```shell\ngowc myfiles/*\n```\n\n```plain\nFile                   Bytes    Chars   Lines Words\n.myfiles/onemore.txt   460      460     2     63\n.myfiles/another.txt   608      608     2     80\n.myfiles/moby_dick.txt 1232922  1232922 23243 214132\n```\n\n### JSON\n\n```shell\ngowc moby_dick.txt --json | jq\n```\n\n```json\n{\n  \"name\": \"moby_dick.txt\",\n  \"lines\": 23243,\n  \"bytes\": 1232922,\n  \"words\": 214132,\n  \"chars\": 1232922\n}\n```\n\nYou can also do multiple files in JSON:\n\n```shell\ngowc myfiles/* --json\n```\n\n```json\n[\n  {\n    \"name\": \"myfiles/onemore.txt\",\n    \"lines\": 2,\n    \"bytes\": 460,\n    \"words\": 63,\n    \"chars\": 460\n  },\n  {\n    \"name\": \"myfiles/another.txt\",\n    \"lines\": 2,\n    \"bytes\": 608,\n    \"words\": 80,\n    \"chars\": 608\n  },\n  {\n    \"name\": \"myfiles/moby_dick.txt\",\n    \"lines\": 23243,\n    \"bytes\": 1232922,\n    \"words\": 214132,\n    \"chars\": 1232922\n  }\n]\n```\n\n## Performance\n\nI've not really put too much effort into optimisation, there's potentially some to be had, but it performs fast enough so that you wouldn't notice\nthe difference with the original.\n\nCounting on multiple files happens concurrently in a worker pool across all your cores so even on very high numbers of files it performs well:\n\n![bench](https://github.com/FollowTheProcess/gowc/raw/main/docs/img/bench.png)\n\nThat's 9261 files read and counted words, lines, bytes and utf-8 characters in just over 18ms 🚀\n\n### Credits\n\nThis package was created with [copier] and the [FollowTheProcess/go_copier] project template.\n\n[copier]: https://copier.readthedocs.io/en/stable/\n[FollowTheProcess/go_copier]: https://github.com/FollowTheProcess/go_copier\n[GitHub release]: https://github.com/FollowTheProcess/gowc/releases\n[homebrew]: https://brew.sh\n[coreutils]: https://www.gnu.org/software/coreutils/manual/\n[wc]: https://www.gnu.org/software/coreutils/manual/html_node/wc-invocation.html#wc-invocation\n[io.Writer]: https://pkg.go.dev/io#Writer\n[io.Copy]: https://pkg.go.dev/io#Copy\n[io.Reader]: https://pkg.go.dev/io#Reader\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollowtheprocess%2Fgowc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffollowtheprocess%2Fgowc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollowtheprocess%2Fgowc/lists"}