Marshal a map into Writer.
(w io.Writer, configType string)
| 1733 | |
| 1734 | // Marshal a map into Writer. |
| 1735 | func (v *Viper) marshalWriter(w io.Writer, configType string) error { |
| 1736 | c := v.AllSettings() |
| 1737 | |
| 1738 | encoder, err := v.encoderRegistry.Encoder(configType) |
| 1739 | if err != nil { |
| 1740 | return ConfigMarshalError{err} |
| 1741 | } |
| 1742 | |
| 1743 | b, err := encoder.Encode(c) |
| 1744 | if err != nil { |
| 1745 | return ConfigMarshalError{err} |
| 1746 | } |
| 1747 | |
| 1748 | _, err = w.Write(b) |
| 1749 | if err != nil { |
| 1750 | return ConfigMarshalError{err} |
| 1751 | } |
| 1752 | |
| 1753 | return nil |
| 1754 | } |
| 1755 | |
| 1756 | func keyExists(k string, m map[string]any) string { |
| 1757 | lk := strings.ToLower(k) |
no test coverage detected