diff --git a/go.mod b/go.mod index 3858d99..47e9e70 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,10 @@ module github.com/jedib0t/go-pretty/v6 go 1.13 require ( - github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 // indirect - github.com/go-openapi/errors v0.19.0 // indirect - github.com/go-openapi/strfmt v0.19.0 - github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/mattn/go-runewidth v0.0.9 github.com/pkg/profile v1.2.1 + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/testify v1.2.2 golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c ) diff --git a/go.sum b/go.sum index d8a332b..68b74a3 100644 --- a/go.sum +++ b/go.sum @@ -1,31 +1,7 @@ -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco= -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.19.0 h1:guf3T2lnCBKlODmERt4T9GtMWRpJOikgKGyIvi0xcb8= -github.com/go-openapi/errors v0.19.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/strfmt v0.19.0 h1:0Dn9qy1G9+UJfRU7TR8bmdGxb4uifB7HNrJjOnV0yPk= -github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983 h1:wL11wNW7dhKIcRCHSm4sHKPWz0tt4mwBsVodG7+Xyqg= -github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/pkg/profile v1.2.1 h1:F++O52m40owAmADcojzM+9gyjmMOY/T4oYJkgFDH8RE= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -34,5 +10,3 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c h1:uHnKXcvx6SNkuwC+nrzxkJ+TpPwZOtumbhWrrOYN5YA= golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/text/transformer.go b/text/transformer.go index e54b34a..5056358 100644 --- a/text/transformer.go +++ b/text/transformer.go @@ -7,8 +7,6 @@ import ( "strconv" "strings" "time" - - "github.com/go-openapi/strfmt" ) // Transformer related constants @@ -119,8 +117,8 @@ func NewJSONTransformer(prefix string, indent string) Transformer { } // NewTimeTransformer returns a Transformer that can format a timestamp (a -// time.Time or strfmt.DateTime object) into a well-defined time format defined -// using the provided layout (ex.: time.RFC3339). +// time.Time) into a well-defined time format defined using the provided layout +// (ex.: time.RFC3339). // // If a non-nil location value is provided, the time will be localized to that // location (use time.Local to get localized timestamps). @@ -138,9 +136,7 @@ func NewTimeTransformer(layout string, location *time.Location) Transformer { } rsp := fmt.Sprint(val) - if valDate, ok := val.(strfmt.DateTime); ok { - rsp = formatTime(time.Time(valDate)) - } else if valTime, ok := val.(time.Time); ok { + if valTime, ok := val.(time.Time); ok { rsp = formatTime(valTime) } else if valStr, ok := val.(string); ok { if valTime, err := time.Parse(time.RFC3339, valStr); err == nil { diff --git a/text/transformer_test.go b/text/transformer_test.go index eaee8ec..e9bec90 100644 --- a/text/transformer_test.go +++ b/text/transformer_test.go @@ -7,7 +7,6 @@ import ( "testing" "time" - "github.com/go-openapi/strfmt" "github.com/stretchr/testify/assert" ) @@ -143,7 +142,6 @@ func TestNewTimeTransformer(t *testing.T) { inStr := "2010-11-12T13:14:15-07:00" inTime, err := time.Parse(time.RFC3339, inStr) assert.Nil(t, err) - inDateTime := strfmt.DateTime(inTime) location, err := time.LoadLocation("America/Los_Angeles") assert.Nil(t, err) @@ -151,7 +149,6 @@ func TestNewTimeTransformer(t *testing.T) { expected := "2010-11-12T12:14:15-08:00" assert.Equal(t, expected, transformer(inStr)) assert.Equal(t, expected, transformer(inTime)) - assert.Equal(t, expected, transformer(inDateTime)) location, err = time.LoadLocation("Asia/Singapore") assert.Nil(t, err) @@ -159,7 +156,6 @@ func TestNewTimeTransformer(t *testing.T) { expected = "Sat Nov 13 04:14:15 +08 2010" assert.Equal(t, expected, transformer(inStr)) assert.Equal(t, expected, transformer(inTime)) - assert.Equal(t, expected, transformer(inDateTime)) location, err = time.LoadLocation("Europe/London") assert.Nil(t, err) @@ -167,7 +163,6 @@ func TestNewTimeTransformer(t *testing.T) { expected = "2010-11-12T20:14:15Z" assert.Equal(t, expected, transformer(inStr)) assert.Equal(t, expected, transformer(inTime)) - assert.Equal(t, expected, transformer(inDateTime)) } func TestNewUnixTimeTransformer(t *testing.T) {