Skip to content

Commit

Permalink
Remove unneeded access funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidaguerre committed Oct 30, 2024
1 parent 36eeb35 commit 07db4a6
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/turbot/powerpipe

go 1.23.2

//replace github.com/turbot/pipe-fittings => ../pipe-fittings
replace github.com/turbot/pipe-fittings => ../pipe-fittings

require (
github.com/Masterminds/semver/v3 v3.3.0
Expand Down
2 changes: 1 addition & 1 deletion internal/controlexecute/control_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func NewControlRun(control *resources.Control, group *ResultGroup, executionTree
controlId := control.Name()

// only show qualified control names for controls from dependent mods
if control.Mod.Name() == executionTree.Workspace.GetMod().Name() {
if control.Mod.Name() == executionTree.Workspace.Mod.Name() {
controlId = control.UnqualifiedName
}

Expand Down
2 changes: 1 addition & 1 deletion internal/controlexecute/execution_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewExecutionTree(ctx context.Context, w *workspace.PowerpipeWorkspace, clie
resolvedItem = targets[0]
} else {
// create a root benchmark with `items` as it's children
resolvedItem = resources.NewRootBenchmarkWithChildren(w.GetMod(), targets).(modconfig.ModTreeItem)
resolvedItem = resources.NewRootBenchmarkWithChildren(w.Mod, targets).(modconfig.ModTreeItem)
}

// build tree of result groups, starting with a synthetic 'root' node
Expand Down
4 changes: 2 additions & 2 deletions internal/db_client/database_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ func GetDatabaseConfigForResource(resource modconfig.ModTreeItem, workspaceMod *
}

// NOTE: if the resource is in a dependency mod, check whether database or search path has been specified for it
depName := resource.(modconfig.ModItem).GetMod().GetDependencyName()
depName := resource.(modconfig.ModItem).GetMod().DependencyName

if depName != "" {
// look for this mod in the workspace mod require
modRequirement := workspaceMod.GetRequire().GetModDependency(depName)
modRequirement := workspaceMod.Require.GetModDependency(depName)
if modRequirement == nil {
// not expected
return database, searchPathConfig, sperr.New("could not find mod requirement for '%s' in workspace mod %s", depName, workspaceMod.ShortName)
Expand Down
2 changes: 1 addition & 1 deletion internal/display/list_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func getListResourceFilter[T modconfig.ModTreeItem](w *workspace.Workspace) work
if viper.GetString(constants.ArgOutput) == constants.OutputFormatPretty || viper.GetString(constants.ArgOutput) == constants.OutputFormatPlain {
// build a lookup of mod names to filter on
var modNames = map[string]struct{}{}
for _, mod := range w.GetMods() {
for _, mod := range w.Mods {
modNames[mod.Name()] = struct{}{}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/initialisation/init_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func validateModRequirementsRecursively(mod *modconfig.Mod, client *db_client.Db

// validate dependent mods
for childDependencyName, childMod := range mod.GetModResources().GetMods() {
if childDependencyName == "local" || mod.GetDependencyName() == childMod.GetDependencyName() {
if childDependencyName == "local" || mod.DependencyName == childMod.DependencyName {
// this is a reference to self - skip (otherwise we will end up with a recursion loop)
continue
}
Expand Down
6 changes: 3 additions & 3 deletions internal/workspace/resource_from_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ func ResolveResourceAndArgsFromSQLString[T modconfig.ModTreeItem](sqlString stri
// so we failed to resolve the resource from the input string
// check whether it _looks_ like a resource name (i.e. mod.type.name OR type.name)
if name, looksLikeResource := SqlLooksLikeExecutableResource(sqlString); looksLikeResource {
return empty, nil, fmt.Errorf("'%s' not found in %s (%s)", name, w.GetMod().Name(), w.GetPath())
return empty, nil, fmt.Errorf("'%s' not found in %s (%s)", name, w.Mod.Name(), w.Path)
}
switch any(empty).(type) {
case *resources.Query:
// if the desired type is a query, and the sqlString DOES NOT look like a resource name,
// treat it as a raw query and create a Query to wrap it
q := createQueryResourceForCommandLineQuery(sqlString, w.GetMod())
q := createQueryResourceForCommandLineQuery(sqlString, w.Mod)

// add to the workspace mod so the dashboard execution code can find it
if err := w.GetMod().AddResource(q); err != nil {
if err := w.Mod.AddResource(q); err != nil {
return empty, nil, err
}

Expand Down

0 comments on commit 07db4a6

Please sign in to comment.