Skip to content

Commit 6e389b2

Browse files
committed
ReadSourceFromURI refactor
1 parent 2b4c3f3 commit 6e389b2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

stream/stream.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,11 @@ func ReadSourceLocal(filename string, src any) ([]byte, error) {
111111
// ReadSourceFromURI reads the source from the given URI.
112112
// If src != nil, it reads from src; otherwise, it opens the URI and reads
113113
// from it.
114-
func ReadSourceFromURI(uri string, src any) (ret []byte, err error) {
114+
func ReadSourceFromURI(uri string, src any) ([]byte, error) {
115115
if src == nil {
116-
var f io.ReadCloser
117-
f, err = Open(uri)
116+
f, err := Open(uri)
118117
if err != nil {
119-
return
118+
return nil, err
120119
}
121120
defer f.Close()
122121
src = f

0 commit comments

Comments
 (0)