mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-05 16:44:22 +00:00
Fix concurrent map write issue in MarshalJSON by initializing BackendOptions
This commit is contained in:
@@ -93,6 +93,8 @@ func (o *Options) MarshalJSON() ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to marshal backend options: %w", err)
|
return nil, fmt.Errorf("failed to marshal backend options: %w", err)
|
||||||
}
|
}
|
||||||
|
// Create a new map to avoid concurrent map writes
|
||||||
|
aux.BackendOptions = make(map[string]any)
|
||||||
if err := json.Unmarshal(optionsData, &aux.BackendOptions); err != nil {
|
if err := json.Unmarshal(optionsData, &aux.BackendOptions); err != nil {
|
||||||
return nil, fmt.Errorf("failed to unmarshal backend options to map: %w", err)
|
return nil, fmt.Errorf("failed to unmarshal backend options to map: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user