diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/states/statefile/version0.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/states/statefile/version0.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version0.go b/vendor/github.com/hashicorp/terraform/states/statefile/version0.go new file mode 100644 index 0000000..9b53331 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform/states/statefile/version0.go | |||
@@ -0,0 +1,23 @@ | |||
1 | package statefile | ||
2 | |||
3 | // looksLikeVersion0 sniffs for the signature indicating a version 0 state | ||
4 | // file. | ||
5 | // | ||
6 | // Version 0 was the number retroactively assigned to Terraform's initial | ||
7 | // (unversioned) binary state file format, which was later superseded by the | ||
8 | // version 1 format in JSON. | ||
9 | // | ||
10 | // Version 0 is no longer supported, so this is used only to detect it and | ||
11 | // return a nice error to the user. | ||
12 | func looksLikeVersion0(src []byte) bool { | ||
13 | // Version 0 files begin with the magic prefix "tfstate". | ||
14 | const magic = "tfstate" | ||
15 | if len(src) < len(magic) { | ||
16 | // Not even long enough to have the magic prefix | ||
17 | return false | ||
18 | } | ||
19 | if string(src[0:len(magic)]) == magic { | ||
20 | return true | ||
21 | } | ||
22 | return false | ||
23 | } | ||