Skip to content

Commit

Permalink
add doc comments for loader
Browse files Browse the repository at this point in the history
  • Loading branch information
zjom committed Oct 23, 2024
1 parent b4a38b2 commit ab93d26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/processor/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type Deserializer interface {
Deserialize(document string) (map[string]interface{}, error)
}

// Takes a path and returns its bytes
// path may be file path or url
type Loader interface {
Load(path string) ([]byte, error)
}
6 changes: 3 additions & 3 deletions pkg/processor/loader/loader.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// loader is responsible for loading assets (images, fonts)
// into memory for templates and documents
package loader

import (
Expand All @@ -19,7 +17,9 @@ func NewLoader() *loader {
return &loader{}
}

func (localloader *loader) Load(path string) ([]byte, error) {
// Load takes the path/url/uri of an asset (image, font)
// and returns its contents.
func (l *loader) Load(path string) ([]byte, error) {
ext := getExt(path)
if _, ok := validExts[ext]; !ok {
return nil, errors.Wrap(ErrUnsupportedExtension, ext)
Expand Down

0 comments on commit ab93d26

Please sign in to comment.