fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

zoekt-sourcegraph-indexserver: add --debug-meta (#128)

This adds a new flag --debug-meta which prints a shard's indexMetaData
and repository meta data. We print JSON, so the ouput can easily be
piped to jq or something similar.

+28
+28
cmd/zoekt-sourcegraph-indexserver/main.go
··· 5 5 import ( 6 6 "bytes" 7 7 "context" 8 + "encoding/json" 8 9 "errors" 9 10 "flag" 10 11 "fmt" ··· 580 581 return nil 581 582 } 582 583 584 + func printMetaData(fn string) error { 585 + repo, indexMeta, err := zoekt.ReadMetadataPath(fn) 586 + if err != nil { 587 + return err 588 + } 589 + 590 + err = json.NewEncoder(os.Stdout).Encode(indexMeta) 591 + if err != nil { 592 + return err 593 + } 594 + 595 + err = json.NewEncoder(os.Stdout).Encode(repo) 596 + if err != nil { 597 + return err 598 + } 599 + return nil 600 + } 601 + 583 602 func printShardStats(fn string) error { 584 603 f, err := os.Open(fn) 585 604 if err != nil { ··· 630 649 debugList := flag.Bool("debug-list", false, "do not start the indexserver, rather list the repositories owned by this indexserver then quit.") 631 650 debugIndex := flag.String("debug-index", "", "do not start the indexserver, rather index the repositories then quit.") 632 651 debugShard := flag.String("debug-shard", "", "do not start the indexserver, rather print shard stats then quit.") 652 + debugMeta := flag.String("debug-meta", "", "do not start the indexserver, rather print shard metadata then quit.") 633 653 634 654 _ = flag.Bool("exp-git-index", true, "DEPRECATED: not read anymore. We always use zoekt-git-index now.") 635 655 ··· 721 741 722 742 if *debugShard != "" { 723 743 err = printShardStats(*debugShard) 744 + if err != nil { 745 + log.Fatal(err) 746 + } 747 + os.Exit(0) 748 + } 749 + 750 + if *debugMeta != "" { 751 + err = printMetaData(*debugMeta) 724 752 if err != nil { 725 753 log.Fatal(err) 726 754 }