CheckOps home

Tools directory

G

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.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

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

  1. Readable matchers: Expect(...).To(...) style.
  2. Async assertions: Eventually and Consistently for concurrent code.
  3. Rich matcher library: Collections, errors, JSON, HTTP and more.
  4. Helper packages: gexec, gbytes, ghttp and gstruct.

Pros

  1. Free to use: Open source under the MIT licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 10 October 2026.

Cons

  1. Different from idiomatic Go: Matcher DSL is unfamiliar to plain go test users.
  2. Best with Ginkgo: Some features are most natural inside Ginkgo specs.
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.

  1. Ginkgo users, as the standard matcher library.
  2. 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.