@@ -11,16 +11,17 @@ import (
1111 "encoding/xml"
1212 "errors"
1313 "fmt"
14- "github.com/littlecxm/kcheck/kbinxml"
15- "github.com/littlecxm/kcheck/kstruct"
16- "golang.org/x/net/html/charset"
1714 "io"
1815 "io/ioutil"
1916 "log"
2017 "os"
2118 "path/filepath"
2219 "strings"
2320 "time"
21+
22+ "github.com/littlecxm/kcheck/kbinxml"
23+ "github.com/littlecxm/kcheck/kstruct"
24+ "golang.org/x/net/html/charset"
2425)
2526
2627var builddate , commit string
@@ -35,7 +36,7 @@ type Option struct {
3536}
3637
3738func main () {
38- fmt .Println ("kcheck v1.4.1 " )
39+ fmt .Println ("kcheck v1.4.2 " )
3940 fmt .Printf ("build: %s(%s)\n " , builddate , commit )
4041 fmt .Println ("--------" )
4142 Workdir , _ := os .Getwd ()
@@ -139,8 +140,16 @@ func main() {
139140 fmt .Println ("metadata created at:" , metaCreateAt )
140141
141142 for _ , files := range metaStruct .Files {
142- FormatPath := strings .TrimPrefix (filepath .FromSlash (files .Path ), string (os .PathSeparator ))
143- if err := opt .CompareFileSHA1 (FormatPath , files .SHA1 ); err != nil {
143+ var fileSHA1 = files .SHA1
144+ var filePath = files .Path
145+ if fileSHA1 == "" {
146+ fileSHA1 = files .SSHA1
147+ }
148+ if filePath == "" {
149+ filePath = files .SPath
150+ }
151+ FormatPath := strings .TrimPrefix (filepath .FromSlash (filePath ), string (os .PathSeparator ))
152+ if err := opt .CompareFileSHA1 (FormatPath , fileSHA1 ); err != nil {
144153 errstring := "[" + err .Error () + "] "
145154 failures = append (failures , errstring + FormatPath )
146155 failCount ++
0 commit comments