Open
Description
Hi! While doing a quick code search, I found that the code incorrectly exposes the MaxTokens
field with the -
key during JSON marshaling and unmarshaling. This is caused by the json:"-,omitempty"
tag; by adding the ,
after the -
, the -
becomes the field key.
You can confirm this Go behavior with the following script:
package main
import (
"encoding/json"
"fmt"
)
func main() {
type Test struct {
MaxTokens string `json:"-,omitempty"`
}
u := Test{}
_ = json.Unmarshal([]byte(`{"-": "asd"}`), &u)
fmt.Printf("Result: %#v\n", u)
// Result: main.Test{MaxTokens:"asd"}
}
Metadata
Metadata
Assignees
Labels
No labels