lang: Clean up import logs
We get a lot of useless noise here, make it neater.
This commit is contained in:
@@ -3503,21 +3503,26 @@ func (obj *StmtProg) importSystemScope(name string) (*interfaces.Scope, error) {
|
||||
obj.data.Logf("behold, the AST: %+v", ast)
|
||||
}
|
||||
|
||||
obj.data.Logf("init...")
|
||||
//obj.data.Logf("init...")
|
||||
//obj.data.Logf("import: %s", ?) // TODO: add this for symmetry?
|
||||
// init and validate the structure of the AST
|
||||
// some of this might happen *after* interpolate in SetScope or later...
|
||||
if err := ast.Init(obj.data); err != nil {
|
||||
return nil, errwrap.Wrapf(err, "could not init and validate AST")
|
||||
}
|
||||
|
||||
obj.data.Logf("interpolating...")
|
||||
if obj.data.Debug {
|
||||
obj.data.Logf("interpolating...")
|
||||
}
|
||||
// interpolate strings and other expansionable nodes in AST
|
||||
interpolated, err := ast.Interpolate()
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf(err, "could not interpolate AST from import `%s`", name)
|
||||
}
|
||||
|
||||
obj.data.Logf("scope building...")
|
||||
if obj.data.Debug {
|
||||
obj.data.Logf("scope building...")
|
||||
}
|
||||
// propagate the scope down through the AST...
|
||||
// most importantly, we ensure that the child imports will run!
|
||||
// we pass in *our* parent scope, which will include the globals
|
||||
@@ -3602,7 +3607,8 @@ func (obj *StmtProg) importScopeWithParsedInputs(input *inputs.ParsedInput, scop
|
||||
|
||||
// nested logger
|
||||
logf := func(format string, v ...interface{}) {
|
||||
obj.data.Logf("import: "+format, v...)
|
||||
//obj.data.Logf("import: "+format, v...) // don't nest!
|
||||
obj.data.Logf(format, v...)
|
||||
}
|
||||
|
||||
// build new list of files
|
||||
@@ -3623,7 +3629,8 @@ func (obj *StmtProg) importScopeWithParsedInputs(input *inputs.ParsedInput, scop
|
||||
logf("behold, the AST: %+v", ast)
|
||||
}
|
||||
|
||||
logf("init...")
|
||||
//logf("init...")
|
||||
logf("import: %s", input.Base)
|
||||
// init and validate the structure of the AST
|
||||
data := &interfaces.Data{
|
||||
// TODO: add missing fields here if/when needed
|
||||
@@ -3649,14 +3656,18 @@ func (obj *StmtProg) importScopeWithParsedInputs(input *inputs.ParsedInput, scop
|
||||
return nil, errwrap.Wrapf(err, "could not init and validate AST")
|
||||
}
|
||||
|
||||
logf("interpolating...")
|
||||
if obj.data.Debug {
|
||||
logf("interpolating...")
|
||||
}
|
||||
// interpolate strings and other expansionable nodes in AST
|
||||
interpolated, err := ast.Interpolate()
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf(err, "could not interpolate AST from import")
|
||||
}
|
||||
|
||||
logf("scope building...")
|
||||
if obj.data.Debug {
|
||||
logf("scope building...")
|
||||
}
|
||||
// propagate the scope down through the AST...
|
||||
// most importantly, we ensure that the child imports will run!
|
||||
// we pass in *our* parent scope, which will include the globals
|
||||
|
||||
@@ -189,7 +189,8 @@ func (obj *GAPI) Cli(info *gapi.Info) (*gapi.Deploy, error) {
|
||||
}
|
||||
importGraph.AddVertex(importVertex)
|
||||
|
||||
logf("init...")
|
||||
//logf("init...")
|
||||
logf("import: %s", output.Base)
|
||||
// init and validate the structure of the AST
|
||||
data := &interfaces.Data{
|
||||
// TODO: add missing fields here if/when needed
|
||||
@@ -219,7 +220,9 @@ func (obj *GAPI) Cli(info *gapi.Info) (*gapi.Deploy, error) {
|
||||
return nil, errwrap.Wrapf(err, "could not init and validate AST")
|
||||
}
|
||||
|
||||
logf("interpolating...")
|
||||
if debug {
|
||||
logf("interpolating...")
|
||||
}
|
||||
// interpolate strings and other expansionable nodes in AST
|
||||
iast, err := xast.Interpolate()
|
||||
if err != nil {
|
||||
@@ -249,7 +252,9 @@ func (obj *GAPI) Cli(info *gapi.Info) (*gapi.Deploy, error) {
|
||||
Functions: ast.FuncPrefixToFunctionsScope(""), // runs funcs.LookupPrefix
|
||||
}
|
||||
|
||||
logf("scope building...")
|
||||
if debug {
|
||||
logf("scope building...")
|
||||
}
|
||||
// propagate the scope down through the AST...
|
||||
// We use SetScope because it follows all of the imports through. I did
|
||||
// not think we needed to pass in an initial scope because the download
|
||||
|
||||
11
lang/lang.go
11
lang/lang.go
@@ -173,7 +173,8 @@ func (obj *Lang) Init(ctx context.Context) error {
|
||||
}
|
||||
importGraph.AddVertex(importVertex)
|
||||
|
||||
obj.Logf("init...")
|
||||
//obj.Logf("init...")
|
||||
obj.Logf("import: %s", output.Base)
|
||||
// init and validate the structure of the AST
|
||||
data := &interfaces.Data{
|
||||
// TODO: add missing fields here if/when needed
|
||||
@@ -203,7 +204,9 @@ func (obj *Lang) Init(ctx context.Context) error {
|
||||
return errwrap.Wrapf(err, "could not init and validate AST")
|
||||
}
|
||||
|
||||
obj.Logf("interpolating...")
|
||||
if obj.Debug {
|
||||
obj.Logf("interpolating...")
|
||||
}
|
||||
timing = time.Now()
|
||||
// interpolate strings and other expansionable nodes in AST
|
||||
iast, err := xast.Interpolate()
|
||||
@@ -233,7 +236,9 @@ func (obj *Lang) Init(ctx context.Context) error {
|
||||
Functions: ast.FuncPrefixToFunctionsScope(""), // runs funcs.LookupPrefix
|
||||
}
|
||||
|
||||
obj.Logf("scope building...")
|
||||
if obj.Debug {
|
||||
obj.Logf("scope building...")
|
||||
}
|
||||
timing = time.Now()
|
||||
// propagate the scope down through the AST...
|
||||
if err := obj.ast.SetScope(scope); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user