diff --git a/flyteidl/clients/go/coreutils/extract_literal_test.go b/flyteidl/clients/go/coreutils/extract_literal_test.go index 44c7cbddda..0cd4c2fb16 100644 --- a/flyteidl/clients/go/coreutils/extract_literal_test.go +++ b/flyteidl/clients/go/coreutils/extract_literal_test.go @@ -126,7 +126,7 @@ func TestFetchLiteral(t *testing.T) { }) t.Run("Generic", func(t *testing.T) { - os.Setenv("FLYTE_USE_OLD_DC_FORMAT", "true") + os.Setenv(FlyteUseOldDcFormat, "true") literalVal := map[string]interface{}{ "x": 1, "y": "ystringvalue", @@ -152,7 +152,7 @@ func TestFetchLiteral(t *testing.T) { for key, val := range expectedStructVal.Fields { assert.Equal(t, val.Kind, extractedStructValue.Fields[key].Kind) } - os.Unsetenv("FLYTE_USE_OLD_DC_FORMAT") + os.Unsetenv(FlyteUseOldDcFormat) }) t.Run("Generic Passed As String", func(t *testing.T) { diff --git a/flyteidl/clients/go/coreutils/literals.go b/flyteidl/clients/go/coreutils/literals.go index a448a19b92..6f292d7118 100644 --- a/flyteidl/clients/go/coreutils/literals.go +++ b/flyteidl/clients/go/coreutils/literals.go @@ -22,7 +22,7 @@ import ( ) const MESSAGEPACK = "msgpack" -const FLYTE_USE_OLD_DC_FORMAT = "FLYTE_USE_OLD_DC_FORMAT" +const FlyteUseOldDcFormat = "FLYTE_USE_OLD_DC_FORMAT" func MakePrimitive(v interface{}) (*core.Primitive, error) { switch p := v.(type) { @@ -565,7 +565,7 @@ func MakeLiteralForType(t *core.LiteralType, v interface{}) (*core.Literal, erro strValue = fmt.Sprintf("%.0f", math.Trunc(f)) } if newT.Simple == core.SimpleType_STRUCT { - useOldFormat := strings.ToLower(os.Getenv(FLYTE_USE_OLD_DC_FORMAT)) + useOldFormat := strings.ToLower(os.Getenv(FlyteUseOldDcFormat)) if _, isValueStringType := v.(string); !isValueStringType { if useOldFormat == "1" || useOldFormat == "t" || useOldFormat == "true" { byteValue, err := json.Marshal(v) diff --git a/flyteidl/clients/go/coreutils/literals_test.go b/flyteidl/clients/go/coreutils/literals_test.go index 6c9edff624..f2d8c9e5b2 100644 --- a/flyteidl/clients/go/coreutils/literals_test.go +++ b/flyteidl/clients/go/coreutils/literals_test.go @@ -5,7 +5,6 @@ package coreutils import ( "fmt" - "github.com/shamaton/msgpack/v2" "os" "reflect" "strconv" @@ -16,6 +15,7 @@ import ( "github.com/golang/protobuf/ptypes" structpb "github.com/golang/protobuf/ptypes/struct" "github.com/pkg/errors" + "github.com/shamaton/msgpack/v2" "github.com/stretchr/testify/assert" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" @@ -457,7 +457,7 @@ func TestMakeLiteralForType(t *testing.T) { }) t.Run("Generic", func(t *testing.T) { - os.Setenv("FLYTE_USE_OLD_DC_FORMAT", "true") + os.Setenv(FlyteUseOldDcFormat, "true") literalVal := map[string]interface{}{ "x": 1, "y": "ystringvalue", @@ -483,7 +483,7 @@ func TestMakeLiteralForType(t *testing.T) { for key, val := range expectedStructVal.Fields { assert.Equal(t, val.Kind, extractedStructValue.Fields[key].Kind) } - os.Unsetenv("FLYTE_USE_OLD_DC_FORMAT") + os.Unsetenv(FlyteUseOldDcFormat) }) t.Run("SimpleBinary", func(t *testing.T) {