mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 00:41:27 -06:00
f40800b3a4
This is part of a general effort to move all of Terraform's non-library package surface under internal in order to reinforce that these are for internal use within Terraform only. If you were previously importing packages under this prefix into an external codebase, you could pin to an earlier release tag as an interim solution until you've make a plan to achieve the same functionality some other way.
24 lines
697 B
Go
24 lines
697 B
Go
package statefile
|
|
|
|
// looksLikeVersion0 sniffs for the signature indicating a version 0 state
|
|
// file.
|
|
//
|
|
// Version 0 was the number retroactively assigned to Terraform's initial
|
|
// (unversioned) binary state file format, which was later superseded by the
|
|
// version 1 format in JSON.
|
|
//
|
|
// Version 0 is no longer supported, so this is used only to detect it and
|
|
// return a nice error to the user.
|
|
func looksLikeVersion0(src []byte) bool {
|
|
// Version 0 files begin with the magic prefix "tfstate".
|
|
const magic = "tfstate"
|
|
if len(src) < len(magic) {
|
|
// Not even long enough to have the magic prefix
|
|
return false
|
|
}
|
|
if string(src[0:len(magic)]) == magic {
|
|
return true
|
|
}
|
|
return false
|
|
}
|