From f98411d629ceefd91d6d2e2fe5f3e5cf15fa8730 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 20 Jun 2024 14:35:53 +0200 Subject: [PATCH] feat(encoding): use external encoding libraries Signed-off-by: Mark Sagi-Kazar --- go.mod | 6 ++++++ go.sum | 12 ++++++++++++ viper.go | 12 ++++++------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 50ff1a3..8806a7a 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,12 @@ go 1.21 require ( github.com/fsnotify/fsnotify v1.7.0 + github.com/go-viper/encoding/dotenv v0.1.0 + github.com/go-viper/encoding/hcl v0.1.0 + github.com/go-viper/encoding/ini v0.1.0 + github.com/go-viper/encoding/javaproperties v0.1.0 + github.com/go-viper/encoding/toml v0.1.0 + github.com/go-viper/encoding/yaml v0.1.0 github.com/go-viper/mapstructure/v2 v2.0.0 github.com/hashicorp/hcl v1.0.0 github.com/magiconair/properties v1.8.7 diff --git a/go.sum b/go.sum index da9f1f0..8fba041 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,18 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-viper/encoding/dotenv v0.1.0 h1:XelRj/HPBriYmnXY59h1QLMBnmWC21qFojzr9vdzbZo= +github.com/go-viper/encoding/dotenv v0.1.0/go.mod h1:SF1B9MODzZ1OLBEePSrjMkJjVg821fFiYea5AIL8CBc= +github.com/go-viper/encoding/hcl v0.1.0 h1:eC0Vo0XLTkWMd0ehSeF4H2ushiKu/lwNAzYnStgTkho= +github.com/go-viper/encoding/hcl v0.1.0/go.mod h1:uXPhzJnVyTb45tuW8lqhcUDe7DYvrZFoZs0HU9vXOyg= +github.com/go-viper/encoding/ini v0.1.0 h1:zzt54JVGIAFGIPYzqauMgJt7gjh9hVC3S+NzWJPvb9Y= +github.com/go-viper/encoding/ini v0.1.0/go.mod h1:Pfi4M2V1eAGJVZ5q6FrkHPhtHED2YgLlXhvgMVrB+YQ= +github.com/go-viper/encoding/javaproperties v0.1.0 h1:4pQN/pez/rMy9ITZ++SgLH6VIN3zWzNNuWFHKjrpn6w= +github.com/go-viper/encoding/javaproperties v0.1.0/go.mod h1:LGaThjx5J/GFdQRJscxLMQsYt0XKAM7IW9YzsJTv6jw= +github.com/go-viper/encoding/toml v0.1.0 h1:Gtd343g0JR9lLeBaudZILjLPYiGmzyE0LSpTf6HsYDU= +github.com/go-viper/encoding/toml v0.1.0/go.mod h1:+gJiMxUZ/wslHYy06NBtkotxZ7fbue+36KvdMm2OXTk= +github.com/go-viper/encoding/yaml v0.1.0 h1:tILva5u4EUgtJDYhAB7U+aj5zIDZqmq5qvcS8U4bFQE= +github.com/go-viper/encoding/yaml v0.1.0/go.mod h1:nsYhB8GzJ0rVF6sA0Xiok0mEuHtmHqmCn5tUuKKAwv0= github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/viper.go b/viper.go index 30ae4aa..22314be 100644 --- a/viper.go +++ b/viper.go @@ -35,19 +35,19 @@ import ( "time" "github.com/fsnotify/fsnotify" + "github.com/go-viper/encoding/dotenv" + "github.com/go-viper/encoding/hcl" + "github.com/go-viper/encoding/ini" + "github.com/go-viper/encoding/javaproperties" + "github.com/go-viper/encoding/toml" + "github.com/go-viper/encoding/yaml" "github.com/go-viper/mapstructure/v2" "github.com/spf13/afero" "github.com/spf13/cast" "github.com/spf13/pflag" "github.com/spf13/viper/internal/encoding" - "github.com/spf13/viper/internal/encoding/dotenv" - "github.com/spf13/viper/internal/encoding/hcl" - "github.com/spf13/viper/internal/encoding/ini" - "github.com/spf13/viper/internal/encoding/javaproperties" "github.com/spf13/viper/internal/encoding/json" - "github.com/spf13/viper/internal/encoding/toml" - "github.com/spf13/viper/internal/encoding/yaml" "github.com/spf13/viper/internal/features" )