package packages import ( "bytes" "fmt" "io" "os" "path/filepath" ) type Package struct { Name string Dependencies []Dependency } type Dependency struct { Name string Version string } func LookupPackageFile(name string) (io.Reader, error) { path := filepath.Join("./packages", name+".lua") f, err := os.Open(path) if err != nil { return nil, fmt.Errorf("opening package file: %w", err) } defer f.Close() buf := new(bytes.Buffer) _, err = io.Copy(buf, f) if err != nil { return nil, fmt.Errorf("reading package file: %w", err) } return buf, nil }