I'm using NPM to manage build/test/version lifecycle of a go package using go 1.11 modules. Prior to publishing, I'd like to check 'everything', included the modules, so I run: go test all
(which runs tests in all included modules).
The problem is that the standard os
package in go 1.11.5 (at least) fail on some Mac versions/environments (including mine). That's OK and irrelevant for my purposes, since the failures are in functions I don't use. However, this causes the publish process to fail since go test
exits with a non-zero status.
Any advice on how to deal with this?
It would be great if there was a way to run all the tests for functions that are in the call tree of my local tests (go test all -relevant
). Or, if I could name and skip the tests, that would be fine as well.
I'm aware of the -run
flag, but that doesn't seem to help because I cannot know beforehand what tests to run, and (from what I've seen) the regex used by -run
doesn't support negative lookaheads so it would be very tedious to construct a regular expression to exclude certain tests.
Failing os
tests:
--- FAIL: TestStatError (0.00s)
os_test.go:200: symlink no-such-file symlink: permission denied
--- FAIL: TestHardLink (0.00s)
os_test.go:694: open "hardlinktestto" failed: open hardlinktestto: permission denied
--- FAIL: TestSymlink (0.00s)
os_test.go:780: Create("symlinktestto") failed: open symlinktestto: permission denied
--- FAIL: TestLongSymlink (0.00s)
os_test.go:847: symlink "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "longsymlinktestfrom" failed: symlink 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef longsymlinktestfrom: permission denied
--- FAIL: TestRename (0.00s)
os_test.go:868: open "renamefrom" failed: open renamefrom: permission denied
--- FAIL: TestRenameOverwriteDest (0.00s)
os_test.go:896: write file "renameto" failed: open renameto: permission denied
--- FAIL: TestAppend (0.00s)
os_test.go:1684: Open: open append.txt: permission denied
--- FAIL: TestSameFile (0.00s)
os_test.go:1766: Create(a): open a: permission denied
FAIL
FAIL os 19.145s