-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmain.go
50 lines (42 loc) · 1.14 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"fmt"
"time"
"github.com/xeipuuv/gojsonschema"
)
const (
SchemaFilePath = "./src/token.schema.json"
DevNetTokenListPath = "./src/devnet/tokenList.json"
TestNetTokenListPath = "./src/testnet/tokenList.json"
HoleskyTokenListPath = "./src/holesky/tokenList.json"
QAnetTokenListPath = "./src/qanet/tokenList.json"
)
var CheckPath = [...]string{
DevNetTokenListPath,
TestNetTokenListPath,
HoleskyTokenListPath,
QAnetTokenListPath,
}
func main() {
// get time now
currentTime := time.Now().UTC().Format(time.RFC3339)
_ = currentTime
schemaLoader := gojsonschema.NewReferenceLoader("file://" + SchemaFilePath)
for i := 0; i < len(CheckPath); i++ {
tokenListPath := CheckPath[i]
documentLoader := gojsonschema.NewReferenceLoader("file://" + tokenListPath)
result, err := gojsonschema.Validate(schemaLoader, documentLoader)
if err != nil {
panic(err.Error())
}
if result.Valid() {
fmt.Printf("The document is valid\n")
} else {
fmt.Printf("The document is not valid. see errors :\n")
for _, desc := range result.Errors() {
fmt.Printf("- %s\n", desc)
}
panic("check ERR")
}
}
}