From cd2ac648ffc008e755f0c5d6a509e82d8a451686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=8F=E4=B9=90?= Date: Sun, 11 Aug 2019 18:05:35 +0800 Subject: [PATCH] Fix read yaml config from memory package main import ( "fmt" "github.com/micro/go-micro/config" "github.com/micro/go-micro/config/source/memory" ) var configData = []byte(` --- a: 1234 `) func main() { memorySource := memory.NewSource( memory.WithYAML(configData), ) // Create new config conf := config.NewConfig() // Load file source conf.Load(memorySource) fmt.Println(string(conf.Bytes())) } --- config/source/memory/memory.go | 1 + 1 file changed, 1 insertion(+) diff --git a/config/source/memory/memory.go b/config/source/memory/memory.go index 607c7b4a..78e26d3f 100644 --- a/config/source/memory/memory.go +++ b/config/source/memory/memory.go @@ -18,6 +18,7 @@ type memory struct { func (s *memory) Read() (*source.ChangeSet, error) { s.RLock() cs := &source.ChangeSet{ + Format: s.ChangeSet.Format, Timestamp: s.ChangeSet.Timestamp, Data: s.ChangeSet.Data, Checksum: s.ChangeSet.Checksum,