Skip to content

Commit b93e002

Browse files
committed
CI: go back to macos-latest
Now that it seems we found a fix to #200, there is no reason to stick to macos-11, which will likely be deprecated soon. Update actions/setup-go to its latest version as well. The new version uses caching by default, which we do not need. While here, tidy up the cloneFile docs a bit.
1 parent 5150104 commit b93e002

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ jobs:
1616
- '1.20.x'
1717
os:
1818
- ubuntu-latest
19-
- macos-11
19+
- macos-latest
2020
- windows-latest
2121
runs-on: ${{ matrix.os }}
2222
steps:
2323
- name: Checkout code
2424
uses: actions/checkout@v3
2525
- name: Install Go
26-
uses: actions/setup-go@v3
26+
uses: actions/setup-go@v4
2727
with:
2828
go-version: ${{ matrix.go-version }}
29+
cache: false # our tests are quick enough
2930
- name: Test
3031
run: |
3132
go test ./...

testscript/clonefile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package testscript
55

66
import "os"
77

8-
// cloneFile creates to as a hard link to the from file.
8+
// cloneFile makes a clone of a file via a hard link.
99
func cloneFile(from, to string) error {
1010
return os.Link(from, to)
1111
}

testscript/clonefile_darwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package testscript
22

33
import "golang.org/x/sys/unix"
44

5-
// cloneFile clones the file from to the file to.
5+
// cloneFile makes a clone of a file via MacOS's `clonefile` syscall.
66
func cloneFile(from, to string) error {
77
return unix.Clonefile(from, to, 0)
88
}

testscript/clonefile_other.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ package testscript
55

66
import "fmt"
77

8-
// We don't want to use hard links on Windows, as that can lead to "access denied" errors when removing.
8+
// cloneFile does not attempt anything on Windows, as hard links on it have
9+
// led to "access denied" errors when deleting files at the end of a test.
10+
// We haven't tested platforms like plan9 or wasm/wasi.
911
func cloneFile(from, to string) error {
1012
return fmt.Errorf("unavailable")
1113
}

testscript/exe.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@ func RunMain(m TestingM, commands map[string]func() int) (exitCode int) {
117117
// Second, symlinks might not be available on some environments, so we have to
118118
// implement a "full copy" fallback anyway.
119119
//
120-
// However, we do try to use a hard link, since that will probably work on most
120+
// However, we do try to use cloneFile, since that will probably work on most
121121
// unix-like setups. Note that "go test" also places test binaries in the
122-
// system's temporary directory, like we do. We don't use hard links on Windows,
123-
// as that can lead to "access denied" errors when removing.
122+
// system's temporary directory, like we do.
124123
func copyBinary(from, to string) error {
125124
if err := cloneFile(from, to); err == nil {
126125
return nil

0 commit comments

Comments
 (0)