{"id":28158448,"url":"https://github.com/indeedeng/go-opine","last_synced_at":"2025-05-15T09:20:00.384Z","repository":{"id":42055595,"uuid":"272809950","full_name":"indeedeng/go-opine","owner":"indeedeng","description":"go-opine is an opinionated tool to enforce minimum code coverage requirements for go projects, and supports writing coverage reports in junit xml or cobertura formats.","archived":false,"fork":false,"pushed_at":"2025-05-08T15:35:25.000Z","size":64,"stargazers_count":4,"open_issues_count":2,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-08T16:44:22.282Z","etag":null,"topics":["golang","testing-tools"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indeedeng.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-06-16T20:53:07.000Z","updated_at":"2025-05-08T15:34:46.000Z","dependencies_parsed_at":"2024-06-20T10:18:11.672Z","dependency_job_id":"05095bb9-ff6c-4691-a640-2d6edd59015b","html_url":"https://github.com/indeedeng/go-opine","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indeedeng%2Fgo-opine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indeedeng%2Fgo-opine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indeedeng%2Fgo-opine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indeedeng%2Fgo-opine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indeedeng","download_url":"https://codeload.github.com/indeedeng/go-opine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310504,"owners_count":22049471,"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":["golang","testing-tools"],"created_at":"2025-05-15T09:19:35.383Z","updated_at":"2025-05-15T09:20:00.373Z","avatar_url":"https://github.com/indeedeng.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-opine\n=========\n\n[![Go Report Card](https://goreportcard.com/badge/oss.indeed.com/go/go-opine)](https://goreportcard.com/report/oss.indeed.com/go/go-opine)\n[![Build Status](https://travis-ci.com/indeedeng/go-opine.svg?branch=master)](https://travis-ci.org/indeedeng/go-opine)\n[![GoDoc](https://godoc.org/oss.indeed.com/go/go-opine?status.svg)](https://godoc.org/oss.indeed.com/go/go-opine)\n[![NetflixOSS Lifecycle](https://img.shields.io/osslifecycle/indeedeng/go-opine.svg)](OSSMETADATA)\n[![GitHub](https://img.shields.io/github/license/indeedeng/go-opine.svg)](LICENSE)\n\n## Project Overview\n\ngo-opine is an opiniated way to run `go test ./... -race` and generate percent total\nof lines covered by tests. By default go-opine exits successfully if at least 50% code\nhas test coverage, but this can be configured. go-opine tries to ignore and skip code\nthat was generated by tools when calculating test coverage (e.g \n[minimock mocks](https://github.com/gojuno/minimock)). go-opine also supports outputting\ntest coverage reports in various formats, such as junit \u0026 cobertura.\n\n## Getting Started\n\nRun `go-opine test` to test for code coverage in the root of a go project. For example,\nrunning in this repo produces the following output:\n\n```\n~/go-opine $\ngo-opine test\n?       indeed.com/gophers/go-opine     [no test files]\nok      indeed.com/gophers/go-opine/internal/run        0.039s\nok      indeed.com/gophers/go-opine/internal/printing   0.019s\nok      indeed.com/gophers/go-opine/internal/coverage   0.317s\nok      indeed.com/gophers/go-opine/internal/junit      0.364s\nok      indeed.com/gophers/go-opine/internal/gotest     1.572s\nok      indeed.com/gophers/go-opine/internal/cmd        3.132s\nTest coverage sufficient (85.4% \u003e= 50.0%)\n```\n\nTo generate a go coverage report, junit report, or corbertura report, see the usage info:\n```\n$ go-opine help test\ntest [-min-coverage \u003cpercent\u003e] [-junit \u003cpath\u003e] [-xmlcov \u003cpath\u003e] [-coverprofile \u003cpath\u003e]:\n  Run Go tests in an opinionated way.\n  -coverprofile string\n        write Go coverprofile coverage\n  -junit string\n        write JUnit XML test results\n  -min-coverage float\n        minimum code test coverage to enforce (default 50)\n  -xmlcov string\n        write Cobertura XML coverage\n```\n\n\n#### Configuring minimum code coverage\nBy default go-opine requires 50% code coverage. This may not be adequate for every project,\nbut Indeed has found it to be a good minimum. For projects that want to enforce different test\ncoverage requirements, set the `-min-coverage` flag to the coverage percentage desired, between\n`0` and `100`.\n\nFor example, to enforce a 75% code coverage requirement:\n```\ngo-opine test -min-coverage 75\n```\n\nTo disable code coverage requirements entirely, set `-min-coverage` to `0`.\n\n#### go-opine is a Go tool\n\nSince go-opine is typically a tool dependency (rather than a library dependency) you\ncan use the \"tools.go\" approach described in\n[gotools](https://github.com/go-modules-by-example/index/tree/5ec250b4b78114a55001bd7c9cb88f6e07270ea5/010_tools)\nand [go#25922](https://github.com/golang/go/issues/25922#issuecomment-451123151) to declare\nthe dependency.\n\nIf you are not using a `tools.go` you can `go get` go-opine and install it on your path.\n\n## How To Contribute\n\nWe welcome contributions! Feel free to help make `go-opine` better.\n\n### Process\n\n- Open an issue and describe the desired feature / bug fix before making\nchanges. It's useful to get a second pair of eyes before investing development\neffort.\n- Make the change. If adding a new feature, remember to provide tests that\ndemonstrate the new feature works, including any error paths. If contributing\na bug fix, add tests that demonstrate the erroneous behavior is fixed.\n- Open a pull request. Automated CI tests will run. If the tests fail, please\nmake changes to fix the behavior, and repeat until the tests pass.\n- Once everything looks good, one of the indeedeng members will review the\nPR and provide feedback.\n\n### Maintainers\n\nThe `oss.indeed.com/go/go-opine` module is maintained by Indeed Engineering.\n\nWhile we are always busy helping people get jobs, we will try to respond to\nGitHub issues, pull requests, and questions within a couple of business days.\n\n## Code of Conduct\nThis project is governed by the [Contributor Covenant v 1.4.1](CODE_OF_CONDUCT.md).\n\n## License\nThis project uses the [Apache 2.0](LICENSE) license. (Update this and the LICENSE file if your project uses a different license.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findeedeng%2Fgo-opine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findeedeng%2Fgo-opine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findeedeng%2Fgo-opine/lists"}