1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00

fix: Catch all stat errors

This commit is contained in:
Harmen 2018-02-01 13:11:46 +01:00
parent 761e48e72b
commit 002d88b514
2 changed files with 3 additions and 3 deletions

View File

@ -161,8 +161,8 @@ func checkMain(ctx *context.Context, build config.Build) error {
main = "."
}
stat, ferr := os.Stat(main)
if os.IsNotExist(ferr) {
return errors.Wrapf(ferr, "could not open %s", main)
if ferr != nil {
return ferr
}
if stat.IsDir() {
packs, err := parser.ParseDir(token.NewFileSet(), main, nil, 0)

View File

@ -246,7 +246,7 @@ func TestRunPipeWithoutMainFunc(t *testing.T) {
ctx.Config.Builds[0].Main = "foo.go"
assert.EqualError(t, Default.Build(ctx, ctx.Config.Builds[0], api.Options{
Target: runtimeTarget,
}), `could not open foo.go: stat foo.go: no such file or directory`)
}), `stat foo.go: no such file or directory`)
})
t.Run("glob", func(t *testing.T) {
ctx.Config.Builds[0].Main = "."