build: remove error return from genMainModule
The genMainModule function never returns an error, so simplified its signature to return only Package. Updated: - genMainModule signature: (Package, error) -> Package - Call site in build.go to not handle error - Both test cases to remove error checking Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
This commit is contained in:
@@ -30,7 +30,7 @@ import (
|
||||
llssa "github.com/goplus/llgo/ssa"
|
||||
)
|
||||
|
||||
func genMainModule(ctx *context, rtPkgPath string, pkg *packages.Package, needRuntime, needPyInit bool) (Package, error) {
|
||||
func genMainModule(ctx *context, rtPkgPath string, pkg *packages.Package, needRuntime, needPyInit bool) Package {
|
||||
prog := ctx.prog
|
||||
mainPkg := prog.NewPackage("", pkg.PkgPath+".main")
|
||||
|
||||
@@ -55,7 +55,7 @@ func genMainModule(ctx *context, rtPkgPath string, pkg *packages.Package, needRu
|
||||
}
|
||||
|
||||
if ctx.buildConf.BuildMode != BuildModeExe {
|
||||
return mainAPkg, nil
|
||||
return mainAPkg
|
||||
}
|
||||
|
||||
runtimeStub := defineWeakNoArgStub(mainPkg, "runtime.init")
|
||||
@@ -80,7 +80,7 @@ func genMainModule(ctx *context, rtPkgPath string, pkg *packages.Package, needRu
|
||||
defineStart(mainPkg, entryFn, argvValueType)
|
||||
}
|
||||
|
||||
return mainAPkg, nil
|
||||
return mainAPkg
|
||||
}
|
||||
|
||||
func defineEntryFunction(ctx *context, pkg llssa.Package, argcVar, argvVar llssa.Global, argvType llssa.Type, runtimeStub, mainInit, mainMain llssa.Function, pyInit, rtInit llssa.Function) llssa.Function {
|
||||
|
||||
Reference in New Issue
Block a user