packagematchersimport("fmt""github.com/onsi/gomega/format")typeSucceedMatcherstruct{}func(matcher*SucceedMatcher)Match(actualinterface{})(successbool,errerror){// is purely nil?ifactual==nil{returntrue,nil}// must be an 'error' typeif!isError(actual){returnfalse,fmt.Errorf("Expected an error-type. Got:\n%s",format.Object(actual,1))}// must be nil (or a pointer to a nil)returnisNil(actual),nil}func(matcher*SucceedMatcher)FailureMessage(actualinterface{})(messagestring){returnfmt.Sprintf("Expected success, but got an error:\n%s\n%s",format.Object(actual,1),format.IndentString(actual.(error).Error(),1))}func(matcher*SucceedMatcher)NegatedFailureMessage(actualinterface{})(messagestring){return"Expected failure, but got no error."}