5 Commits

Author SHA1 Message Date
root 5629dbc1af Merge pull request 'bump version and changelog' (#5) from release/v1.0.1 into develop
continuous-integration/drone/push Build is passing
2020-06-11 03:22:20 +00:00
root ec6a8338b5 bump version and changelog
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2020-06-11 03:06:43 +00:00
root 7f9508b827 Merge pull request '[feat] add load opts fromEnv' (#3) from feature/add-from-env-config into develop
continuous-integration/drone/push Build is passing
2020-06-11 03:04:36 +00:00
root 83dd096a9a [chore] add ignore file
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2020-06-11 03:04:06 +00:00
root 855a1f508c [fix] fix type error 2020-06-11 03:03:35 +00:00
3 changed files with 9 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
*.swp
+4
View File
@@ -1,5 +1,9 @@
# Change log
## 2020-06-11 (v1.0.1
- add load from env options
## 2020-06-05 (v1.0.0)
- first version
+4 -6
View File
@@ -67,7 +67,6 @@ func TestLoad(t *testing.T) {
{
name: "test load json file with default",
args: args{
i: &Config{},
opts: &LoadOptions{
ConfigFile: &ConfigFile{
Type: ConfigFileTypeJSON,
@@ -80,7 +79,6 @@ func TestLoad(t *testing.T) {
{
name: "test load yaml file with default",
args: args{
i: &Config{},
opts: &LoadOptions{
ConfigFile: &ConfigFile{
Type: ConfigFileTypeYAML,
@@ -93,7 +91,6 @@ func TestLoad(t *testing.T) {
{
name: "test load toml file with default",
args: args{
i: &Config{},
opts: &LoadOptions{
ConfigFile: &ConfigFile{
Type: ConfigFileTypeTOML,
@@ -106,7 +103,6 @@ func TestLoad(t *testing.T) {
{
name: "test load json file with default and env",
args: args{
i: &Config{},
opts: &LoadOptions{
ConfigFile: &ConfigFile{
Type: ConfigFileTypeJSON,
@@ -120,15 +116,17 @@ func TestLoad(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
src := Config{}
tt.args.i = &src
if err := Load(tt.args.i, tt.args.opts); (err != nil) != tt.wantErr {
t.Errorf("Load() error = %v, wantErr %v", err, tt.wantErr)
}
if tt.args.opts != nil && tt.args.opts.FromEnv {
if !reflect.DeepEqual(tt.args.i, expectedWithEnv) {
if !reflect.DeepEqual(src, expectedWithEnv) {
t.Errorf("Load and expected not match")
}
} else {
if !reflect.DeepEqual(tt.args.i, expected) {
if !reflect.DeepEqual(src, expected) {
t.Errorf("Load and expected not match")
}
}