Prechádzať zdrojové kódy

Fix documentation example showing use of ReadStruct

Logic flow was inverted. Example was printing the result when an
error was occurring and using panic when no error.
Kevin Etienne 8 rokov pred
rodič
commit
6adc582934
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      example_read_test.go

+ 2 - 2
example_read_test.go

@@ -29,8 +29,8 @@ func ExampleRow_ReadStruct() {
 	readStruct := &structTest{}
 	err := row.ReadStruct(readStruct)
 	if err != nil {
-		fmt.Println(readStruct)
-	} else {
 		panic(err)
+	} else {
+		fmt.Println(readStruct)
 	}
 }