github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/eval/gowrap/genwrap.go (about)

     1  // Copyright 2015 The Neugram Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build ignore
     6  
     7  package main
     8  
     9  import (
    10  	"io/ioutil"
    11  	"log"
    12  	"os"
    13  	"strings"
    14  
    15  	"neugram.io/ng/eval/gowrap/genwrap"
    16  )
    17  
    18  func main() {
    19  	pkgName := os.Args[1]
    20  
    21  	// Set skipDeps to true, which means we have to
    22  	// be careful to include the required dependencies
    23  	// in our builtins.
    24  	b, err := genwrap.GenGo(pkgName, "wrapbuiltin", true)
    25  	if err != nil {
    26  		log.Fatal(err)
    27  	}
    28  	quotedPkgName := strings.Replace(pkgName, "/", "_", -1)
    29  	err = ioutil.WriteFile("wrapbuiltin/wrap_"+quotedPkgName+".go", b, 0666)
    30  	if err != nil {
    31  		log.Fatal(err)
    32  	}
    33  }