func main() { if len(os.Args) < 2 { fmt.Println("usage: go run introspector.go <namespace> [symbol...]") return } namespace := os.Args[1] gogi.Init() loaded := gogi.LoadNamespace(namespace) if !loaded { fmt.Printf("Failed to load namespace '%s'\n", namespace) return } if len(os.Args) == 2 { infos := gogi.GetInfos(namespace) for _, info := range infos { fmt.Println(info.GetName()) } } else { for i := 2; i < len(os.Args); i++ { symbol := os.Args[i] info := gogi.GetInfoByName(namespace, symbol) if info != nil { Display(info) } else { fmt.Printf("Symbol '%s' not found\n", symbol) } } } }
func main() { if len(os.Args) < 2 { fmt.Println("usage: go run binding-generator.go <namespace>") return } var err error knownPackages = make(map[string]Deps) deps_config, _ := os.Open("deps.json") deps_decoder := json.NewDecoder(deps_config) err = deps_decoder.Decode(&knownPackages) if err != nil { println(err.Error()) } deps_config.Close() namespace := os.Args[1] gogi.Init() loaded := gogi.LoadNamespace(namespace) if !loaded { fmt.Printf("Failed to load namespace '%s'\n", namespace) return } var commonBytes []byte commonBytes, err = ioutil.ReadFile("misc/common.go") if err != nil { fmt.Println("Failed to read misc/common.go") return } else { common = string(commonBytes) } /* dependencies := gogi.GetDependencies(namespace) for _, dep := range dependencies { nameAndVersion := strings.Split(dep, "-") name := nameAndVersion[0] //version := nameAndVersion[1] Process(name) } */ Process(namespace) fmt.Println("done.") }