mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-15 11:56:56 +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 = "."
|
main = "."
|
||||||
}
|
}
|
||||||
stat, ferr := os.Stat(main)
|
stat, ferr := os.Stat(main)
|
||||||
if os.IsNotExist(ferr) {
|
if ferr != nil {
|
||||||
return errors.Wrapf(ferr, "could not open %s", main)
|
return ferr
|
||||||
}
|
}
|
||||||
if stat.IsDir() {
|
if stat.IsDir() {
|
||||||
packs, err := parser.ParseDir(token.NewFileSet(), main, nil, 0)
|
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"
|
ctx.Config.Builds[0].Main = "foo.go"
|
||||||
assert.EqualError(t, Default.Build(ctx, ctx.Config.Builds[0], api.Options{
|
assert.EqualError(t, Default.Build(ctx, ctx.Config.Builds[0], api.Options{
|
||||||
Target: runtimeTarget,
|
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) {
|
t.Run("glob", func(t *testing.T) {
|
||||||
ctx.Config.Builds[0].Main = "."
|
ctx.Config.Builds[0].Main = "."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user