@@ -22,6 +22,7 @@ const BaseURLOverrideRequired = "override"
2222
2323type CLIData struct {
2424 // ContainsCompleteDir bool
25+ // NoPenaltyOnFail bool
2526 BaseURLDefault string
2627 Steps []CLIStep
2728 AllowedOperatingSystems []string
@@ -189,12 +190,14 @@ type lessonSubmissionCLI struct {
189190 CLIResults []CLIStepResult
190191}
191192
192- type verificationResult struct {
193- ResultSlug string
193+ type VerificationResult struct {
194+ // ResultSlug string
194195 // user friendly message to put in the toast
195196 ResultMessage string
196197 // only present if the lesson is an CLI type
197198 StructuredErrCLI * VerificationResultStructuredErrCLI
199+ // for "noop" on "noPenaltyOnFail" CLI lessons
200+ StructuredNoopCLI * VerificationResultStructuredErrCLI
198201}
199202
200203type VerificationResultStructuredErrCLI struct {
@@ -203,27 +206,27 @@ type VerificationResultStructuredErrCLI struct {
203206 FailedTestIndex int `json:"FailedTestIndex"`
204207}
205208
206- func SubmitCLILesson (uuid string , results []CLIStepResult ) (* VerificationResultStructuredErrCLI , error ) {
209+ func SubmitCLILesson (uuid string , results []CLIStepResult ) (VerificationResult , error ) {
207210 bytes , err := json .Marshal (lessonSubmissionCLI {CLIResults : results })
208211 if err != nil {
209- return nil , err
212+ return VerificationResult {} , err
210213 }
211214 endpoint := fmt .Sprintf ("/v1/lessons/%v/" , uuid )
212215 resp , code , err := fetchWithAuthAndPayload ("POST" , endpoint , bytes )
213216 if err != nil {
214- return nil , err
217+ return VerificationResult {} , err
215218 }
216219 if code == 402 {
217- return nil , fmt .Errorf ("to run and submit the tests for this lesson, you must have an active Boot.dev membership\n https://boot.dev/pricing" )
220+ return VerificationResult {} , fmt .Errorf ("to run and submit the tests for this lesson, you must have an active Boot.dev membership\n https://boot.dev/pricing" )
218221 }
219222 if code != 200 {
220- return nil , fmt .Errorf ("failed to submit CLI lesson (code %v): %s" , code , string (resp ))
223+ return VerificationResult {} , fmt .Errorf ("failed to submit CLI lesson (code %v): %s" , code , string (resp ))
221224 }
222225
223- result := verificationResult {}
226+ result := VerificationResult {}
224227 err = json .Unmarshal (resp , & result )
225228 if err != nil {
226- return nil , err
229+ return VerificationResult {} , err
227230 }
228- return result . StructuredErrCLI , nil
231+ return result , nil
229232}
0 commit comments