Skip to content

Adding support for Go 1.16's FS interface #191

Description

@advdv

Go 1.16 introduces the fs package and a FS interface. Implementing a Jet loader for this seems like an ideal use case. Are there any plans for this, would it be easy?

EDIT: actually, maybe it is as simple as this?

type StdFileSystemLoader struct{ fs.FS }

func (l StdFileSystemLoader) Open(templatePath string) (io.ReadCloser, error) {
	return l.FS.Open(templatePath)
}

func (l StdFileSystemLoader) Exists(templatePath string) bool {
	_, err := l.Open(templatePath)
	return err == nil && !os.IsNotExist(err)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions