dolt/go: store/types/format: Respond to PR feedback.

This commit is contained in:
Aaron Son
2019-07-22 16:05:52 -07:00
parent 0d68c7adb1
commit bb452b36b0
2 changed files with 26 additions and 16 deletions
+13 -1
View File
@@ -5,10 +5,22 @@
// Package constants collects common constants used in Noms, such as the Noms data format version.
package constants
import "os"
func init() {
nbfVerStr := os.Getenv("DOLT_DEFAULT_BIN_FORMAT")
if nbfVerStr != "" {
FormatDefaultString = nbfVerStr
}
}
const NomsVersion = "7.18"
var NomsGitSHA = "<developer build>"
// See //go/store/types/format.go for corresponding formats.
const Format718String = "7.18"
const FormatLD1String = "__LD_1__"
const FormatDefaultString = "7.18"
var FormatDefaultString = Format718String
+13 -15
View File
@@ -1,8 +1,18 @@
package types
import "errors"
import "os"
import "github.com/liquidata-inc/ld/dolt/go/store/constants"
import (
"errors"
"github.com/liquidata-inc/ld/dolt/go/store/constants"
)
func init() {
nbf, err := GetFormatForVersionString(constants.FormatDefaultString)
if err != nil {
panic("unrecognized value for DOLT_DEFAULT_BIN_FORMAT " + constants.FormatDefaultString)
}
Format_Default = nbf
}
type NomsBinFormat struct {
tag *formatTag
@@ -41,15 +51,3 @@ func (nbf *NomsBinFormat) VersionString() string {
panic("unrecognized NomsBinFormat tag value")
}
}
func init() {
nbfVerStr := os.Getenv("DOLT_DEFAULT_BIN_FORMAT")
if nbfVerStr == "" {
nbfVerStr = constants.FormatDefaultString
}
nbf, err := GetFormatForVersionString(nbfVerStr)
if err != nil {
panic("unrecognized value for DOLT_DEFAULT_BIN_FORMAT " + nbfVerStr)
}
Format_Default = nbf
}