1
0
mirror of https://github.com/json-iterator/go.git synced 2025-07-06 23:37:39 +02:00

move IndentionStep to config

This commit is contained in:
Tao Wen
2017-06-13 17:03:27 +08:00
parent acddcf5bbf
commit 48e9f6ec84
6 changed files with 20 additions and 16 deletions

@ -172,7 +172,9 @@ func (decoder *AdaptedDecoder) UseNumber() {
}
func NewEncoder(writer io.Writer) *AdaptedEncoder {
stream := NewStream(DEFAULT_CONFIG, writer, 512)
newCfg := &Config{}
initConfig(newCfg)
stream := NewStream(newCfg, writer, 512)
return &AdaptedEncoder{stream}
}
@ -187,5 +189,5 @@ func (adapter *AdaptedEncoder) Encode(val interface{}) error {
}
func (adapter *AdaptedEncoder) SetIndent(prefix, indent string) {
adapter.stream.IndentionStep = len(indent)
adapter.stream.cfg.IndentionStep = len(indent)
}