1
0
mirror of https://github.com/MADTeacher/go_basics.git synced 2025-11-23 21:34:47 +02:00
Files
go_basics/part_5/5.6/my_embed_app/main.go
2025-06-14 12:40:10 +03:00

33 lines
478 B
Go

package main
import (
_ "embed"
"encoding/json"
"fmt"
"log"
)
//go:embed embed_config.json
var configData []byte
type Config struct {
Debug bool `json:"debug"`
Offset int `json:"offset"`
AppName string `json:"app_name"`
Version string `json:"version"`
}
func getConfig() Config {
var config Config
err := json.Unmarshal(configData, &config)
if err != nil {
log.Fatal(err)
}
return config
}
func main() {
config := getConfig()
fmt.Println(config)
}