diff --git a/base/pkg_version.go b/base/pkg_version.go index d924967..b082904 100644 --- a/base/pkg_version.go +++ b/base/pkg_version.go @@ -39,38 +39,34 @@ func (this PkgVersion) GetSourceMapPath(prefix ...string) string { ) } -func (this PkgVersion) GetFile(app *do.Injector) ([]byte, error) { +func (this PkgVersion) GetFile(app *do.Injector) (file string, err error) { if this.Id == 0 { - return nil, contracts.ErrPkgUnknown + return file, contracts.ErrPkgUnknown } res, ok := do.MustInvoke[contracts.GetResource](app)("PkgVersion") if !ok { - return nil, contracts.ErrResNotFound + return file, contracts.ErrResNotFound } - file := []byte{} - - _, err := res.GetDBTable().Where("id", this.Id).Value(&file, "file") + _, err = res.GetDBTable().Where("id", this.Id).Value(&file, "file") return file, err } -func (this PkgVersion) GetSourceMap(app *do.Injector) ([]byte, error) { +func (this PkgVersion) GetSourceMap(app *do.Injector) (file string, err error) { if this.Id == 0 { - return nil, contracts.ErrPkgUnknown + return file, contracts.ErrPkgUnknown } res, ok := do.MustInvoke[contracts.GetResource](app)("PkgVersion") if !ok { - return nil, contracts.ErrResNotFound + return file, contracts.ErrResNotFound } - file := []byte{} - - _, err := res.GetDBTable().Where("id", this.Id).Value(&file, "sourcemap") + _, err = res.GetDBTable().Where("id", this.Id).Value(&file, "sourcemap") return file, err }