mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-24 16:10:46 -06:00
go mod vendor; go mod tidy
This commit is contained in:
parent
210b3aff0a
commit
a8dcd0cab2
2
go.sum
2
go.sum
@ -197,6 +197,8 @@ github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82k
|
||||
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||
github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
|
||||
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
|
||||
github.com/hashicorp/go-slug v0.4.0 h1:YSz3afoEZZJVVB46NITf0+opd2cHpaYJ1XSojOyP0x8=
|
||||
github.com/hashicorp/go-slug v0.4.0/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
|
||||
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 h1:7YOlAIO2YWnJZkQp7B5eFykaIY7C9JndqAFQyVV5BhM=
|
||||
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||
github.com/hashicorp/go-tfe v0.3.25 h1:4rPk/9rSYuRoujKk5FsxSvtC/AjJCQphLS/57yr6wUM=
|
||||
|
8
vendor/github.com/hashicorp/go-slug/README.md
generated
vendored
8
vendor/github.com/hashicorp/go-slug/README.md
generated
vendored
@ -31,7 +31,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"ioutil"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
@ -40,11 +40,11 @@ import (
|
||||
|
||||
func main() {
|
||||
// First create a buffer for storing the slug.
|
||||
slug := bytes.NewBuffer(nil)
|
||||
buf := bytes.NewBuffer(nil)
|
||||
|
||||
// Then call the Pack function with a directory path containing the
|
||||
// configuration files and an io.Writer to write the slug to.
|
||||
if _, err := Pack("testdata/archive-dir", slug); err != nil {
|
||||
if _, err := slug.Pack("testdata/archive-dir", buf, false); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ func main() {
|
||||
// Unpacking a slug is done by calling the Unpack function with an
|
||||
// io.Reader to read the slug from and a directory path of an existing
|
||||
// directory to store the unpacked configuration files.
|
||||
if err := Unpack(slug, dst); err != nil {
|
||||
if err := slug.Unpack(buf, dst); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
1
vendor/github.com/hashicorp/go-slug/slug.go
generated
vendored
1
vendor/github.com/hashicorp/go-slug/slug.go
generated
vendored
@ -154,7 +154,6 @@ func packWalkFn(root, src, dst string, tarW *tar.Writer, meta *Meta, dereference
|
||||
// If the target is a directory we can recurse into the target
|
||||
// directory by calling the packWalkFn with updated arguments.
|
||||
if info.IsDir() {
|
||||
// I'm wondering if this section is unnecessary?
|
||||
return filepath.Walk(target, packWalkFn(root, target, path, tarW, meta, dereference, ignoreRules))
|
||||
}
|
||||
|
||||
|
225
vendor/github.com/hashicorp/go-slug/terraformignore.go
generated
vendored
Normal file
225
vendor/github.com/hashicorp/go-slug/terraformignore.go
generated
vendored
Normal file
@ -0,0 +1,225 @@
|
||||
package slug
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"text/scanner"
|
||||
)
|
||||
|
||||
func parseIgnoreFile(rootPath string) []rule {
|
||||
// Look for .terraformignore at our root path/src
|
||||
file, err := os.Open(filepath.Join(rootPath, ".terraformignore"))
|
||||
defer file.Close()
|
||||
|
||||
// If there's any kind of file error, punt and use the default ignore patterns
|
||||
if err != nil {
|
||||
// Only show the error debug if an error *other* than IsNotExist
|
||||
if !os.IsNotExist(err) {
|
||||
fmt.Fprintf(os.Stderr, "Error reading .terraformignore, default exclusions will apply: %v \n", err)
|
||||
}
|
||||
return defaultExclusions
|
||||
}
|
||||
return readRules(file)
|
||||
}
|
||||
|
||||
func readRules(input io.Reader) []rule {
|
||||
rules := defaultExclusions
|
||||
scanner := bufio.NewScanner(input)
|
||||
scanner.Split(bufio.ScanLines)
|
||||
|
||||
for scanner.Scan() {
|
||||
pattern := scanner.Text()
|
||||
// Ignore blank lines
|
||||
if len(pattern) == 0 {
|
||||
continue
|
||||
}
|
||||
// Trim spaces
|
||||
pattern = strings.TrimSpace(pattern)
|
||||
// Ignore comments
|
||||
if pattern[0] == '#' {
|
||||
continue
|
||||
}
|
||||
// New rule structure
|
||||
rule := rule{}
|
||||
// Exclusions
|
||||
if pattern[0] == '!' {
|
||||
rule.excluded = true
|
||||
pattern = pattern[1:]
|
||||
}
|
||||
// If it is a directory, add ** so we catch descendants
|
||||
if pattern[len(pattern)-1] == os.PathSeparator {
|
||||
pattern = pattern + "**"
|
||||
}
|
||||
// If it starts with /, it is absolute
|
||||
if pattern[0] == os.PathSeparator {
|
||||
pattern = pattern[1:]
|
||||
} else {
|
||||
// Otherwise prepend **/
|
||||
pattern = "**" + string(os.PathSeparator) + pattern
|
||||
}
|
||||
rule.val = pattern
|
||||
rule.dirs = strings.Split(pattern, string(os.PathSeparator))
|
||||
rules = append(rules, rule)
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error reading .terraformignore, default exclusions will apply: %v \n", err)
|
||||
return defaultExclusions
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
func matchIgnoreRule(path string, rules []rule) bool {
|
||||
matched := false
|
||||
path = filepath.FromSlash(path)
|
||||
for _, rule := range rules {
|
||||
match, _ := rule.match(path)
|
||||
|
||||
if match {
|
||||
matched = !rule.excluded
|
||||
}
|
||||
}
|
||||
|
||||
if matched {
|
||||
debug(true, path, "Skipping excluded path:", path)
|
||||
}
|
||||
|
||||
return matched
|
||||
}
|
||||
|
||||
type rule struct {
|
||||
val string // the value of the rule itself
|
||||
excluded bool // ! is present, an exclusion rule
|
||||
dirs []string // directories of the rule
|
||||
regex *regexp.Regexp // regular expression to match for the rule
|
||||
}
|
||||
|
||||
func (r *rule) match(path string) (bool, error) {
|
||||
if r.regex == nil {
|
||||
if err := r.compile(); err != nil {
|
||||
return false, filepath.ErrBadPattern
|
||||
}
|
||||
}
|
||||
|
||||
b := r.regex.MatchString(path)
|
||||
debug(false, path, path, r.regex, b)
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (r *rule) compile() error {
|
||||
regStr := "^"
|
||||
pattern := r.val
|
||||
// Go through the pattern and convert it to a regexp.
|
||||
// Use a scanner to support utf-8 chars.
|
||||
var scan scanner.Scanner
|
||||
scan.Init(strings.NewReader(pattern))
|
||||
|
||||
sl := string(os.PathSeparator)
|
||||
escSL := sl
|
||||
if sl == `\` {
|
||||
escSL += `\`
|
||||
}
|
||||
|
||||
for scan.Peek() != scanner.EOF {
|
||||
ch := scan.Next()
|
||||
if ch == '*' {
|
||||
if scan.Peek() == '*' {
|
||||
// is some flavor of "**"
|
||||
scan.Next()
|
||||
|
||||
// Treat **/ as ** so eat the "/"
|
||||
if string(scan.Peek()) == sl {
|
||||
scan.Next()
|
||||
}
|
||||
|
||||
if scan.Peek() == scanner.EOF {
|
||||
// is "**EOF" - to align with .gitignore just accept all
|
||||
regStr += ".*"
|
||||
} else {
|
||||
// is "**"
|
||||
// Note that this allows for any # of /'s (even 0) because
|
||||
// the .* will eat everything, even /'s
|
||||
regStr += "(.*" + escSL + ")?"
|
||||
}
|
||||
} else {
|
||||
// is "*" so map it to anything but "/"
|
||||
regStr += "[^" + escSL + "]*"
|
||||
}
|
||||
} else if ch == '?' {
|
||||
// "?" is any char except "/"
|
||||
regStr += "[^" + escSL + "]"
|
||||
} else if ch == '.' || ch == '$' {
|
||||
// Escape some regexp special chars that have no meaning
|
||||
// in golang's filepath.Match
|
||||
regStr += `\` + string(ch)
|
||||
} else if ch == '\\' {
|
||||
// escape next char. Note that a trailing \ in the pattern
|
||||
// will be left alone (but need to escape it)
|
||||
if sl == `\` {
|
||||
// On windows map "\" to "\\", meaning an escaped backslash,
|
||||
// and then just continue because filepath.Match on
|
||||
// Windows doesn't allow escaping at all
|
||||
regStr += escSL
|
||||
continue
|
||||
}
|
||||
if scan.Peek() != scanner.EOF {
|
||||
regStr += `\` + string(scan.Next())
|
||||
} else {
|
||||
regStr += `\`
|
||||
}
|
||||
} else {
|
||||
regStr += string(ch)
|
||||
}
|
||||
}
|
||||
|
||||
regStr += "$"
|
||||
re, err := regexp.Compile(regStr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
r.regex = re
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
Default rules as they would appear in .terraformignore:
|
||||
.git/
|
||||
.terraform/
|
||||
!.terraform/modules/
|
||||
*/
|
||||
|
||||
var defaultExclusions = []rule{
|
||||
{
|
||||
val: "**/.git/**",
|
||||
excluded: false,
|
||||
},
|
||||
{
|
||||
val: "**/.terraform/**",
|
||||
excluded: false,
|
||||
},
|
||||
{
|
||||
val: "**/.terraform/modules/**",
|
||||
excluded: true,
|
||||
},
|
||||
}
|
||||
|
||||
func debug(printAll bool, path string, message ...interface{}) {
|
||||
logLevel := os.Getenv("TF_IGNORE") == "trace"
|
||||
debugPath := os.Getenv("TF_IGNORE_DEBUG")
|
||||
isPath := debugPath != ""
|
||||
if isPath {
|
||||
isPath = strings.Contains(path, debugPath)
|
||||
}
|
||||
|
||||
if logLevel {
|
||||
if printAll || isPath {
|
||||
fmt.Println(message...)
|
||||
}
|
||||
}
|
||||
}
|
2
vendor/github.com/hashicorp/go-tfe/go.mod
generated
vendored
2
vendor/github.com/hashicorp/go-tfe/go.mod
generated
vendored
@ -5,7 +5,7 @@ require (
|
||||
github.com/google/go-querystring v1.0.0
|
||||
github.com/hashicorp/go-cleanhttp v0.5.0
|
||||
github.com/hashicorp/go-retryablehttp v0.5.2
|
||||
github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1
|
||||
github.com/hashicorp/go-slug v0.4.0
|
||||
github.com/hashicorp/go-uuid v1.0.1
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d
|
||||
|
8
vendor/github.com/hashicorp/go-tfe/go.sum
generated
vendored
8
vendor/github.com/hashicorp/go-tfe/go.sum
generated
vendored
@ -8,12 +8,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6K
|
||||
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4=
|
||||
github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
||||
github.com/hashicorp/go-slug v0.3.1-0.20191009194302-70074d64c6a1 h1:MY27QJoTm9u5o8KmpruodvlYUFUCcrIjGaH0TIqiDAk=
|
||||
github.com/hashicorp/go-slug v0.3.1-0.20191009194302-70074d64c6a1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
|
||||
github.com/hashicorp/go-slug v0.3.1-0.20191010205338-b03503a77720 h1:TgaHYe8odauiIiJ/vHC/CdKNUBf3CUErDlmgPcRpdSc=
|
||||
github.com/hashicorp/go-slug v0.3.1-0.20191010205338-b03503a77720/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
|
||||
github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1 h1:HOXYrgAVqLyWolTJqE7NktkqoQY0IGY3PJ+YKvbFJs4=
|
||||
github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
|
||||
github.com/hashicorp/go-slug v0.4.0 h1:YSz3afoEZZJVVB46NITf0+opd2cHpaYJ1XSojOyP0x8=
|
||||
github.com/hashicorp/go-slug v0.4.0/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
|
||||
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
|
||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
|
1
vendor/github.com/hashicorp/go-version/constraint.go
generated
vendored
1
vendor/github.com/hashicorp/go-version/constraint.go
generated
vendored
@ -59,6 +59,7 @@ func NewConstraint(v string) (Constraints, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result[i] = c
|
||||
}
|
||||
|
||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -314,9 +314,9 @@ github.com/hashicorp/go-retryablehttp
|
||||
github.com/hashicorp/go-rootcerts
|
||||
# github.com/hashicorp/go-safetemp v1.0.0
|
||||
github.com/hashicorp/go-safetemp
|
||||
# github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1
|
||||
# github.com/hashicorp/go-slug v0.4.0
|
||||
github.com/hashicorp/go-slug
|
||||
# github.com/hashicorp/go-tfe v0.3.25-0.20191014160435-c612f0723085
|
||||
# github.com/hashicorp/go-tfe v0.3.25
|
||||
github.com/hashicorp/go-tfe
|
||||
# github.com/hashicorp/go-uuid v1.0.1
|
||||
github.com/hashicorp/go-uuid
|
||||
|
Loading…
Reference in New Issue
Block a user