Skip to content

Commit

Permalink
Documents takes an Exercise
Browse files Browse the repository at this point in the history
`documents()` is more flexible and is more encapsulated by not requiring
consumers to know that they need to call `exercise.Filepath()`
  • Loading branch information
jdsutherland committed Jan 2, 2019
1 parent 381a1cd commit 17b34e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error {
return err
}

documents, err := ctx.documents(exercise.Filepath())
documents, err := ctx.documents(exercise)
if err != nil {
return err
}
Expand Down Expand Up @@ -233,7 +233,7 @@ func (s *submitContext) metadata(exercise workspace.Exercise) (*workspace.Exerci
return metadata, nil
}

func (s *submitContext) documents(exerciseDir string) ([]workspace.Document, error) {
func (s *submitContext) documents(exercise workspace.Exercise) ([]workspace.Document, error) {
docs := make([]workspace.Document, 0, len(s.args))
for _, file := range s.args {
// Don't submit empty files
Expand Down Expand Up @@ -262,7 +262,7 @@ func (s *submitContext) documents(exerciseDir string) ([]workspace.Document, err
fmt.Fprintf(Err, msg, file)
continue
}
doc, err := workspace.NewDocument(exerciseDir, file)
doc, err := workspace.NewDocument(exercise.Filepath(), file)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 17b34e4

Please sign in to comment.