From 67e02f10d495144de55c7b85db3eda42cf6ed588 Mon Sep 17 00:00:00 2001 From: "wangzekun.zekin" Date: Mon, 1 Jun 2026 14:13:32 +0800 Subject: [PATCH 1/2] fix(go): return nil instead of panic when AST node has invalid position When parsing files with compilation errors, AST nodes can have End offset smaller than Pos offset, causing slice bounds out of range panic. Co-Authored-By: Claude Opus 4.6 (1M context) --- lang/golang/parser/ctx.go | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/golang/parser/ctx.go b/lang/golang/parser/ctx.go index 938d238c..ed70c1a8 100644 --- a/lang/golang/parser/ctx.go +++ b/lang/golang/parser/ctx.go @@ -257,6 +257,7 @@ func GetRawContent(fset *token.FileSet, file []byte, node ast.Node, collectComme funcName = fn.Name.Name } fmt.Fprintf(os.Stderr, "end < begin, file: %s, function: %s, possibly because file compilation failed\n", pos.Filename, funcName) + return nil } doc.Write(file[pos.Offset:endPos.Offset]) return doc.Bytes() From 6df93911d51560836fd3872cd176fb71c61257cc Mon Sep 17 00:00:00 2001 From: "wangzekun.zekin" Date: Mon, 1 Jun 2026 15:24:58 +0800 Subject: [PATCH 2/2] ci: pin gopls to v0.22.0 Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/go-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index b7d9bbf6..474868b7 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -42,7 +42,7 @@ jobs: components: rust-analyzer - name: Install gopls - run: go install golang.org/x/tools/gopls@latest + run: go install golang.org/x/tools/gopls@v0.16.2 - name: Run all tests run: go test ./lang/... -skip '${{ env.SKIPPED_TESTS }}'