forked from golang/vulndb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (37 loc) · 1.08 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
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Command checkdeploy validates that it is safe to deploy a new
// vulnerability database.
package main
import (
"flag"
"log"
db "golang.org/x/vulndb/internal/database"
"golang.org/x/vulndb/internal/database/legacydb"
)
var (
newPath = flag.String("new", "", "path to new database")
newLegacyPath = flag.String("legacy", "", "path to the new database in the legacy schema (optional)")
existingPath = flag.String("existing", "", "path to existing database")
)
func main() {
flag.Parse()
if *newPath == "" {
log.Fatalf("flag -new must be set")
}
if *existingPath == "" {
log.Fatalf("flag -existing must be set")
}
if err := db.Validate(*newPath, *existingPath); err != nil {
log.Fatal(err)
}
if *newLegacyPath != "" {
if err := legacydb.Validate(*newLegacyPath, *existingPath); err != nil {
log.Fatal(err)
}
if err := legacydb.Equivalent(*newPath, *newLegacyPath); err != nil {
log.Fatal(err)
}
}
}