implement plan-diff command #1134
reviewdog [golangci] report
reported by reviewdog 🐶
Findings (139)
internal/exec/terraform_utils_test.go|604 col 1| cognitive complexity 28 of func testExecuteTerraformPlanDiff
is high (> 20) (gocognit)
internal/exec/terraform_utils.go|192 col 1| cyclomatic: function compareMapAtoB has cyclomatic complexity 11 (> max enabled 10) (revive)
internal/exec/terraform_utils.go|577 col 1| cyclomatic: function parsePlanDiffArgs has cyclomatic complexity 13 (> max enabled 10) (revive)
internal/exec/terraform_utils.go|791| file-length-limit: file length is 563 lines, which exceeds the limit of 500 (revive)
internal/exec/terraform_utils.go|636 col 1| argument-limit: maximum number of arguments per function exceeded; max 5 but got 6 (revive)
internal/exec/terraform_utils.go|664 col 1| function-result-limit: maximum number of return results per function exceeded; max 2 but got 3 (revive)
internal/exec/terraform_utils.go|62 col 72| add-constant: string literal "file" appears, at least, 4 times, create a named constant for it (revive)
internal/exec/terraform_utils.go|96 col 71| add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
internal/exec/terraform_utils.go|115 col 76| add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
internal/exec/terraform_utils.go|394 col 61| add-constant: string literal " " appears, at least, 4 times, create a named constant for it (revive)
internal/exec/terraform_utils.go|512 col 3| add-constant: string literal "address" appears, at least, 4 times, create a named constant for it (revive)
internal/exec/terraform_utils.go|712 col 42| add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
internal/exec/terraform_utils.go|759 col 11| add-constant: string literal "timestamp" appears, at least, 4 times, create a named constant for it (revive)
internal/exec/terraform_utils.go|604 col 23| do not define dynamic errors, use wrapped static errors instead: "errors.New("--orig flag must be provided with the path to the original plan file")" (err113)
internal/exec/terraform_utils.go|615 col 23| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("original plan file does not exist at path: %s", origPlanPath)" (err113)
internal/exec/terraform_utils.go|628 col 24| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("new plan file does not exist at path: %s", newPlanPath)" (err113)
internal/exec/terraform_utils_test.go|632 col 10| do not define dynamic errors, use wrapped static errors instead: "errors.New("--orig flag must be provided with the path to the original plan file")" (err113)
internal/exec/terraform_utils_test.go|643 col 10| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("original plan file does not exist at path: %s", origPlanPath)" (err113)
internal/exec/terraform_utils_test.go|671 col 11| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("new plan file does not exist at path: %s", newPlanPath)" (err113)
internal/exec/terraform_utils_test.go|1177 col 14| do not define dynamic errors, use wrapped static errors instead: "errors.New("simulated marshal error")" (err113)
internal/exec/terraform_utils.go|227 col 5| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|269 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|271 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|274 col 3| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|285 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|287 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|290 col 3| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|296 col 2| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|297 col 2| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|298 col 2| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|313 col 2| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|314 col 2| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|326 col 4| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|329 col 4| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|348 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|393 col 2| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|397 col 3| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|399 col 3| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|405 col 2| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|409 col 3| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|411 col 3| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|417 col 2| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|423 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|425 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|428 col 3| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|435 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|437 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|440 col 3| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|490 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|495 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|503 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|528 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|533 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|545 col 4| use of fmt.Printf
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|741 col 2| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|742 col 2| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|747 col 3| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils_test.go|724 col 2| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils_test.go|725 col 2| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils_test.go|732 col 3| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils_test.go|734 col 3| use of fmt.Println
forbidden by pattern ^(fmt\.Print(|f|ln)|print|println)$
(forbidigo)
internal/exec/terraform_utils.go|551 col 31| hugeParam: atmosConfig is heavy (5760 bytes); consider passing it by pointer (gocritic)
internal/exec/terraform_utils.go|590 col 3| ifElseChain: rewrite if-else to switch statement (gocritic)
internal/exec/terraform_utils_test.go|926 col 41| hugeParam: tt is heavy (80 bytes); consider passing it by pointer (gocritic)
internal/exec/terraform_utils_test.go|957 col 44| hugeParam: tt is heavy (80 bytes); consider passing it by pointer (gocritic)
internal/exec/terraform_utils_test.go|618 col 3| ifElseChain: rewrite if-else to switch statement (gocritic)
internal/exec/terraform_utils.go|178 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|191 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|236 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|254 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|262 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|278 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|294 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|301 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|311 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|336 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|357 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|375 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|391 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|403 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|415 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|446 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|469 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|483 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|508 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|550 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|576 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|635 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|663 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|698 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|726 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|753 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|763 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|22 col 2| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|195 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|201 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|231 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|244 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|289 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|307 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|315 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|331 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|347 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|354 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|364 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|389 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|410 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|428 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|444 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|456 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|468 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|499 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|522 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|536 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|561 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|603 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|774 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|800 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|872 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|881 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|915 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|925 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|956 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|991 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|1009 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|1022 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|1148 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|1172 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|1175 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils_test.go|1180 col 1| Comment should end in a period (godot)
internal/exec/terraform_utils.go|14 col 2| import "github.com/charmbracelet/log" imported without alias but must be with alias "log" according to config (importas)
internal/exec/terraform_utils_test.go|16 col 2| import "github.com/charmbracelet/log" imported without alias but must be with alias "log" according to config (importas)
internal/exec/terraform_utils_test.go|933 col 2| ineffectual assignment to err (ineffassign)
internal/exec/terraform_utils_test.go|964 col 2| ineffectual assignment to err (ineffassign)
internal/exec/terraform_utils_test.go|1089 col 3| ineffectual assignment to err (ineffassign)
internal/exec/terraform_utils_test.go|1128 col 3| ineffectual assignment to err (ineffassign)
internal/exec/terraform_utils.go|53 col 1| if err == nil
has complex nested blocks (complexity: 4) (nestif)
internal/exec/terraform_utils.go|85 col 1| if atmosConfig.Components.Terraform.AutoGenerateBackendFile
has complex nested blocks (complexity: 5) (nestif)
internal/exec/terraform_utils_test.go|648 col 1| if newPlanFlag == ""
has complex nested blocks (complexity: 4) (nestif)
Filtered Findings (0)
Annotations
Check failure on line 604 in internal/exec/terraform_utils_test.go
github-actions / golangci
[golangci] internal/exec/terraform_utils_test.go#L604
cognitive complexity 28 of func `testExecuteTerraformPlanDiff` is high (> 20) (gocognit)
Raw output
internal/exec/terraform_utils_test.go:604:1: cognitive complexity 28 of func `testExecuteTerraformPlanDiff` is high (> 20) (gocognit)
func testExecuteTerraformPlanDiff(executor *MockExecutor, info schema.ConfigAndStacksInfo, componentPath, varFile, planFile string) error {
^
Check failure on line 192 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L192
cyclomatic: function compareMapAtoB has cyclomatic complexity 11 (> max enabled 10) (revive)
Raw output
internal/exec/terraform_utils.go:192:1: cyclomatic: function compareMapAtoB has cyclomatic complexity 11 (> max enabled 10) (revive)
func compareMapAtoB(a, b map[string]interface{}, path string) bool {
hasDifferences := false
for k, v1 := range a {
currentPath := buildPath(path, k)
v2, exists := b[k]
if !exists {
// Key exists in a but not in b
printRemovedValue(currentPath, v1)
hasDifferences = true
continue
}
// Types are different
if reflect.TypeOf(v1) != reflect.TypeOf(v2) {
printTypeDifference(currentPath, v1, v2)
hasDifferences = true
continue
}
// Handle based on value type
switch val := v1.(type) {
case map[string]interface{}:
if prettyDiff(val, v2.(map[string]interface{}), currentPath) {
hasDifferences = true
}
case []interface{}:
if !reflect.DeepEqual(val, v2) {
if diffArrays(currentPath, val, v2.([]interface{})) {
hasDifferences = true
}
}
default:
if !reflect.DeepEqual(v1, v2) {
fmt.Printf("~ %s: %v => %v\n", currentPath, v1, v2)
hasDifferences = true
}
}
}
return hasDifferences
}
Check failure on line 577 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L577
cyclomatic: function parsePlanDiffArgs has cyclomatic complexity 13 (> max enabled 10) (revive)
Raw output
internal/exec/terraform_utils.go:577:1: cyclomatic: function parsePlanDiffArgs has cyclomatic complexity 13 (> max enabled 10) (revive)
func parsePlanDiffArgs(info schema.ConfigAndStacksInfo, componentPath, planFile string) (string, string, []string, error) {
origPlanFlag := ""
newPlanFlag := ""
var skipNext bool
var additionalPlanArgs []string
// Extract the orig and new plan file paths from the flags and collect other arguments
for i, arg := range info.AdditionalArgsAndFlags {
if skipNext {
skipNext = false
continue
}
if arg == "--orig" && i+1 < len(info.AdditionalArgsAndFlags) {
origPlanFlag = info.AdditionalArgsAndFlags[i+1]
skipNext = true
} else if arg == "--new" && i+1 < len(info.AdditionalArgsAndFlags) {
newPlanFlag = info.AdditionalArgsAndFlags[i+1]
skipNext = true
} else {
// Add any other arguments to be passed to the terraform plan command
additionalPlanArgs = append(additionalPlanArgs, arg)
}
}
// Check if orig flag is provided
if origPlanFlag == "" {
return "", "", nil, errors.New("--orig flag must be provided with the path to the original plan file")
}
// Get the absolute path of the original plan file
origPlanPath := origPlanFlag
if !filepath.IsAbs(origPlanPath) {
origPlanPath = filepath.Join(componentPath, origPlanPath)
}
// Check if orig plan file exists
if _, err := os.Stat(origPlanPath); os.IsNotExist(err) {
return "", "", nil, fmt.Errorf("original plan file does not exist at path: %s", origPlanPath)
}
// Process the new plan path if provided
newPlanPath := ""
if newPlanFlag != "" {
newPlanPath = newPlanFlag
if !filepath.IsAbs(newPlanPath) {
newPlanPath = filepath.Join(componentPath, newPlanPath)
}
// Check if new plan file exists
if _, err := os.Stat(newPlanPath); os.IsNotExist(err) {
return "", "", nil, fmt.Errorf("new plan file does not exist at path: %s", newPlanPath)
}
}
return origPlanPath, newPlanPath, additionalPlanArgs, nil
}
Check failure on line 791 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L791
file-length-limit: file length is 563 lines, which exceeds the limit of 500 (revive)
Raw output
internal/exec/terraform_utils.go:791: file-length-limit: file length is 563 lines, which exceeds the limit of 500 (revive)
Check failure on line 636 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L636
argument-limit: maximum number of arguments per function exceeded; max 5 but got 6 (revive)
Raw output
internal/exec/terraform_utils.go:636:1: argument-limit: maximum number of arguments per function exceeded; max 5 but got 6 (revive)
func generateNewPlan(atmosConfig schema.AtmosConfiguration, info schema.ConfigAndStacksInfo, componentPath, varFile, planFile string, additionalPlanArgs []string) (string, error) {
^
Check failure on line 664 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L664
function-result-limit: maximum number of return results per function exceeded; max 2 but got 3 (revive)
Raw output
internal/exec/terraform_utils.go:664:1: function-result-limit: maximum number of return results per function exceeded; max 2 but got 3 (revive)
func convertPlansToJSON(atmosConfig schema.AtmosConfiguration, info schema.ConfigAndStacksInfo, componentPath, origPlanPath, newPlanPath string) ([]byte, []byte, error) {
^
Check failure on line 62 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L62
add-constant: string literal "file" appears, at least, 4 times, create a named constant for it (revive)
Raw output
internal/exec/terraform_utils.go:62:72: add-constant: string literal "file" appears, at least, 4 times, create a named constant for it (revive)
log.Debug("Terraform environment file not found. No action needed.", "file", filePath)
^
Check failure on line 96 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L96
add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
Raw output
internal/exec/terraform_utils.go:96:71: add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
err = u.WriteToFileAsJSON(backendFileName, componentBackendConfig, 0o600)
^
Check failure on line 115 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L115
add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
Raw output
internal/exec/terraform_utils.go:115:76: add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
err := u.WriteToFileAsJSON(providerOverrideFileName, providerOverrides, 0o600)
^
Check failure on line 394 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L394
add-constant: string literal " " appears, at least, 4 times, create a named constant for it (revive)
Raw output
internal/exec/terraform_utils.go:394:61: add-constant: string literal " " appears, at least, 4 times, create a named constant for it (revive)
resourceBytes, err := json.MarshalIndent(resource, " ", " ")
^
Check failure on line 512 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L512
add-constant: string literal "address" appears, at least, 4 times, create a named constant for it (revive)
Raw output
internal/exec/terraform_utils.go:512:3: add-constant: string literal "address" appears, at least, 4 times, create a named constant for it (revive)
"address": true,
^
Check failure on line 712 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L712
add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
Raw output
internal/exec/terraform_utils.go:712:42: add-constant: avoid magic numbers like '0o600', create a named constant for it (revive)
err = os.WriteFile(outputPath, planOut, 0o600)
^
Check failure on line 759 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L759
add-constant: string literal "timestamp" appears, at least, 4 times, create a named constant for it (revive)
Raw output
internal/exec/terraform_utils.go:759:11: add-constant: string literal "timestamp" appears, at least, 4 times, create a named constant for it (revive)
newPlan["timestamp"] = "TIMESTAMP_IGNORED"
^
Check failure on line 604 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L604
do not define dynamic errors, use wrapped static errors instead: "errors.New(\"--orig flag must be provided with the path to the original plan file\")" (err113)
Raw output
internal/exec/terraform_utils.go:604:23: do not define dynamic errors, use wrapped static errors instead: "errors.New(\"--orig flag must be provided with the path to the original plan file\")" (err113)
return "", "", nil, errors.New("--orig flag must be provided with the path to the original plan file")
^
Check failure on line 615 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L615
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"original plan file does not exist at path: %s\", origPlanPath)" (err113)
Raw output
internal/exec/terraform_utils.go:615:23: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"original plan file does not exist at path: %s\", origPlanPath)" (err113)
return "", "", nil, fmt.Errorf("original plan file does not exist at path: %s", origPlanPath)
^
Check failure on line 628 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L628
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"new plan file does not exist at path: %s\", newPlanPath)" (err113)
Raw output
internal/exec/terraform_utils.go:628:24: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"new plan file does not exist at path: %s\", newPlanPath)" (err113)
return "", "", nil, fmt.Errorf("new plan file does not exist at path: %s", newPlanPath)
^
Check failure on line 632 in internal/exec/terraform_utils_test.go
github-actions / golangci
[golangci] internal/exec/terraform_utils_test.go#L632
do not define dynamic errors, use wrapped static errors instead: "errors.New(\"--orig flag must be provided with the path to the original plan file\")" (err113)
Raw output
internal/exec/terraform_utils_test.go:632:10: do not define dynamic errors, use wrapped static errors instead: "errors.New(\"--orig flag must be provided with the path to the original plan file\")" (err113)
return errors.New("--orig flag must be provided with the path to the original plan file")
^
Check failure on line 643 in internal/exec/terraform_utils_test.go
github-actions / golangci
[golangci] internal/exec/terraform_utils_test.go#L643
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"original plan file does not exist at path: %s\", origPlanPath)" (err113)
Raw output
internal/exec/terraform_utils_test.go:643:10: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"original plan file does not exist at path: %s\", origPlanPath)" (err113)
return fmt.Errorf("original plan file does not exist at path: %s", origPlanPath)
^
Check failure on line 671 in internal/exec/terraform_utils_test.go
github-actions / golangci
[golangci] internal/exec/terraform_utils_test.go#L671
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"new plan file does not exist at path: %s\", newPlanPath)" (err113)
Raw output
internal/exec/terraform_utils_test.go:671:11: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"new plan file does not exist at path: %s\", newPlanPath)" (err113)
return fmt.Errorf("new plan file does not exist at path: %s", newPlanPath)
^
Check failure on line 1177 in internal/exec/terraform_utils_test.go
github-actions / golangci
[golangci] internal/exec/terraform_utils_test.go#L1177
do not define dynamic errors, use wrapped static errors instead: "errors.New(\"simulated marshal error\")" (err113)
Raw output
internal/exec/terraform_utils_test.go:1177:14: do not define dynamic errors, use wrapped static errors instead: "errors.New(\"simulated marshal error\")" (err113)
return nil, errors.New("simulated marshal error")
^
Check failure on line 227 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L227
use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
Raw output
internal/exec/terraform_utils.go:227:5: use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
fmt.Printf("~ %s: %v => %v\n", currentPath, v1, v2)
^
Check failure on line 269 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L269
use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
Raw output
internal/exec/terraform_utils.go:269:4: use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
fmt.Printf("- %s: %v\n", path, v)
^
Check failure on line 271 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L271
use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
Raw output
internal/exec/terraform_utils.go:271:4: use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
fmt.Printf("- %s:\n%s\n", path, string(jsonBytes))
^
Check failure on line 274 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L274
use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
Raw output
internal/exec/terraform_utils.go:274:3: use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
fmt.Printf("- %s: %v\n", path, v)
^
Check failure on line 285 in internal/exec/terraform_utils.go
github-actions / golangci
[golangci] internal/exec/terraform_utils.go#L285
use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
Raw output
internal/exec/terraform_utils.go:285:4: use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
fmt.Printf("+ %s: %v\n", path, v)
^