Skip to content

Commit 0ac8026

Browse files
committed
rework CI with Go 1.14 and Windows support
Thanks to lessons learned in other Go repositories.
1 parent 960b1ec commit 0ac8026

24 files changed

+37
-53
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# To prevent CRLF breakages on Windows for fragile files, like testdata.
2+
* -text

.github/workflows/test.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go-version: [1.12.x, 1.13.x]
8-
# platform: [ubuntu-latest, macos-latest, windows-latest]
9-
# TODO: reenable windows once %LocalAppData% is set
10-
platform: [ubuntu-latest, macos-latest]
7+
go-version: [1.13.x, 1.14.x]
8+
platform: [ubuntu-latest, macos-latest, windows-latest]
119
runs-on: ${{ matrix.platform }}
1210
steps:
1311
- name: Install Go
1412
uses: actions/setup-go@v1
1513
with:
1614
go-version: ${{ matrix.go-version }}
1715
- name: Checkout code
18-
uses: actions/checkout@v1
16+
uses: actions/checkout@v2
1917
- name: Test
2018
run: go test ./...

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module mvdan.cc/unparam
22

33
require (
4-
github.com/rogpeppe/go-internal v1.3.2
5-
golang.org/x/tools v0.0.0-20190911151314-feee8acb394c
4+
github.com/rogpeppe/go-internal v1.5.2
5+
golang.org/x/tools v0.0.0-20200313205530-4303120df7d8
66
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
77
)
88

go.sum

+17-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,29 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
33
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
44
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
55
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
6-
github.com/rogpeppe/go-internal v1.3.2 h1:XU784Pr0wdahMY2bYcyK6N1KuaRAdLtqD4qd8D18Bfs=
7-
github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
6+
github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w=
7+
github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
8+
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
89
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
10+
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
11+
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
12+
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
13+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
914
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
15+
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
1016
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
17+
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
1118
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
19+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1220
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
13-
golang.org/x/tools v0.0.0-20190911151314-feee8acb394c h1:Z68bwv5Kf04vdnGGHkuVaXWsvmeiFHysXpV8x6/8r0A=
14-
golang.org/x/tools v0.0.0-20190911151314-feee8acb394c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
21+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
22+
golang.org/x/tools v0.0.0-20200313205530-4303120df7d8 h1:gkI/wGGwpcG5W4hLCzZNGxA4wzWBGGDStRI1MrjDl2Q=
23+
golang.org/x/tools v0.0.0-20200313205530-4303120df7d8/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
1524
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
25+
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
26+
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
27+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
28+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1629
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
1730
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1831
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=

main_test.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"path/filepath"
66
"testing"
77

8+
"github.com/rogpeppe/go-internal/gotooltest"
89
"github.com/rogpeppe/go-internal/testscript"
910
)
1011

@@ -16,7 +17,15 @@ func TestMain(m *testing.M) {
1617

1718
func TestScripts(t *testing.T) {
1819
t.Parallel()
19-
testscript.Run(t, testscript.Params{
20+
p := testscript.Params{
2021
Dir: filepath.Join("testdata", "scripts"),
21-
})
22+
Setup: func(env *testscript.Env) error {
23+
env.Vars = append(env.Vars, "/="+string(os.PathSeparator))
24+
return nil
25+
},
26+
}
27+
if err := gotooltest.Setup(&p); err != nil {
28+
t.Fatal(err)
29+
}
30+
testscript.Run(t, p)
2231
}

testdata/scripts/build_tags.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/closure.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/crashers.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/extractparams.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/funclit.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/ignoredrets.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/impl.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
env HOME=$WORK/home
2-
31
! unparam ./...
4-
cmp stdout stdout.golden
2+
cmpenv stdout stdout.golden
53

64
-- go.mod --
75
module testdata.tld/foo
86
-- stdout.golden --
97
foo.go:7:19: oneUnused - b is unused
108
foo.go:49:38: (*EnsuredImpl).otherMethod - b is unused
11-
main/main.go:5:19: oneUnused - b is unused
9+
main${/}main.go:5:19: oneUnused - b is unused
1210
-- foo.go --
1311
package foo
1412

testdata/scripts/include_test.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
stdout 'fooUnused .* unused'
53
! stdout 'footestUnused .* unused'

testdata/scripts/main.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/methods.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/names.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/paramuses.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/phi.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/reused.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/samerets.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/simple.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/stubs.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/usedas.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

testdata/scripts/values.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env HOME=$WORK/home
2-
31
! unparam .
42
cmp stdout stdout.golden
53

0 commit comments

Comments
 (0)