CheckOps
Gomega
Gomega is an MIT-licensed matcher and assertion library for Go, designed for Ginkgo but usable with plain go test, with asynchronous Eventually/Consistently assertions.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
Gomega is a matcher and assertion library for Go. It is the preferred companion to Ginkgo but works with the standard testing package too, via gomega.NewWithT(t). Assertions read naturally: Expect(err).NotTo(HaveOccurred()), Expect(items).To(ContainElement("apple")), Expect(resp).To(HaveHTTPStatus(200)).
Its standout feature is asynchronous assertions. Eventually(func() int { return queue.Len() }).Should(Equal(0)) polls until the condition holds or a timeout expires, and Consistently checks that a condition stays true over a period, both essential for testing concurrent and distributed systems. Gomega includes a large library of matchers for equality, collections, errors, types, strings, JSON, YAML and XML, plus composable matchers (And, Or, WithTransform), and subpackages such as gexec for running binaries, gbytes for streams, ghttp for test HTTP servers and gstruct for struct matching. Version 1.44.0 was released on 24 September 2026.
The source code is at onsi/gomega on GitHub under the MIT licence, with about 2,400 stars; the most recent commit was on 10 October 2026.
Features
- Readable matchers:
Expect(...).To(...)style. - Async assertions:
EventuallyandConsistentlyfor concurrent code. - Rich matcher library: Collections, errors, JSON, HTTP and more.
- Helper packages: gexec, gbytes, ghttp and gstruct.
Pros
- Free to use: Open source under the MIT licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 10 October 2026.
Cons
- Different from idiomatic Go: Matcher DSL is unfamiliar to plain go test users.
- Best with Ginkgo: Some features are most natural inside Ginkgo specs.
Usage and Links (Example)
func TestWorkerDrainsQueue(t *testing.T) {
g := NewWithT(t)
q := NewQueue()
q.Push("job-1")
go Worker(q)
g.Eventually(q.Len).WithTimeout(2 * time.Second).Should(Equal(0))
g.Expect(q.Errors()).To(BeEmpty())
}
Resources:
Pricing
Gomega is free and open source under the MIT licence.
Recommended for?
- Ginkgo users, as the standard matcher library.
- Go developers testing asynchronous behaviour with Eventually and Consistently.
Conclusion
Gomega is a rich Go matcher library whose asynchronous assertions make it valuable even outside Ginkgo.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with Gomega side by side.
GGinkgoGinkgo is an MIT-licensed BDD-style testing framework for Go with Describe/Context/It specs, parallel execution, focused and labelled specs and rich reporting, usually paired with the Gomega matcher library.Compare with Gomega
TTestifyTestify is an MIT-licensed Go toolkit with assert and require assertion packages, mock objects and test suites, the most widely used testing library in the Go ecosystem.Compare with Gomega
GGo testing packageGo's built-in testing package and go test command provide unit tests, table-driven subtests, benchmarks, fuzzing, examples and coverage with no third-party dependencies.Compare with Gomega
GGoMock (uber-go/mock)GoMock is an Apache-2.0 mocking framework for Go, maintained by Uber after the original golang/mock was archived, with the mockgen code generator and a gomock controller for expectations.Compare with Gomega
AAssertJAssertJ is an Apache-2.0 fluent assertions library for Java, with rich, discoverable assertions for core types, collections, exceptions, dates and more, plus soft assertions and custom assertion generation.Compare with Gomega
CChaiChai is an MIT-licensed BDD/TDD assertion library for Node.js and browsers, offering expect, should and assert styles and a large plugin ecosystem, pairing with any test framework.Compare with Gomega