Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
golang 1.23.4
golang 1.26.4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.7
FROM golang:1.26.2-alpine AS builder
FROM golang:1.26.4-alpine AS builder

RUN apk add --no-cache ca-certificates

Expand Down
2 changes: 1 addition & 1 deletion cmd/zoekt-git-index/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func run() int {
}

opts.LanguageMap = make(ctags.LanguageMap)
for _, mapping := range strings.Split(*languageMap, ",") {
for mapping := range strings.SplitSeq(*languageMap, ",") {
m := strings.Split(mapping, ":")
if len(m) != 2 {
continue
Expand Down
4 changes: 2 additions & 2 deletions cmd/zoekt-index/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ func main() {

ignoreDirMap := map[string]struct{}{}
if *ignoreDirs != "" {
dirs := strings.Split(*ignoreDirs, ",")
for _, d := range dirs {
dirs := strings.SplitSeq(*ignoreDirs, ",")
for d := range dirs {
d = strings.TrimSpace(d)
if d != "" {
ignoreDirMap[d] = struct{}{}
Expand Down
2 changes: 1 addition & 1 deletion cmd/zoekt-indexserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func executeMirror(cfg []ConfigEntry, repoDir string, pendingRepos chan<- string

stdout, _ := loggedRun(cmd)

for _, fn := range bytes.Split(stdout, []byte{'\n'}) {
for fn := range bytes.SplitSeq(stdout, []byte{'\n'}) {
if len(fn) == 0 {
continue
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/zoekt-mirror-gitlab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func main() {
ListOptions: gitlab.ListOptions{
PerPage: 100,
},
Sort: gitlab.Ptr("asc"),
OrderBy: gitlab.Ptr("id"),
Sort: new("asc"),
OrderBy: new("id"),
Membership: isMember,
}
if *isPublic {
Expand All @@ -100,11 +100,11 @@ func main() {
if err != nil {
log.Fatal(err)
}
opt.LastActivityAfter = gitlab.Ptr(targetDate)
opt.LastActivityAfter = new(targetDate)
}

if *noArchived {
opt.Archived = gitlab.Ptr(false)
opt.Archived = new(false)
}

var gitlabProjects []*gitlab.Project
Expand Down
2 changes: 1 addition & 1 deletion cmd/zoekt-sourcegraph-indexserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ func getEnvWithDefaultDuration(k string, defaultVal time.Duration) time.Duration

func getEnvWithDefaultEmptySet(k string) map[string]struct{} {
set := map[string]struct{}{}
for _, v := range strings.Split(os.Getenv(k), ",") {
for v := range strings.SplitSeq(os.Getenv(k), ",") {
v = strings.TrimSpace(v)
if v != "" {
set[v] = struct{}{}
Expand Down
12 changes: 6 additions & 6 deletions gitindex/catfile_hardening_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestCatfileReader_ConcurrentClose(t *testing.T) {
wg.Add(goroutines)
barrier := make(chan struct{})

for i := 0; i < goroutines; i++ {
for range goroutines {
go func() {
defer wg.Done()
<-barrier // all start at once
Expand Down Expand Up @@ -186,7 +186,7 @@ func createManyBlobRepo(t *testing.T, fileCount, fileSize int) (string, []plumbi

runGit(t, dir, "init", "-b", "main", "repo")

for i := 0; i < fileCount; i++ {
for i := range fileCount {
content := bytes.Repeat([]byte{byte(i)}, fileSize)
name := filepath.Join(repoDir, fmt.Sprintf("file_%03d.bin", i))
if err := os.WriteFile(name, content, 0o644); err != nil {
Expand All @@ -203,7 +203,7 @@ func createManyBlobRepo(t *testing.T, fileCount, fileSize int) (string, []plumbi
}

ids := make([]plumbing.Hash, 0, fileCount)
for _, entry := range bytes.Split(out, []byte{0}) {
for entry := range bytes.SplitSeq(out, []byte{0}) {
if len(entry) == 0 {
continue
}
Expand Down Expand Up @@ -268,7 +268,7 @@ func TestCatfileReader_ReadAfterFullConsumption(t *testing.T) {
}

// Blob is fully read — additional Reads must return EOF.
for i := 0; i < 3; i++ {
for i := range 3 {
buf := make([]byte, 10)
n, err := cr.Read(buf)
if n != 0 || err != io.EOF {
Expand Down Expand Up @@ -718,7 +718,7 @@ func TestCatfileReader_RepeatedNextAfterEOF(t *testing.T) {
}

// Second and third EOF — must be stable.
for i := 0; i < 2; i++ {
for i := range 2 {
_, _, _, err = cr.Next()
if err != io.EOF {
t.Fatalf("Next #%d after EOF: %v, want io.EOF", i+2, err)
Expand Down Expand Up @@ -843,7 +843,7 @@ func TestCatfileReader_DuplicateSHAs(t *testing.T) {
}
defer cr.Close()

for i := 0; i < 3; i++ {
for i := range 3 {
size, missing, excluded, err := cr.Next()
if err != nil {
t.Fatalf("Next #%d: %v", i, err)
Expand Down
1 change: 0 additions & 1 deletion gitindex/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,6 @@ func TestIndexDeltaBasic(t *testing.T) {
},
},
} {
test := test

t.Run(test.name, func(t *testing.T) {
t.Parallel()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

go 1.25.9
go 1.26.4
4 changes: 2 additions & 2 deletions grpc/grpcutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
// Copied from github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/reporter.go
func SplitMethodName(fullMethod string) (string, string) {
fullMethod = strings.TrimPrefix(fullMethod, "/") // remove leading slash
if i := strings.Index(fullMethod, "/"); i >= 0 {
return fullMethod[:i], fullMethod[i+1:]
if before, after, ok := strings.Cut(fullMethod, "/"); ok {
return before, after
}
return "unknown", "unknown"
}
Expand Down
8 changes: 3 additions & 5 deletions index/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,6 @@ func TestBuilder_DeltaShardsBuildsShouldErrorOnIndexOptionsMismatch(t *testing.T
options: func(options *Options) { options.LargeFiles = []string{"-large_file", "*.md", "-large_file", "*.yaml"} },
},
} {
test := test

t.Run(test.name, func(t *testing.T) {
indexDir := t.TempDir()
Expand Down Expand Up @@ -714,7 +713,6 @@ func TestBuilder_DeltaShardsMetadataInOlderShards(t *testing.T) {
},
},
} {
test := test

t.Run(test.name, func(t *testing.T) {
indexDir := t.TempDir()
Expand Down Expand Up @@ -1090,11 +1088,11 @@ func testFileRankAspect(t *testing.T, c filerankCase) {
sortDocuments(got)

print := func(ds []*Document) string {
r := ""
var r strings.Builder
for _, d := range ds {
r += fmt.Sprintf("%v, ", d)
r.WriteString(fmt.Sprintf("%v, ", d))
}
return r
return r.String()
}
if !reflect.DeepEqual(got, want) {
t.Errorf("got docs [%v], want [%v]", print(got), print(want))
Expand Down
8 changes: 4 additions & 4 deletions index/docmatchtreecache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ func TestDocMatchTreeCache_Concurrent(t *testing.T) {
done := make(chan bool, numGoroutines)

// Reader goroutines (should be majority of operations)
for i := 0; i < numGoroutines-1; i++ {
for i := range numGoroutines - 1 {
go func(id int) {
for j := 0; j < numOperations; j++ {
for j := range numOperations {
field := "field" + strconv.Itoa(j%10)
value := "value" + strconv.Itoa(j%20)
cache.Get(field, value)
Expand All @@ -82,7 +82,7 @@ func TestDocMatchTreeCache_Concurrent(t *testing.T) {

// Writer goroutine (fewer write operations)
go func() {
for j := 0; j < numOperations/10; j++ {
for j := range numOperations / 10 {
field := "field" + strconv.Itoa(j%10)
value := "value" + strconv.Itoa(j%20)
tree := trees[j%len(trees)]
Expand All @@ -92,7 +92,7 @@ func TestDocMatchTreeCache_Concurrent(t *testing.T) {
}()

// Wait for all goroutines to complete
for i := 0; i < numGoroutines; i++ {
for range numGoroutines {
<-done
}
}
5 changes: 1 addition & 4 deletions index/shard_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ const initialPostingCap = 64
// derived from the maximum shard content size. Intentionally over-estimates
// (the map only holds non-ASCII trigrams) to avoid rehashing.
func estimateNgrams(shardMaxBytes int) int {
n := shardMaxBytes / 600
if n < 1024 {
n = 1024
}
n := max(shardMaxBytes/600, 1024)
return n
}

Expand Down
2 changes: 1 addition & 1 deletion search/sched.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (t *deadlineTimer) Stop() {
func parseTuneables(v string) map[string]int {
m := map[string]int{}

for _, kv := range strings.Split(v, ",") {
for kv := range strings.SplitSeq(v, ",") {
if kv == "" {
continue
}
Expand Down
1 change: 0 additions & 1 deletion search/shards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,6 @@ func TestShardedSearcher_List(t *testing.T) {
},
},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pkgs.mkShell {
name = "zoekt";

nativeBuildInputs = [
pkgs.go_1_23
pkgs.go_1_26

# zoekt-git-index
pkgs.git
Expand Down
Loading