chore: fix lint problem

pull/2868/head
GuangZhan 1 year ago
parent 93532ae621
commit 2f3762081f
No known key found for this signature in database
GPG Key ID: 7E6B84F82A98876B
  1. 2
      config/config.go
  2. 12
      config/config_test.go

@ -61,7 +61,7 @@ func New(opts ...Option) Config {
} }
func (c *config) watch(w Watcher) { func (c *config) watch(w Watcher) {
var reloadReader = func(opts options) (Reader, error) { reloadReader := func(opts options) (Reader, error) {
r := newReader(c.opts) r := newReader(c.opts)
for _, src := range c.opts.sources { for _, src := range c.opts.sources {
kvs, err := src.Load() kvs, err := src.Load()

@ -198,27 +198,27 @@ func AssertStringValue(t *testing.T, expect any, v Value) bool {
} }
func TestConfig_WatchBetweenSourcesReferenceConfig(t *testing.T) { func TestConfig_WatchBetweenSourcesReferenceConfig(t *testing.T) {
var testJson = ` testJSON := `
{ {
"foo": "${remote.foo}" "foo": "${remote.foo}"
} }
` `
var testJson2 = ` testJSON2 := `
{ {
"remote": { "remote": {
"foo": "bar" "foo": "bar"
} }
} }
` `
var testJsonUpdate = ` testJSONUpdate := `
{ {
"remote": { "remote": {
"foo": "bar2" "foo": "bar2"
} }
} }
` `
var src1 = newTestJSONSource(testJson) src1 := newTestJSONSource(testJSON)
var src2 = newTestJSONSource(testJson2) src2 := newTestJSONSource(testJSON2)
opts := options{ opts := options{
sources: []Source{src1, src2}, sources: []Source{src1, src2},
decoder: defaultDecoder, decoder: defaultDecoder,
@ -241,7 +241,7 @@ func TestConfig_WatchBetweenSourcesReferenceConfig(t *testing.T) {
} }
// update remote.foo value // update remote.foo value
src2.data = testJsonUpdate src2.data = testJSONUpdate
src2.sig <- struct{}{} src2.sig <- struct{}{}
// wait for watch to finish // wait for watch to finish
src2.sig <- struct{}{} src2.sig <- struct{}{}

Loading…
Cancel
Save