mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-05-06 05:38:51 +00:00
fix: resolve domain.ts type errors and SWR fetching bugs; fix vps config unmarshal issue
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
IPReportPeriod int `json:"ip_report_period"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
jsonData := `{"ip_report_period":30, "unknown_field": 123}`
|
||||
var c Config
|
||||
|
||||
dec := json.NewDecoder(strings.NewReader(jsonData))
|
||||
dec.DisallowUnknownFields()
|
||||
err := dec.Decode(&c)
|
||||
if err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
} else {
|
||||
fmt.Println("Success")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user