Skip to content

Commit

Permalink
fix: slice init length (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuishuang authored Oct 7, 2024
1 parent 4f323ce commit 560ac99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/vm-low-orbit/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func (f *Factory) CreatePubsubEvent(msg *pubsub.Message) *Event {

func (f *Factory) CreateHttpEvent(w http.ResponseWriter, r *http.Request) *Event {
q := r.URL.Query()
qKeys := make([]string, len(q))
qKeys := make([]string, 0, len(q))
for k := range q {
qKeys = append(qKeys, k)
}

hKeys := make([]string, len(r.Header))
hKeys := make([]string, 0, len(r.Header))
for k := range r.Header {
hKeys = append(hKeys, k)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/vm/service/wazero/module_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (m *moduleInstance) Memory() vm.Memory {

func (m *moduleInstance) Functions() []vm.FunctionDefinition {
defMap := m.module.ExportedFunctionDefinitions()
defs := make([]vm.FunctionDefinition, len(defMap))
defs := make([]vm.FunctionDefinition, 0, len(defMap))
for _, def := range defMap {
defs = append(defs, def)
}
Expand Down

0 comments on commit 560ac99

Please sign in to comment.