()
| 441 | } |
| 442 | |
| 443 | func buildBasicExampleJSONData() error { |
| 444 | req := getBasicExampleReq() |
| 445 | data, err := json.Marshal(req) |
| 446 | if err != nil { |
| 447 | panic(fmt.Sprintf("buildExampleJSONData failed, err: %v", err.Error())) |
| 448 | } |
| 449 | checkExist := func(path string) bool { |
| 450 | _, err := os.Stat(path) |
| 451 | if err != nil { |
| 452 | if os.IsExist(err) { |
| 453 | return true |
| 454 | } |
| 455 | return false |
| 456 | } |
| 457 | return true |
| 458 | } |
| 459 | var file *os.File |
| 460 | absoluteExampleJSONPath := util_test.MustGitPath(basicExampleJSON) |
| 461 | if checkExist(absoluteExampleJSONPath) == true { |
| 462 | if err = os.Remove(absoluteExampleJSONPath); err != nil { |
| 463 | panic("delete protoJSONFile failed") |
| 464 | } |
| 465 | } |
| 466 | file, err = os.Create(absoluteExampleJSONPath) |
| 467 | if err != nil { |
| 468 | panic("create protoJSONFile failed") |
| 469 | } |
| 470 | defer file.Close() |
| 471 | if _, err := file.WriteString(string(data)); err != nil { |
| 472 | panic("write protoJSONData failed") |
| 473 | } |
| 474 | return nil |
| 475 | } |
| 476 | |
| 477 | func getExampleInt2Float() *proto.TypeDescriptor { |
| 478 | includeDirs := util_test.MustGitPath("testdata/idl/") // includeDirs is used to find the include files. |
no test coverage detected
searching dependent graphs…