Skip to content

Commit

Permalink
fix(logic): implement open on fs
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Mar 15, 2023
1 parent a869ec6 commit 9bb1c10
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions x/logic/interpreter/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ func New(ctx goctx.Context, handlers []URIHandler) FileSystem {
}
}

// Open will read the entire file from ReadFile interface,
// Since file is provided by a provider that do not support streams.
// Open opens the named file.
//
// When Open returns an error, it should be of type *PathError
// with the Op field set to "open", the Path field set to name,
// and the Err field describing the problem.
//
// Open should reject attempts to open names that do not satisfy
// ValidPath(name), returning a *PathError with Err set to
// ErrInvalid or ErrNotExist.
func (f FileSystem) Open(name string) (fs.File, error) {
//data, err := f.ReadFile(name)
data, err := f.router.Open(f.ctx, name)
if err != nil {
return nil, &fs.PathError{
Expand All @@ -39,9 +45,3 @@ func (f FileSystem) Open(name string) (fs.File, error) {
}
return data, nil
}

// ReadFile read the entire file at the uri provided.
// Parse all handler and return the first supported handler file response.
//func (f FileSystem) ReadFile(name string) ([]byte, error) {
// return f.router.Open(f.ctx, name)
//}

0 comments on commit 9bb1c10

Please sign in to comment.