func readConfig(path string) (Config, error) { f, err := os.Open(path) if err != nil { return Config{}, fmt.Errorf("open %s: %w", path, err) } defer f.Close() var c Config if err := json.NewDecoder(f).Decode(&c); err != nil { return Config{}, fmt.Errorf("decode %s: %w", path, err) } return c, nil }