mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-19 18:12:43 -05:00
Fix issues reported by the 'unused', 'staticcheck', 'gosimple' linters. Closes #1360
This commit is contained in:
18
.golangci.yml
Normal file
18
.golangci.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- deadcode
|
||||
- errcheck
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- typecheck
|
||||
- unused
|
||||
- varcheck
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
skip-dirs:
|
||||
- "tests/acceptance"
|
||||
@@ -58,9 +58,6 @@ type InteractiveClient struct {
|
||||
schemaMetadata *schema.Metadata
|
||||
|
||||
highlighter *Highlighter
|
||||
|
||||
// status update hooks
|
||||
statusHook statushooks.StatusHooks
|
||||
}
|
||||
|
||||
func getHighlighter(theme string) *Highlighter {
|
||||
|
||||
@@ -28,7 +28,6 @@ type PluginManager struct {
|
||||
pb.UnimplementedPluginManagerServer
|
||||
|
||||
Plugins map[string]*runningPlugin
|
||||
configDir string
|
||||
mut sync.Mutex
|
||||
connectionConfig map[string]*pb.ConnectionConfig
|
||||
logger hclog.Logger
|
||||
|
||||
@@ -31,7 +31,7 @@ func Complete(input *CompleterInput) []prompt.Suggest {
|
||||
|
||||
func completerFromArgsOf(cmd string) completer {
|
||||
return func(input *CompleterInput) []prompt.Suggest {
|
||||
metaQueryDefinition, _ := metaQueryDefinitions[cmd]
|
||||
metaQueryDefinition := metaQueryDefinitions[cmd]
|
||||
suggestions := make([]prompt.Suggest, len(metaQueryDefinition.args))
|
||||
for idx, arg := range metaQueryDefinition.args {
|
||||
suggestions[idx] = prompt.Suggest{Text: arg.value, Description: arg.description, Output: arg.value}
|
||||
|
||||
@@ -438,8 +438,8 @@ func TestGetConnectionsToUpdate(t *testing.T) {
|
||||
updates, res := NewConnectionUpdates([]string{"a", "b"})
|
||||
|
||||
if res.Error != nil && test.expected != "ERROR" {
|
||||
continue
|
||||
t.Fatalf("NewConnectionUpdates failed with unexpected error: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
expectedUpdates := test.expected.(*ConnectionUpdates)
|
||||
@@ -521,7 +521,7 @@ func resetConfig(test getConnectionsToUpdateTest) {
|
||||
connectionStatePath := filepaths.ConnectionStatePath()
|
||||
|
||||
os.Remove(connectionStatePath)
|
||||
for i := range test.required {
|
||||
for i := range test.required {
|
||||
os.Remove(connectionConfigPath(i))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,24 +291,25 @@ func decodeParam(block *hcl.Block, runCtx *RunContext, parentName string) (*modc
|
||||
content, diags := block.Body.Content(ParamDefBlockSchema)
|
||||
|
||||
if attr, exists := content.Attributes["description"]; exists {
|
||||
valDiags := gohcl.DecodeExpression(attr.Expr, runCtx.EvalCtx, &def.Description)
|
||||
diags = append(diags, valDiags...)
|
||||
moreDiags := gohcl.DecodeExpression(attr.Expr, runCtx.EvalCtx, &def.Description)
|
||||
diags = append(diags, moreDiags...)
|
||||
}
|
||||
if attr, exists := content.Attributes["default"]; exists {
|
||||
v, diags := attr.Expr.Value(runCtx.EvalCtx)
|
||||
if diags.HasErrors() {
|
||||
return nil, diags
|
||||
}
|
||||
// convert the raw default into a postgres representation
|
||||
if valStr, err := ctyToPostgresString(v); err == nil {
|
||||
def.Default = utils.ToStringPointer(valStr)
|
||||
} else {
|
||||
diags = append(diags, &hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: fmt.Sprintf("%s has invalid parameter config", parentName),
|
||||
Detail: err.Error(),
|
||||
Subject: &attr.Range,
|
||||
})
|
||||
v, moreDiags := attr.Expr.Value(runCtx.EvalCtx)
|
||||
diags = append(diags, moreDiags...)
|
||||
|
||||
if !moreDiags.HasErrors() {
|
||||
// convert the raw default into a postgres representation
|
||||
if valStr, err := ctyToPostgresString(v); err == nil {
|
||||
def.Default = utils.ToStringPointer(valStr)
|
||||
} else {
|
||||
diags = append(diags, &hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: fmt.Sprintf("%s has invalid parameter config", parentName),
|
||||
Detail: err.Error(),
|
||||
Subject: &attr.Range,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return def, diags
|
||||
|
||||
Reference in New Issue
Block a user