From c1c5dfa855fefacbfeb147c493452e307b7c0e3f Mon Sep 17 00:00:00 2001 From: Drew Stinnett Date: Sat, 17 Feb 2024 10:23:15 -0500 Subject: [PATCH] Removing a couple builtins --- formats/csv/csv.go | 11 ----------- formats/csv/csv_test.go | 20 -------------------- formats/toml/toml.go | 11 ----------- formats/toml/toml_test.go | 19 ------------------- 4 files changed, 61 deletions(-) delete mode 100644 formats/csv/csv.go delete mode 100644 formats/csv/csv_test.go delete mode 100644 formats/toml/toml.go delete mode 100644 formats/toml/toml_test.go diff --git a/formats/csv/csv.go b/formats/csv/csv.go deleted file mode 100644 index fcc91c7..0000000 --- a/formats/csv/csv.go +++ /dev/null @@ -1,11 +0,0 @@ -package csv - -import ( - "github.com/jszwec/csvutil" -) - -type Formatter struct{} - -func (w Formatter) Format(v interface{}) ([]byte, error) { - return csvutil.Marshal(v) -} diff --git a/formats/csv/csv_test.go b/formats/csv/csv_test.go deleted file mode 100644 index 4ed20c8..0000000 --- a/formats/csv/csv_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package csv - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestCSVFormatter(t *testing.T) { - f := Formatter{} - got, err := f.Format([]struct { - Foo string - }{ - {Foo: "bar"}, - {Foo: "baz"}, - }) - require.NoError(t, err) - require.IsType(t, []byte{}, got) - require.Equal(t, string("Foo\nbar\nbaz\n"), string(got)) -} diff --git a/formats/toml/toml.go b/formats/toml/toml.go deleted file mode 100644 index 02fcd1d..0000000 --- a/formats/toml/toml.go +++ /dev/null @@ -1,11 +0,0 @@ -package toml - -import ( - utoml "github.com/pelletier/go-toml/v2" -) - -type Formatter struct{} - -func (w Formatter) Format(v interface{}) ([]byte, error) { - return utoml.Marshal(v) -} diff --git a/formats/toml/toml_test.go b/formats/toml/toml_test.go deleted file mode 100644 index 16ba6da..0000000 --- a/formats/toml/toml_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package toml - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestTOMLFormatter(t *testing.T) { - f := Formatter{} - got, err := f.Format(struct { - Foo string - }{ - Foo: "bar", - }) - require.NoError(t, err) - require.IsType(t, []byte{}, got) - require.Equal(t, string("Foo = 'bar'\n"), string(got)) -}