Skip to content

Commit

Permalink
all: gofmt -s -w . (#730)
Browse files Browse the repository at this point in the history
This is just the outcome of running gofmt with the simplify option.

Test Plan: go test
  • Loading branch information
keegancsmith authored Jan 30, 2024
1 parent 19fa44c commit fdc144f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ type Builder struct {
todo []*zoekt.Document
docChecker zoekt.DocChecker
size int

parserBins ctags.ParserBinMap
building sync.WaitGroup

Expand Down
8 changes: 4 additions & 4 deletions build/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/zoekt-sourcegraph-indexserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}

Expand Down
16 changes: 8 additions & 8 deletions cmd/zoekt-sourcegraph-indexserver/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand All @@ -91,15 +91,15 @@ func TestServer_parallelism(t *testing.T) {
name: "ignore invalid index option",
cpuCount: 8,
indexConcurrency: 2,
options: IndexOptions {
options: IndexOptions{
ShardConcurrency: -1,
},
want: 4,
},
}

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",
Expand All @@ -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)
}
})
Expand All @@ -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
})

Expand Down Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/zoekt-sourcegraph-indexserver/sg.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,8 @@ func (o *indexOptionsItem) ToProto() *proto.ZoektIndexOptions {

Error: o.Error,

LanguageMap: languageMap,
ShardConcurrency: o.ShardConcurrency,
LanguageMap: languageMap,
ShardConcurrency: o.ShardConcurrency,
}
}

Expand Down
4 changes: 2 additions & 2 deletions ctags/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 0 additions & 1 deletion ctags/parser_bins.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,3 @@ func checkBinary(typ CTagsParserType, bin string) error {

return nil
}

1 change: 0 additions & 1 deletion ctags/symbol_kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,3 @@ func ParseSymbolKind(kind string) SymbolKind {
return Other
}
}

0 comments on commit fdc144f

Please sign in to comment.