{"id":13471343,"url":"https://github.com/tj/go-cli-analytics","last_synced_at":"2026-03-17T17:47:54.991Z","repository":{"id":57486522,"uuid":"58093602","full_name":"tj/go-cli-analytics","owner":"tj","description":"Unobtrusive disk-buffered analytics for CLI tools powered by Segment","archived":false,"fork":false,"pushed_at":"2021-03-18T11:40:00.000Z","size":9,"stargazers_count":77,"open_issues_count":4,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T12:53:44.658Z","etag":null,"topics":["analytics","cli","segment"],"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/tj.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":"2016-05-05T00:53:46.000Z","updated_at":"2025-02-11T21:32:36.000Z","dependencies_parsed_at":"2022-09-01T22:31:53.207Z","dependency_job_id":null,"html_url":"https://github.com/tj/go-cli-analytics","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tj/go-cli-analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fgo-cli-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fgo-cli-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fgo-cli-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fgo-cli-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tj","download_url":"https://codeload.github.com/tj/go-cli-analytics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fgo-cli-analytics/sbom","scorecard":{"id":888098,"data":{"date":"2025-08-11","repo":{"name":"github.com/tj/go-cli-analytics","commit":"cd31e907b1c8acd55d03b73716e9f1a30a9f8c92"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"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":"Code-Review","score":0,"reason":"Found 0/14 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":"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":"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":"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":"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":"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":"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 '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-24T10:46:15.808Z","repository_id":57486522,"created_at":"2025-08-24T10:46:15.808Z","updated_at":"2025-08-24T10:46:15.808Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30628400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: 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":["analytics","cli","segment"],"created_at":"2024-07-31T16:00:43.330Z","updated_at":"2026-03-17T17:47:54.948Z","avatar_url":"https://github.com/tj.png","language":"Go","readme":"\n# go-cli-analytics\n\nDisk-buffered analytics for CLI tools powered by [Segment](https://segment.com). Analytics for CLI tools can help determine which aspects of your tool are most valued by users, and where improvements could be made. Track command or flag usage, errors, latencies, or others, just don't be sketchy!\n\n## How\n\nPass your Segemnt write key, and specify a directory name which will reside in HOME.\n\n```go\na := analytics.New(\u0026analytics.Config{\n  WriteKey: \"\u003cwrite key\u003e\",\n  Dir:      \".myprogram\",\n})\n```\n\nThis package will create three files:\n\n- ~/DIR/id – pseudo user id\n- ~/DIR/events – buffered events\n- ~/DIR/last_flush – state for previous flush\n\nTrack events like this:\n\n```go\na.Track(\"More Something\", map[string]interface{}{\n  \"other\":    \"stuff\",\n  \"whatever\": \"else here\",\n})\n```\n\nFlush events at random, based on the previous duration time, or based on size. Note that flushing on every command will introduce ~500ms of latency, so don't do this.\n\n```go\nlastFlush, _ := a.LastFlush()\nn, _ := a.Size()\n\nswitch {\ncase n \u003e= 15:\n  fmt.Printf(\"  flush due to size\\n\")\n  a.Flush()\ncase time.Now().Sub(lastFlush) \u003e= time.Minute:\n  fmt.Printf(\"  flush due to duration\\n\")\n  a.Flush()\ndefault:\n  fmt.Printf(\"  close\\n\")\n  a.Close()\n}\n```\n\n## Notes\n\nNote that there is no file-level locking at the moment for concurrent executions of your program. This may be added in the future if necessary.\n\n## Badges\n\n[![GoDoc](https://godoc.org/github.com/tj/go-cli-analytics?status.svg)](https://godoc.org/github.com/tj/go-cli-analytics)\n![](https://img.shields.io/badge/license-MIT-blue.svg)\n![](https://img.shields.io/badge/status-stable-green.svg)\n\n---\n\n\u003e [tjholowaychuk.com](http://tjholowaychuk.com) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e GitHub [@tj](https://github.com/tj) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e Twitter [@tjholowaychuk](https://twitter.com/tjholowaychuk)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftj%2Fgo-cli-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftj%2Fgo-cli-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftj%2Fgo-cli-analytics/lists"}