mirror of
https://github.com/actions/setup-go.git
synced 2025-06-16 18:47:12 +02:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
818723587f | |||
b98503c960 | |||
e7a06beff0 | |||
419ae75c25 |
13
README.md
13
README.md
@ -1,8 +1,12 @@
|
|||||||
# setup-go
|
# setup-go
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<a href="https://github.com/actions/setup-go"><img alt="GitHub Actions status" src="https://github.com/actions/setup-go/workflows/Main%20workflow/badge.svg"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
This action sets up a go environment for use in actions by:
|
This action sets up a go environment for use in actions by:
|
||||||
|
|
||||||
- optionally downloading and caching a version of go by version and adding to PATH
|
- optionally downloading and caching a version of Go by version and adding to PATH
|
||||||
- registering problem matchers for error output
|
- registering problem matchers for error output
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
@ -15,7 +19,7 @@ steps:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- uses: actions/setup-go@v1
|
- uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
version: 1.9.3 // The Go version to download (if necessary) and use.
|
go-version: '1.9.3' // The Go version to download (if necessary) and use.
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -23,16 +27,17 @@ Matrix Testing:
|
|||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
runs-on: ubuntu-16.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: [ 1.8, 1.9.3, 1.10 ]
|
go: [ '1.8', '1.9.3', '1.10' ]
|
||||||
name: Go ${{ matrix.go }} sample
|
name: Go ${{ matrix.go }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
name: 'Setup Go for use with actions'
|
name: 'Setup Go environment'
|
||||||
description: 'Setup a Go environment and add it to the PATH, additionally providing proxy support'
|
description: 'Setup a Go environment and add it to the PATH, additionally providing proxy support'
|
||||||
author: 'GitHub'
|
author: 'GitHub'
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
go-version:
|
||||||
description: 'The Go version to download (if necessary) and use. Example: 1.9.3'
|
description: 'The Go version to download (if necessary) and use. Example: 1.9.3'
|
||||||
default: '1.10'
|
default: '1.10'
|
||||||
|
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||||
|
version:
|
||||||
|
description: 'Deprecated. Use go-version instead. Will not be supported after October 1, 2019'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/setup-go.js'
|
main: 'lib/setup-go.js'
|
||||||
|
@ -25,7 +25,10 @@ function run() {
|
|||||||
// Version is optional. If supplied, install / use from the tool cache
|
// Version is optional. If supplied, install / use from the tool cache
|
||||||
// If not supplied then task is still used to setup proxy, auth, etc...
|
// If not supplied then task is still used to setup proxy, auth, etc...
|
||||||
//
|
//
|
||||||
const version = core.getInput('version');
|
let version = core.getInput('version');
|
||||||
|
if (!version) {
|
||||||
|
version = core.getInput('go-version');
|
||||||
|
}
|
||||||
if (version) {
|
if (version) {
|
||||||
yield installer.getGo(version);
|
yield installer.getGo(version);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,10 @@ async function run() {
|
|||||||
// Version is optional. If supplied, install / use from the tool cache
|
// Version is optional. If supplied, install / use from the tool cache
|
||||||
// If not supplied then task is still used to setup proxy, auth, etc...
|
// If not supplied then task is still used to setup proxy, auth, etc...
|
||||||
//
|
//
|
||||||
const version = core.getInput('version');
|
let version = core.getInput('version');
|
||||||
|
if (!version) {
|
||||||
|
version = core.getInput('go-version');
|
||||||
|
}
|
||||||
if (version) {
|
if (version) {
|
||||||
await installer.getGo(version);
|
await installer.getGo(version);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user