{"id":13414176,"url":"https://github.com/hhatto/gocloc","last_synced_at":"2025-05-14T03:06:53.065Z","repository":{"id":8216636,"uuid":"55236570","full_name":"hhatto/gocloc","owner":"hhatto","description":" A little fast cloc(Count Lines Of Code)","archived":false,"fork":false,"pushed_at":"2025-03-24T14:19:59.000Z","size":4076,"stargazers_count":858,"open_issues_count":15,"forks_count":83,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-11T08:45:53.549Z","etag":null,"topics":["cli","cloc","count-lines","go"],"latest_commit_sha":null,"homepage":null,"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/hhatto.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}},"created_at":"2016-04-01T14:01:25.000Z","updated_at":"2025-05-10T13:05:49.000Z","dependencies_parsed_at":"2023-11-09T15:28:18.381Z","dependency_job_id":"87682a58-36f6-4be8-a316-031abdac0c96","html_url":"https://github.com/hhatto/gocloc","commit_stats":{"total_commits":361,"total_committers":29,"mean_commits":"12.448275862068966","dds":"0.42659279778393355","last_synced_commit":"e26badb974c81ddd34967b52bf16079586126506"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhatto%2Fgocloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhatto%2Fgocloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhatto%2Fgocloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhatto%2Fgocloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hhatto","download_url":"https://codeload.github.com/hhatto/gocloc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254059500,"owners_count":22007768,"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","cloc","count-lines","go"],"created_at":"2024-07-30T21:00:16.054Z","updated_at":"2025-05-14T03:06:53.000Z","avatar_url":"https://github.com/hhatto.png","language":"Go","funding_links":[],"categories":["Misc","开源类库","Open source library","Code","Go","Repositories"],"sub_categories":["代码分析","Code Analysis","Cloc"],"readme":"# gocloc\n\n[![GoDoc](https://godoc.org/github.com/hhatto/gocloc?status.svg)](https://godoc.org/github.com/hhatto/gocloc)\n[![ci](https://github.com/hhatto/gocloc/workflows/Go/badge.svg)](https://github.com/hhatto/gocloc/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hhatto/gocloc)](https://goreportcard.com/report/github.com/hhatto/gocloc)\n[![Docker Pulls](https://img.shields.io/docker/pulls/hhatto/gocloc)](https://hub.docker.com/r/hhatto/gocloc)\n[![Docker Image Size](https://img.shields.io/docker/image-size/hhatto/gocloc)](https://hub.docker.com/r/hhatto/gocloc)\n\nA little fast [cloc(Count Lines Of Code)](https://github.com/AlDanial/cloc), written in Go.\nInspired by [tokei](https://github.com/Aaronepower/tokei).\n\n## Installation\n\nrequire Go 1.19+\n\n```\n$ go install github.com/hhatto/gocloc/cmd/gocloc@latest\n```\n\nArch Linux user can also install from AUR: [gocloc-git](https://aur.archlinux.org/packages/gocloc-git/).\n\n## Usage\n\n### Basic Usage\n```\n$ gocloc .\n```\n\n```\n$ gocloc .\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nMarkdown                         3              8              0             18\nGo                               1             29              1            323\n-------------------------------------------------------------------------------\nTOTAL                            4             37              1            341\n-------------------------------------------------------------------------------\n```\n\n### Via Docker\nwith [dockerhub](https://hub.docker.com/repository/docker/hhatto/gocloc)\n```\n$ docker run --rm -v \"${PWD}\":/workdir hhatto/gocloc .\n```\n\nwith [GitHub Packages](https://github.com/hhatto/gocloc/packages/350535) on GitHub Actions\n```\njobs:\n  build:\n    name: example of code measurement using gocloc\n    runs-on: ubuntu-18.04\n    steps:\n      - uses: actions/checkout@master\n\n      - name: Login GitHub Registry\n        run: docker login docker.pkg.github.com -u owner -p ${{ secrets.GITHUB_TOKEN }}\n\n      - name: Run gocloc\n        run: docker run --rm -v \"${PWD}\":/workdir docker.pkg.github.com/hhatto/gocloc/gocloc:latest .\n```\n\n### Integration Jenkins CI\nuse [SLOCCount Plugin](https://wiki.jenkins-ci.org/display/JENKINS/SLOCCount+Plugin).\n\n```\n$ cloc --by-file --output-type=sloccount . \u003e sloccount.scc\n```\n\n```\n$ cat sloccount.scc\n398 Go      ./main.go\n190 Go      ./language.go\n132 Markdown        ./README.md\n24  Go      ./xml.go\n18  Go      ./file.go\n15  Go      ./option.go\n```\n\n## Support Languages\nuse `--show-lang` option\n\n```\n$ gocloc --show-lang\n```\n\n## Performance\n* CPU 3.8GHz 8core Intel Core i7 / 32GB 2667MHz DDR4 / MacOSX 13.3.1\n* cloc 1.96\n* tokei 12.1.2 compiled with serialization support: json\n* gocloc [a88edc5](https://github.com/hhatto/gocloc/commit/a88edc52b3eea697687f9546f6ac74a03c91c5fb)\n* target repository is [golang/go commit:f742ddc](https://github.com/golang/go/tree/f742ddc349723667fc9af5d0f16233f7762aeaa0)\n\n### cloc\n\n```\n$ time cloc .\n   12003 text files.\n   11150 unique files.\n    1192 files ignored.\n\n8 errors:\nLine count, exceeded timeout:  ./src/cmd/dist/build.go\nLine count, exceeded timeout:  ./src/cmd/trace/static/webcomponents.min.js\nLine count, exceeded timeout:  ./src/net/http/requestwrite_test.go\nLine count, exceeded timeout:  ./src/vendor/golang.org/x/net/idna/tables10.0.0.go\nLine count, exceeded timeout:  ./src/vendor/golang.org/x/net/idna/tables11.0.0.go\nLine count, exceeded timeout:  ./src/vendor/golang.org/x/net/idna/tables12.0.0.go\nLine count, exceeded timeout:  ./src/vendor/golang.org/x/net/idna/tables13.0.0.go\nLine count, exceeded timeout:  ./src/vendor/golang.org/x/net/idna/tables9.0.0.go\n\ngithub.com/AlDanial/cloc v 1.96  T=35.07 s (317.9 files/s, 78679.3 lines/s)\n-----------------------------------------------------------------------------------\nLanguage                         files          blank        comment           code\n-----------------------------------------------------------------------------------\nGo                                9081         205135         337681        1779107\nText                              1194          11530              0         210849\nAssembly                           563          15549          21625         122329\nHTML                                17           3197             78          24983\nC                                  139           1324            982           6895\nJSON                                20              0              0           3122\nCSV                                  1              0              0           2119\nMarkdown                            27            674            106           1949\nBourne Shell                        16            253            868           1664\nJavaScript                          10            234            221           1517\nPerl                                10            173            171           1111\nC/C++ Header                        26            145            346            724\nBourne Again Shell                  16            120            263            535\nPython                               1            133            104            375\nCSS                                  3              4             13            337\nDOS Batch                            5             56             66            207\nWindows Resource File                4             23              0            146\nLogos                                2             16              0            101\nDockerfile                           2             13             15             47\nC++                                  2             11             14             24\nmake                                 5              9             10             21\nObjective-C                          1              2              3             11\nFortran 90                           2              1              3              8\nawk                                  1              1              6              7\nYAML                                 1              0              0              5\nMATLAB                               1              1              0              4\n-----------------------------------------------------------------------------------\nSUM:                             11150         238604         362575        2158197\n-----------------------------------------------------------------------------------\ncloc .  33.70s user 1.48s system 99% cpu 35.237 total\n```\n\n### tokei\n\n```\n$ time tokei --sort code  --exclude \"**/*.txt\" .\n===============================================================================\n Language            Files        Lines         Code     Comments       Blanks\n===============================================================================\n Go                   9242      2330107      1812147       318036       199924\n GNU Style Assembly    565       159534       127093        16888        15553\n C                     143         9272         6949         1000         1323\n JSON                   21         3122         3122            0            0\n Shell                  16         2785         2267          342          176\n JavaScript             10         1972         1520          218          234\n Perl                    9         1360         1032          170          158\n C Header               27         1222          727          349          146\n BASH                   16          918          521          279          118\n Python                  1          612          421           70          121\n CSS                     3          354          337           13            4\n Autoconf                9          283          274            0            9\n Batch                   5          329          207           66           56\n Alex                    2          117          101            0           16\n Dockerfile              2           75           47           15           13\n C++                     2           49           24           14           11\n Makefile                5           40           20           10           10\n Objective-C             2           21           15            3            3\n FORTRAN Modern          2           12            8            3            1\n Markdown               18         2402            0         1853          549\n-------------------------------------------------------------------------------\n HTML                   17        19060        18584           49          427\n |- CSS                  4         2071         1852           10          209\n |- HTML                 1          219          212            0            7\n |- JavaScript           8         6920         6876           16           28\n (Total)                          28270        27524           75          671\n===============================================================================\n Total               10117      2533646      1975416       339378       218852\n===============================================================================\ntokei --sort code --exclude \"**/*.txt\" .  0.76s user 0.50s system 562% cpu 0.224 total\n```\n\n### gocloc\n\n```\n$ time gocloc --exclude-ext=txt .\n-------------------------------------------------------------------------------\nLanguage                     files          blank        comment           code\n-------------------------------------------------------------------------------\nGo                            9096         205242         352844        1764503\nAssembly                       563          15555          21624         122324\nHTML                            17           3197            212          24849\nC                              139           1324            983           6894\nJSON                            20              0              0           3122\nBASH                            27            345           1106           2122\nMarkdown                        18            549             28           1825\nJavaScript                      10            234            218           1520\nC Header                        26            145            346            724\nPerl                            10            173            584            698\nPython                           1            133            104            375\nCSS                              3              4             13            337\nBatch                            5             56              0            273\nPlan9 Shell                      4             23             50             96\nBourne Shell                     5             28             24             78\nC++                              2             11             14             24\nMakefile                         5             10             10             20\nObjective-C                      2              3              3             15\nFORTRAN Modern                   2              1              3              8\nAwk                              1              1              6              7\n-------------------------------------------------------------------------------\nTOTAL                         9956         227034         378172        1929814\n-------------------------------------------------------------------------------\ngocloc --exclude-ext=txt .  0.65s user 0.51s system 119% cpu 0.970 total\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhatto%2Fgocloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhhatto%2Fgocloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhatto%2Fgocloc/lists"}