metadataMatchesExercise checks that the metadata refers to the exercise being submitted.
(metadata *workspace.ExerciseMetadata, exercise workspace.Exercise)
| 430 | |
| 431 | // metadataMatchesExercise checks that the metadata refers to the exercise being submitted. |
| 432 | func (s submitValidator) metadataMatchesExercise(metadata *workspace.ExerciseMetadata, exercise workspace.Exercise) error { |
| 433 | if metadata.ExerciseSlug != exercise.Slug { |
| 434 | // TODO: error msg should suggest running future doctor command |
| 435 | msg := ` |
| 436 | |
| 437 | The exercise directory does not match exercise slug in metadata: |
| 438 | |
| 439 | expected '%[1]s' but got '%[2]s' |
| 440 | |
| 441 | Please rename the directory '%[1]s' to '%[2]s' and try again. |
| 442 | |
| 443 | ` |
| 444 | return fmt.Errorf(msg, exercise.Slug, metadata.ExerciseSlug) |
| 445 | } |
| 446 | return nil |
| 447 | } |
| 448 | |
| 449 | // isRequestor checks that the submission requestor is listed as the author in the metadata. |
| 450 | func (s submitValidator) isRequestor(metadata *workspace.ExerciseMetadata) error { |