mirror of https://github.com/spf13/viper.git
fix: go fmt
This commit is contained in:
parent
0967fc9ace
commit
2e3a48342c
|
@ -33,7 +33,7 @@ func (rc remoteConfigProvider) Watch(rp viper.RemoteProvider) (io.Reader, error)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resp,err := cm.Get(rp.Path())
|
resp, err := cm.Get(rp.Path())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -50,10 +50,10 @@ func (rc remoteConfigProvider) WatchChannel(rp viper.RemoteProvider) (<-chan *vi
|
||||||
viperResponsCh := make(chan *viper.RemoteResponse)
|
viperResponsCh := make(chan *viper.RemoteResponse)
|
||||||
cryptoResponseCh := cm.Watch(rp.Path(), quit)
|
cryptoResponseCh := cm.Watch(rp.Path(), quit)
|
||||||
// need this function to convert the Channel response form crypt.Response to viper.Response
|
// need this function to convert the Channel response form crypt.Response to viper.Response
|
||||||
go func(cr <-chan *crypt.Response,vr chan<- *viper.RemoteResponse, quitwc <-chan bool, quit chan<- bool) {
|
go func(cr <-chan *crypt.Response, vr chan<- *viper.RemoteResponse, quitwc <-chan bool, quit chan<- bool) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <- quitwc:
|
case <-quitwc:
|
||||||
quit <- true
|
quit <- true
|
||||||
return
|
return
|
||||||
case resp := <-cr:
|
case resp := <-cr:
|
||||||
|
@ -65,13 +65,12 @@ func (rc remoteConfigProvider) WatchChannel(rp viper.RemoteProvider) (<-chan *vi
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}(cryptoResponseCh,viperResponsCh,quitwc,quit)
|
}(cryptoResponseCh, viperResponsCh, quitwc, quit)
|
||||||
|
|
||||||
return viperResponsCh,quitwc
|
return viperResponsCh, quitwc
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func getConfigManager(rp viper.RemoteProvider) (crypt.ConfigManager, error) {
|
func getConfigManager(rp viper.RemoteProvider) (crypt.ConfigManager, error) {
|
||||||
|
|
||||||
var cm crypt.ConfigManager
|
var cm crypt.ConfigManager
|
||||||
|
|
2
viper.go
2
viper.go
|
@ -53,7 +53,7 @@ func init() {
|
||||||
type remoteConfigFactory interface {
|
type remoteConfigFactory interface {
|
||||||
Get(rp RemoteProvider) (io.Reader, error)
|
Get(rp RemoteProvider) (io.Reader, error)
|
||||||
Watch(rp RemoteProvider) (io.Reader, error)
|
Watch(rp RemoteProvider) (io.Reader, error)
|
||||||
WatchChannel(rp RemoteProvider)(<-chan *RemoteResponse, chan bool)
|
WatchChannel(rp RemoteProvider) (<-chan *RemoteResponse, chan bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoteConfig is optional, see the remote package
|
// RemoteConfig is optional, see the remote package
|
||||||
|
|
Loading…
Reference in New Issue