MCPcopy
hub / github.com/pquerna/ffjson / GenerateFiles

Function GenerateFiles

generator/generator.go:26–59  ·  view source on GitHub ↗
(goCmd string, inputPath string, outputPath string, importName string, forceRegenerate bool, resetFields bool)

Source from the content-addressed store, hash-verified

24)
25
26func GenerateFiles(goCmd string, inputPath string, outputPath string, importName string, forceRegenerate bool, resetFields bool) error {
27
28 if _, StatErr := os.Stat(outputPath); !os.IsNotExist(StatErr) {
29 inputFileInfo, inputFileErr := os.Stat(inputPath)
30 outputFileInfo, outputFileErr := os.Stat(outputPath)
31
32 if nil == outputFileErr && nil == inputFileErr {
33 if !forceRegenerate && inputFileInfo.ModTime().Before(outputFileInfo.ModTime()) {
34 fmt.Println("File " + outputPath + " already exists.")
35
36 return nil
37 }
38 }
39 }
40
41 packageName, structs, err := ExtractStructs(inputPath)
42 if err != nil {
43 return err
44 }
45
46 im := NewInceptionMain(goCmd, inputPath, outputPath, resetFields)
47
48 err = im.Generate(packageName, structs, importName)
49 if err != nil {
50 return errors.New(fmt.Sprintf("error=%v path=%q", err, im.TempMainPath))
51 }
52
53 err = im.Run()
54 if err != nil {
55 return err
56 }
57
58 return nil
59}

Callers

nothing calls this directly

Calls 4

GenerateMethod · 0.95
RunMethod · 0.95
ExtractStructsFunction · 0.85
NewInceptionMainFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…