Fix Windows tests, verify in CI (#394)

* ci: Test on Windows too

Adds a Windows test run to CI.
Go setup relies on GHA for this
because Hermit doesn't yet support Windows.

* fix(mapper_windows_test): assert.NotNil => assert.True

assert.NotNil does not exist.

* filecontent mapper: Handle error from directory

If we couldn't read because the source is a directory,
override the original error message.

* fix(test): Handle platform-specific "file not found" messages
This commit is contained in:
Abhinav Gupta
2023-12-09 20:42:50 -08:00
committed by GitHub
parent 815ba68265
commit 3263463a7e
6 changed files with 51 additions and 28 deletions
+3
View File
@@ -717,6 +717,9 @@ func fileContentMapper(r *Registry) MapperFunc {
data, err = ioutil.ReadAll(os.Stdin)
}
if err != nil {
if info, statErr := os.Stat(path); statErr == nil && info.IsDir() {
return fmt.Errorf("%q exists but is a directory: %w", path, err)
}
return err
}
target.SetBytes(data)