diff --git a/Makefile b/Makefile index 63d18c1..d20dd04 100644 --- a/Makefile +++ b/Makefile @@ -62,4 +62,4 @@ static-assets-clean: static-assets: @echo "==> Generating static assets" @go-bindata -pkg glass -prefix webui -nocompress -o assets.gen.go ./webui/... - #go run ./internal/gensym -o=./module/internal/types/types.gen.go + @go run ./internal/gensym -o=./module/internal/types/types.gen.go diff --git a/go.mod b/go.mod index 500ff34..be71404 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/hamba/testutils v0.1.1 github.com/joho/godotenv v1.3.0 github.com/stretchr/testify v1.6.1 - github.com/traefik/yaegi v0.9.2 + github.com/traefik/yaegi v0.9.4 github.com/urfave/cli/v2 v2.2.0 github.com/vincent-petithory/dataurl v0.0.0-20191104211930-d1553a71de50 github.com/zserge/lorca v0.1.9 diff --git a/go.sum b/go.sum index 5afd11c..30abd99 100644 --- a/go.sum +++ b/go.sum @@ -31,6 +31,8 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/traefik/yaegi v0.9.2 h1:u694KQ98E0gGQoOPvlHIkc6DLxgoA24ZfEgo+TWhqyE= github.com/traefik/yaegi v0.9.2/go.mod h1:FAYnRlZyuVlEkvnkHq3bvJ1lW5be6XuwgLdkYgYG6Lk= +github.com/traefik/yaegi v0.9.4 h1:ZyxSsvpzZTTTbvE2ODjRkOvq6kYT3dIZDqUfCZJYDtw= +github.com/traefik/yaegi v0.9.4/go.mod h1:FAYnRlZyuVlEkvnkHq3bvJ1lW5be6XuwgLdkYgYG6Lk= github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4= github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/vincent-petithory/dataurl v0.0.0-20191104211930-d1553a71de50 h1:uxE3GYdXIOfhMv3unJKETJEhw78gvzuQqRX/rVirc2A= diff --git a/internal/gensym/gensym.go b/internal/gensym/gensym.go index c6df6de..2cd36b5 100644 --- a/internal/gensym/gensym.go +++ b/internal/gensym/gensym.go @@ -1,36 +1,36 @@ package main -// import ( -// "bytes" -// "flag" -// "io/ioutil" -// "log" -// -// "github.com/traefik/yaegi/internal/extract" -// ) -// -// const ( -// pkgIdent = "github.com/glasslabs/looking-glass/module/types" -// ) -// -// var ( -// outputFile = flag.String("o", "gen.go", "The output file") -// ) -// -// func main() { -// flag.Parse() -// -// ext := extract.Extractor{Dest: "types"} -// -// var buf bytes.Buffer -// _, err := ext.Extract(pkgIdent, "", &buf) -// if err != nil { -// log.Println(err) -// return -// } -// -// if err := ioutil.WriteFile(*outputFile, buf.Bytes(), 0600); err != nil { -// log.Println(err) -// return -// } -// } +import ( + "bytes" + "flag" + "io/ioutil" + "log" + + "github.com/traefik/yaegi/extract" +) + +const ( + pkgIdent = "github.com/glasslabs/looking-glass/module/types" +) + +var ( + outputFile = flag.String("o", "gen.go", "The output file") +) + +func main() { + flag.Parse() + + ext := extract.Extractor{Dest: "types"} + + var buf bytes.Buffer + _, err := ext.Extract(pkgIdent, "", &buf) + if err != nil { + log.Println(err) + return + } + + if err := ioutil.WriteFile(*outputFile, buf.Bytes(), 0600); err != nil { + log.Println(err) + return + } +} diff --git a/module/internal/types/types.yaegi.go b/module/internal/types/types.yaegi.go deleted file mode 100644 index 9ef510d..0000000 --- a/module/internal/types/types.yaegi.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by 'github.com/traefik/yaegi/extract github.com/nrwiersma/scape/module/types'. DO NOT EDIT. - -package types - -import ( - "github.com/glasslabs/looking-glass/module/types" - "reflect" -) - -func init() { - Symbols["github.com/glasslabs/looking-glass/module/types"] = map[string]reflect.Value{ - // type definitions - "Info": reflect.ValueOf((*types.Info)(nil)), - "Logger": reflect.ValueOf((*types.Logger)(nil)), - "UI": reflect.ValueOf((*types.UI)(nil)), - - // interface wrapper definitions - "_Logger": reflect.ValueOf((*_github_com_nrwiersma_scape_module_types_Logger)(nil)), - "_UI": reflect.ValueOf((*_github_com_nrwiersma_scape_module_types_UI)(nil)), - } -} - -// _github_com_nrwiersma_scape_module_types_Logger is an interface wrapper for Logger type -type _github_com_nrwiersma_scape_module_types_Logger struct { - WError func(msg string, ctx []interface{}) - WInfo func(msg string, ctx []interface{}) -} - -func (W _github_com_nrwiersma_scape_module_types_Logger) Error(msg string, ctx []interface{}) { - W.WError(msg, ctx) -} -func (W _github_com_nrwiersma_scape_module_types_Logger) Info(msg string, ctx []interface{}) { - W.WInfo(msg, ctx) -} - -// _github_com_nrwiersma_scape_module_types_UI is an interface wrapper for UI type -type _github_com_nrwiersma_scape_module_types_UI struct { - WBind func(name string, fun interface{}) error - WEval func(cmd string, ctx []interface{}) (interface{}, error) - WLoadCSS func(css string) error - WLoadHTML func(html string) error -} - -func (W _github_com_nrwiersma_scape_module_types_UI) Bind(name string, fun interface{}) error { - return W.WBind(name, fun) -} -func (W _github_com_nrwiersma_scape_module_types_UI) Eval(cmd string, ctx []interface{}) (interface{}, error) { - return W.WEval(cmd, ctx) -} -func (W _github_com_nrwiersma_scape_module_types_UI) LoadCSS(css string) error { - return W.WLoadCSS(css) -} -func (W _github_com_nrwiersma_scape_module_types_UI) LoadHTML(html string) error { - return W.WLoadHTML(html) -}