Skip to content

Commit

Permalink
remove tools.go hack from documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
onsi committed Feb 17, 2023
1 parent cca66a8 commit 0718693
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,17 @@ You should now be able to run `ginkgo version` at the command line and see the G
To upgrade Ginkgo run:

```bash
go get github.com/onsi/ginkgo/v2/ginkgo
go get github.com/onsi/ginkgo/v2
go install github.com/onsi/ginkgo/v2/ginkgo
```

To pick a particular version:

```bash
go get github.com/onsi/ginkgo/v2/ginkgo@v2.m.p
go get github.com/onsi/ginkgo/[email protected]
go install github.com/onsi/ginkgo/v2/ginkgo
```

Note that in both cases we `go get` the `/v2/ginkgo` subpackage. This pulls in the CLI and its dependencies. If you only `go get github.com/onsi/ginkgo/v2` you may experience issues installing the cli - if you do simply run `go get github.com/onsi/ginkgo/v2/ginkgo` to fetch the missing dependencies.

### Support Policy

Ginkgo adheres to semantic versioning - the intent is for there to be no breaking changes along the `2.m.p` line with new functionality landing as minor releases and bug-fixes landing as patch releases (fixes are never back-ported). We work hard to maintain this policy however exceptions (while rare and typically minor) are possible, especially for brand new/emerging features.
Expand Down Expand Up @@ -3510,21 +3508,6 @@ When running in CI you must make sure that the version of the `ginkgo` CLI you a

`go run github.com/onsi/ginkgo/v2/ginkgo`

This alone, however, is often not enough. The Ginkgo CLI includes additional dependencies that aren't part of the Ginkgo library - since your code doesn't import the cli these dependencies probably aren't in your `go.sum` file. To get around this it is idiomatic Go to introduce a `tools.go` file. This can go anywhere in your module - for example, Gomega places its `tools.go` at the top-level. Your `tools.go` file should look like:

```go
//go:build tools
// +build tools

package main

import (
_ "github.com/onsi/ginkgo/v2/ginkgo"
)
```

The `//go:build tools` constraint ensures this code is never actually built, however the `_ "github.com/onsi/ginkgo/v2/ginkgo` import statement is enough to convince `go mod` to include the Ginkgo CLI dependencies in your `go.sum` file.

Once you have `ginkgo` running on CI, you'll want to pick and choose the optimal set of flags for your test runs. We recommend the following set of flags when running in a continuous integration environment:

```bash
Expand Down

0 comments on commit 0718693

Please sign in to comment.