Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Nov 8, 2024
1 parent f3df2ea commit 7e235c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions flyteidl/clients/go/coreutils/extract_literal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions flyteidl/clients/go/coreutils/literals.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions flyteidl/clients/go/coreutils/literals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package coreutils

import (
"fmt"
"github.com/shamaton/msgpack/v2"
"os"
"reflect"
"strconv"
Expand All @@ -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"
Expand Down Expand Up @@ -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",
Expand All @@ -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) {
Expand Down

0 comments on commit 7e235c0

Please sign in to comment.