Skip to content

Commit

Permalink
make readme method return an io.Reader
Browse files Browse the repository at this point in the history
  • Loading branch information
mwhooker committed Mar 18, 2021
1 parent 9d745a0 commit 0fbe7bc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"context"
"errors"
"fmt"
"io"
"net/url"
"strings"
"time"
)

Expand Down Expand Up @@ -124,11 +126,17 @@ type Workspace struct {

// Readme will retrieve any readme file attached to the workspace. "" if none
// exists.
func (w *Workspace) Readme(ctx context.Context) (string, error) {
func (w *Workspace) Readme(ctx context.Context) (io.Reader, error) {
if w.readme == nil {
return "", nil
return nil, nil
}
return w.readme(ctx)

readme, err := w.readme(ctx)
if err != nil {
return nil, err
}

return strings.NewReader(readme), nil
}

// VCSRepo contains the configuration of a VCS integration.
Expand Down

0 comments on commit 0fbe7bc

Please sign in to comment.