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:
parent
761e48e72b
commit
002d88b514
@ -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)
|
||||
|
@ -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 = "."
|
||||
|
Loading…
Reference in New Issue
Block a user