pgraph: Move GraphMetas function out of package
This removes a dependency on the resources package which wasn't necessary.
This commit is contained in:
13
lib/main.go
13
lib/main.go
@@ -453,7 +453,7 @@ func (obj *Main) Run() error {
|
||||
Debug: obj.Flags.Debug,
|
||||
})
|
||||
|
||||
for _, m := range newGraph.GraphMetas() {
|
||||
for _, m := range graphMetas(newGraph) {
|
||||
// apply the global noop parameter if requested
|
||||
if obj.Noop {
|
||||
m.Noop = obj.Noop
|
||||
@@ -614,3 +614,14 @@ func (obj *Main) Run() error {
|
||||
log.Println("Goodbye!")
|
||||
return reterr
|
||||
}
|
||||
|
||||
// graphMetas returns a list of pointers to each of the resource MetaParams.
|
||||
func graphMetas(g *pgraph.Graph) []*resources.MetaParams {
|
||||
metas := []*resources.MetaParams{}
|
||||
for _, v := range g.Vertices() { // loop through the vertices (resources)
|
||||
res := v.Res // resource
|
||||
meta := res.Meta()
|
||||
metas = append(metas, meta)
|
||||
}
|
||||
return metas
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user