{"id":16623676,"url":"https://github.com/jandelgado/gcov2lcov","last_synced_at":"2025-04-05T21:11:13.875Z","repository":{"id":39906263,"uuid":"212906204","full_name":"jandelgado/gcov2lcov","owner":"jandelgado","description":"convert go coverage files to lcov format","archived":false,"fork":false,"pushed_at":"2025-03-25T01:20:42.000Z","size":52,"stargazers_count":53,"open_issues_count":3,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T20:09:16.650Z","etag":null,"topics":["coverage","golang","lcov","testing"],"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/jandelgado.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-10-04T21:36:53.000Z","updated_at":"2025-03-23T20:47:30.000Z","dependencies_parsed_at":"2024-12-16T19:11:22.217Z","dependency_job_id":"354359ad-17f5-428b-b8e5-311e33ab9dff","html_url":"https://github.com/jandelgado/gcov2lcov","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandelgado%2Fgcov2lcov","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandelgado%2Fgcov2lcov/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandelgado%2Fgcov2lcov/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandelgado%2Fgcov2lcov/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jandelgado","download_url":"https://codeload.github.com/jandelgado/gcov2lcov/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399885,"owners_count":20932880,"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":["coverage","golang","lcov","testing"],"created_at":"2024-10-12T03:24:35.220Z","updated_at":"2025-04-05T21:11:13.828Z","avatar_url":"https://github.com/jandelgado.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gcov2lcov\n\n[![Build Status](https://github.com/jandelgado/gcov2lcov/workflows/run%20tests/badge.svg)](https://github.com/jandelgado/gcov2lcov/actions?workflow=run%20tests)\n[![Coverage Status](https://coveralls.io/repos/github/jandelgado/gcov2lcov/badge.svg?branch=master)](https://coveralls.io/github/jandelgado/gcov2lcov?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jandelgado/gcov2lcov)](https://goreportcard.com/report/github.com/jandelgado/gcov2lcov)\n\nConvert golang test coverage to lcov format (which can for example be uploaded\nto coveralls).\n\nSee [gcov2lcov-action](https://github.com/jandelgado/gcov2lcov-action)\nfor a github action which uses this tool.\n\n## Credits\n\nThis tool is based on [covfmt](https://github.com/ricallinson/covfmt) and\nuses some parts of [goveralls](https://github.com/mattn/goveralls).\n\n## Installation\n\n### Binary download\n\nDownload a version for your platform from the [Releases](https://github.com/jandelgado/gcov2lcov/releases) page.\n\nYou may have noticed that the file `gcov2lcov-linux-amd64.tar.gz` does not\nfollow the naming convention used for other artifacts. This particular file is\nprovided for backward compatibility with the `gcov2lcov-action` and can be\ndisregarded for general use.\n\n### Compile from source\n\n```text\n$ go install github.com/jandelgado/gcov2lcov@latest\n```\n\n## Usage\n\n```text\nUsage of ./gcov2lcov:\n  -infile string\n        go coverage file to read, default: \u003cstdin\u003e\n  -outfile string\n        lcov file to write, default: \u003cstdout\u003e\n  -use-absolute-source-path\n        use absolute paths for source file in lcov output, default: false\n```\n\n### Example\n\n```sh\n$ go test -coverprofile=coverage.out \u0026\u0026 \\\ngcov2lcov -infile=coverage.out -outfile=coverage.lcov\n```\n\n### GOROOT\n\nIt might be necessary to set the `GOROOT` environment variable properly before\ncalling `gcov2lcov`. If you see `cannot find GOROOT directory` warnings like\ne.g.\n\n```text\n022/05/23 16:00:58 warn: go/build: importGo github.com/pashagolub/pgxmock/: exit status 2\ngo: cannot find GOROOT directory: /opt/hostedtoolcache/go/1.13.15/x64\n```\n\nThen call `gcov2lcov` with \n\n```text\n$ GOROOT=$(go env GOROOT) gcov2lcov -infile=coverage.out -outfile=coverage.lcov\n```\n\n## Build and Test\n\n* `make test`  to run tests\n* `make build` to build binary in `bin/` directory\n\n## Tracefile format reference\n\nThe following desription is taken from the [geninfo\nmanpage](http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php) of the [lcov\nhomepage](http://ltp.sourceforge.net/coverage/lcov/):\n\n```text\nA tracefile is made up of several human-readable lines of text, divided into\nsections. If available, a tracefile begins with the testname which is stored in\nthe following format:\n\nTN:\u003ctest name\u003e\n\nFor each source file referenced in the .da file, there is a section containing\nfilename and coverage data:\n\nSF:\u003cabsolute path to the source file\u003e\n\nFollowing is a list of line numbers for each function name found in the source file:\n\nFN:\u003cline number of function start\u003e,\u003cfunction name\u003e\n\nNext, there is a list of execution counts for each instrumented function:\n\nFNDA:\u003cexecution count\u003e,\u003cfunction name\u003e\n\nThis list is followed by two lines containing the number of functions found and hit:\n\nFNF:\u003cnumber of functions found\u003e FNH:\u003cnumber of function hit\u003e\n\nBranch coverage information is stored which one line per branch:\n\nBRDA:\u003cline number\u003e,\u003cblock number\u003e,\u003cbranch number\u003e,\u003ctaken\u003e\n\nBlock number and branch number are gcc internal IDs for the branch. Taken is\neither '-' if the basic block containing the branch was never executed or a\nnumber indicating how often that branch was taken.\n\nBranch coverage summaries are stored in two lines:\n\nBRF:\u003cnumber of branches found\u003e BRH:\u003cnumber of branches hit\u003e\n\nThen there is a list of execution counts for each instrumented line (i.e. a\nline which resulted in executable code):\n\nDA:\u003cline number\u003e,\u003cexecution count\u003e[,\u003cchecksum\u003e]\n\nNote that there may be an optional checksum present for each instrumented line.\nThe current geninfo implementation uses an MD5 hash as checksumming algorithm.\n\nAt the end of a section, there is a summary about how many lines were found and\nhow many were actually instrumented:\n\nLH:\u003cnumber of lines with a non-zero execution count\u003e LF:\u003cnumber of instrumented lines\u003e\n\nEach sections ends with:\n\nend_of_record\n\nIn addition to the main source code file there are sections for all #included\nfiles which also contain executable code.\n\nNote that the absolute path of a source file is generated by interpreting the\ncontents of the respective .bb file (see gcov (1) for more information on this\nfile type). Relative filenames are prefixed with the directory in which the .bb\nfile is found.\n\nNote also that symbolic links to the .bb file will be resolved so that the\nactual file path is used instead of the path to a link. This approach is\nnecessary for the mechanism to work with the /proc/gcov files.\n\n```\n\n## Author\n\nJan Delgado\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjandelgado%2Fgcov2lcov","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjandelgado%2Fgcov2lcov","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjandelgado%2Fgcov2lcov/lists"}