Skip to content

Commit

Permalink
chore: Adding performance Lint Preset (#3336)
Browse files Browse the repository at this point in the history
* chore: Hiding mocks tests

* fix: Removing terratest log parser

* fix: Moving mocks generation

* fix: Fixing mock tests again

* fix: Still need mockery for unit tests, it seems

* chore: Adding `performance` preset to lints

* chore: Addressing lint errors

* fix: Resolving weird conflict from merge

* fix: Fixing `TestTerragruntProviderCacheMultiplePlatforms` test

* fix: Fixing copy bug in arg optimization
  • Loading branch information
yhakbar committed Aug 13, 2024
1 parent cb78603 commit c818ea4
Show file tree
Hide file tree
Showing 76 changed files with 654 additions and 648 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ linters:
ignored-functions: strconv.Format*,os.*,strconv.Parse*,strings.SplitN,bytes.SplitN
presets:
- bugs
- performance
issues:
exclude-dirs:
- docs
Expand Down
3 changes: 2 additions & 1 deletion aws_helper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package aws_helper
import (
"fmt"
"os"
"strconv"
"time"

"github.com/aws/aws-sdk-go/aws/request"
Expand Down Expand Up @@ -137,7 +138,7 @@ func getWebIdentityCredentialsFromIAMRoleOptions(sess *session.Session, iamRoleO
roleSessionName := iamRoleOptions.AssumeRoleSessionName
if roleSessionName == "" {
// Set a unique session name in the same way it is done in the SDK
roleSessionName = fmt.Sprintf("%d", time.Now().UTC().UnixNano())
roleSessionName = strconv.FormatInt(time.Now().UTC().UnixNano(), 10)
}
svc := sts.New(sess)
p := stscreds.NewWebIdentityRoleProviderWithOptions(svc, iamRoleOptions.RoleARN, roleSessionName, tokenFetcher(iamRoleOptions.WebIdentityToken))
Expand Down
21 changes: 10 additions & 11 deletions cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cli

import (
"bytes"
"fmt"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -80,8 +79,8 @@ func TestParseTerragruntOptionsFromArgs(t *testing.T) {
},

{
[]string{doubleDashed(commands.TerragruntConfigFlagName), fmt.Sprintf("/some/path/%s", config.DefaultTerragruntConfigPath)},
mockOptions(t, fmt.Sprintf("/some/path/%s", config.DefaultTerragruntConfigPath), workingDir, []string{}, false, "", false, false, defaultLogLevel, false),
[]string{doubleDashed(commands.TerragruntConfigFlagName), "/some/path/" + config.DefaultTerragruntConfigPath},
mockOptions(t, "/some/path/"+config.DefaultTerragruntConfigPath, workingDir, []string{}, false, "", false, false, defaultLogLevel, false),
nil,
},

Expand Down Expand Up @@ -140,14 +139,14 @@ func TestParseTerragruntOptionsFromArgs(t *testing.T) {
},

{
[]string{doubleDashed(commands.TerragruntConfigFlagName), fmt.Sprintf("/some/path/%s", config.DefaultTerragruntConfigPath), "--terragrunt-non-interactive"},
mockOptions(t, fmt.Sprintf("/some/path/%s", config.DefaultTerragruntConfigPath), workingDir, []string{}, true, "", false, false, defaultLogLevel, false),
[]string{doubleDashed(commands.TerragruntConfigFlagName), "/some/path/" + config.DefaultTerragruntConfigPath, "--terragrunt-non-interactive"},
mockOptions(t, "/some/path/"+config.DefaultTerragruntConfigPath, workingDir, []string{}, true, "", false, false, defaultLogLevel, false),
nil,
},

{
[]string{"--foo", doubleDashed(commands.TerragruntConfigFlagName), fmt.Sprintf("/some/path/%s", config.DefaultTerragruntConfigPath), "bar", doubleDashed(commands.TerragruntNonInteractiveFlagName), "--baz", doubleDashed(commands.TerragruntWorkingDirFlagName), "/some/path", doubleDashed(commands.TerragruntSourceFlagName), "github.com/foo/bar//baz?ref=1.0.3"},
mockOptions(t, fmt.Sprintf("/some/path/%s", config.DefaultTerragruntConfigPath), "/some/path", []string{"-foo", "bar", "-baz"}, true, "github.com/foo/bar//baz?ref=1.0.3", false, false, defaultLogLevel, false),
[]string{"--foo", doubleDashed(commands.TerragruntConfigFlagName), "/some/path/" + config.DefaultTerragruntConfigPath, "bar", doubleDashed(commands.TerragruntNonInteractiveFlagName), "--baz", doubleDashed(commands.TerragruntWorkingDirFlagName), "/some/path", doubleDashed(commands.TerragruntSourceFlagName), "github.com/foo/bar//baz?ref=1.0.3"},
mockOptions(t, "/some/path/"+config.DefaultTerragruntConfigPath, "/some/path", []string{"-foo", "bar", "-baz"}, true, "github.com/foo/bar//baz?ref=1.0.3", false, false, defaultLogLevel, false),
nil,
},

Expand Down Expand Up @@ -282,10 +281,10 @@ func TestFilterTerragruntArgs(t *testing.T) {
}{
{[]string{}, []string{}},
{[]string{"foo", "--bar"}, []string{"foo", "-bar"}},
{[]string{"foo", doubleDashed(commands.TerragruntConfigFlagName), fmt.Sprintf("/some/path/%s", config.DefaultTerragruntConfigPath)}, []string{"foo"}},
{[]string{"foo", doubleDashed(commands.TerragruntConfigFlagName), "/some/path/" + config.DefaultTerragruntConfigPath}, []string{"foo"}},
{[]string{"foo", doubleDashed(commands.TerragruntNonInteractiveFlagName)}, []string{"foo"}},
{[]string{"foo", doubleDashed(commands.TerragruntDebugFlagName)}, []string{"foo"}},
{[]string{"foo", doubleDashed(commands.TerragruntNonInteractiveFlagName), "-bar", doubleDashed(commands.TerragruntWorkingDirFlagName), "/some/path", "--baz", doubleDashed(commands.TerragruntConfigFlagName), fmt.Sprintf("/some/path/%s", config.DefaultTerragruntConfigPath)}, []string{"foo", "-bar", "-baz"}},
{[]string{"foo", doubleDashed(commands.TerragruntNonInteractiveFlagName), "-bar", doubleDashed(commands.TerragruntWorkingDirFlagName), "/some/path", "--baz", doubleDashed(commands.TerragruntConfigFlagName), "/some/path/" + config.DefaultTerragruntConfigPath}, []string{"foo", "-bar", "-baz"}},
{[]string{CommandNameApplyAll, "foo", "bar"}, []string{terraform.CommandNameApply, "foo", "bar"}},
{[]string{CommandNameDestroyAll, "foo", "-foo", "--bar"}, []string{terraform.CommandNameDestroy, "foo", "-foo", "-bar"}},
}
Expand Down Expand Up @@ -486,13 +485,13 @@ func runAppTest(args []string, opts *options.TerragruntOptions) (*options.Terrag
}

func doubleDashed(name string) string {
return fmt.Sprintf("--%s", name)
return "--" + name
}

type argMissingValueError string

func (err argMissingValueError) Error() string {
return fmt.Sprintf("flag needs an argument: -%s", string(err))
return "flag needs an argument: -" + string(err)
}

func TestAutocomplete(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions cli/commands/aws-provider-patch/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ package awsproviderpatch
import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -142,7 +141,7 @@ func findAllTerraformFilesInModules(opts *options.TerragruntOptions) ([]string,
// Ideally, we'd use a builtin Go library like filepath.Glob here, but per https://github.com/golang/go/issues/11862,
// the current go implementation doesn't support treating ** as zero or more directories, just zero or one.
// So we use a third-party library.
matches, err := zglob.Glob(fmt.Sprintf("%s/**/*.tf", moduleAbsPath))
matches, err := zglob.Glob(moduleAbsPath + "/**/*.tf")
if err != nil {
return nil, errors.WithStackTrace(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/catalog/tui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type model struct {

func newModel(modules module.Modules, opts *options.TerragruntOptions) model {
var (
items []list.Item
items = make([]list.Item, 0, len(modules))
listKeys = newListKeyMap()
delegateKeys = newDelegateKeyMap()
pagerKeys = newPagerKeyMap()
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/catalog/tui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit

case rendererErrMsg:
m.viewport.SetContent(fmt.Sprintf("there was an error rendering markdown: %s", msg.err.Error()))
m.viewport.SetContent("there was an error rendering markdown: " + msg.err.Error())
// ensure we show the viewport
m.state = pagerState
}
Expand Down
4 changes: 2 additions & 2 deletions cli/commands/graph/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package graph

import (
"context"
"fmt"
"errors"

runall "github.com/gruntwork-io/terragrunt/cli/commands/run-all"

Expand All @@ -23,7 +23,7 @@ func Run(ctx context.Context, opts *options.TerragruntOptions) error {

func graph(ctx context.Context, opts *options.TerragruntOptions, cfg *config.TerragruntConfig) error {
if cfg == nil {
return fmt.Errorf("Terragrunt was not able to render the config as json because it received no config. This is almost certainly a bug in Terragrunt. Please open an issue on github.com/gruntwork-io/terragrunt with this message and the contents of your terragrunt.hcl.")
return errors.New("Terragrunt was not able to render the config as json because it received no config. This is almost certainly a bug in Terragrunt. Please open an issue on github.com/gruntwork-io/terragrunt with this message and the contents of your terragrunt.hcl.")
}
// consider root for graph identification passed destroy-graph-root argument
rootDir := opts.GraphRoot
Expand Down
4 changes: 1 addition & 3 deletions cli/commands/output-module-groups/command.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package outputmodulegroups

import (
"fmt"

"github.com/gruntwork-io/terragrunt/options"
"github.com/gruntwork-io/terragrunt/pkg/cli"
)
Expand All @@ -28,7 +26,7 @@ func NewCommand(opts *options.TerragruntOptions) *cli.Command {
func subCommandFunc(cmd string, opts *options.TerragruntOptions) *cli.Command {
return &cli.Command{
Name: cmd,
Usage: fmt.Sprintf("Recursively find terragrunt modules in the current directory tree and output the dependency order as a list of list in JSON for the %s", cmd),
Usage: "Recursively find terragrunt modules in the current directory tree and output the dependency order as a list of list in JSON for the " + cmd,
Action: func(ctx *cli.Context) error {
opts.TerraformCommand = cmd
return Run(ctx, opts.OptionsFromContext(ctx))
Expand Down
4 changes: 2 additions & 2 deletions cli/commands/render-json/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package renderjson
import (
"context"
"encoding/json"
"fmt"
goErrors "errors"
"os"
"path/filepath"

Expand All @@ -33,7 +33,7 @@ func Run(ctx context.Context, opts *options.TerragruntOptions) error {

func runRenderJSON(ctx context.Context, opts *options.TerragruntOptions, cfg *config.TerragruntConfig) error {
if cfg == nil {
return fmt.Errorf("Terragrunt was not able to render the config as json because it received no config. This is almost certainly a bug in Terragrunt. Please open an issue on github.com/gruntwork-io/terragrunt with this message and the contents of your terragrunt.hcl.")
return goErrors.New("Terragrunt was not able to render the config as json because it received no config. This is almost certainly a bug in Terragrunt. Please open an issue on github.com/gruntwork-io/terragrunt with this message and the contents of your terragrunt.hcl.")
}

if !opts.JsonDisableDependentModules {
Expand Down
14 changes: 7 additions & 7 deletions cli/commands/terraform/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func confirmActionWithDependentModules(ctx context.Context, terragruntOptions *o
return false
}
for _, module := range modules {
if _, err := terragruntOptions.ErrWriter.Write([]byte(fmt.Sprintf("%s\n", module.Path))); err != nil {
if _, err := terragruntOptions.ErrWriter.Write([]byte(module.Path + "\n")); err != nil {
terragruntOptions.Logger.Error(err)
return false
}
Expand Down Expand Up @@ -471,13 +471,13 @@ func prepareInitCommand(ctx context.Context, terragruntOptions *options.Terragru

func checkFolderContainsTerraformCode(terragruntOptions *options.TerragruntOptions) error {
files := []string{}
hclFiles, err := zglob.Glob(fmt.Sprintf("%s/**/*.tf", terragruntOptions.WorkingDir))
hclFiles, err := zglob.Glob(terragruntOptions.WorkingDir + "/**/*.tf")
if err != nil {
return errors.WithStackTrace(err)
}
files = append(files, hclFiles...)

jsonFiles, err := zglob.Glob(fmt.Sprintf("%s/**/*.tf.json", terragruntOptions.WorkingDir))
jsonFiles, err := zglob.Glob(terragruntOptions.WorkingDir + "/**/*.tf.json")
if err != nil {
return errors.WithStackTrace(err)
}
Expand All @@ -497,7 +497,7 @@ func checkTerraformCodeDefinesBackend(terragruntOptions *options.TerragruntOptio
return errors.WithStackTrace(err)
}

definesBackend, err := util.Grep(terraformBackendRegexp, fmt.Sprintf("%s/**/*.tf", terragruntOptions.WorkingDir))
definesBackend, err := util.Grep(terraformBackendRegexp, terragruntOptions.WorkingDir+"/**/*.tf")
if err != nil {
return err
}
Expand All @@ -510,7 +510,7 @@ func checkTerraformCodeDefinesBackend(terragruntOptions *options.TerragruntOptio
return errors.WithStackTrace(err)
}

definesJSONBackend, err := util.Grep(terraformJSONBackendRegexp, fmt.Sprintf("%s/**/*.tf.json", terragruntOptions.WorkingDir))
definesJSONBackend, err := util.Grep(terraformJSONBackendRegexp, terragruntOptions.WorkingDir+"/**/*.tf.json")
if err != nil {
return err
}
Expand Down Expand Up @@ -661,7 +661,7 @@ func checkProtectedModule(terragruntOptions *options.TerragruntOptions, terragru
if util.FirstArg(terragruntOptions.TerraformCliArgs) == terraform.CommandNameDestroy {
destroyFlag = true
}
if util.ListContainsElement(terragruntOptions.TerraformCliArgs, fmt.Sprintf("-%s", terraform.CommandNameDestroy)) {
if util.ListContainsElement(terragruntOptions.TerraformCliArgs, "-"+terraform.CommandNameDestroy) {
destroyFlag = true
}
if !destroyFlag {
Expand Down Expand Up @@ -703,7 +703,7 @@ func filterTerraformExtraArgs(terragruntOptions *options.TerragruntOptions, terr
if !skipVars {
varFiles := arg.GetVarFiles(terragruntOptions.Logger)
for _, file := range varFiles {
out = append(out, fmt.Sprintf("-var-file=%s", file))
out = append(out, "-var-file="+file)
}
}
}
Expand Down
15 changes: 7 additions & 8 deletions cli/commands/terraform/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package terraform

import (
"context"
"fmt"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -344,13 +343,13 @@ func TestFilterTerraformExtraArgs(t *testing.T) {
{
mockCmdOptions(t, workingDir, []string{"apply"}),
mockExtraArgs([]string{"--foo", "bar"}, []string{"apply", "plan"}, []string{}, []string{temporaryFile}),
[]string{"--foo", "bar", fmt.Sprintf("-var-file=%s", temporaryFile)},
[]string{"--foo", "bar", "-var-file=" + temporaryFile},
},
// required var file + optional existing var file
{
mockCmdOptions(t, workingDir, []string{"apply"}),
mockExtraArgs([]string{"--foo", "bar"}, []string{"apply", "plan"}, []string{"required.tfvars"}, []string{temporaryFile}),
[]string{"--foo", "bar", "-var-file=required.tfvars", fmt.Sprintf("-var-file=%s", temporaryFile)},
[]string{"--foo", "bar", "-var-file=required.tfvars", "-var-file=" + temporaryFile},
},
// non existing required var file + non existing optional var file
{
Expand All @@ -362,13 +361,13 @@ func TestFilterTerraformExtraArgs(t *testing.T) {
{
mockCmdOptions(t, workingDir, []string{"plan", workingDir}),
mockExtraArgs([]string{"--foo", "bar"}, []string{"plan", "apply"}, []string{"required.tfvars"}, []string{temporaryFile}),
[]string{"--foo", "bar", "-var-file=required.tfvars", fmt.Sprintf("-var-file=%s", temporaryFile)},
[]string{"--foo", "bar", "-var-file=required.tfvars", "-var-file=" + temporaryFile},
},
// apply providing a folder, var files should stay included
{
mockCmdOptions(t, workingDir, []string{"apply", workingDir}),
mockExtraArgs([]string{"--foo", "-var-file=test.tfvars", "-var='key=value'"}, []string{"plan", "apply"}, []string{"required.tfvars"}, []string{temporaryFile}),
[]string{"--foo", "-var-file=test.tfvars", "-var='key=value'", "-var-file=required.tfvars", fmt.Sprintf("-var-file=%s", temporaryFile)},
[]string{"--foo", "-var-file=test.tfvars", "-var='key=value'", "-var-file=required.tfvars", "-var-file=" + temporaryFile},
},
// apply providing a file, no var files included
{
Expand All @@ -381,7 +380,7 @@ func TestFilterTerraformExtraArgs(t *testing.T) {
{
mockCmdOptions(t, workingDir, []string{"apply"}),
mockExtraArgs([]string{"--foo", "-var-file=test.tfvars", "bar", "-var='key=value'", "foo"}, []string{"plan", "apply"}, []string{"required.tfvars"}, []string{temporaryFile}),
[]string{"--foo", "-var-file=test.tfvars", "bar", "-var='key=value'", "foo", "-var-file=required.tfvars", fmt.Sprintf("-var-file=%s", temporaryFile)},
[]string{"--foo", "-var-file=test.tfvars", "bar", "-var='key=value'", "foo", "-var-file=required.tfvars", "-var-file=" + temporaryFile},
},
// apply with some parameters, providing a file => no var files included
{
Expand All @@ -393,7 +392,7 @@ func TestFilterTerraformExtraArgs(t *testing.T) {
{
mockCmdOptions(t, workingDir, []string{"destroy", workingDir}),
mockExtraArgs([]string{"--foo", "-var-file=test.tfvars", "-var='key=value'"}, []string{"plan", "destroy"}, []string{"required.tfvars"}, []string{temporaryFile}),
[]string{"--foo", "-var-file=test.tfvars", "-var='key=value'", "-var-file=required.tfvars", fmt.Sprintf("-var-file=%s", temporaryFile)},
[]string{"--foo", "-var-file=test.tfvars", "-var='key=value'", "-var-file=required.tfvars", "-var-file=" + temporaryFile},
},
// destroy providing a file, no var files included
{
Expand All @@ -406,7 +405,7 @@ func TestFilterTerraformExtraArgs(t *testing.T) {
{
mockCmdOptions(t, workingDir, []string{"destroy"}),
mockExtraArgs([]string{"--foo", "-var-file=test.tfvars", "bar", "-var='key=value'", "foo"}, []string{"plan", "destroy"}, []string{"required.tfvars"}, []string{temporaryFile}),
[]string{"--foo", "-var-file=test.tfvars", "bar", "-var='key=value'", "foo", "-var-file=required.tfvars", fmt.Sprintf("-var-file=%s", temporaryFile)},
[]string{"--foo", "-var-file=test.tfvars", "bar", "-var='key=value'", "foo", "-var-file=required.tfvars", "-var-file=" + temporaryFile},
},
// destroy with some parameters, providing a file => no var files included
{
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/terraform/download_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func alreadyHaveLatestCode(terraformSource *terraform.Source, terragruntOptions
return false, nil
}

tfFiles, err := filepath.Glob(fmt.Sprintf("%s/*.tf", terraformSource.WorkingDir))
tfFiles, err := filepath.Glob(terraformSource.WorkingDir + "/*.tf")
if err != nil {
return false, errors.WithStackTrace(err)
}
Expand Down
12 changes: 6 additions & 6 deletions cli/commands/terraform/download_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
func TestAlreadyHaveLatestCodeLocalFilePathWithNoModifiedFiles(t *testing.T) {
t.Parallel()

canonicalUrl := fmt.Sprintf("file://%s", absPath(t, "../../../test/fixture-download-source/hello-world-local-hash"))
canonicalUrl := "file://" + absPath(t, "../../../test/fixture-download-source/hello-world-local-hash")
downloadDir := tmpDir(t)
defer os.Remove(downloadDir)

Expand All @@ -51,7 +51,7 @@ func TestAlreadyHaveLatestCodeLocalFilePathHashingFailure(t *testing.T) {
t.Parallel()

fixturePath := absPath(t, "../../../test/fixture-download-source/hello-world-local-hash-failed")
canonicalUrl := fmt.Sprintf("file://%s", fixturePath)
canonicalUrl := "file://" + fixturePath
downloadDir := tmpDir(t)
defer os.Remove(downloadDir)

Expand All @@ -78,7 +78,7 @@ func TestAlreadyHaveLatestCodeLocalFilePathHashingFailure(t *testing.T) {
func TestAlreadyHaveLatestCodeLocalFilePathWithHashChanged(t *testing.T) {
t.Parallel()

canonicalUrl := fmt.Sprintf("file://%s", absPath(t, "../../../test/fixture-download-source/hello-world-local-hash"))
canonicalUrl := "file://" + absPath(t, "../../../test/fixture-download-source/hello-world-local-hash")
downloadDir := tmpDir(t)
defer os.Remove(downloadDir)

Expand All @@ -99,7 +99,7 @@ func TestAlreadyHaveLatestCodeLocalFilePathWithHashChanged(t *testing.T) {
func TestAlreadyHaveLatestCodeLocalFilePath(t *testing.T) {
t.Parallel()

canonicalUrl := fmt.Sprintf("file://%s", absPath(t, "../../../test/fixture-download-source/hello-world"))
canonicalUrl := "file://" + absPath(t, "../../../test/fixture-download-source/hello-world")
downloadDir := "does-not-exist"

testAlreadyHaveLatestCode(t, canonicalUrl, downloadDir, false)
Expand Down Expand Up @@ -162,7 +162,7 @@ func TestAlreadyHaveLatestCodeRemoteFilePathDownloadDirExistsWithVersionAndVersi
func TestDownloadTerraformSourceIfNecessaryLocalDirToEmptyDir(t *testing.T) {
t.Parallel()

canonicalUrl := fmt.Sprintf("file://%s", absPath(t, "../../../test/fixture-download-source/hello-world"))
canonicalUrl := "file://" + absPath(t, "../../../test/fixture-download-source/hello-world")
downloadDir := tmpDir(t)
defer os.Remove(downloadDir)

Expand All @@ -172,7 +172,7 @@ func TestDownloadTerraformSourceIfNecessaryLocalDirToEmptyDir(t *testing.T) {
func TestDownloadTerraformSourceIfNecessaryLocalDirToAlreadyDownloadedDir(t *testing.T) {
t.Parallel()

canonicalUrl := fmt.Sprintf("file://%s", absPath(t, "../../../test/fixture-download-source/hello-world"))
canonicalUrl := "file://" + absPath(t, "../../../test/fixture-download-source/hello-world")
downloadDir := tmpDir(t)
defer os.Remove(downloadDir)

Expand Down
2 changes: 1 addition & 1 deletion cli/commands/terraform/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (err BackendNotDefined) Error() string {
type NoTerraformFilesFound string

func (path NoTerraformFilesFound) Error() string {
return fmt.Sprintf("Did not find any Terraform files (*.tf) in %s", string(path))
return "Did not find any Terraform files (*.tf) in " + string(path)
}

type ModuleIsProtected struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/terraform/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func processHooks(ctx context.Context, hooks []config.Hook, terragruntOptions *o
for _, curHook := range hooks {
allPreviousErrors := multierror.Append(previousExecErrors, errorsOccured)
if shouldRunHook(curHook, terragruntOptions, allPreviousErrors) {
err := telemetry.Telemetry(ctx, terragruntOptions, fmt.Sprintf("hook_%s", curHook.Name), map[string]interface{}{
err := telemetry.Telemetry(ctx, terragruntOptions, "hook_"+curHook.Name, map[string]interface{}{
"hook": curHook.Name,
"dir": curHook.WorkingDir,
}, func(childCtx context.Context) error {
Expand Down
Loading

0 comments on commit c818ea4

Please sign in to comment.