-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(config): #13 - config handling using koanf package #12
Conversation
04f488a
to
00a10d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test
command to Makefile
.
Add Github Action
to run make test
command in pull request
and main
branch.
config/config_test.go
Outdated
@@ -0,0 +1,135 @@ | |||
package config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change config
to config_test
.
All test files should have _test
postfix in the package name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ormus
scope to PR title
feat(ormus): config....
koanf
packagekoanf
package
27a3e0c
to
3b73873
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me, just a few things need to be fixed.
Makefile
Outdated
golangci-lint run --config=$(ROOT)/.golangci.yml $(ROOT)/... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to define ROOT
variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Root
is already defined
Makefile
Outdated
@@ -8,4 +8,7 @@ ROOT=$(realpath $(dir $(lastword $(MAKEFILE_LIST)))) | |||
// TODO: add lint and format to github ci |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add format
command and remove TODO
comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the format command add to the #16 pull request
Makefile
Outdated
|
||
test: | ||
go test -v ./... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the indentation with 4 spaces
is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please |
Please add issue number to PR title like these PR. |
koanf
packageThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very close to Approve :)
config/loader.go
Outdated
"github.com/knadh/koanf" | ||
"github.com/knadh/koanf/parsers/yaml" | ||
"github.com/knadh/koanf/providers/env" | ||
"github.com/knadh/koanf/providers/file" | ||
"github.com/knadh/koanf/providers/structs" | ||
"log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort import packages using goimports
, see this.
config/loader.go
Outdated
log.Fatalf("error unmarshaling config: %s", err) | ||
} | ||
} | ||
|
||
func C() *Config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not expose Config with pointer. The caller can modify the config object, just return Config
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
config/loader.go
Outdated
return c | ||
} | ||
|
||
func New(opt Option) *Config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just return Config
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
8b077d5
to
d7f47c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great
@@ -0,0 +1,5 @@ | |||
package config | |||
|
|||
func Default() Config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is redundant
event/context.go
Outdated
@@ -5,7 +5,7 @@ import ( | |||
"net/url" | |||
) | |||
|
|||
// This is an implementation of Context class similar to the `CoreExtraContext` in segment js SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra changes.
rebase the main and resolve the conflicts
Please squash commits and rebase it with main |
d7f47c3
to
831cbe8
Compare
No description provided.