diff --git a/README.md b/README.md index f05315d..32c86d7 100644 --- a/README.md +++ b/README.md @@ -102,18 +102,6 @@ For details on Semantic Versioning, see [the semver package documentation](https > > The recommendation is based on the YAML parser's behavior, which interprets non-wrapped values as numbers and, in the case of version `1.20`, trims it down to `1.2`, which may not be very obvious. -### Automatic go.mod detection - -**New in v6**: If neither `go-version` nor `go-version-file` is specified, the action will automatically look for a `go.mod` file in the repository root and use the Go version specified in it. This simplifies workflows for projects that already have a `go.mod` file. - -```yaml -steps: - - uses: actions/checkout@v6 - - uses: actions/setup-go@v6 - # Automatically uses go.mod from repository root - - run: go version -``` - For more usage examples, please refer to the section: [Using go-version input](docs/advanced-usage.md#using-the-go-version-input) of the [Advanced usage](docs/advanced-usage.md) guide. ## Recommended permissions diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 91e8ffa..1a41962 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -168,6 +168,18 @@ jobs: If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used. The `.tool-versions` file supports version specifications in accordance with asdf standards, adhering to Semantic Versioning ([semver](https://semver.org)). +### Automatic go.mod detection + +If neither `go-version` nor `go-version-file` is specified, the action will automatically look for a `go.mod` file in the repository root and use the Go version specified in it. This simplifies workflows for projects that already have a `go.mod` file. + +```yaml +steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + # Automatically uses go.mod from repository root + - run: go version +``` + ```yaml steps: - uses: actions/checkout@v6