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

Configure Feed

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

all: gofmt -s -w . (#730)

This is just the outcome of running gofmt with the simplify option.

Test Plan: go test

+21 -23
+1 -1
build/builder.go
··· 247 247 todo []*zoekt.Document 248 248 docChecker zoekt.DocChecker 249 249 size int 250 - 250 + 251 251 parserBins ctags.ParserBinMap 252 252 building sync.WaitGroup 253 253
+4 -4
build/e2e_test.go
··· 529 529 name: "skipped docs", 530 530 docs: []*zoekt.Document{ 531 531 { 532 - Name: "binary_file", 532 + Name: "binary_file", 533 533 SkipReason: "binary file", 534 534 }, 535 535 { 536 - Name: "some_test.go", 536 + Name: "some_test.go", 537 537 Content: []byte("bla"), 538 538 }, 539 539 { 540 - Name: "large_file.go", 540 + Name: "large_file.go", 541 541 SkipReason: "too large", 542 542 }, 543 543 { 544 - Name: "file.go", 544 + Name: "file.go", 545 545 Content: []byte("blabla"), 546 546 }, 547 547 },
+4 -4
cmd/zoekt-sourcegraph-indexserver/main.go
··· 644 644 parallelism := s.parallelism(opts, runtime.GOMAXPROCS(0)) 645 645 return &indexArgs{ 646 646 IndexOptions: opts, 647 - IndexDir: s.IndexDir, 648 - Parallelism: parallelism, 649 - Incremental: true, 647 + IndexDir: s.IndexDir, 648 + Parallelism: parallelism, 649 + Incremental: true, 650 650 651 651 // 1 MB; match https://sourcegraph.sgdev.org/github.com/sourcegraph/sourcegraph/-/blob/cmd/symbols/internal/symbols/search.go#L22 652 652 FileLimit: 1 << 20, ··· 665 665 } 666 666 667 667 // In case this was accidentally misconfigured, we cap the threads at 4 times the available CPUs 668 - if parallelism > 4 * maxProcs { 668 + if parallelism > 4*maxProcs { 669 669 parallelism = 4 * maxProcs 670 670 } 671 671
+8 -8
cmd/zoekt-sourcegraph-indexserver/main_test.go
··· 63 63 name string 64 64 cpuCount int 65 65 indexConcurrency int 66 - options IndexOptions 67 - want int 66 + options IndexOptions 67 + want int 68 68 }{ 69 69 { 70 70 name: "CPU count divides evenly", ··· 82 82 name: "index option overrides server flag", 83 83 cpuCount: 2, 84 84 indexConcurrency: 1, 85 - options: IndexOptions { 85 + options: IndexOptions{ 86 86 ShardConcurrency: 1, 87 87 }, 88 88 want: 1, ··· 91 91 name: "ignore invalid index option", 92 92 cpuCount: 8, 93 93 indexConcurrency: 2, 94 - options: IndexOptions { 94 + options: IndexOptions{ 95 95 ShardConcurrency: -1, 96 96 }, 97 97 want: 4, ··· 99 99 } 100 100 101 101 for _, tt := range cases { 102 - t.Run(tt.name, func(t *testing.T) { 102 + t.Run(tt.name, func(t *testing.T) { 103 103 s := &Server{ 104 104 Sourcegraph: newSourcegraphClient(root, "", WithBatchSize(0)), 105 105 IndexDir: "/testdata/index", ··· 109 109 110 110 maxProcs := 16 111 111 got := s.parallelism(tt.options, maxProcs) 112 - if tt.want != got{ 112 + if tt.want != got { 113 113 t.Errorf("mismatch, want: %d, got: %d", tt.want, got) 114 114 } 115 115 }) ··· 122 122 IndexConcurrency: 1, 123 123 } 124 124 125 - got := s.indexArgs(IndexOptions { 125 + got := s.indexArgs(IndexOptions{ 126 126 ShardConcurrency: 2048, // Some number that's way too high 127 127 }) 128 128 ··· 440 440 _ = os.Unsetenv(v) 441 441 } 442 442 443 - for k, _ := range tc.envVarsToSet { 443 + for k := range tc.envVarsToSet { 444 444 _ = os.Unsetenv(k) 445 445 } 446 446
+2 -2
cmd/zoekt-sourcegraph-indexserver/sg.go
··· 521 521 522 522 Error: o.Error, 523 523 524 - LanguageMap: languageMap, 525 - ShardConcurrency: o.ShardConcurrency, 524 + LanguageMap: languageMap, 525 + ShardConcurrency: o.ShardConcurrency, 526 526 } 527 527 } 528 528
+2 -2
ctags/parser.go
··· 86 86 opts := goctags.Options{Bin: bin} 87 87 parserType := ParserToString(typ) 88 88 if debug { 89 - opts.Info = log.New(os.Stderr, "CTAGS (" + parserType + ") INF: ", log.LstdFlags) 90 - opts.Debug = log.New(os.Stderr, "CTAGS (" + parserType + ") DBG: ", log.LstdFlags) 89 + opts.Info = log.New(os.Stderr, "CTAGS ("+parserType+") INF: ", log.LstdFlags) 90 + opts.Debug = log.New(os.Stderr, "CTAGS ("+parserType+") DBG: ", log.LstdFlags) 91 91 } 92 92 return goctags.New(opts) 93 93 }
-1
ctags/parser_bins.go
··· 113 113 114 114 return nil 115 115 } 116 -
-1
ctags/symbol_kind.go
··· 107 107 return Other 108 108 } 109 109 } 110 -