diff --git a/cli/download_source.go b/cli/download_source.go index b4274bebb..07a9a6472 100644 --- a/cli/download_source.go +++ b/cli/download_source.go @@ -141,25 +141,25 @@ func writeVersionFile(terraformSource *TerraformSource) error { // To maximize reuse, given a working directory w and a source URL s, we download code from S into the folder /T/W/H // where: // -// 1. S is the part of s before the double-slash (//). This typically represents the root of the repo (e.g. -// github.com/foo/infrastructure-modules). We download the entire repo so that relative paths to other files in that -// repo resolve correctly. If no double-slash is specified, all of s is used. -// 1. T is the OS temp dir (e.g. /tmp). -// 2. W is the base 64 encoded sha1 hash of w. This ensures that if you are running Terragrunt concurrently in -// multiple folders (e.g. during automated tests), then even if those folders are using the same source URL s, they -// do not overwrite each other. -// 3. H is the base 64 encoded sha1 of S without its query string. For remote source URLs (e.g. Git -// URLs), this is based on the assumption that the scheme/host/path of the URL (e.g. git::github.com/foo/bar) -// identifies the repo, and we always want to download the same repo into the same folder (see the encodeSourceName -// method). We also assume the version of the module is stored in the query string (e.g. ref=v0.0.3), so we store -// the base 64 encoded sha1 of the query string in a file called .terragrunt-source-version within /T/W/H. +// 1. S is the part of s before the double-slash (//). This typically represents the root of the repo (e.g. +// github.com/foo/infrastructure-modules). We download the entire repo so that relative paths to other files in that +// repo resolve correctly. If no double-slash is specified, all of s is used. +// 1. T is the OS temp dir (e.g. /tmp). +// 2. W is the base 64 encoded sha1 hash of w. This ensures that if you are running Terragrunt concurrently in +// multiple folders (e.g. during automated tests), then even if those folders are using the same source URL s, they +// do not overwrite each other. +// 3. H is the base 64 encoded sha1 of S without its query string. For remote source URLs (e.g. Git +// URLs), this is based on the assumption that the scheme/host/path of the URL (e.g. git::github.com/foo/bar) +// identifies the repo, and we always want to download the same repo into the same folder (see the encodeSourceName +// method). We also assume the version of the module is stored in the query string (e.g. ref=v0.0.3), so we store +// the base 64 encoded sha1 of the query string in a file called .terragrunt-source-version within /T/W/H. // // The downloadTerraformSourceIfNecessary decides when we should download the Terraform code and when not to. It uses // the following rules: // -// 1. Always download source URLs pointing to local file paths. -// 2. Only download source URLs pointing to remote paths if /T/W/H doesn't already exist or, if it does exist, if the -// version number in /T/W/H/.terragrunt-source-version doesn't match the current version. +// 1. Always download source URLs pointing to local file paths. +// 2. Only download source URLs pointing to remote paths if /T/W/H doesn't already exist or, if it does exist, if the +// version number in /T/W/H/.terragrunt-source-version doesn't match the current version. func processTerraformSource(source string, terragruntOptions *options.TerragruntOptions) (*TerraformSource, error) { canonicalWorkingDir, err := util.CanonicalPath(terragruntOptions.WorkingDir, "") if err != nil { diff --git a/config/config_helpers.go b/config/config_helpers.go index 4cf667fd8..f19b78167 100644 --- a/config/config_helpers.go +++ b/config/config_helpers.go @@ -217,7 +217,8 @@ func (ctx *resolveContext) getParentDir() (string, error) { } // Returns the named environment variable or default value if it does not exist -// get_env(variable_name, default_value) +// +// get_env(variable_name, default_value) func (ctx *resolveContext) getEnvironmentVariable(env, defValue string) string { if value, exists := ctx.options.Env[env]; exists { return value diff --git a/configstack/running_module.go b/configstack/running_module.go index 04b32aab8..da62d229f 100644 --- a/configstack/running_module.go +++ b/configstack/running_module.go @@ -161,9 +161,9 @@ func toRunningModules(modules []*TerraformModule, dependencyOrder dependencyOrde // Loop through the map of runningModules and for each module M: // -// * If dependencyOrder is NormalOrder, plug in all the modules M depends on into the Dependencies field and all the -// modules that depend on M into the NotifyWhenDone field. -// * If dependencyOrder is ReverseOrder, do the reverse. +// - If dependencyOrder is NormalOrder, plug in all the modules M depends on into the Dependencies field and all the +// modules that depend on M into the NotifyWhenDone field. +// - If dependencyOrder is ReverseOrder, do the reverse. func crossLinkDependencies(modules map[string]*runningModule, dependencyOrder dependencyOrder) (map[string]*runningModule, error) { for _, module := range modules { for _, dependency := range module.Module.Dependencies { diff --git a/util/collections.go b/util/collections.go index fda1c9aa3..30243ed82 100644 --- a/util/collections.go +++ b/util/collections.go @@ -44,9 +44,10 @@ func RemoveDuplicatesFromListKeepLast(list []string) []string { // RemoveDuplicatesFromList returns a copy of the given list with all duplicates removed (keeping the last encountereds) // Params: -// list: The list to filter -// keepLast: Indicates whether the last or first encountered duplicate element should be kept -// getKey: Function used to extract the actual key from the string +// +// list: The list to filter +// keepLast: Indicates whether the last or first encountered duplicate element should be kept +// getKey: Function used to extract the actual key from the string func RemoveDuplicatesFromList(list []string, keepLast bool, getKey func(key string) string) []string { out := make([]string, 0, len(list)) present := make(map[string]bool) diff --git a/util/random.go b/util/random.go index ea92172d8..3afd92045 100644 --- a/util/random.go +++ b/util/random.go @@ -6,7 +6,9 @@ import ( ) // GetRandomTime returns random time duration between the lower bound and upper bound. This is useful because some of our -// automated tests wound up flooding the AWS API all at once, leading to a "Subscriber limit exceeded" error. +// +// automated tests wound up flooding the AWS API all at once, leading to a "Subscriber limit exceeded" error. +// // TODO: Some of the more exotic test cases fail, but it's not worth catching them given the intended use of this function. func GetRandomTime(lowerBound, upperBound time.Duration) time.Duration { if lowerBound < 0 {