Skip to content

Commit 8187235

Browse files
author
Danny McCormick
authored
Update to use go-version (#10)
1 parent b98503c commit 8187235

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
This action sets up a go environment for use in actions by:
88

9-
- optionally downloading and caching a version of go by version and adding to PATH
9+
- optionally downloading and caching a version of Go by version and adding to PATH
1010
- registering problem matchers for error output
1111

1212
# Usage
@@ -19,7 +19,7 @@ steps:
1919
- uses: actions/checkout@master
2020
- uses: actions/setup-go@v1
2121
with:
22-
version: '1.9.3' // The Go version to download (if necessary) and use.
22+
go-version: '1.9.3' // The Go version to download (if necessary) and use.
2323
- run: go run hello.go
2424
```
2525
@@ -37,7 +37,7 @@ jobs:
3737
- name: Setup go
3838
uses: actions/setup-go@v1
3939
with:
40-
version: ${{ matrix.go }}
40+
go-version: ${{ matrix.go }}
4141
- run: go run hello.go
4242
```
4343

action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ name: 'Setup Go environment'
22
description: 'Setup a Go environment and add it to the PATH, additionally providing proxy support'
33
author: 'GitHub'
44
inputs:
5-
version:
5+
go-version:
66
description: 'The Go version to download (if necessary) and use. Example: 1.9.3'
77
default: '1.10'
8+
# Deprecated option, do not use. Will not be supported after October 1, 2019
9+
version:
10+
description: 'Deprecated. Use go-version instead. Will not be supported after October 1, 2019'
811
runs:
912
using: 'node12'
1013
main: 'lib/setup-go.js'

lib/setup-go.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ function run() {
2525
// Version is optional. If supplied, install / use from the tool cache
2626
// If not supplied then task is still used to setup proxy, auth, etc...
2727
//
28-
const version = core.getInput('version');
28+
let version = core.getInput('version');
29+
if (!version) {
30+
version = core.getInput('go-version');
31+
}
2932
if (version) {
3033
yield installer.getGo(version);
3134
}

src/setup-go.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ async function run() {
88
// Version is optional. If supplied, install / use from the tool cache
99
// If not supplied then task is still used to setup proxy, auth, etc...
1010
//
11-
const version = core.getInput('version');
11+
let version = core.getInput('version');
12+
if (!version) {
13+
version = core.getInput('go-version');
14+
}
1215
if (version) {
1316
await installer.getGo(version);
1417
}

0 commit comments

Comments
 (0)