diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 15:59:15 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 16:39:21 +0200 |
commit | 863486a6b71ed0e562a3965bed56465d007b1418 (patch) | |
tree | e93f6a687695af86d54237ec9f575d4ef104222d /vendor/github.com/hashicorp/go-getter/checksum.go | |
parent | 49c1c7b4dc69ffb9ab52330e6dc52ccdd6351087 (diff) | |
download | terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.gz terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.zst terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.zip |
update vendor and go.modadd_contact_groups
Diffstat (limited to 'vendor/github.com/hashicorp/go-getter/checksum.go')
-rw-r--r-- | vendor/github.com/hashicorp/go-getter/checksum.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/vendor/github.com/hashicorp/go-getter/checksum.go b/vendor/github.com/hashicorp/go-getter/checksum.go index bea7ed1..eeccfea 100644 --- a/vendor/github.com/hashicorp/go-getter/checksum.go +++ b/vendor/github.com/hashicorp/go-getter/checksum.go | |||
@@ -19,8 +19,8 @@ import ( | |||
19 | urlhelper "github.com/hashicorp/go-getter/helper/url" | 19 | urlhelper "github.com/hashicorp/go-getter/helper/url" |
20 | ) | 20 | ) |
21 | 21 | ||
22 | // fileChecksum helps verifying the checksum for a file. | 22 | // FileChecksum helps verifying the checksum for a file. |
23 | type fileChecksum struct { | 23 | type FileChecksum struct { |
24 | Type string | 24 | Type string |
25 | Hash hash.Hash | 25 | Hash hash.Hash |
26 | Value []byte | 26 | Value []byte |
@@ -50,7 +50,7 @@ func (cerr *ChecksumError) Error() string { | |||
50 | 50 | ||
51 | // checksum is a simple method to compute the checksum of a source file | 51 | // checksum is a simple method to compute the checksum of a source file |
52 | // and compare it to the given expected value. | 52 | // and compare it to the given expected value. |
53 | func (c *fileChecksum) checksum(source string) error { | 53 | func (c *FileChecksum) checksum(source string) error { |
54 | f, err := os.Open(source) | 54 | f, err := os.Open(source) |
55 | if err != nil { | 55 | if err != nil { |
56 | return fmt.Errorf("Failed to open file for checksum: %s", err) | 56 | return fmt.Errorf("Failed to open file for checksum: %s", err) |
@@ -74,7 +74,7 @@ func (c *fileChecksum) checksum(source string) error { | |||
74 | return nil | 74 | return nil |
75 | } | 75 | } |
76 | 76 | ||
77 | // extractChecksum will return a fileChecksum based on the 'checksum' | 77 | // extractChecksum will return a FileChecksum based on the 'checksum' |
78 | // parameter of u. | 78 | // parameter of u. |
79 | // ex: | 79 | // ex: |
80 | // http://hashicorp.com/terraform?checksum=<checksumValue> | 80 | // http://hashicorp.com/terraform?checksum=<checksumValue> |
@@ -93,7 +93,7 @@ func (c *fileChecksum) checksum(source string) error { | |||
93 | // <checksum> *file2 | 93 | // <checksum> *file2 |
94 | // | 94 | // |
95 | // see parseChecksumLine for more detail on checksum file parsing | 95 | // see parseChecksumLine for more detail on checksum file parsing |
96 | func (c *Client) extractChecksum(u *url.URL) (*fileChecksum, error) { | 96 | func (c *Client) extractChecksum(u *url.URL) (*FileChecksum, error) { |
97 | q := u.Query() | 97 | q := u.Query() |
98 | v := q.Get("checksum") | 98 | v := q.Get("checksum") |
99 | 99 | ||
@@ -115,14 +115,14 @@ func (c *Client) extractChecksum(u *url.URL) (*fileChecksum, error) { | |||
115 | 115 | ||
116 | switch checksumType { | 116 | switch checksumType { |
117 | case "file": | 117 | case "file": |
118 | return c.checksumFromFile(checksumValue, u) | 118 | return c.ChecksumFromFile(checksumValue, u) |
119 | default: | 119 | default: |
120 | return newChecksumFromType(checksumType, checksumValue, filepath.Base(u.EscapedPath())) | 120 | return newChecksumFromType(checksumType, checksumValue, filepath.Base(u.EscapedPath())) |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | func newChecksum(checksumValue, filename string) (*fileChecksum, error) { | 124 | func newChecksum(checksumValue, filename string) (*FileChecksum, error) { |
125 | c := &fileChecksum{ | 125 | c := &FileChecksum{ |
126 | Filename: filename, | 126 | Filename: filename, |
127 | } | 127 | } |
128 | var err error | 128 | var err error |
@@ -133,7 +133,7 @@ func newChecksum(checksumValue, filename string) (*fileChecksum, error) { | |||
133 | return c, nil | 133 | return c, nil |
134 | } | 134 | } |
135 | 135 | ||
136 | func newChecksumFromType(checksumType, checksumValue, filename string) (*fileChecksum, error) { | 136 | func newChecksumFromType(checksumType, checksumValue, filename string) (*FileChecksum, error) { |
137 | c, err := newChecksum(checksumValue, filename) | 137 | c, err := newChecksum(checksumValue, filename) |
138 | if err != nil { | 138 | if err != nil { |
139 | return nil, err | 139 | return nil, err |
@@ -157,7 +157,7 @@ func newChecksumFromType(checksumType, checksumValue, filename string) (*fileChe | |||
157 | return c, nil | 157 | return c, nil |
158 | } | 158 | } |
159 | 159 | ||
160 | func newChecksumFromValue(checksumValue, filename string) (*fileChecksum, error) { | 160 | func newChecksumFromValue(checksumValue, filename string) (*FileChecksum, error) { |
161 | c, err := newChecksum(checksumValue, filename) | 161 | c, err := newChecksum(checksumValue, filename) |
162 | if err != nil { | 162 | if err != nil { |
163 | return nil, err | 163 | return nil, err |
@@ -183,14 +183,14 @@ func newChecksumFromValue(checksumValue, filename string) (*fileChecksum, error) | |||
183 | return c, nil | 183 | return c, nil |
184 | } | 184 | } |
185 | 185 | ||
186 | // checksumsFromFile will return all the fileChecksums found in file | 186 | // ChecksumFromFile will return all the FileChecksums found in file |
187 | // | 187 | // |
188 | // checksumsFromFile will try to guess the hashing algorithm based on content | 188 | // ChecksumFromFile will try to guess the hashing algorithm based on content |
189 | // of checksum file | 189 | // of checksum file |
190 | // | 190 | // |
191 | // checksumsFromFile will only return checksums for files that match file | 191 | // ChecksumFromFile will only return checksums for files that match file |
192 | // behind src | 192 | // behind src |
193 | func (c *Client) checksumFromFile(checksumFile string, src *url.URL) (*fileChecksum, error) { | 193 | func (c *Client) ChecksumFromFile(checksumFile string, src *url.URL) (*FileChecksum, error) { |
194 | checksumFileURL, err := urlhelper.Parse(checksumFile) | 194 | checksumFileURL, err := urlhelper.Parse(checksumFile) |
195 | if err != nil { | 195 | if err != nil { |
196 | return nil, err | 196 | return nil, err |
@@ -286,7 +286,7 @@ func (c *Client) checksumFromFile(checksumFile string, src *url.URL) (*fileCheck | |||
286 | // of a line. | 286 | // of a line. |
287 | // for BSD type sums parseChecksumLine guesses the hashing algorithm | 287 | // for BSD type sums parseChecksumLine guesses the hashing algorithm |
288 | // by checking the length of the checksum. | 288 | // by checking the length of the checksum. |
289 | func parseChecksumLine(line string) (*fileChecksum, error) { | 289 | func parseChecksumLine(line string) (*FileChecksum, error) { |
290 | parts := strings.Fields(line) | 290 | parts := strings.Fields(line) |
291 | 291 | ||
292 | switch len(parts) { | 292 | switch len(parts) { |