refactor(resources): вынести embed-конфиги в корневой resources

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-08-09 00:33:32 +03:00
parent 174b5f9048
commit a9f5a74162
4 changed files with 17 additions and 9 deletions
+4 -9
View File
@@ -1,19 +1,14 @@
package main package main
import ( import (
_ "embed"
"fmt" "fmt"
"os" "os"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.tswf.io/infra/go-synapse-backupper/resources"
) )
//go:embed resources/config.en.yaml
var configEnYAML []byte
//go:embed resources/config.ru.yaml
var configRuYAML []byte
func generateConfigCmd() *cobra.Command { func generateConfigCmd() *cobra.Command {
var lang string var lang string
var output string var output string
@@ -25,9 +20,9 @@ func generateConfigCmd() *cobra.Command {
var tmpl []byte var tmpl []byte
switch lang { switch lang {
case "en": case "en":
tmpl = configEnYAML tmpl = resources.ConfigEnYAML
case "ru": case "ru":
tmpl = configRuYAML tmpl = resources.ConfigRuYAML
default: default:
return fmt.Errorf("unsupported language: %q (must be \"en\" or \"ru\")", lang) return fmt.Errorf("unsupported language: %q (must be \"en\" or \"ru\")", lang)
} }
+13
View File
@@ -0,0 +1,13 @@
package resources
import _ "embed"
// ConfigEnYAML is the embedded English example configuration file.
//
//go:embed config.en.yaml
var ConfigEnYAML []byte
// ConfigRuYAML is the embedded Russian example configuration file.
//
//go:embed config.ru.yaml
var ConfigRuYAML []byte