mirror of
https://github.com/actions/setup-go
synced 2026-09-18 23:22:09 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e626ada899 | ||
|
|
468e940882 | ||
|
|
34829cb9ac | ||
|
|
addc0880c9 | ||
|
|
fba3fb4ead | ||
|
|
5064d95ba1 |
@@ -20,7 +20,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
go-version: ['1.25', '1.24']
|
go-version: ['1.25', '1.24']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: Setup Microsoft build of Go ${{ matrix.go-version }}
|
- name: Setup Microsoft build of Go ${{ matrix.go-version }}
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -59,7 +59,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest'
|
GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: Setup Microsoft build of Go via environment variable
|
- name: Setup Microsoft build of Go via environment variable
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -95,7 +95,7 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
architecture: arm64
|
architecture: arm64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: Setup Microsoft build of Go with architecture
|
- name: Setup Microsoft build of Go with architecture
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -116,7 +116,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: Setup Microsoft build of Go with caching
|
- name: Setup Microsoft build of Go with caching
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checking out
|
- name: Checking out
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Publish
|
- name: Publish
|
||||||
id: publish
|
id: publish
|
||||||
uses: actions/publish-immutable-action@v0.0.4
|
uses: actions/publish-immutable-action@v0.0.4
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go Stable
|
- name: Setup Go Stable
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -33,9 +33,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go oldStable
|
- name: Setup Go oldStable
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -43,21 +43,46 @@ jobs:
|
|||||||
- name: Verify Go
|
- name: Verify Go
|
||||||
run: go version
|
run: go version
|
||||||
|
|
||||||
|
go-env-outputs:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
- name: Setup Go
|
||||||
|
id: setup-go
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
go-version: stable
|
||||||
|
- name: Show Go environment outputs
|
||||||
|
run: |
|
||||||
|
echo "go-path: ${{ steps.setup-go.outputs.go-path }}"
|
||||||
|
echo "go-bin: ${{ steps.setup-go.outputs.go-bin }}"
|
||||||
|
echo "go-bin-path: ${{ steps.setup-go.outputs.go-bin-path }}"
|
||||||
|
echo "go-root: ${{ steps.setup-go.outputs.go-root }}"
|
||||||
|
echo "go-cache: ${{ steps.setup-go.outputs.go-cache }}"
|
||||||
|
echo "go-mod-cache: ${{ steps.setup-go.outputs.go-mod-cache }}"
|
||||||
|
echo "go-os: ${{ steps.setup-go.outputs.go-os }}"
|
||||||
|
echo "go-arch: ${{ steps.setup-go.outputs.go-arch }}"
|
||||||
|
echo "go-tool-dir: ${{ steps.setup-go.outputs.go-tool-dir }}"
|
||||||
|
|
||||||
aliases-arch:
|
aliases-arch:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
version: [stable, oldstable]
|
version: [stable, oldstable]
|
||||||
architecture: [x64, x32]
|
architecture: [x64, x32]
|
||||||
exclude:
|
exclude:
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
architecture: x32
|
architecture: x32
|
||||||
- os: macos-latest-large
|
- os: macos-15-intel
|
||||||
architecture: x32
|
architecture: x32
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }}
|
- name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }}
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -72,7 +97,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-large]
|
os: [macos-latest, windows-latest, ubuntu-latest, macos-15-intel]
|
||||||
go: [1.21.13, 1.22.8, 1.23.2]
|
go: [1.21.13, 1.22.8, 1.23.2]
|
||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
@@ -82,7 +107,7 @@ jobs:
|
|||||||
go: 1.23.2
|
go: 1.23.2
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: setup-go ${{ matrix.go }}
|
- name: setup-go ${{ matrix.go }}
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -98,10 +123,10 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
go-version: ['1.20', '1.21', '1.22', '1.23']
|
go-version: ['1.20', '1.21', '1.22', '1.23']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go and check latest
|
- name: Setup Go and check latest
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -115,9 +140,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go and check latest
|
- name: Setup Go and check latest
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -131,9 +156,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go and check latest
|
- name: Setup Go and check latest
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -147,9 +172,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go and check latest
|
- name: Setup Go and check latest
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -163,9 +188,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go from .go-version file
|
- name: Setup Go from .go-version file
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -179,11 +204,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-large]
|
os: [macos-latest, windows-latest, ubuntu-latest, macos-15-intel]
|
||||||
go: [1.20.14, 1.21.10, 1.22.8, 1.23.2]
|
go: [1.20.14, 1.21.10, 1.22.8, 1.23.2]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: setup-go ${{ matrix.go }}
|
- name: setup-go ${{ matrix.go }}
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -199,11 +224,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-latest, ubuntu-latest, macos-latest-large]
|
os: [windows-latest, ubuntu-latest, macos-15-intel]
|
||||||
go: [1.11.12]
|
go: [1.11.12]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: setup-go ${{ matrix.go }}
|
- name: setup-go ${{ matrix.go }}
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -219,7 +244,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
||||||
go-version: [1.20.14, 1.21, 1.22, 1.23]
|
go-version: [1.20.14, 1.21, 1.22, 1.23]
|
||||||
include:
|
include:
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -228,10 +253,10 @@ jobs:
|
|||||||
architecture: x64
|
architecture: x64
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- os: macos-latest-large
|
- os: macos-15-intel
|
||||||
architecture: x64
|
architecture: x64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
- name: Setup Go and check latest
|
- name: Setup Go and check latest
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
cache: [false, true]
|
cache: [false, true]
|
||||||
go: [1.20.1]
|
go: [1.20.1]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: 'Setup ${{ matrix.cache }}, cache: ${{ matrix.go }}'
|
- name: 'Setup ${{ matrix.cache }}, cache: ${{ matrix.go }}'
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -88,7 +88,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
cache: [false, true]
|
cache: [false, true]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: 'Setup default go, cache: ${{ matrix.cache }}'
|
- name: 'Setup default go, cache: ${{ matrix.cache }}'
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -121,7 +121,7 @@ jobs:
|
|||||||
cache: [false]
|
cache: [false]
|
||||||
go: [1.20.1]
|
go: [1.20.1]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}'
|
- name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}'
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@nodable/entities"
|
name: "@nodable/entities"
|
||||||
version: 2.2.0
|
version: 3.0.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Entity parser for XML, HTML, External entites with security and NCR control
|
summary: Entity parser for XML, HTML, External entites with security and NCR control
|
||||||
homepage:
|
homepage:
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: brace-expansion
|
name: brace-expansion
|
||||||
version: 1.1.15
|
version: 1.1.18
|
||||||
type: npm
|
type: npm
|
||||||
summary: Brace expansion as known from sh/bash
|
summary: Brace expansion as known from sh/bash
|
||||||
homepage: https://github.com/juliangruber/brace-expansion
|
homepage: https://github.com/juliangruber/brace-expansion
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: brace-expansion
|
name: brace-expansion
|
||||||
version: 5.0.6
|
version: 5.0.9
|
||||||
type: npm
|
type: npm
|
||||||
summary: Brace expansion as known from sh/bash
|
summary: Brace expansion as known from sh/bash
|
||||||
homepage:
|
homepage:
|
||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: fast-xml-parser
|
name: fast-xml-parser
|
||||||
version: 5.9.3
|
version: 5.10.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
|
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
|
||||||
homepage:
|
homepage:
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: is-unsafe
|
name: is-unsafe
|
||||||
version: 1.0.1
|
version: 2.0.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across
|
summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across
|
||||||
HTML, XML, SVG, SQL, SHELL, and REGEX contexts
|
HTML, XML, SVG, SQL, SHELL, and REGEX contexts
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: path-expression-matcher
|
name: path-expression-matcher
|
||||||
version: 1.6.0
|
version: 1.6.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Efficient path tracking and pattern matching for XML/JSON parsers
|
summary: Efficient path tracking and pattern matching for XML/JSON parsers
|
||||||
homepage: https://github.com/NaturalIntelligence/path-expression-matcher#readme
|
homepage: https://github.com/NaturalIntelligence/path-expression-matcher#readme
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: undici
|
name: undici
|
||||||
version: 6.27.0
|
version: 6.28.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: An HTTP/1.1 client, written from scratch for Node.js
|
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||||
homepage: https://undici.nodejs.org
|
homepage: https://undici.nodejs.org
|
||||||
|
|||||||
Generated
+35
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
name: xml-naming
|
||||||
|
version: 0.3.0
|
||||||
|
type: npm
|
||||||
|
summary: Validates XML name productions — Name, NCName, QName, NMToken, NMTokens —
|
||||||
|
for XML 1.0 and 1.1
|
||||||
|
homepage:
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Natural Intelligence
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
- sources: README.md
|
||||||
|
text: MIT
|
||||||
|
notices: []
|
||||||
@@ -35,7 +35,7 @@ See [action.yml](action.yml).
|
|||||||
|
|
||||||
<!-- start usage -->
|
<!-- start usage -->
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
# Version or version range of Go to use
|
# Version or version range of Go to use
|
||||||
go-version: '1.23'
|
go-version: '1.23'
|
||||||
@@ -70,8 +70,8 @@ See [action.yml](action.yml).
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25' # The Go version to download (if necessary) and use.
|
go-version: '1.25' # The Go version to download (if necessary) and use.
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ jest.unstable_mockModule('@actions/core', () => ({
|
|||||||
getBooleanInput: jest.fn(),
|
getBooleanInput: jest.fn(),
|
||||||
info: jest.fn(),
|
info: jest.fn(),
|
||||||
debug: jest.fn(),
|
debug: jest.fn(),
|
||||||
|
warning: jest.fn(),
|
||||||
|
setOutput: jest.fn(),
|
||||||
exportVariable: jest.fn()
|
exportVariable: jest.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -110,6 +112,8 @@ describe('setup-go', () => {
|
|||||||
let findSpy: jest.Mock;
|
let findSpy: jest.Mock;
|
||||||
let cnSpy: jest.SpiedFunction<typeof process.stdout.write>;
|
let cnSpy: jest.SpiedFunction<typeof process.stdout.write>;
|
||||||
let logSpy: jest.Mock;
|
let logSpy: jest.Mock;
|
||||||
|
let setOutputSpy: jest.Mock<typeof core.setOutput>;
|
||||||
|
let warningSpy: jest.Mock<typeof core.warning>;
|
||||||
let getSpy: jest.Mock;
|
let getSpy: jest.Mock;
|
||||||
let platSpy: jest.Mock;
|
let platSpy: jest.Mock;
|
||||||
let archSpy: jest.Mock;
|
let archSpy: jest.Mock;
|
||||||
@@ -198,6 +202,8 @@ describe('setup-go', () => {
|
|||||||
// writes
|
// writes
|
||||||
cnSpy = jest.spyOn(process.stdout, 'write');
|
cnSpy = jest.spyOn(process.stdout, 'write');
|
||||||
logSpy = core.info as jest.Mock;
|
logSpy = core.info as jest.Mock;
|
||||||
|
setOutputSpy = core.setOutput as jest.Mock<typeof core.setOutput>;
|
||||||
|
warningSpy = core.warning as jest.Mock<typeof core.warning>;
|
||||||
dbgSpy = core.debug as jest.Mock;
|
dbgSpy = core.debug as jest.Mock;
|
||||||
getSpy.mockImplementation(() => goJsonData as IGoVersion[] | null);
|
getSpy.mockImplementation(() => goJsonData as IGoVersion[] | null);
|
||||||
cnSpy.mockImplementation(() => true);
|
cnSpy.mockImplementation(() => true);
|
||||||
@@ -646,6 +652,104 @@ describe('setup-go', () => {
|
|||||||
expect(added).toBeTruthy();
|
expect(added).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('go env outputs', () => {
|
||||||
|
const goEnv = {
|
||||||
|
GOPATH: '/Users/testuser/go',
|
||||||
|
GOBIN: '',
|
||||||
|
GOROOT: '/usr/local/go',
|
||||||
|
GOCACHE: '/Users/testuser/.cache/go-build',
|
||||||
|
GOMODCACHE: '/Users/testuser/go/pkg/mod',
|
||||||
|
GOOS: 'darwin',
|
||||||
|
GOARCH: 'arm64',
|
||||||
|
GOTOOLDIR: '/usr/local/go/pkg/tool/darwin_arm64'
|
||||||
|
};
|
||||||
|
|
||||||
|
it('parses the output of go env -json', () => {
|
||||||
|
execFileSpy.mockImplementation(() => JSON.stringify(goEnv));
|
||||||
|
|
||||||
|
expect(main.readGoEnv('/usr/local/go/bin/go')).toEqual(goEnv);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns undefined when go env -json is not supported', () => {
|
||||||
|
execFileSpy.mockImplementation(() => {
|
||||||
|
throw new Error('flag provided but not defined: -json');
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(main.readGoEnv('/usr/local/go/bin/go')).toBeUndefined();
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
expect.stringContaining('flag provided but not defined: -json')
|
||||||
|
);
|
||||||
|
expect(warningSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns undefined when the output is not valid JSON', () => {
|
||||||
|
execFileSpy.mockImplementation(() => 'GOPATH="/Users/testuser/go"');
|
||||||
|
|
||||||
|
expect(main.readGoEnv('/usr/local/go/bin/go')).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns undefined when the output is not a JSON object', () => {
|
||||||
|
execFileSpy.mockImplementation(() => '[]');
|
||||||
|
|
||||||
|
expect(main.readGoEnv('/usr/local/go/bin/go')).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('sets an output for each exposed variable', () => {
|
||||||
|
main.setGoEnvOutputs(goEnv);
|
||||||
|
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-path', goEnv.GOPATH);
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-bin', '');
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-root', goEnv.GOROOT);
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-cache', goEnv.GOCACHE);
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith(
|
||||||
|
'go-mod-cache',
|
||||||
|
goEnv.GOMODCACHE
|
||||||
|
);
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-os', goEnv.GOOS);
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-arch', goEnv.GOARCH);
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-tool-dir', goEnv.GOTOOLDIR);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('falls back to $GOPATH/bin when GOBIN is empty', () => {
|
||||||
|
main.setGoEnvOutputs(goEnv);
|
||||||
|
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith(
|
||||||
|
'go-bin-path',
|
||||||
|
'/Users/testuser/go/bin'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('prefers GOBIN over $GOPATH/bin when it is set', () => {
|
||||||
|
main.setGoEnvOutputs({...goEnv, GOBIN: '/Users/testuser/bin'});
|
||||||
|
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith(
|
||||||
|
'go-bin-path',
|
||||||
|
'/Users/testuser/bin'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('uses the first entry of a multi-entry GOPATH', () => {
|
||||||
|
const GOPATH = ['/Users/testuser/go', '/Users/testuser/other'].join(
|
||||||
|
path.delimiter
|
||||||
|
);
|
||||||
|
|
||||||
|
main.setGoEnvOutputs({...goEnv, GOPATH});
|
||||||
|
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-path', GOPATH);
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith(
|
||||||
|
'go-bin-path',
|
||||||
|
'/Users/testuser/go/bin'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('leaves variables missing from go env -json empty', () => {
|
||||||
|
main.setGoEnvOutputs({});
|
||||||
|
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-path', '');
|
||||||
|
expect(setOutputSpy).toHaveBeenCalledWith('go-bin-path', '');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
interface Annotation {
|
interface Annotation {
|
||||||
file: string;
|
file: string;
|
||||||
line: number;
|
line: number;
|
||||||
|
|||||||
+18
@@ -26,6 +26,24 @@ outputs:
|
|||||||
description: 'The installed Go version. Useful when given a version range as input.'
|
description: 'The installed Go version. Useful when given a version range as input.'
|
||||||
cache-hit:
|
cache-hit:
|
||||||
description: 'A boolean value to indicate if a cache was hit'
|
description: 'A boolean value to indicate if a cache was hit'
|
||||||
|
go-path:
|
||||||
|
description: 'The value of `go env GOPATH`.'
|
||||||
|
go-bin:
|
||||||
|
description: 'The value of `go env GOBIN`.'
|
||||||
|
go-bin-path:
|
||||||
|
description: 'The base Go binary directory: `GOBIN`, otherwise `bin` under the first `GOPATH` entry.'
|
||||||
|
go-root:
|
||||||
|
description: 'The value of `go env GOROOT`.'
|
||||||
|
go-cache:
|
||||||
|
description: 'The value of `go env GOCACHE`, the build cache directory.'
|
||||||
|
go-mod-cache:
|
||||||
|
description: 'The value of `go env GOMODCACHE`, the module cache directory.'
|
||||||
|
go-os:
|
||||||
|
description: 'The value of `go env GOOS`, the target OS in Go notation (linux, darwin, windows).'
|
||||||
|
go-arch:
|
||||||
|
description: 'The value of `go env GOARCH`, the target architecture in Go notation (amd64, arm64).'
|
||||||
|
go-tool-dir:
|
||||||
|
description: 'The value of `go env GOTOOLDIR`, the directory holding the toolchain binaries.'
|
||||||
runs:
|
runs:
|
||||||
using: 'node24'
|
using: 'node24'
|
||||||
main: 'dist/setup/index.js'
|
main: 'dist/setup/index.js'
|
||||||
|
|||||||
Vendored
+1093
-396
File diff suppressed because it is too large
Load Diff
Vendored
+1328
-493
File diff suppressed because it is too large
Load Diff
+86
-53
@@ -12,6 +12,9 @@
|
|||||||
- [Restore-only caches](advanced-usage.md#restore-only-caches)
|
- [Restore-only caches](advanced-usage.md#restore-only-caches)
|
||||||
- [Parallel builds](advanced-usage.md#parallel-builds)
|
- [Parallel builds](advanced-usage.md#parallel-builds)
|
||||||
- [Outputs](advanced-usage.md#outputs)
|
- [Outputs](advanced-usage.md#outputs)
|
||||||
|
- [go-version](advanced-usage.md#go-version)
|
||||||
|
- [cache-hit](advanced-usage.md#cache-hit)
|
||||||
|
- [Go environment outputs](advanced-usage.md#go-environment-outputs)
|
||||||
- [Custom download URL](advanced-usage.md#custom-download-url)
|
- [Custom download URL](advanced-usage.md#custom-download-url)
|
||||||
- [Using `setup-go` on GHES](advanced-usage.md#using-setup-go-on-ghes)
|
- [Using `setup-go` on GHES](advanced-usage.md#using-setup-go-on-ghes)
|
||||||
|
|
||||||
@@ -23,8 +26,8 @@ For repeatable builds, specify the **exact major, minor, and patch version** (su
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25.5'
|
go-version: '1.25.5'
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
@@ -36,8 +39,8 @@ You can specify **only a major and minor version** if you are okay with the most
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
@@ -53,8 +56,8 @@ Download and use beta or RC Go versions as needed.
|
|||||||
```yaml
|
```yaml
|
||||||
# RC version
|
# RC version
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25.0-rc.2'
|
go-version: '1.25.0-rc.2'
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -63,8 +66,8 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
# Beta version
|
# Beta version
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.19.0-beta.1'
|
go-version: '1.19.0-beta.1'
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -80,8 +83,8 @@ If `oldstable` is provided, the action resolves it to the latest patch release o
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: 'stable'
|
go-version: 'stable'
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
@@ -89,8 +92,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: 'oldstable'
|
go-version: 'oldstable'
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
@@ -100,8 +103,8 @@ You can also use **SemVer's version range syntax**, for instance:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '^1.25.1'
|
go-version: '^1.25.1'
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -109,8 +112,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.24.0-rc.1'
|
go-version: '>=1.24.0-rc.1'
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -129,9 +132,9 @@ jobs:
|
|||||||
go: [ '1.24', '1.25' ]
|
go: [ '1.24', '1.25' ]
|
||||||
name: Go ${{ matrix.go }} sample
|
name: Go ${{ matrix.go }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
@@ -154,9 +157,9 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
go: '1.25'
|
go: '1.25'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
@@ -170,8 +173,8 @@ If both the `go-version` and the `go-version-file` inputs are provided then the
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version-file: 'path/to/go.mod' # Read Go version from go.mod
|
go-version-file: 'path/to/go.mod' # Read Go version from go.mod
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -187,8 +190,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version-file: '.go-version' # Read Go version from .go-version
|
go-version-file: '.go-version' # Read Go version from .go-version
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -196,8 +199,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version-file: '.tool-versions' # Read Go version from .tool-versions
|
go-version-file: '.tool-versions' # Read Go version from .tool-versions
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -205,8 +208,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.work' # Read Go version from go.work
|
go-version-file: 'go.work' # Read Go version from go.work
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -228,8 +231,8 @@ want the most up-to-date Go version to always be used. It supports major (e.g.,
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
@@ -242,8 +245,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
cache-dependency-path: subdir/go.sum
|
cache-dependency-path: subdir/go.sum
|
||||||
@@ -256,8 +259,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
cache-dependency-path: '**/go.sum'
|
cache-dependency-path: '**/go.sum'
|
||||||
@@ -266,8 +269,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
@@ -288,8 +291,8 @@ env:
|
|||||||
steps:
|
steps:
|
||||||
- run: echo "$GOOS $GOARCH" > env.txt
|
- run: echo "$GOOS $GOARCH" > env.txt
|
||||||
|
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
@@ -306,8 +309,8 @@ Besides dependencies, the action can also cache build outputs (the [`GOCACHE`](h
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
@@ -328,10 +331,10 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
id: setup-go
|
id: setup-go
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25.5'
|
go-version: '1.25.5'
|
||||||
cache: false
|
cache: false
|
||||||
@@ -394,8 +397,8 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
id: go124
|
id: go124
|
||||||
with:
|
with:
|
||||||
go-version: '^1.24'
|
go-version: '^1.24'
|
||||||
@@ -411,8 +414,8 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
id: go124
|
id: go124
|
||||||
with:
|
with:
|
||||||
go-version: '1.24'
|
go-version: '1.24'
|
||||||
@@ -420,6 +423,36 @@ jobs:
|
|||||||
- run: echo "Was the Go cache restored? ${{ steps.go124.outputs.cache-hit }}" # true if cache-hit occurred
|
- run: echo "Was the Go cache restored? ${{ steps.go124.outputs.cache-hit }}" # true if cache-hit occurred
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Go environment outputs
|
||||||
|
|
||||||
|
Once Go is on the `PATH`, the action exposes the most commonly needed `go env` variables as outputs, so workflows don't have to query them in duplicated `bash`/`pwsh` steps — one expression works on Linux, macOS, and Windows. The values are a snapshot from setup time: anything a later step changes, such as setting `GOOS`/`GOARCH` to cross-compile, is not reflected.
|
||||||
|
|
||||||
|
| Output | `go env` variable | Notes |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `go-path` | `GOPATH` | Go workspace root; `bin` and `pkg/mod` live under it |
|
||||||
|
| `go-bin` | `GOBIN` | Go 1.27+ reports an implicit `$GOPATH/bin` default; earlier releases are empty unless `GOBIN` is set |
|
||||||
|
| `go-bin-path` | `GOBIN` or `$GOPATH/bin` | The base Go binary directory, using the first `GOPATH` entry. Cross-compiled binaries go one level deeper, in `$GOPATH/bin/$GOOS_$GOARCH` |
|
||||||
|
| `go-root` | `GOROOT` | Installation directory of the Go toolchain in use |
|
||||||
|
| `go-cache` | `GOCACHE` | Build cache directory |
|
||||||
|
| `go-mod-cache` | `GOMODCACHE` | Module cache directory |
|
||||||
|
| `go-os` | `GOOS` | Go notation (`linux`, `darwin`, `windows`), unlike `runner.os` |
|
||||||
|
| `go-arch` | `GOARCH` | Go notation (`amd64`, `arm64`), unlike `runner.arch` or the `x64` in the action's cache key |
|
||||||
|
| `go-tool-dir` | `GOTOOLDIR` | Holds `compile`, `link`, `vet` and the other toolchain binaries |
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-go@v7
|
||||||
|
id: setup-go
|
||||||
|
with:
|
||||||
|
go-version: '1.25.5'
|
||||||
|
- run: echo "Modules are cached in ${{ steps.setup-go.outputs.go-mod-cache }}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Quote `go-bin-path` in shell commands, since it may contain spaces. Variables without a dedicated output are not exposed; run `go env <NAME>` in a step when you need one.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> These outputs need Go 1.9 or newer (`go env -json`); on older releases the action logs a message, leaves them unset and does not fail. `go-cache` needs Go 1.10 and `go-mod-cache` needs Go 1.15.
|
||||||
|
|
||||||
## Custom download URL
|
## Custom download URL
|
||||||
|
|
||||||
The `go-download-base-url` input lets you download Go from a mirror or alternative source instead of the default `https://go.dev/dl`. This can also be set via the `GO_DOWNLOAD_BASE_URL` environment variable; the input takes precedence over the environment variable.
|
The `go-download-base-url` input lets you download Go from a mirror or alternative source instead of the default `https://go.dev/dl`. This can also be set via the `GO_DOWNLOAD_BASE_URL` environment variable; the input takes precedence over the environment variable.
|
||||||
@@ -430,8 +463,8 @@ When a custom base URL is provided, the action skips the `actions/go-versions` m
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
go-download-base-url: 'https://aka.ms/golang/release/latest'
|
go-download-base-url: 'https://aka.ms/golang/release/latest'
|
||||||
@@ -445,8 +478,8 @@ env:
|
|||||||
GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest'
|
GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
- run: go version
|
- run: go version
|
||||||
@@ -462,8 +495,8 @@ If your custom download source requires authentication, the `token` input is for
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
go-download-base-url: 'https://private-mirror.example.com/golang'
|
go-download-base-url: 'https://private-mirror.example.com/golang'
|
||||||
@@ -485,7 +518,7 @@ If that fails as well the action will try to download versions directly from [go
|
|||||||
If that fails as well you can get a higher rate limit with [generating a personal access token on github.com](https://github.com/settings/tokens/new) and passing it as the `token` input to the action:
|
If that fails as well you can get a higher rate limit with [generating a personal access token on github.com](https://github.com/settings/tokens/new) and passing it as the `token` input to the action:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
|
|||||||
Generated
+73
-88
@@ -75,9 +75,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache/node_modules/brace-expansion": {
|
"node_modules/@actions/cache/node_modules/brace-expansion": {
|
||||||
"version": "1.1.15",
|
"version": "1.1.18",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz",
|
||||||
"integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
|
"integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
@@ -1627,9 +1627,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@nodable/entities": {
|
"node_modules/@nodable/entities": {
|
||||||
"version": "2.2.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-3.0.0.tgz",
|
||||||
"integrity": "sha512-9uGyhaQavEUMC8AIddIjau4NsnsXhou+j5sBAGojCM1oxmQpVKTWR/9JxABD6UAv12vpIms55fPZKFQEhG6uBg==",
|
"integrity": "sha512-8L9xFeTYKhm49xfIypoe2W5wV1m/3Z58kT+7kR9A8OyFxcPduI4VmxaUMQyKYrRjUoLLSXv6EKKID5Tvj9cUVw==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -2234,9 +2234,6 @@
|
|||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2251,9 +2248,6 @@
|
|||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2268,9 +2262,6 @@
|
|||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2285,9 +2276,6 @@
|
|||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2302,9 +2290,6 @@
|
|||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2319,9 +2304,6 @@
|
|||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2336,9 +2318,6 @@
|
|||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2353,9 +2332,6 @@
|
|||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2370,9 +2346,6 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2387,9 +2360,6 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2733,9 +2703,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/baseline-browser-mapping": {
|
"node_modules/baseline-browser-mapping": {
|
||||||
"version": "2.10.38",
|
"version": "2.11.20",
|
||||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.38.tgz",
|
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz",
|
||||||
"integrity": "sha512-31/02mVB4yuQU6adKk5SlY6m+mxDwUq5KZkyYgnLrrKl7TEm1+3PyDtDBz2kOv/wxZz41GHsvV1A/u6RmiyBvw==",
|
"integrity": "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -2746,21 +2716,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/brace-expansion": {
|
"node_modules/brace-expansion": {
|
||||||
"version": "5.0.6",
|
"version": "5.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
|
||||||
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
|
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"balanced-match": "^4.0.2"
|
"balanced-match": "^4.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "18 || 20 || >=22"
|
"node": "20 || >=22"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/browserslist": {
|
"node_modules/browserslist": {
|
||||||
"version": "4.28.2",
|
"version": "4.28.8",
|
||||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz",
|
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz",
|
||||||
"integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==",
|
"integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -2778,11 +2748,11 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.10.12",
|
"baseline-browser-mapping": "^2.11.12",
|
||||||
"caniuse-lite": "^1.0.30001782",
|
"caniuse-lite": "^1.0.30001809",
|
||||||
"electron-to-chromium": "^1.5.328",
|
"electron-to-chromium": "^1.5.402",
|
||||||
"node-releases": "^2.0.36",
|
"node-releases": "^2.0.53",
|
||||||
"update-browserslist-db": "^1.2.3"
|
"update-browserslist-db": "^1.3.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"browserslist": "cli.js"
|
"browserslist": "cli.js"
|
||||||
@@ -2842,9 +2812,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001799",
|
"version": "1.0.30001810",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
|
||||||
"integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==",
|
"integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -3123,9 +3093,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.5.376",
|
"version": "1.5.418",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.376.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.418.tgz",
|
||||||
"integrity": "sha512-cUVA7/RvbFTEuw/i3obUwDTRIXojaxkResf+ibByPFxjc6XK3VNtcQXV0NSbAlJ0FMjcJGgftVVB4Qo184EXvA==",
|
"integrity": "sha512-UzS26r3AEbG5wSoGVpJKqwHIU9zwQN7LHdVIThDrJpS0I5KdlXFMEb8543fhc9dVnIIAST6ar8rhwa00AL5MlA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
@@ -3650,9 +3620,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-parser": {
|
"node_modules/fast-xml-parser": {
|
||||||
"version": "5.9.3",
|
"version": "5.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.10.1.tgz",
|
||||||
"integrity": "sha512-brCNCeScma/kqa54J4PIDriSSSLssRkuYaUCpvHJulGc3HGI/xxKUCTDcYkAdqJsyb//ydpbxecjC3hB9+tb/g==",
|
"integrity": "sha512-IEMIf7298kXuZSRFoGfMYrl7is8LpavODgbNz1cwIudv7KwVFnuU+UsMporfq6PD6aXSlawZlARiA3UywCTfMw==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -3661,17 +3631,32 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nodable/entities": "^2.2.0",
|
"@nodable/entities": "^3.0.0",
|
||||||
"fast-xml-builder": "^1.2.0",
|
"fast-xml-builder": "^1.2.0",
|
||||||
"is-unsafe": "^1.0.1",
|
"is-unsafe": "^2.0.0",
|
||||||
"path-expression-matcher": "^1.5.0",
|
"path-expression-matcher": "^1.6.2",
|
||||||
"strnum": "^2.4.1",
|
"strnum": "^2.4.1",
|
||||||
"xml-naming": "^0.1.0"
|
"xml-naming": "^0.3.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"fxparser": "src/cli/cli.js"
|
"fxparser": "src/cli/cli.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fast-xml-parser/node_modules/xml-naming": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-ghig2TBE/H11aOVgmahA3MhimvkBr6JIYknH/Dhdk10nXwdbIqBJsbfMxpvFPG8bAw77gN29aQWvKpmVoPlvPQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/NaturalIntelligence"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fb-watchman": {
|
"node_modules/fb-watchman": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
|
||||||
@@ -3889,9 +3874,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/glob/node_modules/brace-expansion": {
|
"node_modules/glob/node_modules/brace-expansion": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
|
||||||
"integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==",
|
"integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -4146,9 +4131,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/is-unsafe": {
|
"node_modules/is-unsafe": {
|
||||||
"version": "1.0.1",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.0.tgz",
|
||||||
"integrity": "sha512-CLK2+VdgERgD96EYm5lUQssZYlRg2tkZnbsxZoacmSiRxiFJ4Nk4SzjCl+Ur+v3kXIY9dTIdb3IH22y1mZ56LA==",
|
"integrity": "sha512-2LdV822R+wmI86unXA93WCFpL6g+av8ynWk0nrHyJqGop5VoocYsSLFgN8jrfalT6iGeLNM4KXuVSsULP53kEA==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -4839,9 +4824,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/js-yaml": {
|
"node_modules/js-yaml": {
|
||||||
"version": "3.15.0",
|
"version": "3.15.2",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.2.tgz",
|
||||||
"integrity": "sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==",
|
"integrity": "sha512-6EuL879VkRA+1Cz578mKMiKvjPNEuk6+r1JaFzoSWejZmtf7xWbIyw1e3KkxlkzTIt9Taw6JBhEppG7utc1P+w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -5131,9 +5116,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/node-releases": {
|
"node_modules/node-releases": {
|
||||||
"version": "2.0.48",
|
"version": "2.0.54",
|
||||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.48.tgz",
|
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz",
|
||||||
"integrity": "sha512-1uz8041X6LoI6ZSdZacM9lVY28vuzDlSKitnpbSNK0RfKoIJkX29NBPVEFXhnuSuEOA9Ww0xnPJ+ILWbGAv8DA==",
|
"integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -5293,9 +5278,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/path-expression-matcher": {
|
"node_modules/path-expression-matcher": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.2.tgz",
|
||||||
"integrity": "sha512-e5y7RCLHKjemsgQ4eqGJtPyr10ILz25HO7flzxhTV8bgvd5yHx98DGtCAtbVW9f2TqnYI/gEVZd+vz7snrdPTw==",
|
"integrity": "sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -5972,9 +5957,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/test-exclude/node_modules/brace-expansion": {
|
"node_modules/test-exclude/node_modules/brace-expansion": {
|
||||||
"version": "1.1.15",
|
"version": "1.1.18",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz",
|
||||||
"integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
|
"integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -6200,9 +6185,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "6.27.0",
|
"version": "6.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-6.28.0.tgz",
|
||||||
"integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==",
|
"integrity": "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17"
|
"node": ">=18.17"
|
||||||
@@ -6254,9 +6239,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/update-browserslist-db": {
|
"node_modules/update-browserslist-db": {
|
||||||
"version": "1.2.3",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz",
|
||||||
"integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
|
"integrity": "sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|||||||
+10
-1
@@ -4,5 +4,14 @@ export enum State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum Outputs {
|
export enum Outputs {
|
||||||
CacheHit = 'cache-hit'
|
CacheHit = 'cache-hit',
|
||||||
|
GoPath = 'go-path',
|
||||||
|
GoBin = 'go-bin',
|
||||||
|
GoBinPath = 'go-bin-path',
|
||||||
|
GoRoot = 'go-root',
|
||||||
|
GoCache = 'go-cache',
|
||||||
|
GoModCache = 'go-mod-cache',
|
||||||
|
GoOs = 'go-os',
|
||||||
|
GoArch = 'go-arch',
|
||||||
|
GoToolDir = 'go-tool-dir'
|
||||||
}
|
}
|
||||||
|
|||||||
+95
-32
@@ -10,6 +10,7 @@ import cp from 'child_process';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import {Architecture} from './types.js';
|
import {Architecture} from './types.js';
|
||||||
|
import {Outputs} from './constants.js';
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
try {
|
||||||
@@ -21,7 +22,6 @@ export async function run() {
|
|||||||
setGoToolchain();
|
setGoToolchain();
|
||||||
|
|
||||||
const cache = core.getBooleanInput('cache');
|
const cache = core.getBooleanInput('cache');
|
||||||
core.info(`Setup go version spec ${versionSpec}`);
|
|
||||||
|
|
||||||
let arch = core.getInput('architecture') as Architecture;
|
let arch = core.getInput('architecture') as Architecture;
|
||||||
|
|
||||||
@@ -30,41 +30,48 @@ export async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (versionSpec) {
|
if (versionSpec) {
|
||||||
const token = core.getInput('token');
|
core.startGroup('Installed version');
|
||||||
const auth = !token ? undefined : `token ${token}`;
|
try {
|
||||||
|
core.info(`Setup go version spec ${versionSpec}`);
|
||||||
|
|
||||||
const checkLatest = core.getBooleanInput('check-latest');
|
const token = core.getInput('token');
|
||||||
|
const auth = !token ? undefined : `token ${token}`;
|
||||||
|
|
||||||
const goDownloadBaseUrl =
|
const checkLatest = core.getBooleanInput('check-latest');
|
||||||
core.getInput('go-download-base-url') ||
|
|
||||||
process.env['GO_DOWNLOAD_BASE_URL'] ||
|
|
||||||
undefined;
|
|
||||||
|
|
||||||
if (goDownloadBaseUrl) {
|
const goDownloadBaseUrl =
|
||||||
core.info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
|
core.getInput('go-download-base-url') ||
|
||||||
|
process.env['GO_DOWNLOAD_BASE_URL'] ||
|
||||||
|
undefined;
|
||||||
|
|
||||||
|
if (goDownloadBaseUrl) {
|
||||||
|
core.info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const installDir = await installer.getGo(
|
||||||
|
versionSpec,
|
||||||
|
checkLatest,
|
||||||
|
auth,
|
||||||
|
arch,
|
||||||
|
goDownloadBaseUrl
|
||||||
|
);
|
||||||
|
|
||||||
|
const installDirVersion = path.basename(path.dirname(installDir));
|
||||||
|
|
||||||
|
core.addPath(path.join(installDir, 'bin'));
|
||||||
|
core.info('Added go to the path');
|
||||||
|
|
||||||
|
const version = installer.makeSemver(installDirVersion);
|
||||||
|
// Go versions less than 1.9 require GOROOT to be set
|
||||||
|
if (semver.lt(version, '1.9.0')) {
|
||||||
|
core.info('Setting GOROOT for Go version < 1.9');
|
||||||
|
core.exportVariable('GOROOT', installDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info(`Successfully set up Go version ${versionSpec}`);
|
||||||
|
} finally {
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
const installDir = await installer.getGo(
|
|
||||||
versionSpec,
|
|
||||||
checkLatest,
|
|
||||||
auth,
|
|
||||||
arch,
|
|
||||||
goDownloadBaseUrl
|
|
||||||
);
|
|
||||||
|
|
||||||
const installDirVersion = path.basename(path.dirname(installDir));
|
|
||||||
|
|
||||||
core.addPath(path.join(installDir, 'bin'));
|
|
||||||
core.info('Added go to the path');
|
|
||||||
|
|
||||||
const version = installer.makeSemver(installDirVersion);
|
|
||||||
// Go versions less than 1.9 require GOROOT to be set
|
|
||||||
if (semver.lt(version, '1.9.0')) {
|
|
||||||
core.info('Setting GOROOT for Go version < 1.9');
|
|
||||||
core.exportVariable('GOROOT', installDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
core.info(`Successfully set up Go version ${versionSpec}`);
|
|
||||||
} else {
|
} else {
|
||||||
core.info(
|
core.info(
|
||||||
'[warning]go-version input was not specified. The action will try to use pre-installed version.'
|
'[warning]go-version input was not specified. The action will try to use pre-installed version.'
|
||||||
@@ -76,6 +83,11 @@ export async function run() {
|
|||||||
|
|
||||||
const goPath = await io.which('go');
|
const goPath = await io.which('go');
|
||||||
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
|
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
|
||||||
|
const goEnvJson = readGoEnv(goPath);
|
||||||
|
|
||||||
|
if (goEnvJson) {
|
||||||
|
setGoEnvOutputs(goEnvJson);
|
||||||
|
}
|
||||||
|
|
||||||
if (cache && isCacheFeatureAvailable()) {
|
if (cache && isCacheFeatureAvailable()) {
|
||||||
const packageManager = 'default';
|
const packageManager = 'default';
|
||||||
@@ -113,6 +125,57 @@ export async function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function readGoEnv(goPath: string): Record<string, string> | undefined {
|
||||||
|
try {
|
||||||
|
const rawGoEnv = cp.execFileSync(goPath, ['env', '-json'], {
|
||||||
|
encoding: 'utf8',
|
||||||
|
stdio: ['ignore', 'pipe', 'pipe']
|
||||||
|
});
|
||||||
|
const parsed: unknown = JSON.parse(rawGoEnv);
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof parsed !== 'object' ||
|
||||||
|
parsed === null ||
|
||||||
|
Array.isArray(parsed)
|
||||||
|
) {
|
||||||
|
throw new Error("'go env -json' did not return a JSON object");
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsed as Record<string, string>;
|
||||||
|
} catch (error) {
|
||||||
|
core.info(
|
||||||
|
`Unable to read 'go env -json', the Go environment outputs will not be set: ${
|
||||||
|
(error as Error).message
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const goEnvOutputs: ReadonlyArray<[Outputs, string]> = [
|
||||||
|
[Outputs.GoPath, 'GOPATH'],
|
||||||
|
[Outputs.GoBin, 'GOBIN'],
|
||||||
|
[Outputs.GoRoot, 'GOROOT'],
|
||||||
|
[Outputs.GoCache, 'GOCACHE'],
|
||||||
|
[Outputs.GoModCache, 'GOMODCACHE'],
|
||||||
|
[Outputs.GoOs, 'GOOS'],
|
||||||
|
[Outputs.GoArch, 'GOARCH'],
|
||||||
|
[Outputs.GoToolDir, 'GOTOOLDIR']
|
||||||
|
];
|
||||||
|
|
||||||
|
export function setGoEnvOutputs(goEnv: Record<string, string>): void {
|
||||||
|
for (const [output, variable] of goEnvOutputs) {
|
||||||
|
core.setOutput(output, goEnv[variable] ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
core.setOutput(Outputs.GoBinPath, goEnv['GOBIN'] || goPathBin(goEnv));
|
||||||
|
}
|
||||||
|
|
||||||
|
function goPathBin(goEnv: Record<string, string>): string {
|
||||||
|
const goPath = (goEnv['GOPATH'] ?? '').split(path.delimiter)[0];
|
||||||
|
return goPath ? path.join(goPath, 'bin') : '';
|
||||||
|
}
|
||||||
|
|
||||||
export async function addBinToPath(): Promise<boolean> {
|
export async function addBinToPath(): Promise<boolean> {
|
||||||
let added = false;
|
let added = false;
|
||||||
const g = await io.which('go');
|
const g = await io.which('go');
|
||||||
|
|||||||
Reference in New Issue
Block a user