You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	Merge pull request #536 from alicebob/mainerr
fix: Fix segfault by catching all stat errors
This commit is contained in:
		| @@ -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 = "." | ||||
|   | ||||
		Reference in New Issue
	
	Block a user