Repository: TomWright/dasel
Pull request #211 (2022-03-28 12:47:06)

Expose the storage package


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0961fb..f78d751 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 - Nothing yet.
 
+## [v1.24.1] - 2022-03-28
+
+### Changed
+
+- `storage` package has been moved outside the `internal` package.
+
+### Fixed
+
+- New funcs added in `v1.24.0` can now be used as expected since you can now access the `storage.ReadWriteOption`.
+
 ## [v1.24.0] - 2022-03-18
 
 ### Added
@@ -428,7 +438,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 - Everything!
 
-[unreleased]: https://github.com/TomWright/dasel/compare/v1.24.0...HEAD
+[unreleased]: https://github.com/TomWright/dasel/compare/v1.24.1...HEAD
+[v1.24.1]: https://github.com/TomWright/dasel/compare/v1.24.0...v1.24.1
 [v1.24.0]: https://github.com/TomWright/dasel/compare/v1.23.0...v1.24.0
 [v1.23.0]: https://github.com/TomWright/dasel/compare/v1.22.1...v1.23.0
 [v1.22.1]: https://github.com/TomWright/dasel/compare/v1.22.0...v1.22.1
diff --git a/internal/command/delete.go b/internal/command/delete.go
index 268f6e3..b4640c5 100644
--- a/internal/command/delete.go
+++ b/internal/command/delete.go
@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"github.com/spf13/cobra"
 	"github.com/tomwright/dasel"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"io"
 )
 
diff --git a/internal/command/put.go b/internal/command/put.go
index df54b73..cafa443 100644
--- a/internal/command/put.go
+++ b/internal/command/put.go
@@ -6,7 +6,7 @@ import (
 	"fmt"
 	"github.com/spf13/cobra"
 	"github.com/tomwright/dasel"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"io"
 	"os"
 	"strconv"
diff --git a/internal/command/put_document_internal.go b/internal/command/put_document_internal.go
index 0998ee0..a5d9119 100644
--- a/internal/command/put_document_internal.go
+++ b/internal/command/put_document_internal.go
@@ -3,7 +3,7 @@ package command
 import (
 	"fmt"
 	"github.com/spf13/cobra"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"io"
 )
 
diff --git a/internal/command/put_object_internal.go b/internal/command/put_object_internal.go
index 89c8045..500ae4a 100644
--- a/internal/command/put_object_internal.go
+++ b/internal/command/put_object_internal.go
@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"github.com/spf13/cobra"
 	"github.com/tomwright/dasel/internal/oflag"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"io"
 	"strings"
 )
diff --git a/internal/command/select.go b/internal/command/select.go
index c0e773e..b11d273 100644
--- a/internal/command/select.go
+++ b/internal/command/select.go
@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"github.com/spf13/cobra"
 	"github.com/tomwright/dasel"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"io"
 	"reflect"
 )
diff --git a/node.go b/node.go
index 04110a5..b185233 100644
--- a/node.go
+++ b/node.go
@@ -2,12 +2,11 @@ package dasel
 
 import (
 	"fmt"
+	"github.com/tomwright/dasel/storage"
 	"io"
 	"os"
 	"reflect"
 	"regexp"
-
-	"github.com/tomwright/dasel/internal/storage"
 )
 
 // Selector represents the selector for a node.
diff --git a/node_put.go b/node_put.go
index 53c158c..af1c934 100644
--- a/node_put.go
+++ b/node_put.go
@@ -2,7 +2,7 @@ package dasel
 
 import (
 	"fmt"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"reflect"
 )
 


Test patch:
diff --git a/internal/command/put_document_internal_test.go b/internal/command/put_document_internal_test.go
index 6168365..c582a98 100644
--- a/internal/command/put_document_internal_test.go
+++ b/internal/command/put_document_internal_test.go
@@ -2,7 +2,7 @@ package command
 
 import (
 	"errors"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"strings"
 	"testing"
 )
diff --git a/internal/command/put_internal_test.go b/internal/command/put_internal_test.go
index 7588018..c4a4049 100644
--- a/internal/command/put_internal_test.go
+++ b/internal/command/put_internal_test.go
@@ -3,7 +3,7 @@ package command
 import (
 	"bytes"
 	"fmt"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"io"
 	"reflect"
 	"strings"
diff --git a/node_test.go b/node_test.go
index 31e06cf..ab1b831 100644
--- a/node_test.go
+++ b/node_test.go
@@ -5,12 +5,12 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
+	"github.com/tomwright/dasel/storage"
 	"reflect"
 	"strings"
 	"testing"
 
 	"github.com/tomwright/dasel"
-	"github.com/tomwright/dasel/internal/storage"
 )
 
 // ExampleNode_ReadmeExample tests the code from the readme explanation.
diff --git a/internal/storage/colourise.go b/storage/colourise.go
similarity index 100%
rename from internal/storage/colourise.go
rename to storage/colourise.go
diff --git a/internal/storage/csv.go b/storage/csv.go
similarity index 100%
rename from internal/storage/csv.go
rename to storage/csv.go
diff --git a/internal/storage/csv_test.go b/storage/csv_test.go
similarity index 98%
rename from internal/storage/csv_test.go
rename to storage/csv_test.go
index dded6a2..ceac6d3 100644
--- a/internal/storage/csv_test.go
+++ b/storage/csv_test.go
@@ -1,7 +1,7 @@
 package storage_test
 
 import (
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"reflect"
 	"testing"
 )
diff --git a/internal/storage/json.go b/storage/json.go
similarity index 100%
rename from internal/storage/json.go
rename to storage/json.go
diff --git a/internal/storage/json_test.go b/storage/json_test.go
similarity index 98%
rename from internal/storage/json_test.go
rename to storage/json_test.go
index e8b6841..1a801a5 100644
--- a/internal/storage/json_test.go
+++ b/storage/json_test.go
@@ -1,7 +1,7 @@
 package storage_test
 
 import (
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"reflect"
 	"testing"
 )
diff --git a/internal/storage/option.go b/storage/option.go
similarity index 100%
rename from internal/storage/option.go
rename to storage/option.go
diff --git a/internal/storage/parser.go b/storage/parser.go
similarity index 100%
rename from internal/storage/parser.go
rename to storage/parser.go
diff --git a/internal/storage/parser_test.go b/storage/parser_test.go
similarity index 98%
rename from internal/storage/parser_test.go
rename to storage/parser_test.go
index ac28fde..eb66842 100644
--- a/internal/storage/parser_test.go
+++ b/storage/parser_test.go
@@ -3,7 +3,7 @@ package storage_test
 import (
 	"bytes"
 	"errors"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"reflect"
 	"strings"
 	"testing"
@@ -194,7 +194,7 @@ var jsonData = map[string]interface{}{
 
 func TestLoadFromFile(t *testing.T) {
 	t.Run("ValidJSON", func(t *testing.T) {
-		data, err := storage.LoadFromFile("../../tests/assets/example.json", &storage.JSONParser{})
+		data, err := storage.LoadFromFile("../tests/assets/example.json", &storage.JSONParser{})
 		if err != nil {
 			t.Errorf("unexpected error: %s", err)
 			return
diff --git a/internal/storage/plain.go b/storage/plain.go
similarity index 100%
rename from internal/storage/plain.go
rename to storage/plain.go
diff --git a/internal/storage/plain_test.go b/storage/plain_test.go
similarity index 96%
rename from internal/storage/plain_test.go
rename to storage/plain_test.go
index e00100f..506e54a 100644
--- a/internal/storage/plain_test.go
+++ b/storage/plain_test.go
@@ -2,7 +2,7 @@ package storage_test
 
 import (
 	"errors"
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"testing"
 )
 
diff --git a/internal/storage/toml.go b/storage/toml.go
similarity index 100%
rename from internal/storage/toml.go
rename to storage/toml.go
diff --git a/internal/storage/toml_test.go b/storage/toml_test.go
similarity index 98%
rename from internal/storage/toml_test.go
rename to storage/toml_test.go
index 545e6f3..9f7d133 100644
--- a/internal/storage/toml_test.go
+++ b/storage/toml_test.go
@@ -1,7 +1,7 @@
 package storage_test
 
 import (
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"reflect"
 	"strings"
 	"testing"
diff --git a/internal/storage/xml.go b/storage/xml.go
similarity index 100%
rename from internal/storage/xml.go
rename to storage/xml.go
diff --git a/internal/storage/xml_test.go b/storage/xml_test.go
similarity index 99%
rename from internal/storage/xml_test.go
rename to storage/xml_test.go
index e1c2287..6042b20 100644
--- a/internal/storage/xml_test.go
+++ b/storage/xml_test.go
@@ -3,11 +3,11 @@ package storage_test
 import (
 	"bytes"
 	"fmt"
+	"github.com/tomwright/dasel/storage"
 	"io"
 	"reflect"
 	"testing"
 
-	"github.com/tomwright/dasel/internal/storage"
 	"golang.org/x/text/encoding/charmap"
 	"golang.org/x/text/encoding/unicode"
 )
diff --git a/internal/storage/yaml.go b/storage/yaml.go
similarity index 100%
rename from internal/storage/yaml.go
rename to storage/yaml.go
diff --git a/internal/storage/yaml_test.go b/storage/yaml_test.go
similarity index 98%
rename from internal/storage/yaml_test.go
rename to storage/yaml_test.go
index c3c0850..8085a9a 100644
--- a/internal/storage/yaml_test.go
+++ b/storage/yaml_test.go
@@ -1,7 +1,7 @@
 package storage_test
 
 import (
-	"github.com/tomwright/dasel/internal/storage"
+	"github.com/tomwright/dasel/storage"
 	"reflect"
 	"strings"
 	"testing"