INNER CODE UNIT · Go

func

sy-vendor/Gobi · config/manager.go:405

func (ce *ConfigExporter) ExportToYAML(config *Config, filepath string) error {
	data, err := yaml.Marshal(config)
	if err != nil {
		return fmt.Errorf("failed to marshal config to YAML: %w", err)
	}

	if err := os.WriteFile(filepath, data, 0644); err != nil {
		return fmt.Errorf("failed to write config file: %w", err)
	}

	return nil
}

// ExportToJSON 导出配置到JSON文件
func (ce *ConfigExporter) ExportToJSON(config *Config, filepath string) error {
	data, err := json.MarshalIndent(config, "", "  ")
	if err != nil {
		return fmt.Errorf("failed to marshal config to JSON: %w", err)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…