diff --git a/build/builder.go b/build/builder.go index cc410aa4a..7932dcf32 100644 --- a/build/builder.go +++ b/build/builder.go @@ -247,7 +247,7 @@ type Builder struct { todo []*zoekt.Document docChecker zoekt.DocChecker size int - + parserBins ctags.ParserBinMap building sync.WaitGroup diff --git a/build/e2e_test.go b/build/e2e_test.go index bc79ac933..838057e0b 100644 --- a/build/e2e_test.go +++ b/build/e2e_test.go @@ -529,19 +529,19 @@ func TestFileRank(t *testing.T) { name: "skipped docs", docs: []*zoekt.Document{ { - Name: "binary_file", + Name: "binary_file", SkipReason: "binary file", }, { - Name: "some_test.go", + Name: "some_test.go", Content: []byte("bla"), }, { - Name: "large_file.go", + Name: "large_file.go", SkipReason: "too large", }, { - Name: "file.go", + Name: "file.go", Content: []byte("blabla"), }, }, diff --git a/cmd/zoekt-sourcegraph-indexserver/main.go b/cmd/zoekt-sourcegraph-indexserver/main.go index 52fccc4ca..694ee4075 100644 --- a/cmd/zoekt-sourcegraph-indexserver/main.go +++ b/cmd/zoekt-sourcegraph-indexserver/main.go @@ -644,9 +644,9 @@ func (s *Server) indexArgs(opts IndexOptions) *indexArgs { parallelism := s.parallelism(opts, runtime.GOMAXPROCS(0)) return &indexArgs{ IndexOptions: opts, - IndexDir: s.IndexDir, - Parallelism: parallelism, - Incremental: true, + IndexDir: s.IndexDir, + Parallelism: parallelism, + Incremental: true, // 1 MB; match https://sourcegraph.sgdev.org/github.com/sourcegraph/sourcegraph/-/blob/cmd/symbols/internal/symbols/search.go#L22 FileLimit: 1 << 20, @@ -665,7 +665,7 @@ func (s *Server) parallelism(opts IndexOptions, maxProcs int) int { } // In case this was accidentally misconfigured, we cap the threads at 4 times the available CPUs - if parallelism > 4 * maxProcs { + if parallelism > 4*maxProcs { parallelism = 4 * maxProcs } diff --git a/cmd/zoekt-sourcegraph-indexserver/main_test.go b/cmd/zoekt-sourcegraph-indexserver/main_test.go index a8004fed9..de0de51bc 100644 --- a/cmd/zoekt-sourcegraph-indexserver/main_test.go +++ b/cmd/zoekt-sourcegraph-indexserver/main_test.go @@ -63,8 +63,8 @@ func TestServer_parallelism(t *testing.T) { name string cpuCount int indexConcurrency int - options IndexOptions - want int + options IndexOptions + want int }{ { name: "CPU count divides evenly", @@ -82,7 +82,7 @@ func TestServer_parallelism(t *testing.T) { name: "index option overrides server flag", cpuCount: 2, indexConcurrency: 1, - options: IndexOptions { + options: IndexOptions{ ShardConcurrency: 1, }, want: 1, @@ -91,7 +91,7 @@ func TestServer_parallelism(t *testing.T) { name: "ignore invalid index option", cpuCount: 8, indexConcurrency: 2, - options: IndexOptions { + options: IndexOptions{ ShardConcurrency: -1, }, want: 4, @@ -99,7 +99,7 @@ func TestServer_parallelism(t *testing.T) { } for _, tt := range cases { - t.Run(tt.name, func(t *testing.T) { + t.Run(tt.name, func(t *testing.T) { s := &Server{ Sourcegraph: newSourcegraphClient(root, "", WithBatchSize(0)), IndexDir: "/testdata/index", @@ -109,7 +109,7 @@ func TestServer_parallelism(t *testing.T) { maxProcs := 16 got := s.parallelism(tt.options, maxProcs) - if tt.want != got{ + if tt.want != got { t.Errorf("mismatch, want: %d, got: %d", tt.want, got) } }) @@ -122,7 +122,7 @@ func TestServer_parallelism(t *testing.T) { IndexConcurrency: 1, } - got := s.indexArgs(IndexOptions { + got := s.indexArgs(IndexOptions{ ShardConcurrency: 2048, // Some number that's way too high }) @@ -440,7 +440,7 @@ func TestGetBoolFromEnvironmentVariables(t *testing.T) { _ = os.Unsetenv(v) } - for k, _ := range tc.envVarsToSet { + for k := range tc.envVarsToSet { _ = os.Unsetenv(k) } diff --git a/cmd/zoekt-sourcegraph-indexserver/sg.go b/cmd/zoekt-sourcegraph-indexserver/sg.go index c285d5c15..d28954cd5 100644 --- a/cmd/zoekt-sourcegraph-indexserver/sg.go +++ b/cmd/zoekt-sourcegraph-indexserver/sg.go @@ -521,8 +521,8 @@ func (o *indexOptionsItem) ToProto() *proto.ZoektIndexOptions { Error: o.Error, - LanguageMap: languageMap, - ShardConcurrency: o.ShardConcurrency, + LanguageMap: languageMap, + ShardConcurrency: o.ShardConcurrency, } } diff --git a/ctags/parser.go b/ctags/parser.go index 84535fee6..51c765bf9 100644 --- a/ctags/parser.go +++ b/ctags/parser.go @@ -86,8 +86,8 @@ func (lp *CTagsParser) newParserProcess(typ CTagsParserType) (goctags.Parser, er opts := goctags.Options{Bin: bin} parserType := ParserToString(typ) if debug { - opts.Info = log.New(os.Stderr, "CTAGS (" + parserType + ") INF: ", log.LstdFlags) - opts.Debug = log.New(os.Stderr, "CTAGS (" + parserType + ") DBG: ", log.LstdFlags) + opts.Info = log.New(os.Stderr, "CTAGS ("+parserType+") INF: ", log.LstdFlags) + opts.Debug = log.New(os.Stderr, "CTAGS ("+parserType+") DBG: ", log.LstdFlags) } return goctags.New(opts) } diff --git a/ctags/parser_bins.go b/ctags/parser_bins.go index bf378631b..d4da811f5 100644 --- a/ctags/parser_bins.go +++ b/ctags/parser_bins.go @@ -113,4 +113,3 @@ func checkBinary(typ CTagsParserType, bin string) error { return nil } - diff --git a/ctags/symbol_kind.go b/ctags/symbol_kind.go index bfe835e72..382ac17aa 100644 --- a/ctags/symbol_kind.go +++ b/ctags/symbol_kind.go @@ -107,4 +107,3 @@ func ParseSymbolKind(kind string) SymbolKind { return Other } } -