github.com/pulumi/terraform@v1.4.0/version/dependencies.go (about) 1 package version 2 3 import "runtime/debug" 4 5 // See the docs for InterestingDependencyVersions to understand what 6 // "interesting" is intended to mean here. We should keep this set relatively 7 // small to avoid bloating the logs too much. 8 var interestingDependencies = map[string]struct{}{ 9 "github.com/hashicorp/hcl/v2": {}, 10 "github.com/zclconf/go-cty": {}, 11 "github.com/hashicorp/go-tfe": {}, 12 "github.com/hashicorp/terraform-config-inspect": {}, 13 "github.com/hashicorp/terraform-svchost": {}, 14 } 15 16 // InterestingDependencies returns the compiled-in module version info for 17 // a small number of dependencies that Terraform uses broadly and which we 18 // tend to upgrade relatively often as part of improvements to Terraform. 19 // 20 // The set of dependencies this reports might change over time if our 21 // opinions change about what's "interesting". This is here only to create 22 // a small number of extra annotations in a debug log to help us more easily 23 // cross-reference bug reports with dependency changelogs. 24 func InterestingDependencies() []*debug.Module { 25 info, ok := debug.ReadBuildInfo() 26 if !ok { 27 // Weird to not be built in module mode, but not a big deal. 28 return nil 29 } 30 31 ret := make([]*debug.Module, 0, len(interestingDependencies)) 32 33 for _, mod := range info.Deps { 34 if _, ok := interestingDependencies[mod.Path]; !ok { 35 continue 36 } 37 if mod.Replace != nil { 38 mod = mod.Replace 39 } 40 ret = append(ret, mod) 41 } 42 43 return ret 44 }