engine, lang: Misc fixes for golang lint

This commit is contained in:
James Shubin
2021-08-09 16:55:31 -04:00
parent 3718372288
commit c555478b54
5 changed files with 9 additions and 14 deletions

View File

@@ -128,10 +128,7 @@ func (obj *NspawnRes) Init(init *engine.Init) error {
} }
obj.svc = svc obj.svc = svc
// TODO: we could build a new init that adds a prefix to the logger... // TODO: we could build a new init that adds a prefix to the logger...
if err := obj.svc.Init(init); err != nil { return obj.svc.Init(init)
return err
}
return nil
} }
// Close is run by the engine to clean up after the resource is done. // Close is run by the engine to clean up after the resource is done.

View File

@@ -83,10 +83,7 @@ func (obj *PippetRes) Validate() error {
func (obj *PippetRes) Init(init *engine.Init) error { func (obj *PippetRes) Init(init *engine.Init) error {
obj.init = init // save for later obj.init = init // save for later
obj.runner = getPippetReceiverInstance() obj.runner = getPippetReceiverInstance()
if err := obj.runner.Register(); err != nil { return obj.runner.Register()
return err
}
return nil
} }
// Close is run by the engine to clean up after the resource is done. // Close is run by the engine to clean up after the resource is done.

View File

@@ -88,16 +88,13 @@ func generateTemplate(c config, f functions, path, templateFile, finalName strin
if err != nil { if err != nil {
return err return err
} }
if err = t.Execute(finalFile, struct { return t.Execute(finalFile, struct {
Packages golangPackages Packages golangPackages
Functions []function Functions []function
}{ }{
c.Packages, c.Packages,
f, f,
}); err != nil { })
return err
}
return nil
} }
// MakeGolangArgs translates the func args to golang args. // MakeGolangArgs translates the func args to golang args.

View File

@@ -23,6 +23,6 @@ const (
ModuleSep = "." ModuleSep = "."
// VarPrefix is the prefix character that precedes the variables // VarPrefix is the prefix character that precedes the variables
// identifer. For example, `$foo` or for a lambda, `$fn(42)`. // identifier. For example, `$foo` or for a lambda, `$fn(42)`.
VarPrefix = "$" VarPrefix = "$"
) )

View File

@@ -3841,6 +3841,7 @@ func (obj *StmtFunc) Init(data *interfaces.Data) error {
if err := obj.Func.Init(data); err != nil { if err := obj.Func.Init(data); err != nil {
return err return err
} }
// no errors
return nil return nil
} }
@@ -4395,6 +4396,7 @@ func (obj *StmtInclude) SetScope(scope *interfaces.Scope) error {
return err return err
} }
// no errors
return nil return nil
} }
@@ -8650,6 +8652,8 @@ func (obj *ExprIf) Init(data *interfaces.Data) error {
if err := obj.ElseBranch.Init(data); err != nil { if err := obj.ElseBranch.Init(data); err != nil {
return err return err
} }
// no errors
return nil return nil
} }