├── .gitattributes ├── .gitignore ├── .prettierrc ├── CONTRIBUTING.md ├── LICENSE ├── PATENTS ├── README.md ├── benchmark └── parse │ ├── parse.go │ └── parse_test.go ├── blog ├── atom │ └── atom.go ├── blog.go └── blog_test.go ├── cmd ├── auth │ ├── authtest │ │ └── authtest.go │ ├── cookieauth │ │ └── cookieauth.go │ ├── gitauth │ │ └── gitauth.go │ ├── go.mod │ └── netrcauth │ │ └── netrcauth.go ├── benchcmp │ ├── benchcmp.go │ ├── benchcmp_test.go │ ├── compare.go │ ├── compare_test.go │ └── doc.go ├── bisect │ ├── go120.go │ ├── main.go │ ├── main_test.go │ └── testdata │ │ ├── README.md │ │ ├── basic.txt │ │ ├── count2.txt │ │ ├── double.txt │ │ ├── max1.txt │ │ ├── max2.txt │ │ ├── maxset.txt │ │ ├── maxset1.txt │ │ ├── maxset4.txt │ │ ├── negate.txt │ │ ├── rand.txt │ │ ├── rand1.txt │ │ └── rand2.txt ├── bundle │ ├── .gitignore │ ├── main.go │ ├── main_test.go │ └── testdata │ │ ├── out.golden │ │ └── src │ │ ├── domain.name │ │ └── importdecl │ │ │ └── p.go │ │ └── initial │ │ ├── a.go │ │ ├── b.go │ │ └── c.go ├── callgraph │ ├── main.go │ ├── main_test.go │ └── testdata │ │ └── src │ │ └── pkg │ │ ├── pkg.go │ │ └── pkg_test.go ├── compilebench │ └── main.go ├── deadcode │ ├── deadcode.go │ ├── deadcode_test.go │ ├── doc.go │ └── testdata │ │ ├── basic.txtar │ │ ├── filterflag.txtar │ │ ├── generated.txtar │ │ ├── issue65915.txtar │ │ ├── issue67915.txt │ │ ├── issue73652.txtar │ │ ├── jsonflag.txtar │ │ ├── lineflag.txtar │ │ ├── testflag.txtar │ │ └── whylive.txtar ├── digraph │ ├── digraph.go │ ├── digraph_test.go │ └── doc.go ├── eg │ └── eg.go ├── file2fuzz │ ├── main.go │ └── main_test.go ├── fiximports │ ├── main.go │ ├── main_test.go │ └── testdata │ │ └── src │ │ ├── fruit.io │ │ ├── banana │ │ │ └── banana.go │ │ ├── orange │ │ │ └── orange.go │ │ └── pear │ │ │ └── pear.go │ │ ├── new.com │ │ └── one │ │ │ └── one.go │ │ ├── old.com │ │ ├── bad │ │ │ └── bad.go │ │ └── one │ │ │ └── one.go │ │ └── titanic.biz │ │ ├── bar │ │ └── bar.go │ │ └── foo │ │ └── foo.go ├── go-contrib-init │ ├── contrib.go │ └── contrib_test.go ├── godex │ ├── doc.go │ ├── gc.go │ ├── gccgo.go │ ├── godex.go │ ├── isAlias18.go │ ├── isAlias19.go │ ├── print.go │ ├── source.go │ └── writetype.go ├── godoc │ ├── doc.go │ ├── godoc_test.go │ ├── goroot.go │ ├── handlers.go │ └── main.go ├── goimports │ ├── doc.go │ ├── goimports.go │ ├── goimports_gc.go │ └── goimports_not_gc.go ├── gomvpkg │ └── main.go ├── gonew │ ├── main.go │ ├── main_test.go │ └── testdata │ │ └── quote.txt ├── gotype │ ├── gotype.go │ ├── sizesFor18.go │ └── sizesFor19.go ├── goyacc │ ├── doc.go │ ├── testdata │ │ └── expr │ │ │ ├── README │ │ │ ├── expr.y │ │ │ └── main.go │ └── yacc.go ├── html2article │ └── conv.go ├── present │ ├── dir.go │ ├── doc.go │ ├── main.go │ ├── play.go │ ├── static │ │ ├── article.css │ │ ├── dir.css │ │ ├── dir.js │ │ ├── favicon.ico │ │ ├── jquery-ui.js │ │ ├── jquery.js │ │ ├── notes.css │ │ ├── notes.js │ │ ├── play.js │ │ ├── playground.js │ │ ├── slides.js │ │ └── styles.css │ └── templates │ │ ├── action.tmpl │ │ ├── article.tmpl │ │ ├── dir.tmpl │ │ └── slides.tmpl ├── present2md │ └── main.go ├── signature-fuzzer │ ├── README.md │ ├── fuzz-driver │ │ ├── driver.go │ │ └── drv_test.go │ ├── fuzz-runner │ │ ├── rnr_test.go │ │ ├── runner.go │ │ └── testdata │ │ │ └── himom.go │ └── internal │ │ └── fuzz-generator │ │ ├── arrayparm.go │ │ ├── gen_test.go │ │ ├── generator.go │ │ ├── mapparm.go │ │ ├── numparm.go │ │ ├── parm.go │ │ ├── pointerparm.go │ │ ├── stringparm.go │ │ ├── structparm.go │ │ ├── typedefparm.go │ │ └── wraprand.go ├── splitdwarf │ ├── internal │ │ └── macho │ │ │ ├── fat.go │ │ │ ├── file.go │ │ │ ├── file_test.go │ │ │ ├── macho.go │ │ │ ├── reloctype.go │ │ │ ├── reloctype_string.go │ │ │ └── testdata │ │ │ ├── clang-386-darwin-exec-with-rpath │ │ │ ├── clang-386-darwin.obj │ │ │ ├── clang-amd64-darwin-exec-with-rpath │ │ │ ├── clang-amd64-darwin.obj │ │ │ ├── fat-gcc-386-amd64-darwin-exec │ │ │ ├── gcc-386-darwin-exec │ │ │ ├── gcc-amd64-darwin-exec │ │ │ ├── gcc-amd64-darwin-exec-debug │ │ │ └── hello.c │ └── splitdwarf.go ├── ssadump │ └── main.go ├── stress │ └── stress.go ├── stringer │ ├── endtoend_test.go │ ├── golden_test.go │ ├── multifile_test.go │ ├── stringer.go │ ├── testdata │ │ ├── cgo.go │ │ ├── conv.go │ │ ├── conv2.go │ │ ├── day.go │ │ ├── gap.go │ │ ├── num.go │ │ ├── number.go │ │ ├── prime.go │ │ ├── prime2.go │ │ ├── tag_main.go │ │ ├── tag_tag.go │ │ ├── unum.go │ │ ├── unum2.go │ │ └── vary_day.go │ └── util_test.go └── toolstash │ ├── buildall │ ├── cmp.go │ └── main.go ├── codereview.cfg ├── container └── intsets │ ├── export_test.go │ ├── sparse.go │ └── sparse_test.go ├── copyright ├── copyright.go └── copyright_test.go ├── cover ├── profile.go └── profile_test.go ├── go.mod ├── go.sum ├── go ├── analysis │ ├── analysis.go │ ├── analysistest │ │ ├── analysistest.go │ │ └── analysistest_test.go │ ├── checker │ │ ├── checker.go │ │ ├── example_test.go │ │ ├── iter_go122.go │ │ ├── iter_go123.go │ │ └── print.go │ ├── diagnostic.go │ ├── doc.go │ ├── doc │ │ └── suggested_fixes.md │ ├── internal │ │ ├── analysisflags │ │ │ ├── flags.go │ │ │ ├── flags_test.go │ │ │ ├── help.go │ │ │ ├── url.go │ │ │ └── url_test.go │ │ ├── checker │ │ │ ├── checker.go │ │ │ ├── checker_test.go │ │ │ ├── fix_test.go │ │ │ ├── start_test.go │ │ │ └── testdata │ │ │ │ ├── conflict.txt │ │ │ │ ├── diff.txt │ │ │ │ ├── fixes.txt │ │ │ │ ├── importdup.txt │ │ │ │ ├── importdup2.txt │ │ │ │ ├── json.txt │ │ │ │ ├── noend.txt │ │ │ │ └── overlap.txt │ │ ├── internal.go │ │ └── versiontest │ │ │ └── version_test.go │ ├── multichecker │ │ ├── multichecker.go │ │ └── multichecker_test.go │ ├── passes │ │ ├── README │ │ ├── appends │ │ │ ├── appends.go │ │ │ ├── appends_test.go │ │ │ ├── doc.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── b │ │ │ │ └── b.go │ │ ├── asmdecl │ │ │ ├── asmdecl.go │ │ │ ├── asmdecl_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── asm.go │ │ │ │ ├── asm1.s │ │ │ │ ├── asm10.s │ │ │ │ ├── asm11.s │ │ │ │ ├── asm2.s │ │ │ │ ├── asm3.s │ │ │ │ ├── asm4.s │ │ │ │ ├── asm5.s │ │ │ │ ├── asm6.s │ │ │ │ ├── asm7.s │ │ │ │ ├── asm8.s │ │ │ │ └── asm9.s │ │ ├── assign │ │ │ ├── assign.go │ │ │ ├── assign_test.go │ │ │ ├── doc.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ │ │ └── typeparams │ │ │ │ ├── typeparams.go │ │ │ │ └── typeparams.go.golden │ │ ├── atomic │ │ │ ├── atomic.go │ │ │ ├── atomic_test.go │ │ │ ├── doc.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── atomicalign │ │ │ ├── atomicalign.go │ │ │ ├── atomicalign_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── stub.go │ │ │ │ └── b │ │ │ │ ├── b.go │ │ │ │ └── stub.go │ │ ├── bools │ │ │ ├── bools.go │ │ │ ├── bools_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── buildssa │ │ │ ├── buildssa.go │ │ │ ├── buildssa_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ ├── b │ │ │ │ └── b.go │ │ │ │ └── c │ │ │ │ └── c.go │ │ ├── buildtag │ │ │ ├── buildtag.go │ │ │ ├── buildtag_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── buildtag.go │ │ │ │ ├── buildtag2.go │ │ │ │ ├── buildtag3.go │ │ │ │ ├── buildtag4.go │ │ │ │ ├── buildtag5.go │ │ │ │ ├── buildtag6.s │ │ │ │ ├── buildtag7.s │ │ │ │ └── buildtag8.s │ │ │ │ └── b │ │ │ │ ├── vers.go │ │ │ │ ├── vers1.go │ │ │ │ ├── vers2.go │ │ │ │ ├── vers3.go │ │ │ │ ├── vers4.go │ │ │ │ ├── vers5.go │ │ │ │ └── vers6.go │ │ ├── cgocall │ │ │ ├── cgocall.go │ │ │ ├── cgocall_go120.go │ │ │ ├── cgocall_go121.go │ │ │ ├── cgocall_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── cgo.go │ │ │ │ └── cgo3.go │ │ │ │ ├── b │ │ │ │ └── b.go │ │ │ │ ├── c │ │ │ │ └── c.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── composite │ │ │ ├── composite.go │ │ │ ├── composite_test.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ ├── a.go │ │ │ │ │ ├── a.go.golden │ │ │ │ │ ├── a_fuzz_test.go │ │ │ │ │ └── a_fuzz_test.go.golden │ │ │ │ │ └── typeparams │ │ │ │ │ ├── lib │ │ │ │ │ └── lib.go │ │ │ │ │ ├── typeparams.go │ │ │ │ │ └── typeparams.go.golden │ │ │ └── whitelist.go │ │ ├── copylock │ │ │ ├── copylock.go │ │ │ ├── copylock_test.go │ │ │ ├── main.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── copylock.go │ │ │ │ ├── copylock_func.go │ │ │ │ ├── copylock_range.go │ │ │ │ └── issue61678.go │ │ │ │ ├── forstmt │ │ │ │ ├── go21.txtar │ │ │ │ └── go22.txtar │ │ │ │ ├── issue67787 │ │ │ │ └── issue67787.go │ │ │ │ ├── typeparams │ │ │ │ └── typeparams.go │ │ │ │ └── unfortunate │ │ │ │ ├── local_go123.go │ │ │ │ └── local_go124.go │ │ ├── ctrlflow │ │ │ ├── ctrlflow.go │ │ │ ├── ctrlflow_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ ├── lib │ │ │ │ └── lib.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── deepequalerrors │ │ │ ├── deepequalerrors.go │ │ │ ├── deepequalerrors_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── defers │ │ │ ├── cmd │ │ │ │ └── defers │ │ │ │ │ └── main.go │ │ │ ├── defers.go │ │ │ ├── defers_test.go │ │ │ ├── doc.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ ├── directive │ │ │ ├── directive.go │ │ │ ├── directive_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── badspace.go │ │ │ │ ├── issue66046.go │ │ │ │ ├── misplaced.go │ │ │ │ ├── misplaced.s │ │ │ │ ├── misplaced_test.go │ │ │ │ └── p.go │ │ ├── errorsas │ │ │ ├── errorsas.go │ │ │ ├── errorsas_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── fieldalignment │ │ │ ├── cmd │ │ │ │ └── fieldalignment │ │ │ │ │ └── main.go │ │ │ ├── fieldalignment.go │ │ │ ├── fieldalignment_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── a.go │ │ │ │ ├── a.go.golden │ │ │ │ ├── a_386.go │ │ │ │ ├── a_386.go.golden │ │ │ │ ├── a_amd64.go │ │ │ │ └── a_amd64.go.golden │ │ ├── findcall │ │ │ ├── cmd │ │ │ │ └── findcall │ │ │ │ │ └── main.go │ │ │ ├── findcall.go │ │ │ ├── findcall_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ ├── framepointer │ │ │ ├── framepointer.go │ │ │ ├── framepointer_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── asm.go │ │ │ │ ├── asm_amd64.s │ │ │ │ ├── asm_arm64.s │ │ │ │ ├── asm_darwin_amd64.s │ │ │ │ ├── asm_linux_amd64.s │ │ │ │ ├── asm_windows_amd64.s │ │ │ │ └── buildtag_amd64.s │ │ ├── gofix │ │ │ ├── doc.go │ │ │ ├── gofix.go │ │ │ ├── gofix_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ ├── hostport │ │ │ ├── hostport.go │ │ │ ├── hostport_test.go │ │ │ ├── main.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ ├── httpmux │ │ │ ├── cmd │ │ │ │ └── httpmux │ │ │ │ │ └── main.go │ │ │ ├── httpmux.go │ │ │ ├── httpmux_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ ├── httpresponse │ │ │ ├── httpresponse.go │ │ │ ├── httpresponse_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── ifaceassert │ │ │ ├── cmd │ │ │ │ └── ifaceassert │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── ifaceassert.go │ │ │ ├── ifaceassert_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── inspect │ │ │ └── inspect.go │ │ ├── internal │ │ │ └── analysisutil │ │ │ │ ├── util.go │ │ │ │ └── util_test.go │ │ ├── loopclosure │ │ │ ├── doc.go │ │ │ ├── loopclosure.go │ │ │ ├── loopclosure_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── b.go │ │ │ │ ├── golang.org │ │ │ │ └── x │ │ │ │ │ └── sync │ │ │ │ │ └── errgroup │ │ │ │ │ └── errgroup.go │ │ │ │ ├── subtests │ │ │ │ └── subtest.go │ │ │ │ ├── typeparams │ │ │ │ └── typeparams.go │ │ │ │ └── versions │ │ │ │ ├── go18.txtar │ │ │ │ └── go22.txtar │ │ ├── lostcancel │ │ │ ├── cmd │ │ │ │ └── lostcancel │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── lostcancel.go │ │ │ ├── lostcancel_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ ├── b │ │ │ │ └── b.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── nilfunc │ │ │ ├── doc.go │ │ │ ├── nilfunc.go │ │ │ ├── nilfunc_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── nilness │ │ │ ├── cmd │ │ │ │ └── nilness │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── nilness.go │ │ │ ├── nilness_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ ├── b │ │ │ │ └── b.go │ │ │ │ ├── c │ │ │ │ └── c.go │ │ │ │ └── d │ │ │ │ └── d.go │ │ ├── pkgfact │ │ │ ├── pkgfact.go │ │ │ ├── pkgfact_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ ├── b │ │ │ │ └── b.go │ │ │ │ └── c │ │ │ │ └── c.go │ │ ├── printf │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── printf.go │ │ │ ├── printf_test.go │ │ │ ├── testdata │ │ │ │ ├── nonconst_go123.txtar │ │ │ │ ├── nonconst_go124.txtar │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ └── a.go │ │ │ │ │ ├── b │ │ │ │ │ └── b.go │ │ │ │ │ ├── issue68744 │ │ │ │ │ └── issue68744.go │ │ │ │ │ ├── issue70572 │ │ │ │ │ └── issue70572.go │ │ │ │ │ ├── nofmt │ │ │ │ │ └── nofmt.go │ │ │ │ │ ├── nonconst │ │ │ │ │ └── nonconst.go │ │ │ │ │ └── typeparams │ │ │ │ │ ├── diagnostics.go │ │ │ │ │ └── wrappers.go │ │ │ └── types.go │ │ ├── reflectvaluecompare │ │ │ ├── cmd │ │ │ │ └── reflectvaluecompare │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── reflectvaluecompare.go │ │ │ ├── reflectvaluecompare_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ ├── shadow │ │ │ ├── cmd │ │ │ │ └── shadow │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── shadow.go │ │ │ ├── shadow_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ ├── shift │ │ │ ├── dead.go │ │ │ ├── shift.go │ │ │ ├── shift_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── sigchanyzer │ │ │ ├── doc.go │ │ │ ├── sigchanyzer.go │ │ │ ├── sigchanyzer_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ ├── slog │ │ │ ├── doc.go │ │ │ ├── slog.go │ │ │ ├── slog_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── b │ │ │ │ └── b.go │ │ ├── sortslice │ │ │ ├── analyzer.go │ │ │ ├── analyzer_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ ├── stdmethods │ │ │ ├── doc.go │ │ │ ├── stdmethods.go │ │ │ ├── stdmethods_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── b.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── stdversion │ │ │ ├── main.go │ │ │ ├── stdversion.go │ │ │ ├── stdversion_test.go │ │ │ └── testdata │ │ │ │ └── test.txtar │ │ ├── stringintconv │ │ │ ├── cmd │ │ │ │ └── stringintconv │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── string.go │ │ │ ├── string_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ ├── fix │ │ │ │ ├── fix.go │ │ │ │ ├── fix.go.golden │ │ │ │ ├── fixdot.go │ │ │ │ ├── fixdot.go.golden │ │ │ │ ├── fixnamed.go │ │ │ │ └── fixnamed.go.golden │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── structtag │ │ │ ├── structtag.go │ │ │ ├── structtag_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── a.go │ │ │ │ └── b │ │ │ │ └── b.go │ │ ├── testinggoroutine │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ ├── a.go │ │ │ │ │ └── b.go │ │ │ │ │ └── typeparams │ │ │ │ │ └── typeparams.go │ │ │ ├── testinggoroutine.go │ │ │ ├── testinggoroutine_test.go │ │ │ └── util.go │ │ ├── tests │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ ├── a.go │ │ │ │ │ ├── a_test.go │ │ │ │ │ ├── ax_test.go │ │ │ │ │ └── go118_test.go │ │ │ │ │ ├── b │ │ │ │ │ └── b.go │ │ │ │ │ ├── b_x_test │ │ │ │ │ └── b_test.go │ │ │ │ │ ├── divergent │ │ │ │ │ ├── buf.go │ │ │ │ │ └── buf_test.go │ │ │ │ │ └── typeparams │ │ │ │ │ ├── typeparams.go │ │ │ │ │ └── typeparams_test.go │ │ │ ├── tests.go │ │ │ └── tests_test.go │ │ ├── timeformat │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ ├── a.go │ │ │ │ │ └── a.go.golden │ │ │ │ │ └── b │ │ │ │ │ └── b.go │ │ │ ├── timeformat.go │ │ │ └── timeformat_test.go │ │ ├── unmarshal │ │ │ ├── cmd │ │ │ │ └── unmarshal │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ └── a.go │ │ │ │ │ └── typeparams │ │ │ │ │ └── typeparams.go │ │ │ ├── unmarshal.go │ │ │ └── unmarshal_test.go │ │ ├── unreachable │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ └── a │ │ │ │ │ ├── a.go │ │ │ │ │ └── a.go.golden │ │ │ ├── unreachable.go │ │ │ └── unreachable_test.go │ │ ├── unsafeptr │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ ├── a.go │ │ │ │ │ └── issue40701.go │ │ │ │ │ └── typeparams │ │ │ │ │ └── typeparams.go │ │ │ ├── unsafeptr.go │ │ │ └── unsafeptr_test.go │ │ ├── unusedresult │ │ │ ├── cmd │ │ │ │ └── unusedresult │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ └── a.go │ │ │ │ │ └── typeparams │ │ │ │ │ ├── typeparams.go │ │ │ │ │ └── userdefs │ │ │ │ │ └── userdefs.go │ │ │ ├── unusedresult.go │ │ │ └── unusedresult_test.go │ │ ├── unusedwrite │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ └── unusedwrite.go │ │ │ │ │ └── importsunsafe │ │ │ │ │ └── i.go │ │ │ ├── unusedwrite.go │ │ │ └── unusedwrite_test.go │ │ ├── usesgenerics │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ └── a.go │ │ │ │ │ ├── b │ │ │ │ │ └── b.go │ │ │ │ │ ├── c │ │ │ │ │ └── c.go │ │ │ │ │ └── d │ │ │ │ │ └── d.go │ │ │ ├── usesgenerics.go │ │ │ └── usesgenerics_test.go │ │ └── waitgroup │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── testdata │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ │ ├── waitgroup.go │ │ │ └── waitgroup_test.go │ ├── singlechecker │ │ └── singlechecker.go │ ├── unitchecker │ │ ├── export_test.go │ │ ├── main.go │ │ ├── separate_test.go │ │ ├── unitchecker.go │ │ ├── unitchecker_test.go │ │ └── vet_std_test.go │ ├── validate.go │ └── validate_test.go ├── ast │ ├── astutil │ │ ├── enclosing.go │ │ ├── enclosing_test.go │ │ ├── imports.go │ │ ├── imports_test.go │ │ ├── rewrite.go │ │ ├── rewrite_test.go │ │ └── util.go │ ├── edge │ │ └── edge.go │ └── inspector │ │ ├── cursor.go │ │ ├── cursor_test.go │ │ ├── inspector.go │ │ ├── inspector_test.go │ │ ├── iter.go │ │ ├── iter_test.go │ │ ├── typeof.go │ │ └── walk.go ├── buildutil │ ├── allpackages.go │ ├── allpackages_test.go │ ├── fakecontext.go │ ├── overlay.go │ ├── overlay_test.go │ ├── tags.go │ ├── tags_test.go │ ├── util.go │ ├── util_test.go │ └── util_windows_test.go ├── callgraph │ ├── callgraph.go │ ├── callgraph_test.go │ ├── cha │ │ ├── cha.go │ │ ├── cha_test.go │ │ └── testdata │ │ │ ├── func.go │ │ │ ├── generics.go │ │ │ ├── iface.go │ │ │ ├── issue23925.go │ │ │ └── recv.go │ ├── internal │ │ └── chautil │ │ │ └── lazy.go │ ├── rta │ │ ├── rta.go │ │ ├── rta_test.go │ │ └── testdata │ │ │ ├── func.txtar │ │ │ ├── generics.txtar │ │ │ ├── iface.txtar │ │ │ ├── multipkgs.txtar │ │ │ ├── reflectcall.txtar │ │ │ └── rtype.txtar │ ├── static │ │ ├── static.go │ │ └── static_test.go │ ├── util.go │ └── vta │ │ ├── graph.go │ │ ├── graph_test.go │ │ ├── helpers_test.go │ │ ├── initial.go │ │ ├── internal │ │ └── trie │ │ │ ├── bits.go │ │ │ ├── bits_test.go │ │ │ ├── builder.go │ │ │ ├── op_test.go │ │ │ ├── scope.go │ │ │ ├── trie.go │ │ │ └── trie_test.go │ │ ├── propagation.go │ │ ├── propagation_test.go │ │ ├── testdata │ │ └── src │ │ │ ├── arrays_generics.go │ │ │ ├── callgraph_collections.go │ │ │ ├── callgraph_comma_maps.go │ │ │ ├── callgraph_field_funcs.go │ │ │ ├── callgraph_fields.go │ │ │ ├── callgraph_generics.go │ │ │ ├── callgraph_ho.go │ │ │ ├── callgraph_interfaces.go │ │ │ ├── callgraph_issue_57756.go │ │ │ ├── callgraph_nested_ptr.go │ │ │ ├── callgraph_pointers.go │ │ │ ├── callgraph_range_over_func.go │ │ │ ├── callgraph_recursive_types.go │ │ │ ├── callgraph_static.go │ │ │ ├── callgraph_type_aliases.go │ │ │ ├── channels.go │ │ │ ├── closures.go │ │ │ ├── d │ │ │ └── d.go │ │ │ ├── dynamic_calls.go │ │ │ ├── fields.go │ │ │ ├── function_alias.go │ │ │ ├── generic_channels.go │ │ │ ├── go117.go │ │ │ ├── issue63146.go │ │ │ ├── maps.go │ │ │ ├── node_uniqueness.go │ │ │ ├── panic.go │ │ │ ├── phi.go │ │ │ ├── phi_alias.go │ │ │ ├── ranges.go │ │ │ ├── returns.go │ │ │ ├── select.go │ │ │ ├── simple.go │ │ │ ├── static_calls.go │ │ │ ├── store.go │ │ │ ├── store_load_alias.go │ │ │ ├── stores_arrays.go │ │ │ ├── t │ │ │ └── t.go │ │ │ ├── type_assertions.go │ │ │ └── type_conversions.go │ │ ├── utils.go │ │ ├── vta.go │ │ └── vta_test.go ├── cfg │ ├── builder.go │ ├── cfg.go │ ├── cfg_test.go │ └── main.go ├── expect │ ├── expect.go │ ├── expect_test.go │ ├── extract.go │ └── testdata │ │ ├── go.fake.mod │ │ ├── go.fake.work │ │ └── test.go ├── gccgoexportdata │ ├── gccgoexportdata.go │ ├── gccgoexportdata_test.go │ └── testdata │ │ ├── errors.gox │ │ ├── long.a │ │ └── short.a ├── gcexportdata │ ├── example_test.go │ ├── gcexportdata.go │ ├── importer.go │ └── main.go ├── internal │ ├── cgo │ │ ├── cgo.go │ │ └── cgo_pkgconfig.go │ └── gccgoimporter │ │ ├── ar.go │ │ ├── backdoor.go │ │ ├── gccgoinstallation.go │ │ ├── gccgoinstallation_test.go │ │ ├── importer.go │ │ ├── importer_test.go │ │ ├── newInterface10.go │ │ ├── newInterface11.go │ │ ├── parser.go │ │ ├── parser_test.go │ │ ├── testdata │ │ ├── aliases.go │ │ ├── aliases.gox │ │ ├── complexnums.go │ │ ├── complexnums.gox │ │ ├── conversions.go │ │ ├── conversions.gox │ │ ├── escapeinfo.go │ │ ├── escapeinfo.gox │ │ ├── imports.go │ │ ├── imports.gox │ │ ├── issue27856.go │ │ ├── issue27856.gox │ │ ├── issue29198.go │ │ ├── issue29198.gox │ │ ├── issue30628.go │ │ ├── issue30628.gox │ │ ├── issue31540.go │ │ ├── issue31540.gox │ │ ├── issue34182.go │ │ ├── issue34182.gox │ │ ├── libimportsar.a │ │ ├── nointerface.go │ │ ├── nointerface.gox │ │ ├── notinheap.go │ │ ├── notinheap.gox │ │ ├── pointer.go │ │ ├── pointer.gox │ │ ├── time.gox │ │ ├── unicode.gox │ │ └── v1reflect.gox │ │ └── testenv_test.go ├── loader │ ├── doc.go │ ├── loader.go │ ├── loader_test.go │ ├── stdlib_test.go │ ├── testdata │ │ ├── a.go │ │ ├── b.go │ │ ├── badpkgdecl.go │ │ └── issue46877 │ │ │ ├── x.go │ │ │ └── x.h │ └── util.go ├── packages │ ├── doc.go │ ├── example_test.go │ ├── external.go │ ├── golist.go │ ├── golist_overlay.go │ ├── gopackages │ │ └── main.go │ ├── internal │ │ └── nodecount │ │ │ └── nodecount.go │ ├── loadmode_string.go │ ├── overlay_test.go │ ├── packages.go │ ├── packages_test.go │ ├── packagestest │ │ ├── expect.go │ │ ├── expect_test.go │ │ ├── export.go │ │ ├── export_test.go │ │ ├── gopath.go │ │ ├── gopath_test.go │ │ ├── modules.go │ │ ├── modules_test.go │ │ └── testdata │ │ │ ├── groups │ │ │ ├── one │ │ │ │ ├── modules │ │ │ │ │ └── example.com │ │ │ │ │ │ └── extra │ │ │ │ │ │ └── help.go │ │ │ │ └── primarymod │ │ │ │ │ └── main.go │ │ │ └── two │ │ │ │ ├── modules │ │ │ │ └── example.com │ │ │ │ │ ├── extra │ │ │ │ │ ├── geez │ │ │ │ │ │ └── help.go │ │ │ │ │ ├── v2 │ │ │ │ │ │ ├── geez │ │ │ │ │ │ │ └── help.go │ │ │ │ │ │ └── me.go │ │ │ │ │ └── yo.go │ │ │ │ │ ├── tempmod │ │ │ │ │ └── main.go │ │ │ │ │ ├── what@v1.0.0 │ │ │ │ │ └── main.go │ │ │ │ │ └── what@v1.1.0 │ │ │ │ │ └── main.go │ │ │ │ └── primarymod │ │ │ │ ├── expect │ │ │ │ ├── yo.go │ │ │ │ └── yo_test.go │ │ │ │ └── main.go │ │ │ ├── test.go │ │ │ ├── test_test.go │ │ │ └── x_test.go │ ├── stdlib_test.go │ └── visit.go ├── ssa │ ├── TODO │ ├── block.go │ ├── blockopt.go │ ├── builder.go │ ├── builder_generic_test.go │ ├── builder_test.go │ ├── const.go │ ├── const_test.go │ ├── create.go │ ├── doc.go │ ├── dom.go │ ├── dom_test.go │ ├── emit.go │ ├── example_test.go │ ├── func.go │ ├── instantiate.go │ ├── instantiate_test.go │ ├── interp │ │ ├── external.go │ │ ├── interp.go │ │ ├── interp_test.go │ │ ├── map.go │ │ ├── ops.go │ │ ├── rangefunc_test.go │ │ ├── reflect.go │ │ ├── testdata │ │ │ ├── boundmeth.go │ │ │ ├── complit.go │ │ │ ├── convert.go │ │ │ ├── coverage.go │ │ │ ├── deepequal.go │ │ │ ├── defer.go │ │ │ ├── fieldprom.go │ │ │ ├── fixedbugs │ │ │ │ ├── issue52342.go │ │ │ │ ├── issue52835.go │ │ │ │ ├── issue55086.go │ │ │ │ ├── issue55115.go │ │ │ │ ├── issue66783.go │ │ │ │ ├── issue69298.go │ │ │ │ └── issue69929.go │ │ │ ├── forvarlifetime_go122.go │ │ │ ├── forvarlifetime_old.go │ │ │ ├── ifaceconv.go │ │ │ ├── ifaceprom.go │ │ │ ├── initorder.go │ │ │ ├── methprom.go │ │ │ ├── minmax.go │ │ │ ├── mrvchain.go │ │ │ ├── range.go │ │ │ ├── rangefunc.go │ │ │ ├── rangeoverint.go │ │ │ ├── rangevarlifetime_go122.go │ │ │ ├── rangevarlifetime_old.go │ │ │ ├── recover.go │ │ │ ├── reflect.go │ │ │ ├── slice2array.go │ │ │ ├── slice2arrayptr.go │ │ │ ├── src │ │ │ │ ├── encoding │ │ │ │ │ └── encoding.go │ │ │ │ ├── errors │ │ │ │ │ └── errors.go │ │ │ │ ├── fmt │ │ │ │ │ └── fmt.go │ │ │ │ ├── io │ │ │ │ │ └── io.go │ │ │ │ ├── log │ │ │ │ │ └── log.go │ │ │ │ ├── math │ │ │ │ │ └── math.go │ │ │ │ ├── os │ │ │ │ │ └── os.go │ │ │ │ ├── reflect │ │ │ │ │ ├── deepequal.go │ │ │ │ │ └── reflect.go │ │ │ │ ├── runtime │ │ │ │ │ └── runtime.go │ │ │ │ ├── sort │ │ │ │ │ └── sort.go │ │ │ │ ├── strconv │ │ │ │ │ └── strconv.go │ │ │ │ ├── strings │ │ │ │ │ └── strings.go │ │ │ │ ├── sync │ │ │ │ │ └── sync.go │ │ │ │ ├── time │ │ │ │ │ └── time.go │ │ │ │ ├── unicode │ │ │ │ │ └── utf8 │ │ │ │ │ │ └── utf8.go │ │ │ │ └── unsafe │ │ │ │ │ └── unsafe.go │ │ │ ├── static.go │ │ │ ├── typeassert.go │ │ │ ├── width32.go │ │ │ └── zeros.go │ │ └── value.go │ ├── lift.go │ ├── lvalue.go │ ├── methods.go │ ├── methods_test.go │ ├── mode.go │ ├── print.go │ ├── sanity.go │ ├── source.go │ ├── source_test.go │ ├── ssa.go │ ├── ssautil │ │ ├── deprecated.go │ │ ├── deprecated_test.go │ │ ├── load.go │ │ ├── load_test.go │ │ ├── switch.go │ │ ├── switch_test.go │ │ ├── testdata │ │ │ └── switches.txtar │ │ └── visit.go │ ├── stdlib_test.go │ ├── subst.go │ ├── subst_test.go │ ├── task.go │ ├── testdata │ │ ├── fixedbugs │ │ │ ├── issue66783a.go │ │ │ ├── issue66783b.go │ │ │ └── issue73594.go │ │ ├── indirect.txtar │ │ ├── objlookup.go │ │ ├── src │ │ │ ├── README.txt │ │ │ ├── bytes │ │ │ │ └── bytes.go │ │ │ ├── context │ │ │ │ └── context.go │ │ │ ├── encoding │ │ │ │ ├── encoding.go │ │ │ │ ├── json │ │ │ │ │ └── json.go │ │ │ │ └── xml │ │ │ │ │ └── xml.go │ │ │ ├── errors │ │ │ │ └── errors.go │ │ │ ├── fmt │ │ │ │ └── fmt.go │ │ │ ├── io │ │ │ │ └── io.go │ │ │ ├── log │ │ │ │ └── log.go │ │ │ ├── math │ │ │ │ └── math.go │ │ │ ├── os │ │ │ │ └── os.go │ │ │ ├── reflect │ │ │ │ └── reflect.go │ │ │ ├── runtime │ │ │ │ └── runtime.go │ │ │ ├── sort │ │ │ │ └── sort.go │ │ │ ├── strconv │ │ │ │ └── strconv.go │ │ │ ├── strings │ │ │ │ └── strings.go │ │ │ ├── sync │ │ │ │ ├── atomic │ │ │ │ │ └── atomic.go │ │ │ │ └── sync.go │ │ │ ├── time │ │ │ │ └── time.go │ │ │ └── unsafe │ │ │ │ └── unsafe.go │ │ ├── structconv.go │ │ └── valueforexpr.go │ ├── testutil_test.go │ ├── typeset.go │ ├── util.go │ └── wrappers.go └── types │ ├── internal │ └── play │ │ └── play.go │ ├── objectpath │ ├── objectpath.go │ ├── objectpath_go118_test.go │ └── objectpath_test.go │ └── typeutil │ ├── callee.go │ ├── callee_test.go │ ├── example_test.go │ ├── imports.go │ ├── imports_test.go │ ├── map.go │ ├── map_test.go │ ├── methodsetcache.go │ ├── ui.go │ └── ui_test.go ├── godoc ├── README.md ├── analysis │ ├── analysis.go │ └── json.go ├── corpus.go ├── dirtrees.go ├── dirtrees_test.go ├── format.go ├── godoc.go ├── godoc17_test.go ├── godoc_test.go ├── index.go ├── index_test.go ├── linkify.go ├── markdown.go ├── meta.go ├── page.go ├── parser.go ├── pres.go ├── redirect │ ├── redirect.go │ └── redirect_test.go ├── search.go ├── server.go ├── server_test.go ├── snippet.go ├── spec.go ├── spec_test.go ├── spot.go ├── static │ ├── analysis │ │ ├── call-eg.png │ │ ├── call3.png │ │ ├── callers1.png │ │ ├── callers2.png │ │ ├── chan1.png │ │ ├── chan2a.png │ │ ├── chan2b.png │ │ ├── error1.png │ │ ├── help.html │ │ ├── ident-def.png │ │ ├── ident-field.png │ │ ├── ident-func.png │ │ ├── ipcg-func.png │ │ ├── ipcg-pkg.png │ │ ├── typeinfo-pkg.png │ │ └── typeinfo-src.png │ ├── callgraph.html │ ├── dirlist.html │ ├── doc.go │ ├── error.html │ ├── example.html │ ├── favicon.ico │ ├── gen.go │ ├── gen_test.go │ ├── godoc.html │ ├── godocs.js │ ├── gopher │ │ └── pkg.png │ ├── images │ │ ├── minus.gif │ │ ├── plus.gif │ │ ├── treeview-black-line.gif │ │ ├── treeview-black.gif │ │ ├── treeview-default-line.gif │ │ ├── treeview-default.gif │ │ ├── treeview-gray-line.gif │ │ └── treeview-gray.gif │ ├── implements.html │ ├── jquery.js │ ├── jquery.treeview.css │ ├── jquery.treeview.edit.js │ ├── jquery.treeview.js │ ├── makestatic.go │ ├── methodset.html │ ├── package.html │ ├── packageroot.html │ ├── play.js │ ├── playground.js │ ├── search.html │ ├── searchcode.html │ ├── searchdoc.html │ ├── searchtxt.html │ ├── static.go │ └── style.css ├── tab.go ├── template.go ├── util │ ├── throttle.go │ └── util.go ├── versions.go ├── versions_test.go └── vfs │ ├── emptyvfs.go │ ├── fs.go │ ├── gatefs │ ├── gatefs.go │ └── gatefs_test.go │ ├── httpfs │ └── httpfs.go │ ├── mapfs │ ├── mapfs.go │ └── mapfs_test.go │ ├── namespace.go │ ├── namespace_test.go │ ├── os.go │ ├── os_test.go │ ├── vfs.go │ └── zipfs │ ├── zipfs.go │ └── zipfs_test.go ├── gopls ├── README.md ├── doc │ ├── advanced.md │ ├── analyzers.md │ ├── assets │ │ ├── add-test-for-func.png │ │ ├── assets.go │ │ ├── browse-assembly.png │ │ ├── browse-free-symbols.png │ │ ├── browse-pkg-doc.png │ │ ├── code-action-doc.png │ │ ├── convert-string-interpreted.png │ │ ├── convert-string-raw.png │ │ ├── diagnostic-analysis.png │ │ ├── diagnostic-typeerror.png │ │ ├── document-highlight.png │ │ ├── documentlink.png │ │ ├── extract-function-after.png │ │ ├── extract-function-before.png │ │ ├── extract-to-new-file-after.png │ │ ├── extract-to-new-file-before.png │ │ ├── extract-val-all-before.png │ │ ├── extract-var-after.png │ │ ├── extract-var-all-after.png │ │ ├── extract-var-before.png │ │ ├── fill-struct-after.png │ │ ├── fill-struct-before.png │ │ ├── fill-switch-after.png │ │ ├── fill-switch-before.png │ │ ├── fill-switch-enum-after.png │ │ ├── fill-switch-enum-before.png │ │ ├── foldingrange.png │ │ ├── go.mod │ │ ├── hover-basic.png │ │ ├── hover-doclink.png │ │ ├── hover-embed.png │ │ ├── hover-field-tag.png │ │ ├── hover-linkname.png │ │ ├── hover-size-field.png │ │ ├── hover-size-struct.png │ │ ├── hover-size-wasteful.png │ │ ├── inlayhint-parameternames.png │ │ ├── invert-if-after.png │ │ ├── invert-if-before.png │ │ ├── outgoingcalls.png │ │ ├── remove-unusedparam-after.png │ │ ├── remove-unusedparam-before.png │ │ ├── rename-conflict.png │ │ ├── signature-help.png │ │ ├── subtypes.png │ │ └── supertypes.png │ ├── codelenses.md │ ├── command-line.md │ ├── contributing.md │ ├── daemon.md │ ├── design │ │ ├── architecture.svg │ │ ├── design.md │ │ ├── implementation.md │ │ └── integrating.md │ ├── emacs.md │ ├── features │ │ ├── README.md │ │ ├── completion.md │ │ ├── diagnostics.md │ │ ├── modfiles.md │ │ ├── navigation.md │ │ ├── passive.md │ │ ├── templates.md │ │ ├── transformation.md │ │ └── web.md │ ├── helix.md │ ├── inlayHints.md │ ├── inline-after.png │ ├── inline-before.png │ ├── refactor-inline.md │ ├── release │ │ ├── README │ │ ├── v0.16.0.md │ │ ├── v0.17.0.md │ │ ├── v0.18.0.md │ │ └── v0.19.0.md │ ├── releases.md │ ├── semantictokens.md │ ├── settings.md │ ├── subl.md │ ├── troubleshooting.md │ ├── vim.md │ ├── workspace.md │ └── zeroconfig.png ├── go.mod ├── go.sum ├── integration │ └── govim │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── artifacts.go │ │ ├── cloudbuild.harness.yaml │ │ ├── cloudbuild.yaml │ │ ├── run_local.sh │ │ └── run_tests_for_cloudbuild.sh ├── internal │ ├── analysis │ │ ├── deprecated │ │ │ ├── deprecated.go │ │ │ ├── deprecated_test.go │ │ │ ├── doc.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── a.go │ │ │ │ └── a_test.go │ │ ├── embeddirective │ │ │ ├── doc.go │ │ │ ├── embeddirective.go │ │ │ ├── embeddirective_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── embedText │ │ │ │ ├── import_missing.go │ │ │ │ ├── import_present.go │ │ │ │ └── import_present_go120.go │ │ ├── fillreturns │ │ │ ├── doc.go │ │ │ ├── fillreturns.go │ │ │ ├── fillreturns_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ │ │ └── typeparams │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ ├── fillstruct │ │ │ ├── fillstruct.go │ │ │ ├── fillstruct_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ ├── b │ │ │ │ └── b.go │ │ │ │ └── typeparams │ │ │ │ └── typeparams.go │ │ ├── fillswitch │ │ │ ├── doc.go │ │ │ ├── fillswitch.go │ │ │ ├── fillswitch_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ └── a.go │ │ │ │ └── b │ │ │ │ └── b.go │ │ ├── infertypeargs │ │ │ ├── infertypeargs.go │ │ │ ├── infertypeargs_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ ├── basic.go │ │ │ │ ├── basic.go.golden │ │ │ │ ├── imported.go │ │ │ │ ├── imported.go.golden │ │ │ │ ├── imported │ │ │ │ └── imported.go │ │ │ │ ├── notypechange.go │ │ │ │ └── notypechange.go.golden │ │ ├── maprange │ │ │ ├── cmd │ │ │ │ └── maprange │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── maprange.go │ │ │ ├── maprange_test.go │ │ │ └── testdata │ │ │ │ ├── basic.txtar │ │ │ │ └── old.txtar │ │ ├── modernize │ │ │ ├── bloop.go │ │ │ ├── cmd │ │ │ │ └── modernize │ │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── efaceany.go │ │ │ ├── fmtappendf.go │ │ │ ├── forvar.go │ │ │ ├── maps.go │ │ │ ├── minmax.go │ │ │ ├── modernize.go │ │ │ ├── modernize_test.go │ │ │ ├── omitzero.go │ │ │ ├── rangeint.go │ │ │ ├── slices.go │ │ │ ├── slicescontains.go │ │ │ ├── slicesdelete.go │ │ │ ├── sortslice.go │ │ │ ├── stringscutprefix.go │ │ │ ├── stringsseq.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── appendclipped │ │ │ │ │ ├── appendclipped.go │ │ │ │ │ ├── appendclipped.go.golden │ │ │ │ │ ├── bytesclone.go │ │ │ │ │ └── bytesclone.go.golden │ │ │ │ │ ├── bloop │ │ │ │ │ ├── bloop.go │ │ │ │ │ ├── bloop_test.go │ │ │ │ │ └── bloop_test.go.golden │ │ │ │ │ ├── efaceany │ │ │ │ │ ├── efaceany.go │ │ │ │ │ └── efaceany.go.golden │ │ │ │ │ ├── fieldsseq │ │ │ │ │ ├── fieldsseq.go │ │ │ │ │ ├── fieldsseq.go.golden │ │ │ │ │ └── fieldsseq_go123.go │ │ │ │ │ ├── fmtappendf │ │ │ │ │ ├── fmtappendf.go │ │ │ │ │ └── fmtappendf.go.golden │ │ │ │ │ ├── forvar │ │ │ │ │ ├── forvar.go │ │ │ │ │ └── forvar.go.golden │ │ │ │ │ ├── mapsloop │ │ │ │ │ ├── mapsloop.go │ │ │ │ │ ├── mapsloop.go.golden │ │ │ │ │ ├── mapsloop_dot.go │ │ │ │ │ └── mapsloop_dot.go.golden │ │ │ │ │ ├── minmax │ │ │ │ │ ├── minmax.go │ │ │ │ │ └── minmax.go.golden │ │ │ │ │ ├── omitzero │ │ │ │ │ ├── omitzero.go │ │ │ │ │ └── omitzero.go.golden │ │ │ │ │ ├── rangeint │ │ │ │ │ ├── rangeint.go │ │ │ │ │ └── rangeint.go.golden │ │ │ │ │ ├── slicescontains │ │ │ │ │ ├── slicescontains.go │ │ │ │ │ └── slicescontains.go.golden │ │ │ │ │ ├── slicesdelete │ │ │ │ │ ├── slicesdelete.go │ │ │ │ │ └── slicesdelete.go.golden │ │ │ │ │ ├── sortslice │ │ │ │ │ ├── sortslice.go │ │ │ │ │ ├── sortslice.go.golden │ │ │ │ │ ├── sortslice_dot.go │ │ │ │ │ └── sortslice_dot.go.golden │ │ │ │ │ ├── splitseq │ │ │ │ │ ├── splitseq.go │ │ │ │ │ ├── splitseq.go.golden │ │ │ │ │ └── splitseq_go123.go │ │ │ │ │ ├── stringscutprefix │ │ │ │ │ ├── bytescutprefix │ │ │ │ │ │ ├── bytescutprefix.go │ │ │ │ │ │ ├── bytescutprefix.go.golden │ │ │ │ │ │ ├── bytescutprefix_dot.go │ │ │ │ │ │ └── bytescutprefix_dot.go.golden │ │ │ │ │ ├── stringscutprefix.go │ │ │ │ │ ├── stringscutprefix.go.golden │ │ │ │ │ ├── stringscutprefix_dot.go │ │ │ │ │ └── stringscutprefix_dot.go.golden │ │ │ │ │ ├── testingcontext │ │ │ │ │ ├── testingcontext.go │ │ │ │ │ ├── testingcontext_test.go │ │ │ │ │ └── testingcontext_test.go.golden │ │ │ │ │ └── waitgroup │ │ │ │ │ ├── waitgroup.go │ │ │ │ │ ├── waitgroup.go.golden │ │ │ │ │ ├── waitgroup_alias.go │ │ │ │ │ ├── waitgroup_alias.go.golden │ │ │ │ │ ├── waitgroup_dot.go │ │ │ │ │ └── waitgroup_dot.go.golden │ │ │ ├── testingcontext.go │ │ │ └── waitgroup.go │ │ ├── nonewvars │ │ │ ├── doc.go │ │ │ ├── nonewvars.go │ │ │ ├── nonewvars_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ │ │ └── typeparams │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ ├── noresultvalues │ │ │ ├── doc.go │ │ │ ├── noresultvalues.go │ │ │ ├── noresultvalues_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ │ │ └── typeparams │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ ├── recursiveiter │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── recursiveiter.go │ │ │ ├── recursiveiter_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ ├── simplifycompositelit │ │ │ ├── doc.go │ │ │ ├── simplifycompositelit.go │ │ │ ├── simplifycompositelit_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ │ │ └── generatedcode │ │ │ │ ├── generatedcode.go │ │ │ │ └── generatedcode.go.golden │ │ ├── simplifyrange │ │ │ ├── doc.go │ │ │ ├── simplifyrange.go │ │ │ ├── simplifyrange_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ │ │ ├── generatedcode │ │ │ │ ├── generatedcode.go │ │ │ │ └── generatedcode.go.golden │ │ │ │ └── rangeoverfunc │ │ │ │ ├── rangeoverfunc.go │ │ │ │ └── rangeoverfunc.go.golden │ │ ├── simplifyslice │ │ │ ├── doc.go │ │ │ ├── simplifyslice.go │ │ │ ├── simplifyslice_test.go │ │ │ └── testdata │ │ │ │ └── src │ │ │ │ ├── a │ │ │ │ ├── a.go │ │ │ │ └── a.go.golden │ │ │ │ ├── generatedcode │ │ │ │ ├── generatedcode.go │ │ │ │ └── generatedcode.go.golden │ │ │ │ └── typeparams │ │ │ │ ├── typeparams.go │ │ │ │ └── typeparams.go.golden │ │ ├── unusedfunc │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ └── a │ │ │ │ │ ├── a.go │ │ │ │ │ └── a.go.golden │ │ │ ├── unusedfunc.go │ │ │ └── unusedfunc_test.go │ │ ├── unusedparams │ │ │ ├── cmd │ │ │ │ └── main.go │ │ │ ├── doc.go │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── a │ │ │ │ │ ├── a.go │ │ │ │ │ └── a.go.golden │ │ │ │ │ ├── generatedcode │ │ │ │ │ ├── generatedcode.go │ │ │ │ │ ├── generatedcode.go.golden │ │ │ │ │ ├── nongeneratedcode.go │ │ │ │ │ └── nongeneratedcode.go.golden │ │ │ │ │ └── typeparams │ │ │ │ │ ├── typeparams.go │ │ │ │ │ └── typeparams.go.golden │ │ │ ├── unusedparams.go │ │ │ └── unusedparams_test.go │ │ ├── unusedvariable │ │ │ ├── testdata │ │ │ │ └── src │ │ │ │ │ ├── assign │ │ │ │ │ ├── a.go │ │ │ │ │ └── a.go.golden │ │ │ │ │ └── decl │ │ │ │ │ ├── a.go │ │ │ │ │ └── a.go.golden │ │ │ ├── unusedvariable.go │ │ │ └── unusedvariable_test.go │ │ └── yield │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── testdata │ │ │ └── src │ │ │ │ └── a │ │ │ │ └── a.go │ │ │ ├── yield.go │ │ │ └── yield_test.go │ ├── bloom │ │ ├── filter.go │ │ └── filter_test.go │ ├── cache │ │ ├── analysis.go │ │ ├── cache.go │ │ ├── check.go │ │ ├── constraints.go │ │ ├── constraints_test.go │ │ ├── debug.go │ │ ├── diagnostics.go │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── filemap.go │ │ ├── filemap_test.go │ │ ├── filterer.go │ │ ├── fs_memoized.go │ │ ├── fs_overlay.go │ │ ├── future.go │ │ ├── future_test.go │ │ ├── imports.go │ │ ├── keys.go │ │ ├── load.go │ │ ├── metadata │ │ │ ├── cycle_test.go │ │ │ ├── graph.go │ │ │ └── metadata.go │ │ ├── methodsets │ │ │ └── methodsets.go │ │ ├── mod.go │ │ ├── mod_tidy.go │ │ ├── mod_vuln.go │ │ ├── os_darwin.go │ │ ├── os_windows.go │ │ ├── package.go │ │ ├── parse.go │ │ ├── parse_cache.go │ │ ├── parse_cache_test.go │ │ ├── parsego │ │ │ ├── file.go │ │ │ ├── parse.go │ │ │ ├── parse_test.go │ │ │ ├── resolver.go │ │ │ ├── resolver_compat.go │ │ │ ├── resolver_gen.go │ │ │ └── resolver_test.go │ │ ├── port.go │ │ ├── port_test.go │ │ ├── session.go │ │ ├── session_test.go │ │ ├── snapshot.go │ │ ├── source.go │ │ ├── symbols.go │ │ ├── symbols │ │ │ └── symbols.go │ │ ├── testfuncs │ │ │ ├── match.go │ │ │ └── tests.go │ │ ├── typerefs │ │ │ ├── doc.go │ │ │ ├── packageset.go │ │ │ ├── pkggraph_test.go │ │ │ ├── pkgrefs_test.go │ │ │ ├── refs.go │ │ │ └── refs_test.go │ │ ├── view.go │ │ ├── view_test.go │ │ ├── workspace.go │ │ └── xrefs │ │ │ └── xrefs.go │ ├── clonetest │ │ ├── clonetest.go │ │ └── clonetest_test.go │ ├── cmd │ │ ├── call_hierarchy.go │ │ ├── capabilities_test.go │ │ ├── check.go │ │ ├── cmd.go │ │ ├── codeaction.go │ │ ├── codelens.go │ │ ├── definition.go │ │ ├── execute.go │ │ ├── folding_range.go │ │ ├── format.go │ │ ├── help_test.go │ │ ├── highlight.go │ │ ├── implementation.go │ │ ├── imports.go │ │ ├── info.go │ │ ├── integration_test.go │ │ ├── links.go │ │ ├── parsespan.go │ │ ├── prepare_rename.go │ │ ├── references.go │ │ ├── remote.go │ │ ├── rename.go │ │ ├── semantictokens.go │ │ ├── serve.go │ │ ├── signature.go │ │ ├── span.go │ │ ├── spanformat_test.go │ │ ├── stats.go │ │ ├── subcommands.go │ │ ├── symbols.go │ │ ├── usage │ │ │ ├── api-json.hlp │ │ │ ├── bug.hlp │ │ │ ├── call_hierarchy.hlp │ │ │ ├── check.hlp │ │ │ ├── codeaction.hlp │ │ │ ├── codelens.hlp │ │ │ ├── definition.hlp │ │ │ ├── execute.hlp │ │ │ ├── fix.hlp │ │ │ ├── folding_ranges.hlp │ │ │ ├── format.hlp │ │ │ ├── help.hlp │ │ │ ├── highlight.hlp │ │ │ ├── implementation.hlp │ │ │ ├── imports.hlp │ │ │ ├── inspect.hlp │ │ │ ├── licenses.hlp │ │ │ ├── links.hlp │ │ │ ├── prepare_rename.hlp │ │ │ ├── references.hlp │ │ │ ├── remote.hlp │ │ │ ├── rename.hlp │ │ │ ├── semtok.hlp │ │ │ ├── serve.hlp │ │ │ ├── signature.hlp │ │ │ ├── stats.hlp │ │ │ ├── symbols.hlp │ │ │ ├── usage-v.hlp │ │ │ ├── usage.hlp │ │ │ ├── version.hlp │ │ │ ├── vulncheck.hlp │ │ │ └── workspace_symbol.hlp │ │ ├── vulncheck.go │ │ └── workspace_symbol.go │ ├── debug │ │ ├── flight.go │ │ ├── flight_go124.go │ │ ├── info.go │ │ ├── info_test.go │ │ ├── log │ │ │ └── log.go │ │ ├── metrics.go │ │ ├── rpc.go │ │ ├── serve.go │ │ ├── template_test.go │ │ └── trace.go │ ├── doc │ │ ├── api.go │ │ ├── api.json │ │ └── generate │ │ │ ├── generate.go │ │ │ └── generate_test.go │ ├── file │ │ ├── file.go │ │ ├── hash.go │ │ ├── kind.go │ │ └── modification.go │ ├── filecache │ │ ├── filecache.go │ │ └── filecache_test.go │ ├── fuzzy │ │ ├── input.go │ │ ├── input_test.go │ │ ├── matcher.go │ │ ├── matcher_test.go │ │ ├── self_test.go │ │ ├── symbol.go │ │ └── symbol_test.go │ ├── goasm │ │ └── definition.go │ ├── golang │ │ ├── add_import.go │ │ ├── addtest.go │ │ ├── assembly.go │ │ ├── call_hierarchy.go │ │ ├── change_quote.go │ │ ├── change_signature.go │ │ ├── code_lens.go │ │ ├── codeaction.go │ │ ├── comment.go │ │ ├── compileropt.go │ │ ├── completion │ │ │ ├── builtin.go │ │ │ ├── completion.go │ │ │ ├── deep_completion.go │ │ │ ├── deep_completion_test.go │ │ │ ├── definition.go │ │ │ ├── format.go │ │ │ ├── fuzz.go │ │ │ ├── keywords.go │ │ │ ├── labels.go │ │ │ ├── literal.go │ │ │ ├── newfile.go │ │ │ ├── package.go │ │ │ ├── package_test.go │ │ │ ├── postfix_snippets.go │ │ │ ├── printf.go │ │ │ ├── printf_test.go │ │ │ ├── snippet.go │ │ │ ├── snippet │ │ │ │ ├── snippet_builder.go │ │ │ │ └── snippet_builder_test.go │ │ │ ├── statements.go │ │ │ ├── unify.go │ │ │ ├── unimported.go │ │ │ └── util.go │ │ ├── definition.go │ │ ├── diagnostics.go │ │ ├── embeddirective.go │ │ ├── extract.go │ │ ├── extracttofile.go │ │ ├── fix.go │ │ ├── folding_range.go │ │ ├── format.go │ │ ├── format_test.go │ │ ├── freesymbols.go │ │ ├── freesymbols_test.go │ │ ├── highlight.go │ │ ├── hover.go │ │ ├── hover_test.go │ │ ├── identifier.go │ │ ├── identifier_test.go │ │ ├── implementation.go │ │ ├── implementation_test.go │ │ ├── inlay_hint.go │ │ ├── inline.go │ │ ├── inline_all.go │ │ ├── invertifcondition.go │ │ ├── known_packages.go │ │ ├── lines.go │ │ ├── linkname.go │ │ ├── modify_tags.go │ │ ├── origin.go │ │ ├── pkgdoc.go │ │ ├── references.go │ │ ├── rename.go │ │ ├── rename_check.go │ │ ├── semtok.go │ │ ├── signature_help.go │ │ ├── snapshot.go │ │ ├── stub.go │ │ ├── stubmethods │ │ │ ├── stubcalledfunc.go │ │ │ └── stubmethods.go │ │ ├── symbols.go │ │ ├── type_definition.go │ │ ├── type_hierarchy.go │ │ ├── types_format.go │ │ ├── undeclared.go │ │ ├── util.go │ │ ├── workspace_symbol.go │ │ └── workspace_symbol_test.go │ ├── label │ │ └── keys.go │ ├── licenses │ │ ├── gen-licenses.sh │ │ ├── licenses.go │ │ └── licenses_test.go │ ├── lsprpc │ │ ├── autostart_default.go │ │ ├── autostart_posix.go │ │ ├── binder.go │ │ ├── binder_test.go │ │ ├── commandinterceptor_test.go │ │ ├── dialer.go │ │ ├── export_test.go │ │ ├── goenv.go │ │ ├── goenv_test.go │ │ ├── lsprpc.go │ │ ├── lsprpc_test.go │ │ └── middleware_test.go │ ├── mcp │ │ ├── context.go │ │ ├── mcp.go │ │ └── mcp_test.go │ ├── mod │ │ ├── code_lens.go │ │ ├── diagnostics.go │ │ ├── format.go │ │ ├── hover.go │ │ └── inlay_hint.go │ ├── progress │ │ ├── progress.go │ │ └── progress_test.go │ ├── protocol │ │ ├── command │ │ │ ├── command_gen.go │ │ │ ├── commandmeta │ │ │ │ └── meta.go │ │ │ ├── gen │ │ │ │ └── gen.go │ │ │ ├── generate.go │ │ │ ├── interface.go │ │ │ ├── interface_test.go │ │ │ └── util.go │ │ ├── context.go │ │ ├── doc.go │ │ ├── edits.go │ │ ├── enums.go │ │ ├── generate │ │ │ ├── README.md │ │ │ ├── generate.go │ │ │ ├── main.go │ │ │ ├── main_test.go │ │ │ ├── output.go │ │ │ ├── tables.go │ │ │ ├── typenames.go │ │ │ └── types.go │ │ ├── json_test.go │ │ ├── log.go │ │ ├── mapper.go │ │ ├── mapper_test.go │ │ ├── protocol.go │ │ ├── semtok │ │ │ └── semtok.go │ │ ├── span.go │ │ ├── tsclient.go │ │ ├── tsdocument_changes.go │ │ ├── tsinsertreplaceedit.go │ │ ├── tsinsertreplaceedit_test.go │ │ ├── tsjson.go │ │ ├── tsprotocol.go │ │ ├── tsserver.go │ │ ├── uri.go │ │ ├── uri_test.go │ │ └── uri_windows_test.go │ ├── server │ │ ├── assets │ │ │ ├── common.css │ │ │ ├── common.js │ │ │ ├── favicon.ico │ │ │ └── go-logo-blue.svg │ │ ├── call_hierarchy.go │ │ ├── code_action.go │ │ ├── code_lens.go │ │ ├── command.go │ │ ├── completion.go │ │ ├── counters.go │ │ ├── debug.go │ │ ├── definition.go │ │ ├── diagnostics.go │ │ ├── folding_range.go │ │ ├── format.go │ │ ├── general.go │ │ ├── highlight.go │ │ ├── hover.go │ │ ├── implementation.go │ │ ├── inlay_hint.go │ │ ├── link.go │ │ ├── prompt.go │ │ ├── prompt_test.go │ │ ├── references.go │ │ ├── rename.go │ │ ├── selection_range.go │ │ ├── semantic.go │ │ ├── server.go │ │ ├── signature_help.go │ │ ├── symbols.go │ │ ├── text_synchronization.go │ │ ├── type_hierarchy.go │ │ ├── unimplemented.go │ │ ├── workspace.go │ │ └── workspace_symbol.go │ ├── settings │ │ ├── analysis.go │ │ ├── codeactionkind.go │ │ ├── default.go │ │ ├── settings.go │ │ ├── settings_test.go │ │ ├── staticcheck.go │ │ └── vet_test.go │ ├── telemetry │ │ ├── counterpath.go │ │ ├── counterpath_test.go │ │ ├── latency.go │ │ └── telemetry_test.go │ ├── template │ │ ├── completion.go │ │ ├── completion_test.go │ │ ├── highlight.go │ │ ├── implementations.go │ │ ├── parse.go │ │ ├── parse_test.go │ │ └── symbols.go │ ├── test │ │ ├── compare │ │ │ ├── text.go │ │ │ └── text_test.go │ │ ├── integration │ │ │ ├── bench │ │ │ │ ├── bench_test.go │ │ │ │ ├── codeaction_test.go │ │ │ │ ├── completion_test.go │ │ │ │ ├── definition_test.go │ │ │ │ ├── diagnostic_test.go │ │ │ │ ├── didchange_test.go │ │ │ │ ├── doc.go │ │ │ │ ├── hover_test.go │ │ │ │ ├── implementations_test.go │ │ │ │ ├── imports_test.go │ │ │ │ ├── iwl_test.go │ │ │ │ ├── references_test.go │ │ │ │ ├── reload_test.go │ │ │ │ ├── rename_test.go │ │ │ │ ├── repo_test.go │ │ │ │ ├── stress_test.go │ │ │ │ ├── tests_test.go │ │ │ │ ├── typing_test.go │ │ │ │ ├── unimported_test.go │ │ │ │ └── workspace_symbols_test.go │ │ │ ├── codelens │ │ │ │ └── codelens_test.go │ │ │ ├── completion │ │ │ │ ├── completion18_test.go │ │ │ │ ├── completion_test.go │ │ │ │ ├── fixedbugs_test.go │ │ │ │ └── postfix_snippet_test.go │ │ │ ├── debug │ │ │ │ └── debug_test.go │ │ │ ├── diagnostics │ │ │ │ ├── analysis_test.go │ │ │ │ ├── builtin_test.go │ │ │ │ ├── diagnostics_test.go │ │ │ │ ├── golist_test.go │ │ │ │ ├── gopackagesdriver_test.go │ │ │ │ ├── invalidation_test.go │ │ │ │ └── undeclared_test.go │ │ │ ├── doc.go │ │ │ ├── env.go │ │ │ ├── env_test.go │ │ │ ├── expectation.go │ │ │ ├── fake │ │ │ │ ├── client.go │ │ │ │ ├── doc.go │ │ │ │ ├── edit.go │ │ │ │ ├── edit_test.go │ │ │ │ ├── editor.go │ │ │ │ ├── editor_test.go │ │ │ │ ├── glob │ │ │ │ │ ├── glob.go │ │ │ │ │ └── glob_test.go │ │ │ │ ├── proxy.go │ │ │ │ ├── sandbox.go │ │ │ │ ├── workdir.go │ │ │ │ ├── workdir_test.go │ │ │ │ └── workdir_windows.go │ │ │ ├── inlayhints │ │ │ │ └── inlayhints_test.go │ │ │ ├── misc │ │ │ │ ├── call_hierarchy_test.go │ │ │ │ ├── codeactions_test.go │ │ │ │ ├── compileropt_test.go │ │ │ │ ├── configuration_test.go │ │ │ │ ├── debugserver_test.go │ │ │ │ ├── definition_test.go │ │ │ │ ├── embed_test.go │ │ │ │ ├── extract_test.go │ │ │ │ ├── failures_test.go │ │ │ │ ├── fix_test.go │ │ │ │ ├── formatting_test.go │ │ │ │ ├── generate_test.go │ │ │ │ ├── highlight_test.go │ │ │ │ ├── hover_test.go │ │ │ │ ├── import_test.go │ │ │ │ ├── imports_test.go │ │ │ │ ├── link_test.go │ │ │ │ ├── misc_test.go │ │ │ │ ├── modify_tags_test.go │ │ │ │ ├── multiple_adhoc_test.go │ │ │ │ ├── package_symbols_test.go │ │ │ │ ├── prompt_test.go │ │ │ │ ├── references_test.go │ │ │ │ ├── rename_test.go │ │ │ │ ├── semantictokens_test.go │ │ │ │ ├── settings_test.go │ │ │ │ ├── shared_test.go │ │ │ │ ├── signature_help_test.go │ │ │ │ ├── staticcheck_test.go │ │ │ │ ├── test_test.go │ │ │ │ ├── vendor_test.go │ │ │ │ ├── vuln_test.go │ │ │ │ └── workspace_symbol_test.go │ │ │ ├── modfile │ │ │ │ ├── modfile_test.go │ │ │ │ └── tempmodfile_test.go │ │ │ ├── options.go │ │ │ ├── regtest.go │ │ │ ├── runner.go │ │ │ ├── template │ │ │ │ └── template_test.go │ │ │ ├── watch │ │ │ │ ├── setting_test.go │ │ │ │ └── watch_test.go │ │ │ ├── web │ │ │ │ ├── assembly_test.go │ │ │ │ ├── flight_test.go │ │ │ │ ├── freesymbols_test.go │ │ │ │ ├── pkdoc_test.go │ │ │ │ └── util_test.go │ │ │ ├── workspace │ │ │ │ ├── adhoc_test.go │ │ │ │ ├── broken_test.go │ │ │ │ ├── didcreatefiles_test.go │ │ │ │ ├── directoryfilters_test.go │ │ │ │ ├── fromenv_test.go │ │ │ │ ├── goversion_test.go │ │ │ │ ├── metadata_test.go │ │ │ │ ├── misspelling_test.go │ │ │ │ ├── modules_test.go │ │ │ │ ├── multi_folder_test.go │ │ │ │ ├── packages_test.go │ │ │ │ ├── quickfix_test.go │ │ │ │ ├── standalone_test.go │ │ │ │ ├── std_test.go │ │ │ │ ├── vendor_test.go │ │ │ │ ├── workspace_test.go │ │ │ │ └── zero_config_test.go │ │ │ └── wrappers.go │ │ └── marker │ │ │ ├── doc.go │ │ │ ├── marker_test.go │ │ │ └── testdata │ │ │ ├── callhierarchy │ │ │ ├── callhierarchy.txt │ │ │ ├── issue64451.txt │ │ │ └── issue66923.txt │ │ │ ├── codeaction │ │ │ ├── add_struct_tags.txt │ │ │ ├── addtest.txt │ │ │ ├── change_quote.txt │ │ │ ├── eliminate_dot_import.txt │ │ │ ├── extract-variadic-63287.txt │ │ │ ├── extract_control.txt │ │ │ ├── extract_method.txt │ │ │ ├── extract_return_err.txt │ │ │ ├── extract_variable-67905.txt │ │ │ ├── extract_variable-70563.txt │ │ │ ├── extract_variable-if.txt │ │ │ ├── extract_variable-inexact.txt │ │ │ ├── extract_variable-toplevel.txt │ │ │ ├── extract_variable.txt │ │ │ ├── extract_variable_all.txt │ │ │ ├── extract_variable_all_resolve.txt │ │ │ ├── extract_variable_resolve.txt │ │ │ ├── extracttofile.txt │ │ │ ├── fill_struct.txt │ │ │ ├── fill_struct_resolve.txt │ │ │ ├── fill_switch.txt │ │ │ ├── fill_switch_resolve.txt │ │ │ ├── functionextraction.txt │ │ │ ├── functionextraction_issue44813.txt │ │ │ ├── functionextraction_issue50851.txt │ │ │ ├── functionextraction_issue66289.txt │ │ │ ├── functionextraction_issue73972.txt │ │ │ ├── grouplines.txt │ │ │ ├── import-shadows-builtin.txt │ │ │ ├── imports-generated.txt │ │ │ ├── imports.txt │ │ │ ├── inline-var.txt │ │ │ ├── inline.txt │ │ │ ├── inline_issue67336.txt │ │ │ ├── inline_issue68554.txt │ │ │ ├── inline_resolve.txt │ │ │ ├── invertif.txt │ │ │ ├── issue64558.txt │ │ │ ├── issue70268.txt │ │ │ ├── moveparam.txt │ │ │ ├── moveparam_issue70599.txt │ │ │ ├── remove_struct_tags.txt │ │ │ ├── removeparam.txt │ │ │ ├── removeparam_formatting.txt │ │ │ ├── removeparam_funcvalue.txt │ │ │ ├── removeparam_imports.txt │ │ │ ├── removeparam_issue65217.txt │ │ │ ├── removeparam_method.txt │ │ │ ├── removeparam_resolve.txt │ │ │ ├── removeparam_satisfies.txt │ │ │ ├── removeparam_witherrs.txt │ │ │ ├── splitlines-variadic.txt │ │ │ └── splitlines.txt │ │ │ ├── codelens │ │ │ ├── generate.txt │ │ │ └── test.txt │ │ │ ├── completion │ │ │ ├── address.txt │ │ │ ├── alias.txt │ │ │ ├── anon.txt │ │ │ ├── append.txt │ │ │ ├── assign.txt │ │ │ ├── bad.txt │ │ │ ├── basic_lit.txt │ │ │ ├── builtins.txt │ │ │ ├── casesensitive.txt │ │ │ ├── cast.txt │ │ │ ├── channel.txt │ │ │ ├── comment.txt │ │ │ ├── complit.txt │ │ │ ├── constant.txt │ │ │ ├── danglingstmt.txt │ │ │ ├── deep.txt │ │ │ ├── deep2.txt │ │ │ ├── errors.txt │ │ │ ├── field_list.txt │ │ │ ├── foobarbaz.txt │ │ │ ├── func_rank.txt │ │ │ ├── func_sig.txt │ │ │ ├── func_snippets.txt │ │ │ ├── func_value.txt │ │ │ ├── fuzzy.txt │ │ │ ├── imported-std.txt │ │ │ ├── index.txt │ │ │ ├── interfacerank.txt │ │ │ ├── issue51783.txt │ │ │ ├── issue56505.txt │ │ │ ├── issue59096.txt │ │ │ ├── issue60545.txt │ │ │ ├── issue62141.txt │ │ │ ├── issue62560.txt │ │ │ ├── issue62676.txt │ │ │ ├── issue70636.txt │ │ │ ├── issue72753.txt │ │ │ ├── keywords.txt │ │ │ ├── labels.txt │ │ │ ├── lit.txt │ │ │ ├── maps.txt │ │ │ ├── multi_return.txt │ │ │ ├── nested_complit.txt │ │ │ ├── postfix.txt │ │ │ ├── postfix_placeholder.txt │ │ │ ├── printf.txt │ │ │ ├── randv2.txt │ │ │ ├── range_func.txt │ │ │ ├── rank.txt │ │ │ ├── snippet.txt │ │ │ ├── snippet_placeholder.txt │ │ │ ├── statements.txt │ │ │ ├── testy.txt │ │ │ ├── type_assert.txt │ │ │ ├── type_mods.txt │ │ │ ├── type_params.txt │ │ │ ├── unimported-std.txt │ │ │ ├── unimported.txt │ │ │ ├── unresolved.txt │ │ │ ├── unsafe.txt │ │ │ └── variadic.txt │ │ │ ├── configuration │ │ │ └── static.txt │ │ │ ├── definition │ │ │ ├── asm.txt │ │ │ ├── branch.txt │ │ │ ├── branch_issue73797.txt │ │ │ ├── branch_issue73797_go124.txt │ │ │ ├── cgo.txt │ │ │ ├── comment.txt │ │ │ ├── embed.txt │ │ │ ├── import.txt │ │ │ ├── misc.txt │ │ │ ├── return.txt │ │ │ ├── standalone.txt │ │ │ └── standalone_issue64557.txt │ │ │ ├── diagnostics │ │ │ ├── addgowork.txt │ │ │ ├── analyzers.txt │ │ │ ├── excludedfile.txt │ │ │ ├── generated.txt │ │ │ ├── initcycle.txt │ │ │ ├── issue56943.txt │ │ │ ├── issue59005.txt │ │ │ ├── issue60544.txt │ │ │ ├── issue60605.txt │ │ │ ├── issue64547.txt │ │ │ ├── issue67360.txt │ │ │ ├── issue69505.txt │ │ │ ├── issue70791.txt │ │ │ ├── issue71812.txt │ │ │ ├── osarch_suffix.txt │ │ │ ├── parseerr.txt │ │ │ ├── rundespiteerrors.txt │ │ │ ├── stdversion.txt │ │ │ ├── strangefiles.txt │ │ │ ├── typeerr.txt │ │ │ ├── useinternal.txt │ │ │ └── usemodule.txt │ │ │ ├── fixedbugs │ │ │ ├── issue59318.txt │ │ │ ├── issue59944.txt │ │ │ ├── issue61543.txt │ │ │ ├── issue66109.txt │ │ │ ├── issue66250.txt │ │ │ ├── issue66876.txt │ │ │ └── issue71044.txt │ │ │ ├── foldingrange │ │ │ ├── a.txt │ │ │ ├── a_lineonly.txt │ │ │ ├── bad.txt │ │ │ └── parse_errors.txt │ │ │ ├── format │ │ │ ├── format.txt │ │ │ ├── generated.txt │ │ │ ├── issue59554.txt │ │ │ └── noparse.txt │ │ │ ├── highlight │ │ │ ├── controlflow.txt │ │ │ ├── highlight.txt │ │ │ ├── highlight_kind.txt │ │ │ ├── highlight_printf.txt │ │ │ ├── issue60435.txt │ │ │ ├── issue68918.txt │ │ │ └── switchbreak.txt │ │ │ ├── hover │ │ │ ├── basiclit.txt │ │ │ ├── comment.txt │ │ │ ├── const.txt │ │ │ ├── embed.txt │ │ │ ├── generics.txt │ │ │ ├── godef.txt │ │ │ ├── goprivate.txt │ │ │ ├── hover.txt │ │ │ ├── hover_alias.txt │ │ │ ├── issues.txt │ │ │ ├── json.txt │ │ │ ├── linkable.txt │ │ │ ├── linkable_generics.txt │ │ │ ├── linkname.txt │ │ │ ├── methods.txt │ │ │ ├── return.txt │ │ │ ├── sizeoffset.txt │ │ │ ├── std.txt │ │ │ └── structfield.txt │ │ │ ├── implementation │ │ │ ├── basic.txt │ │ │ ├── generics-basicalias.txt │ │ │ ├── generics.txt │ │ │ ├── issue43655.txt │ │ │ ├── issue67041.txt │ │ │ ├── issue68641.txt │ │ │ └── signature.txt │ │ │ ├── inlayhints │ │ │ ├── inlayhints.txt │ │ │ └── issue67142.txt │ │ │ ├── links │ │ │ └── links.txt │ │ │ ├── mcptools │ │ │ └── context.txt │ │ │ ├── modfile │ │ │ ├── godebug.txt │ │ │ └── godebug_bad.txt │ │ │ ├── quickfix │ │ │ ├── embeddirective.txt │ │ │ ├── infertypeargs.txt │ │ │ ├── issue65024.txt │ │ │ ├── noresultvalues.txt │ │ │ ├── self_assignment.txt │ │ │ ├── stub.txt │ │ │ ├── stubmethods │ │ │ │ ├── basic.txt │ │ │ │ ├── basic_resolve.txt │ │ │ │ ├── fromcall_basic.txt │ │ │ │ ├── fromcall_params.txt │ │ │ │ ├── fromcall_returns.txt │ │ │ │ ├── issue61693.txt │ │ │ │ ├── issue61830.txt │ │ │ │ ├── issue64078.txt │ │ │ │ └── issue64114.txt │ │ │ ├── undeclared │ │ │ │ ├── diag.txt │ │ │ │ ├── missingfunction.txt │ │ │ │ ├── undeclared_variable.txt │ │ │ │ └── undeclaredfunc.txt │ │ │ ├── unusedrequire.txt │ │ │ └── unusedrequire_gowork.txt │ │ │ ├── references │ │ │ ├── crosspackage.txt │ │ │ ├── imports.txt │ │ │ ├── interfaces.txt │ │ │ ├── intrapackage.txt │ │ │ ├── issue58506.txt │ │ │ ├── issue59851.txt │ │ │ ├── issue60369.txt │ │ │ ├── issue60622.txt │ │ │ ├── issue60676.txt │ │ │ ├── issue61618.txt │ │ │ ├── issue67978.txt │ │ │ ├── shadow.txt │ │ │ ├── test.txt │ │ │ └── typeswitch.txt │ │ │ ├── rename │ │ │ ├── bad.txt │ │ │ ├── basic.txt │ │ │ ├── conflict.txt │ │ │ ├── crosspkg.txt │ │ │ ├── doclink.txt │ │ │ ├── embed.txt │ │ │ ├── func.txt │ │ │ ├── generics.txt │ │ │ ├── generics_basic.txt │ │ │ ├── issue39614.txt │ │ │ ├── issue42134.txt │ │ │ ├── issue43616.txt │ │ │ ├── issue57479.txt │ │ │ ├── issue60752.txt │ │ │ ├── issue60789.txt │ │ │ ├── issue61294.txt │ │ │ ├── issue61640.txt │ │ │ ├── issue61813.txt │ │ │ ├── issue65098.txt │ │ │ ├── issue67069.txt │ │ │ ├── issue70968.txt │ │ │ ├── methods.txt │ │ │ ├── prepare.txt │ │ │ ├── prepare_func.txt │ │ │ ├── random.txt │ │ │ ├── recv.txt │ │ │ ├── shadow.txt │ │ │ ├── testy.txt │ │ │ ├── typeswitch.txt │ │ │ └── unexported.txt │ │ │ ├── selectionrange │ │ │ └── selectionrange.txt │ │ │ ├── signature │ │ │ ├── generic.txt │ │ │ ├── issue63804.txt │ │ │ ├── issue69552.txt │ │ │ └── signature.txt │ │ │ ├── symbol │ │ │ ├── basic.txt │ │ │ └── generic.txt │ │ │ ├── token │ │ │ ├── comment.txt │ │ │ ├── format.txt │ │ │ ├── illformed.txt │ │ │ ├── issue66809.txt │ │ │ ├── issue70251.txt │ │ │ ├── modifiers.txt │ │ │ └── range.txt │ │ │ ├── typedef │ │ │ └── typedef.txt │ │ │ ├── typehierarchy │ │ │ └── basic.txt │ │ │ ├── workfile │ │ │ ├── godebug.txt │ │ │ └── godebug_bad.txt │ │ │ ├── workspacesymbol │ │ │ ├── allscope.txt │ │ │ ├── caseinsensitive.txt │ │ │ ├── casesensitive.txt │ │ │ ├── issue44806.txt │ │ │ ├── workspacesymbol.txt │ │ │ └── wsscope.txt │ │ │ └── zeroconfig │ │ │ ├── adhoc.txt │ │ │ ├── dynamicports.txt │ │ │ ├── nested.txt │ │ │ └── nonworkspacemodule.txt │ ├── util │ │ ├── README.md │ │ ├── asm │ │ │ ├── parse.go │ │ │ └── parse_test.go │ │ ├── astutil │ │ │ ├── fields.go │ │ │ ├── fields_test.go │ │ │ ├── purge.go │ │ │ ├── purge_test.go │ │ │ └── util.go │ │ ├── browser │ │ │ ├── README.md │ │ │ └── browser.go │ │ ├── bug │ │ │ ├── bug.go │ │ │ └── bug_test.go │ │ ├── constraints │ │ │ └── constraint.go │ │ ├── fingerprint │ │ │ ├── fingerprint.go │ │ │ └── fingerprint_test.go │ │ ├── frob │ │ │ ├── frob.go │ │ │ └── frob_test.go │ │ ├── goversion │ │ │ ├── goversion.go │ │ │ └── goversion_test.go │ │ ├── immutable │ │ │ └── immutable.go │ │ ├── lru │ │ │ ├── lru.go │ │ │ ├── lru_fuzz_test.go │ │ │ ├── lru_nil_test.go │ │ │ └── lru_test.go │ │ ├── moreiters │ │ │ └── iters.go │ │ ├── moremaps │ │ │ └── maps.go │ │ ├── moreslices │ │ │ └── slices.go │ │ ├── morestrings │ │ │ └── strings.go │ │ ├── pathutil │ │ │ └── util.go │ │ ├── persistent │ │ │ ├── map.go │ │ │ ├── map_test.go │ │ │ ├── race_test.go │ │ │ ├── set.go │ │ │ └── set_test.go │ │ ├── safetoken │ │ │ ├── safetoken.go │ │ │ └── safetoken_test.go │ │ └── typesutil │ │ │ └── typesutil.go │ ├── version │ │ └── version.go │ ├── vulncheck │ │ ├── copier.go │ │ ├── govulncheck │ │ │ ├── govulncheck.go │ │ │ ├── handler.go │ │ │ └── jsonhandler.go │ │ ├── osv │ │ │ └── osv.go │ │ ├── scan │ │ │ └── command.go │ │ ├── semver │ │ │ ├── semver.go │ │ │ └── semver_test.go │ │ ├── types.go │ │ └── vulntest │ │ │ ├── db.go │ │ │ ├── db_test.go │ │ │ ├── report.go │ │ │ ├── report_test.go │ │ │ ├── stdlib.go │ │ │ ├── stdlib_test.go │ │ │ └── testdata │ │ │ ├── GO-2020-0001.json │ │ │ └── report.yaml │ └── work │ │ ├── completion.go │ │ ├── diagnostics.go │ │ ├── format.go │ │ └── hover.go └── main.go ├── imports └── forward.go ├── internal ├── aliases │ ├── aliases.go │ ├── aliases_go122.go │ └── aliases_test.go ├── analysisinternal │ ├── addimport_test.go │ ├── analysis.go │ ├── analysis_test.go │ ├── extractdoc.go │ ├── extractdoc_test.go │ └── typeindex │ │ └── typeindex.go ├── astutil │ ├── clone.go │ ├── comment.go │ ├── util.go │ └── util_test.go ├── bisect │ ├── bisect.go │ └── bisect_test.go ├── diff │ ├── diff.go │ ├── diff_test.go │ ├── difftest │ │ ├── difftest.go │ │ └── difftest_test.go │ ├── export_test.go │ ├── lcs │ │ ├── common.go │ │ ├── common_test.go │ │ ├── doc.go │ │ ├── git.sh │ │ ├── labels.go │ │ ├── old.go │ │ ├── old_test.go │ │ └── sequence.go │ ├── merge.go │ ├── merge_test.go │ ├── myers │ │ ├── diff.go │ │ └── diff_test.go │ ├── ndiff.go │ └── unified.go ├── diffp │ ├── diff.go │ ├── diff_test.go │ └── testdata │ │ ├── allnew.txt │ │ ├── allold.txt │ │ ├── basic.txt │ │ ├── dups.txt │ │ ├── end.txt │ │ ├── eof.txt │ │ ├── eof1.txt │ │ ├── eof2.txt │ │ ├── long.txt │ │ ├── same.txt │ │ ├── start.txt │ │ └── triv.txt ├── drivertest │ ├── driver.go │ └── driver_test.go ├── edit │ ├── edit.go │ └── edit_test.go ├── event │ ├── bench_test.go │ ├── core │ │ ├── event.go │ │ ├── export.go │ │ └── fast.go │ ├── doc.go │ ├── event.go │ ├── export │ │ ├── eventtest │ │ │ └── eventtest.go │ │ ├── id.go │ │ ├── labels.go │ │ ├── log.go │ │ ├── log_test.go │ │ ├── metric │ │ │ ├── data.go │ │ │ ├── exporter.go │ │ │ └── info.go │ │ ├── printer.go │ │ ├── prometheus │ │ │ └── prometheus.go │ │ └── trace.go │ ├── keys │ │ ├── keys.go │ │ ├── standard.go │ │ ├── util.go │ │ └── util_test.go │ └── label │ │ ├── label.go │ │ └── label_test.go ├── expect │ ├── expect.go │ ├── expect_test.go │ ├── extract.go │ └── testdata │ │ ├── go.fake.mod │ │ ├── go.fake.work │ │ └── test.go ├── facts │ ├── facts.go │ ├── facts_test.go │ └── imports.go ├── fakenet │ └── conn.go ├── fmtstr │ ├── main.go │ └── parse.go ├── gcimporter │ ├── bexport_test.go │ ├── bimport.go │ ├── exportdata.go │ ├── gcimporter.go │ ├── gcimporter_test.go │ ├── iexport.go │ ├── iexport_common_test.go │ ├── iexport_go118_test.go │ ├── iexport_test.go │ ├── iimport.go │ ├── iimport_go122.go │ ├── israce_test.go │ ├── main.go │ ├── predeclared.go │ ├── shallow_test.go │ ├── stdlib_test.go │ ├── support.go │ ├── testdata │ │ ├── a.go │ │ ├── a │ │ │ └── a.go │ │ ├── aliases │ │ │ ├── a │ │ │ │ └── a.go │ │ │ ├── b │ │ │ │ └── b.go │ │ │ └── c │ │ │ │ └── c.go │ │ ├── b.go │ │ ├── exports.go │ │ ├── issue15920.go │ │ ├── issue20046.go │ │ ├── issue25301.go │ │ ├── issue51836 │ │ │ ├── a.go │ │ │ ├── a │ │ │ │ └── a.go │ │ │ └── aa.go │ │ ├── issue57015.go │ │ ├── issue58296 │ │ │ ├── a │ │ │ │ └── a.go │ │ │ ├── b │ │ │ │ └── b.go │ │ │ └── c │ │ │ │ └── c.go │ │ ├── p.go │ │ └── versions │ │ │ ├── test.go │ │ │ └── test_go1.20_u.a │ └── ureader_yes.go ├── gocommand │ ├── invoke.go │ ├── invoke_notunix.go │ ├── invoke_test.go │ ├── invoke_unix.go │ ├── vendor.go │ ├── version.go │ └── version_test.go ├── gofix │ ├── cmd │ │ └── gofix │ │ │ └── main.go │ ├── doc.go │ ├── findgofix │ │ └── findgofix.go │ ├── gofix.go │ ├── gofix_test.go │ └── testdata │ │ └── src │ │ ├── a │ │ ├── a.go │ │ ├── a.go.golden │ │ └── internal │ │ │ └── d.go │ │ ├── b │ │ ├── b.go │ │ └── b.go.golden │ │ ├── binding_false │ │ ├── a.go │ │ └── a.go.golden │ │ ├── binding_true │ │ ├── a.go │ │ └── a.go.golden │ │ ├── c │ │ └── c.go │ │ └── directive │ │ ├── directive.go │ │ └── directive.go.golden ├── gopathwalk │ ├── walk.go │ └── walk_test.go ├── goroot │ └── importcfg.go ├── imports │ ├── fix.go │ ├── fix_test.go │ ├── imports.go │ ├── imports_test.go │ ├── mkindex.go │ ├── mod.go │ ├── mod_cache.go │ ├── mod_cache_test.go │ ├── mod_test.go │ ├── sortimports.go │ ├── source.go │ ├── source_env.go │ ├── source_modindex.go │ ├── sourcex_test.go │ └── testdata │ │ └── mod │ │ ├── example.com_v1.0.0.txt │ │ ├── golang.org_x_text_v0.0.0-20170915032832-14c0d48ead0c.txt │ │ ├── rsc.io_!q!u!o!t!e_v1.5.2.txt │ │ ├── rsc.io_!q!u!o!t!e_v1.5.3-!p!r!e.txt │ │ ├── rsc.io_quote_v1.5.1.txt │ │ ├── rsc.io_quote_v1.5.2.txt │ │ ├── rsc.io_quote_v2_v2.0.1.txt │ │ ├── rsc.io_quote_v3_v3.0.0.txt │ │ ├── rsc.io_sampler_v1.3.0.txt │ │ └── rsc.io_sampler_v1.3.1.txt ├── jsonrpc2 │ ├── conn.go │ ├── handler.go │ ├── jsonrpc2.go │ ├── jsonrpc2_test.go │ ├── labels.go │ ├── messages.go │ ├── serve.go │ ├── serve_test.go │ ├── servertest │ │ ├── servertest.go │ │ └── servertest_test.go │ ├── stream.go │ ├── wire.go │ └── wire_test.go ├── jsonrpc2_v2 │ ├── conn.go │ ├── frame.go │ ├── jsonrpc2.go │ ├── jsonrpc2_test.go │ ├── messages.go │ ├── net.go │ ├── serve.go │ ├── serve_test.go │ ├── wire.go │ └── wire_test.go ├── mcp │ ├── CONTRIBUTING.md │ ├── README.md │ ├── client.go │ ├── client_test.go │ ├── cmd.go │ ├── cmd_test.go │ ├── conformance_test.go │ ├── content.go │ ├── content_test.go │ ├── design │ │ └── design.md │ ├── example_progress_test.go │ ├── examples │ │ ├── hello │ │ │ └── main.go │ │ └── sse │ │ │ └── main.go │ ├── features.go │ ├── features_test.go │ ├── generate.go │ ├── internal │ │ ├── readme │ │ │ ├── Makefile │ │ │ ├── README.src.md │ │ │ ├── build.sh │ │ │ ├── client │ │ │ │ └── client.go │ │ │ └── server │ │ │ │ └── server.go │ │ └── util │ │ │ ├── util.go │ │ │ └── util_test.go │ ├── jsonschema │ │ ├── annotations.go │ │ ├── doc.go │ │ ├── infer.go │ │ ├── infer_test.go │ │ ├── json_pointer.go │ │ ├── json_pointer_test.go │ │ ├── meta-schemas │ │ │ └── draft2020-12 │ │ │ │ ├── meta │ │ │ │ ├── applicator.json │ │ │ │ ├── content.json │ │ │ │ ├── core.json │ │ │ │ ├── format-annotation.json │ │ │ │ ├── meta-data.json │ │ │ │ ├── unevaluated.json │ │ │ │ └── validation.json │ │ │ │ └── schema.json │ │ ├── resolve.go │ │ ├── resolve_test.go │ │ ├── schema.go │ │ ├── schema_test.go │ │ ├── testdata │ │ │ ├── draft2020-12 │ │ │ │ ├── README.md │ │ │ │ ├── additionalProperties.json │ │ │ │ ├── allOf.json │ │ │ │ ├── anchor.json │ │ │ │ ├── anyOf.json │ │ │ │ ├── boolean_schema.json │ │ │ │ ├── const.json │ │ │ │ ├── contains.json │ │ │ │ ├── default.json │ │ │ │ ├── defs.json │ │ │ │ ├── dependentRequired.json │ │ │ │ ├── dependentSchemas.json │ │ │ │ ├── dynamicRef.json │ │ │ │ ├── enum.json │ │ │ │ ├── exclusiveMaximum.json │ │ │ │ ├── exclusiveMinimum.json │ │ │ │ ├── if-then-else.json │ │ │ │ ├── infinite-loop-detection.json │ │ │ │ ├── items.json │ │ │ │ ├── maxContains.json │ │ │ │ ├── maxItems.json │ │ │ │ ├── maxLength.json │ │ │ │ ├── maxProperties.json │ │ │ │ ├── maximum.json │ │ │ │ ├── minContains.json │ │ │ │ ├── minItems.json │ │ │ │ ├── minLength.json │ │ │ │ ├── minProperties.json │ │ │ │ ├── minimum.json │ │ │ │ ├── multipleOf.json │ │ │ │ ├── not.json │ │ │ │ ├── oneOf.json │ │ │ │ ├── pattern.json │ │ │ │ ├── patternProperties.json │ │ │ │ ├── prefixItems.json │ │ │ │ ├── properties.json │ │ │ │ ├── propertyNames.json │ │ │ │ ├── ref.json │ │ │ │ ├── refRemote.json │ │ │ │ ├── required.json │ │ │ │ ├── type.json │ │ │ │ ├── unevaluatedItems.json │ │ │ │ ├── unevaluatedProperties.json │ │ │ │ └── uniqueItems.json │ │ │ └── remotes │ │ │ │ ├── README.md │ │ │ │ ├── different-id-ref-string.json │ │ │ │ ├── draft2020-12 │ │ │ │ ├── baseUriChange │ │ │ │ │ └── folderInteger.json │ │ │ │ ├── baseUriChangeFolder │ │ │ │ │ └── folderInteger.json │ │ │ │ ├── baseUriChangeFolderInSubschema │ │ │ │ │ └── folderInteger.json │ │ │ │ ├── detached-dynamicref.json │ │ │ │ ├── detached-ref.json │ │ │ │ ├── extendible-dynamic-ref.json │ │ │ │ ├── format-assertion-false.json │ │ │ │ ├── format-assertion-true.json │ │ │ │ ├── integer.json │ │ │ │ ├── locationIndependentIdentifier.json │ │ │ │ ├── metaschema-no-validation.json │ │ │ │ ├── metaschema-optional-vocabulary.json │ │ │ │ ├── name-defs.json │ │ │ │ ├── nested │ │ │ │ │ ├── foo-ref-string.json │ │ │ │ │ └── string.json │ │ │ │ ├── prefixItems.json │ │ │ │ ├── ref-and-defs.json │ │ │ │ ├── subSchemas.json │ │ │ │ └── tree.json │ │ │ │ ├── nested-absolute-ref-to-string.json │ │ │ │ └── urn-ref-string.json │ │ ├── util.go │ │ ├── util_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── logging.go │ ├── mcp.go │ ├── mcp_test.go │ ├── prompt.go │ ├── prompt_test.go │ ├── protocol.go │ ├── resource.go │ ├── resource_go124.go │ ├── resource_pre_go124.go │ ├── resource_test.go │ ├── root.go │ ├── server.go │ ├── server_example_test.go │ ├── server_test.go │ ├── shared.go │ ├── shared_test.go │ ├── sse.go │ ├── sse_example_test.go │ ├── sse_test.go │ ├── testdata │ │ ├── conformance │ │ │ └── server │ │ │ │ ├── prompts.txtar │ │ │ │ ├── resources.txtar │ │ │ │ └── tools.txtar │ │ └── files │ │ │ └── info.txt │ ├── tool.go │ ├── tool_test.go │ ├── transport.go │ ├── transport_test.go │ ├── util.go │ └── util_test.go ├── memoize │ ├── memoize.go │ └── memoize_test.go ├── modindex │ ├── dir_test.go │ ├── directories.go │ ├── gomodindex │ │ └── cmd.go │ ├── index.go │ ├── lookup.go │ ├── lookup_test.go │ ├── modindex.go │ ├── symbols.go │ └── types.go ├── packagesinternal │ └── packages.go ├── packagestest │ ├── expect.go │ ├── expect_test.go │ ├── export.go │ ├── export_test.go │ ├── gopath.go │ ├── gopath_test.go │ ├── modules.go │ ├── modules_test.go │ └── testdata │ │ ├── groups │ │ ├── one │ │ │ ├── modules │ │ │ │ └── example.com │ │ │ │ │ └── extra │ │ │ │ │ └── help.go │ │ │ └── primarymod │ │ │ │ └── main.go │ │ └── two │ │ │ ├── modules │ │ │ └── example.com │ │ │ │ ├── extra │ │ │ │ ├── geez │ │ │ │ │ └── help.go │ │ │ │ ├── v2 │ │ │ │ │ ├── geez │ │ │ │ │ │ └── help.go │ │ │ │ │ └── me.go │ │ │ │ └── yo.go │ │ │ │ ├── tempmod │ │ │ │ └── main.go │ │ │ │ ├── what@v1.0.0 │ │ │ │ └── main.go │ │ │ │ └── what@v1.1.0 │ │ │ │ └── main.go │ │ │ └── primarymod │ │ │ ├── expect │ │ │ ├── yo.go │ │ │ └── yo_test.go │ │ │ └── main.go │ │ ├── test.go │ │ ├── test_test.go │ │ └── x_test.go ├── pkgbits │ ├── codes.go │ ├── decoder.go │ ├── doc.go │ ├── encoder.go │ ├── flags.go │ ├── pkgbits_test.go │ ├── reloc.go │ ├── support.go │ ├── sync.go │ ├── syncmarker_string.go │ └── version.go ├── pprof │ ├── main.go │ ├── pprof.go │ ├── pprof_test.go │ └── testdata │ │ └── sample.pprof ├── proxydir │ ├── proxydir.go │ └── proxydir_test.go ├── refactor │ └── inline │ │ ├── callee.go │ │ ├── calleefx.go │ │ ├── calleefx_test.go │ │ ├── doc.go │ │ ├── escape.go │ │ ├── everything_test.go │ │ ├── export_test.go │ │ ├── falcon.go │ │ ├── falcon_test.go │ │ ├── free.go │ │ ├── free_test.go │ │ ├── inline.go │ │ ├── inline_test.go │ │ ├── testdata │ │ ├── assignment-splice.txtar │ │ ├── assignment.txtar │ │ ├── basic-err.txtar │ │ ├── basic-literal.txtar │ │ ├── basic-reduce.txtar │ │ ├── cgo.txtar │ │ ├── comments.txtar │ │ ├── crosspkg-selfref.txtar │ │ ├── crosspkg.txtar │ │ ├── dotimport.txtar │ │ ├── embed.txtar │ │ ├── empty-body.txtar │ │ ├── err-basic.txtar │ │ ├── err-shadow-builtin.txtar │ │ ├── err-shadow-pkg.txtar │ │ ├── err-unexported.txtar │ │ ├── exprstmt.txtar │ │ ├── generic.txtar │ │ ├── import-comments.txtar │ │ ├── import-rename.txtar │ │ ├── import-shadow-1.txtar │ │ ├── import-shadow-2.txtar │ │ ├── import-shadow.txtar │ │ ├── internal.txtar │ │ ├── issue62667.txtar │ │ ├── issue63298.txtar │ │ ├── issue69441.txtar │ │ ├── issue69442.txtar │ │ ├── line-directives.txtar │ │ ├── method.txtar │ │ ├── multistmt-body.txtar │ │ ├── n-ary.txtar │ │ ├── param-subst.txtar │ │ ├── revdotimport.txtar │ │ ├── std-internal.txtar │ │ ├── substgroups.txtar │ │ └── tailcall.txtar │ │ └── util.go ├── robustio │ ├── copyfiles.go │ ├── gopls_windows.go │ ├── robustio.go │ ├── robustio_darwin.go │ ├── robustio_flaky.go │ ├── robustio_other.go │ ├── robustio_plan9.go │ ├── robustio_posix.go │ ├── robustio_test.go │ └── robustio_windows.go ├── stack │ ├── gostacks │ │ └── gostacks.go │ ├── parse.go │ ├── process.go │ ├── stack.go │ ├── stack_test.go │ └── stacktest │ │ └── stacktest.go ├── stdlib │ ├── deps.go │ ├── deps_test.go │ ├── generate.go │ ├── import.go │ ├── manifest.go │ ├── stdlib.go │ └── testdata │ │ ├── nethttp.deps │ │ └── nethttp.imports ├── testenv │ ├── exec.go │ ├── testenv.go │ ├── testenv_notunix.go │ └── testenv_unix.go ├── testfiles │ ├── testdata │ │ ├── somefile.txt │ │ └── versions │ │ │ ├── go.mod.test │ │ │ ├── mod.go │ │ │ ├── post.go │ │ │ ├── pre.go │ │ │ └── sub.test │ │ │ └── sub.go.test │ ├── testfiles.go │ └── testfiles_test.go ├── tokeninternal │ ├── tokeninternal.go │ ├── tokeninternal_go124.go │ ├── tokeninternal_go125.go │ └── tokeninternal_test.go ├── tool │ └── tool.go ├── typeparams │ ├── common.go │ ├── common_test.go │ ├── copytermlist.go │ ├── coretype.go │ ├── coretype_test.go │ ├── free.go │ ├── free_test.go │ ├── genericfeatures │ │ └── features.go │ ├── normalize.go │ ├── normalize_test.go │ ├── termlist.go │ └── typeterm.go ├── typesinternal │ ├── classify_call.go │ ├── classify_call_test.go │ ├── element.go │ ├── element_test.go │ ├── errorcode.go │ ├── errorcode_string.go │ ├── errorcode_test.go │ ├── qualifier.go │ ├── recv.go │ ├── toonew.go │ ├── typeindex │ │ ├── typeindex.go │ │ └── typeindex_test.go │ ├── types.go │ ├── varkind.go │ ├── zerovalue.go │ └── zerovalue_test.go ├── versions │ ├── features.go │ ├── gover.go │ ├── types.go │ ├── types_test.go │ ├── versions.go │ └── versions_test.go └── xcontext │ └── xcontext.go ├── playground ├── playground.go └── socket │ ├── socket.go │ └── socket_test.go ├── present ├── args.go ├── caption.go ├── code.go ├── code_test.go ├── doc.go ├── html.go ├── iframe.go ├── image.go ├── link.go ├── link_test.go ├── parse.go ├── parse_test.go ├── style.go ├── style_test.go ├── testdata │ ├── README │ ├── basic.md │ ├── basic.p │ ├── code.md │ ├── code.p │ ├── code.txt │ ├── list.md │ ├── list.p │ ├── media.html │ ├── media.md │ ├── media.p │ ├── pre.md │ └── pre.p └── video.go ├── refactor ├── README ├── eg │ ├── eg.go │ ├── eg_test.go │ ├── match.go │ ├── rewrite.go │ └── testdata │ │ ├── a.txtar │ │ ├── b.txtar │ │ ├── bad_type.txtar │ │ ├── c.txtar │ │ ├── d.txtar │ │ ├── e.txtar │ │ ├── expr_type_mismatch.txtar │ │ ├── f.txtar │ │ ├── g.txtar │ │ ├── h.txtar │ │ ├── i.txtar │ │ ├── j.txtar │ │ ├── no_after_return.txtar │ │ ├── no_before.txtar │ │ └── type_mismatch.txtar ├── importgraph │ ├── graph.go │ └── graph_test.go ├── rename │ ├── check.go │ ├── mvpkg.go │ ├── mvpkg_test.go │ ├── rename.go │ ├── rename_test.go │ ├── spec.go │ └── util.go └── satisfy │ ├── find.go │ └── find_test.go └── txtar ├── archive.go ├── archive_test.go ├── fs.go └── fs_test.go /.gitattributes: -------------------------------------------------------------------------------- 1 | # Treat all files in this repo as binary, with no git magic updating 2 | # line endings. Windows users contributing to Go will need to use a 3 | # modern version of git and editors capable of LF line endings. 4 | # 5 | # We'll prevent accidental CRLF line endings from entering the repo 6 | # via the git-review gofmt checks. 7 | # 8 | # See golang.org/issue/9281 9 | 10 | * -text 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Add no patterns to .gitignore except for files generated by the build. 2 | last-change 3 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5" 4 | } -------------------------------------------------------------------------------- /cmd/auth/go.mod: -------------------------------------------------------------------------------- 1 | module golang.org/x/tools/cmd/auth 2 | 3 | go 1.23.0 4 | -------------------------------------------------------------------------------- /cmd/bundle/.gitignore: -------------------------------------------------------------------------------- 1 | testdata/out.got 2 | -------------------------------------------------------------------------------- /cmd/bundle/testdata/src/domain.name/importdecl/p.go: -------------------------------------------------------------------------------- 1 | package importdecl 2 | 3 | func F() int { return 1 } 4 | -------------------------------------------------------------------------------- /cmd/bundle/testdata/src/initial/a.go: -------------------------------------------------------------------------------- 1 | package initial 2 | 3 | import "fmt" // this comment should not be visible 4 | 5 | // init functions are not renamed 6 | func init() { foo() } 7 | 8 | // Type S. 9 | type S struct { 10 | t 11 | u int 12 | } /* multi-line 13 | comment 14 | */ 15 | 16 | // non-associated comment 17 | 18 | /* 19 | non-associated comment2 20 | */ 21 | 22 | // Function bar. 23 | func bar(s *S) { 24 | fmt.Println(s.t, s.u) // comment inside function 25 | } 26 | 27 | // file-end comment 28 | -------------------------------------------------------------------------------- /cmd/bundle/testdata/src/initial/b.go: -------------------------------------------------------------------------------- 1 | // The package doc comment 2 | package initial 3 | 4 | import ( 5 | "fmt" 6 | 7 | "domain.name/importdecl" 8 | ) 9 | 10 | type t int // type1 11 | 12 | // const1 13 | const c = 1 // const2 14 | 15 | func foo() { 16 | fmt.Println(importdecl.F()) 17 | } 18 | 19 | // zinit 20 | const ( 21 | z1 = iota // z1 22 | z2 // z2 23 | ) // zend 24 | -------------------------------------------------------------------------------- /cmd/bundle/testdata/src/initial/c.go: -------------------------------------------------------------------------------- 1 | package initial 2 | 3 | import _ "fmt" 4 | import renamedfmt "fmt" 5 | import renamedfmt2 "fmt" 6 | import . "fmt" 7 | 8 | func baz() { 9 | renamedfmt.Println() 10 | renamedfmt2.Println() 11 | Println() 12 | } 13 | -------------------------------------------------------------------------------- /cmd/callgraph/testdata/src/pkg/pkg.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type I interface { 4 | f() 5 | } 6 | 7 | type C int 8 | 9 | func (C) f() {} 10 | 11 | type D int 12 | 13 | func (D) f() {} 14 | 15 | func main() { 16 | var i I = C(0) 17 | i.f() // dynamic call 18 | 19 | main2() 20 | } 21 | 22 | func main2() { 23 | var i I = D(0) 24 | i.f() // dynamic call 25 | } 26 | -------------------------------------------------------------------------------- /cmd/callgraph/testdata/src/pkg/pkg_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // An Example function must have an "Output:" comment for the go build 4 | // system to generate a call to it from the test main package. 5 | 6 | func Example() { 7 | C(0).f() 8 | 9 | // Output: 10 | } 11 | -------------------------------------------------------------------------------- /cmd/deadcode/testdata/jsonflag.txtar: -------------------------------------------------------------------------------- 1 | # Very minimal test of -json flag. 2 | 3 | deadcode -json example.com/p 4 | 5 | want `"Path": "example.com/p",` 6 | want `"Name": "DeadFunc",` 7 | want `"Generated": false` 8 | want `"Line": 5,` 9 | want `"Col": 6` 10 | 11 | -- go.mod -- 12 | module example.com 13 | go 1.18 14 | 15 | -- p/p.go -- 16 | package main 17 | 18 | func main() {} 19 | 20 | func DeadFunc() {} 21 | 22 | type T int 23 | func (*T) DeadMethod() {} -------------------------------------------------------------------------------- /cmd/fiximports/testdata/src/fruit.io/banana/banana.go: -------------------------------------------------------------------------------- 1 | package banana 2 | 3 | import ( 4 | _ "old.com/one" 5 | _ "titanic.biz/bar" 6 | _ "titanic.biz/foo" 7 | ) 8 | -------------------------------------------------------------------------------- /cmd/fiximports/testdata/src/fruit.io/orange/orange.go: -------------------------------------------------------------------------------- 1 | package orange 2 | 3 | import _ "fruit.io/pear" 4 | -------------------------------------------------------------------------------- /cmd/fiximports/testdata/src/fruit.io/pear/pear.go: -------------------------------------------------------------------------------- 1 | package pear 2 | 3 | import _ "fruit.io/banana" 4 | -------------------------------------------------------------------------------- /cmd/fiximports/testdata/src/new.com/one/one.go: -------------------------------------------------------------------------------- 1 | package one // import "new.com/one" 2 | -------------------------------------------------------------------------------- /cmd/fiximports/testdata/src/old.com/bad/bad.go: -------------------------------------------------------------------------------- 1 | // This ill-formed Go source file is here to ensure the tool is robust 2 | // against bad packages in the workspace. 3 | -------------------------------------------------------------------------------- /cmd/fiximports/testdata/src/old.com/one/one.go: -------------------------------------------------------------------------------- 1 | package one // import "new.com/one" 2 | -------------------------------------------------------------------------------- /cmd/fiximports/testdata/src/titanic.biz/bar/bar.go: -------------------------------------------------------------------------------- 1 | // This package is moving to new.com too. 2 | package bar // import "new.com/bar" 3 | -------------------------------------------------------------------------------- /cmd/fiximports/testdata/src/titanic.biz/foo/foo.go: -------------------------------------------------------------------------------- 1 | // This package hasn't jumped ship yet. 2 | package foo 3 | -------------------------------------------------------------------------------- /cmd/godex/gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file implements access to gc-generated export data. 6 | 7 | package main 8 | 9 | import ( 10 | "go/importer" 11 | "go/token" 12 | ) 13 | 14 | func init() { 15 | register("gc", importer.ForCompiler(token.NewFileSet(), "gc", nil)) 16 | } 17 | -------------------------------------------------------------------------------- /cmd/godex/isAlias18.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.9 6 | 7 | package main 8 | 9 | import "go/types" 10 | 11 | func isAlias(obj *types.TypeName) bool { 12 | return false // there are no type aliases before Go 1.9 13 | } 14 | -------------------------------------------------------------------------------- /cmd/godex/isAlias19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.9 6 | 7 | package main 8 | 9 | import "go/types" 10 | 11 | func isAlias(obj *types.TypeName) bool { 12 | return obj.IsAlias() 13 | } 14 | -------------------------------------------------------------------------------- /cmd/godex/source.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file implements access to export data from source. 6 | 7 | package main 8 | 9 | import "go/types" 10 | 11 | func init() { 12 | register("source", sourceImporter{}) 13 | } 14 | 15 | type sourceImporter struct{} 16 | 17 | func (sourceImporter) Import(path string) (*types.Package, error) { 18 | panic("unimplemented") 19 | } 20 | -------------------------------------------------------------------------------- /cmd/goimports/goimports_not_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !gc 6 | 7 | package main 8 | 9 | func doTrace() func() { 10 | return func() {} 11 | } 12 | -------------------------------------------------------------------------------- /cmd/gotype/sizesFor19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.9 6 | 7 | package main 8 | 9 | import "go/types" 10 | 11 | const defaultCompiler = "source" 12 | 13 | func SizesFor(compiler, arch string) types.Sizes { 14 | return types.SizesFor(compiler, arch) 15 | } 16 | -------------------------------------------------------------------------------- /cmd/present/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/present/static/favicon.ico -------------------------------------------------------------------------------- /cmd/signature-fuzzer/fuzz-runner/testdata/himom.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package main 6 | 7 | func main() { 8 | println("hi mom!") 9 | } 10 | -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/clang-386-darwin-exec-with-rpath: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/splitdwarf/internal/macho/testdata/clang-386-darwin-exec-with-rpath -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/clang-386-darwin.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/splitdwarf/internal/macho/testdata/clang-386-darwin.obj -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/clang-amd64-darwin-exec-with-rpath: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/splitdwarf/internal/macho/testdata/clang-amd64-darwin-exec-with-rpath -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/clang-amd64-darwin.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/splitdwarf/internal/macho/testdata/clang-amd64-darwin.obj -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/fat-gcc-386-amd64-darwin-exec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/splitdwarf/internal/macho/testdata/fat-gcc-386-amd64-darwin-exec -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/gcc-386-darwin-exec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/splitdwarf/internal/macho/testdata/gcc-386-darwin-exec -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/gcc-amd64-darwin-exec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/splitdwarf/internal/macho/testdata/gcc-amd64-darwin-exec -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/gcc-amd64-darwin-exec-debug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/cmd/splitdwarf/internal/macho/testdata/gcc-amd64-darwin-exec-debug -------------------------------------------------------------------------------- /cmd/splitdwarf/internal/macho/testdata/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main(void) 5 | { 6 | printf("hello, world\n"); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /cmd/stringer/testdata/tag_main.go: -------------------------------------------------------------------------------- 1 | // No build tag in this file. 2 | 3 | package main 4 | 5 | type Const int 6 | 7 | const ( 8 | A Const = iota 9 | B 10 | C 11 | ) 12 | -------------------------------------------------------------------------------- /cmd/stringer/testdata/tag_tag.go: -------------------------------------------------------------------------------- 1 | // This file has a build tag "tag" 2 | 3 | // +build tag 4 | 5 | package main 6 | 7 | const TagProtected Const = C + 1 8 | -------------------------------------------------------------------------------- /codereview.cfg: -------------------------------------------------------------------------------- 1 | issuerepo: golang/go 2 | -------------------------------------------------------------------------------- /container/intsets/export_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package intsets 6 | 7 | // Backdoor for testing. 8 | func (s *Sparse) Check() error { return s.check() } 9 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module golang.org/x/tools 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/google/go-cmp v0.6.0 7 | github.com/yuin/goldmark v1.4.13 8 | golang.org/x/mod v0.25.0 9 | golang.org/x/net v0.41.0 10 | golang.org/x/sync v0.15.0 11 | golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 12 | ) 13 | 14 | require golang.org/x/sys v0.33.0 // indirect 15 | -------------------------------------------------------------------------------- /go/analysis/checker/iter_go122.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.23 6 | 7 | package checker 8 | 9 | // This type is a placeholder for go1.23's iter.Seq[*Action]. 10 | type actionSeq func(yield func(*Action) bool) 11 | -------------------------------------------------------------------------------- /go/analysis/checker/iter_go123.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.23 6 | 7 | package checker 8 | 9 | import "iter" 10 | 11 | type actionSeq = iter.Seq[*Action] 12 | -------------------------------------------------------------------------------- /go/analysis/internal/checker/testdata/noend.txt: -------------------------------------------------------------------------------- 1 | # Test that a missing SuggestedFix.End position is correctly 2 | # interpreted as if equal to SuggestedFix.Pos (see issue #64199). 3 | 4 | checker -noend -fix example.com/a 5 | exit 0 6 | 7 | -- go.mod -- 8 | module example.com 9 | go 1.22 10 | 11 | -- a/a.go -- 12 | package a 13 | 14 | func f() {} 15 | 16 | -- want/a/a.go -- 17 | package a 18 | 19 | /*hello*/ 20 | func f() {} 21 | -------------------------------------------------------------------------------- /go/analysis/internal/internal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package internal 6 | 7 | import "golang.org/x/tools/go/analysis" 8 | 9 | // This function is set by the checker package to provide 10 | // backdoor access to the private Pass field 11 | // of the checker.Action type, for use by analysistest. 12 | var Pass func(any) *analysis.Pass 13 | -------------------------------------------------------------------------------- /go/analysis/passes/README: -------------------------------------------------------------------------------- 1 | 2 | This directory does not contain a Go package, 3 | but acts as a container for various analyses 4 | that implement the golang.org/x/tools/go/analysis 5 | API and may be imported into an analysis tool. 6 | 7 | By convention, each package foo provides the analysis, 8 | and each command foo/cmd/foo provides a standalone driver. 9 | -------------------------------------------------------------------------------- /go/analysis/passes/asmdecl/testdata/src/a/asm9.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build wasm 6 | 7 | TEXT ·returnint(SB),NOSPLIT|NOFRAME,$0-8 8 | MOVD 24(SP), R1 // ok to access beyond stack frame with NOFRAME 9 | CallImport // interpreted as writing result 10 | RET 11 | 12 | TEXT ·returnbyte(SB),$0-9 13 | RET // want `RET without writing` 14 | -------------------------------------------------------------------------------- /go/analysis/passes/atomic/atomic_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package atomic_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/atomic" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, atomic.Analyzer, "a", "typeparams") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/atomicalign/testdata/src/a/stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file is only here to not trigger "build constraints exclude all Go files" during tests 6 | 7 | package testdata 8 | -------------------------------------------------------------------------------- /go/analysis/passes/atomicalign/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !arm,!386 6 | 7 | package testdata 8 | 9 | import ( 10 | "sync/atomic" 11 | ) 12 | 13 | func nonAffectedArchs() { 14 | var s struct { 15 | _ bool 16 | a uint64 17 | } 18 | atomic.SwapUint64(&s.a, 9) // ok on 64-bit architectures 19 | } 20 | -------------------------------------------------------------------------------- /go/analysis/passes/atomicalign/testdata/src/b/stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file is only here to not trigger "build constraints exclude all Go files" during tests 6 | 7 | package testdata 8 | -------------------------------------------------------------------------------- /go/analysis/passes/bools/bools_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bools_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/bools" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, bools.Analyzer, "a", "typeparams") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/buildssa/testdata/src/a/a.go: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | func Fib(x int) int { 4 | if x < 2 { 5 | return x 6 | } 7 | return Fib(x-1) + Fib(x-2) 8 | } 9 | 10 | type T int 11 | 12 | func (T) fib(x int) int { return Fib(x) } 13 | 14 | func _() { 15 | print("hi") 16 | } 17 | 18 | func _() { 19 | print("hello") 20 | } 21 | -------------------------------------------------------------------------------- /go/analysis/passes/buildssa/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | // Package b contains declarations of generic functions. 2 | package b 3 | 4 | import "unsafe" 5 | 6 | type Pointer[T any] struct { 7 | v unsafe.Pointer 8 | } 9 | 10 | func (x *Pointer[T]) Load() *T { 11 | return (*T)(LoadPointer(&x.v)) 12 | } 13 | 14 | func Load[T any](x *Pointer[T]) *T { 15 | return x.Load() 16 | } 17 | 18 | func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer) 19 | 20 | var G Pointer[int] 21 | -------------------------------------------------------------------------------- /go/analysis/passes/buildssa/testdata/src/c/c.go: -------------------------------------------------------------------------------- 1 | // Package c is to test buildssa importing packages. 2 | package c 3 | 4 | import ( 5 | "a" 6 | "b" 7 | "unsafe" 8 | ) 9 | 10 | func A() { 11 | _ = a.Fib(10) 12 | } 13 | 14 | func B() { 15 | var x int 16 | ptr := unsafe.Pointer(&x) 17 | _ = b.LoadPointer(&ptr) 18 | 19 | m := b.G.Load() 20 | f := b.Load(&b.G) 21 | if f != m { 22 | panic("loads of b.G are expected to be identical") 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/a/buildtag2.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build no 6 | 7 | package a 8 | 9 | // want +1 `misplaced \+build comment` 10 | // +build toolate 11 | 12 | // want +1 `misplaced //go:build comment` 13 | //go:build toolate 14 | 15 | var _ = ` 16 | // +build notacomment 17 | ` 18 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/a/buildtag3.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +3 `[+]build lines do not match //go:build condition` 6 | 7 | //go:build good 8 | // +build bad 9 | 10 | package a 11 | 12 | var _ = ` 13 | // +build notacomment 14 | ` 15 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/a/buildtag4.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !(bad || worse) 6 | // +build !bad 7 | // +build !worse 8 | 9 | package a 10 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/a/buildtag5.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !(bad || worse) 6 | // +build !bad,!worse 7 | 8 | package a 9 | 10 | //want +1 `misplaced \+build comment` 11 | // +build other 12 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/a/buildtag6.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "go_asm.h" 6 | 7 | // ok because we cannot parse assembly files. 8 | // +build no 9 | 10 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/a/buildtag7.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | #include "go_asm.h" 8 | 9 | // ok because we cannot parse assembly files 10 | // the assembler would complain if we did assemble this file. 11 | //go:build no 12 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/a/buildtag8.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +3 `\+build lines do not match //go:build condition` 6 | 7 | //go:build something 8 | // +build ignore 9 | 10 | #include "go_asm.h" 11 | 12 | // ok because we cannot parse assembly files 13 | // the assembler would complain if we did assemble this file. 14 | //go:build no 15 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/b/vers.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +3 `invalid go version \"go1.20.1\" in build constraint` 6 | // want +1 `invalid go version \"go1.20.1\" in build constraint` 7 | //go:build go1.20.1 8 | // +build go1.20.1 9 | 10 | package b 11 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/b/vers1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file is intentionally so its build tags always match. 6 | 7 | package b 8 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/b/vers2.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +1 `invalid go version \"go120\" in build constraint` 6 | //go:build go120 7 | 8 | package b 9 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/b/vers3.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +1 `invalid go version \"go1..20\" in build constraint` 6 | //go:build go1..20 7 | 8 | package b 9 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/b/vers4.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +1 `invalid go version \"go.20\" in build constraint` 6 | //go:build go.20 7 | 8 | package b 9 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/b/vers5.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +1 `invalid go version \"g1.20\" in build constraint` 6 | //go:build g1.20 7 | 8 | package b 9 | -------------------------------------------------------------------------------- /go/analysis/passes/buildtag/testdata/src/b/vers6.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +1 `invalid go version \"go20\" in build constraint` 6 | //go:build go20 7 | 8 | package b 9 | -------------------------------------------------------------------------------- /go/analysis/passes/cgocall/cgocall_go120.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.21 6 | 7 | package cgocall 8 | 9 | import "go/types" 10 | 11 | func setGoVersion(tc *types.Config, pkg *types.Package) { 12 | // no types.Package.GoVersion until Go 1.21 13 | } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/cgocall/cgocall_go121.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.21 6 | 7 | package cgocall 8 | 9 | import "go/types" 10 | 11 | func setGoVersion(tc *types.Config, pkg *types.Package) { 12 | tc.GoVersion = pkg.GoVersion() 13 | } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/cgocall/testdata/src/a/cgo3.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | // The purpose of this inherited test is unclear. 8 | 9 | import "C" 10 | 11 | const x = 1 12 | 13 | var a, b = 1, 2 14 | 15 | func F() { 16 | } 17 | 18 | func FAD(int, string) bool { 19 | C.malloc(3) 20 | return true 21 | } 22 | -------------------------------------------------------------------------------- /go/analysis/passes/cgocall/testdata/src/c/c.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Test the cgo checker on a file that doesn't use cgo. 6 | 7 | package c 8 | 9 | import "unsafe" 10 | 11 | // Passing a pointer (via the slice), but C isn't cgo. 12 | var _ = C.f(unsafe.Pointer(new([]int))) 13 | 14 | var C struct{ f func(interface{}) int } 15 | -------------------------------------------------------------------------------- /go/analysis/passes/composite/testdata/src/a/a_fuzz_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | import "testing" 8 | 9 | var fuzzTargets = []testing.InternalFuzzTarget{ 10 | {"Fuzz", Fuzz}, 11 | } 12 | 13 | func Fuzz(f *testing.F) {} 14 | -------------------------------------------------------------------------------- /go/analysis/passes/composite/testdata/src/a/a_fuzz_test.go.golden: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | import "testing" 8 | 9 | var fuzzTargets = []testing.InternalFuzzTarget{ 10 | {"Fuzz", Fuzz}, 11 | } 12 | 13 | func Fuzz(f *testing.F) {} 14 | -------------------------------------------------------------------------------- /go/analysis/passes/composite/testdata/src/typeparams/lib/lib.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lib 6 | 7 | type Struct struct{ F int } 8 | type Slice []int 9 | type Map map[int]int 10 | -------------------------------------------------------------------------------- /go/analysis/passes/copylock/testdata/src/issue67787/issue67787.go: -------------------------------------------------------------------------------- 1 | package issue67787 2 | 3 | import "sync" 4 | 5 | type T struct{ mu sync.Mutex } 6 | type T1 struct{ t *T } 7 | 8 | func NewT1() *T1 { return &T1{T} } // no analyzer diagnostic about T 9 | -------------------------------------------------------------------------------- /go/analysis/passes/ctrlflow/testdata/src/lib/lib.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lib 6 | 7 | func CanReturn() {} 8 | 9 | func NoReturn() { 10 | for { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /go/analysis/passes/defers/cmd/defers/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The defers command runs the defers analyzer. 6 | package main 7 | 8 | import ( 9 | "golang.org/x/tools/go/analysis/passes/defers" 10 | "golang.org/x/tools/go/analysis/singlechecker" 11 | ) 12 | 13 | func main() { singlechecker.Main(defers.Analyzer) } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/defers/defers_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package defers_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/defers" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, defers.Analyzer, "a") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/directive/testdata/src/a/badspace.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ignore 6 | 7 | // want +1 `invalid space '\\u00a0' in //go:debug directive` 8 | //go:debug 00a0 9 | 10 | package main 11 | 12 | -------------------------------------------------------------------------------- /go/analysis/passes/directive/testdata/src/a/issue66046.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ignore 6 | 7 | //go:debug panicnil=1 8 | package main 9 | -------------------------------------------------------------------------------- /go/analysis/passes/directive/testdata/src/a/misplaced.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ignore 6 | 7 | package main 8 | 9 | // want +1 `//go:debug directive only valid before package declaration` 10 | //go:debug panicnil=1 11 | -------------------------------------------------------------------------------- /go/analysis/passes/directive/testdata/src/a/misplaced_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:debug panicnil=1 6 | 7 | package p_test 8 | 9 | // want +1 `//go:debug directive only valid before package declaration` 10 | //go:debug panicnil=1 11 | -------------------------------------------------------------------------------- /go/analysis/passes/directive/testdata/src/a/p.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // want +1 `//go:debug directive only valid in package main or test` 6 | //go:debug panicnil=1 7 | 8 | package p 9 | 10 | // want +1 `//go:debug directive only valid in package main or test` 11 | //go:debug panicnil=1 12 | -------------------------------------------------------------------------------- /go/analysis/passes/fieldalignment/cmd/fieldalignment/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | package main 5 | 6 | import ( 7 | "golang.org/x/tools/go/analysis/passes/fieldalignment" 8 | "golang.org/x/tools/go/analysis/singlechecker" 9 | ) 10 | 11 | func main() { singlechecker.Main(fieldalignment.Analyzer) } 12 | -------------------------------------------------------------------------------- /go/analysis/passes/findcall/cmd/findcall/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The findcall command runs the findcall analyzer. 6 | package main 7 | 8 | import ( 9 | "golang.org/x/tools/go/analysis/passes/findcall" 10 | "golang.org/x/tools/go/analysis/singlechecker" 11 | ) 12 | 13 | func main() { singlechecker.Main(findcall.Analyzer) } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/findcall/testdata/src/a/a.go: -------------------------------------------------------------------------------- 1 | package main // want package:"found" 2 | 3 | func main() { 4 | println("hi") // want "call of println" 5 | print("hi") // not a call of println 6 | } 7 | 8 | func println(s string) {} // want println:"found" 9 | -------------------------------------------------------------------------------- /go/analysis/passes/findcall/testdata/src/a/a.go.golden: -------------------------------------------------------------------------------- 1 | package main // want package:"found" 2 | 3 | func main() { 4 | println_TEST_("hi") // want "call of println" 5 | print("hi") // not a call of println 6 | } 7 | 8 | func println(s string) {} // want println:"found" 9 | -------------------------------------------------------------------------------- /go/analysis/passes/framepointer/testdata/src/a/asm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | -------------------------------------------------------------------------------- /go/analysis/passes/framepointer/testdata/src/a/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | TEXT ·z1(SB), 0, $0 6 | MOVQ $0, BP // want `frame pointer is clobbered before saving` 7 | RET 8 | -------------------------------------------------------------------------------- /go/analysis/passes/framepointer/testdata/src/a/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | TEXT ·z1(SB), 0, $0 6 | MOVQ $0, BP // want `frame pointer is clobbered before saving` 7 | RET 8 | -------------------------------------------------------------------------------- /go/analysis/passes/framepointer/testdata/src/a/asm_windows_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | TEXT ·z1(SB), 0, $0 6 | MOVQ $0, BP // not an error on windows 7 | RET 8 | -------------------------------------------------------------------------------- /go/analysis/passes/framepointer/testdata/src/a/buildtag_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build nope 6 | 7 | TEXT ·bt1(SB), 0, $0 8 | MOVQ $0, BP // ok because of build tag 9 | RET 10 | -------------------------------------------------------------------------------- /go/analysis/passes/gofix/gofix_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gofix_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/gofix" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, gofix.Analyzer, "a") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/hostport/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ignore 6 | 7 | package main 8 | 9 | import ( 10 | "golang.org/x/tools/go/analysis/singlechecker" 11 | "golang.org/x/tools/gopls/internal/analysis/hostport" 12 | ) 13 | 14 | func main() { singlechecker.Main(hostport.Analyzer) } 15 | -------------------------------------------------------------------------------- /go/analysis/passes/httpmux/cmd/httpmux/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The httpmux command runs the httpmux analyzer. 6 | package main 7 | 8 | import ( 9 | "golang.org/x/tools/go/analysis/passes/httpmux" 10 | "golang.org/x/tools/go/analysis/singlechecker" 11 | ) 12 | 13 | func main() { singlechecker.Main(httpmux.Analyzer) } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/ifaceassert/cmd/ifaceassert/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The ifaceassert command runs the ifaceassert analyzer. 6 | package main 7 | 8 | import ( 9 | "golang.org/x/tools/go/analysis/passes/ifaceassert" 10 | "golang.org/x/tools/go/analysis/singlechecker" 11 | ) 12 | 13 | func main() { singlechecker.Main(ifaceassert.Analyzer) } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/loopclosure/testdata/src/a/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package testdata 6 | 7 | // B is declared in a separate file to test that object resolution spans the 8 | // entire package. 9 | var B int 10 | -------------------------------------------------------------------------------- /go/analysis/passes/loopclosure/testdata/src/golang.org/x/sync/errgroup/errgroup.go: -------------------------------------------------------------------------------- 1 | // Package errgroup synthesizes Go's package "golang.org/x/sync/errgroup", 2 | // which is used in unit-testing. 3 | package errgroup 4 | 5 | type Group struct { 6 | } 7 | 8 | func (g *Group) Go(f func() error) { 9 | go func() { 10 | f() 11 | }() 12 | } 13 | -------------------------------------------------------------------------------- /go/analysis/passes/nilfunc/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package nilfunc defines an Analyzer that checks for useless 6 | // comparisons against nil. 7 | // 8 | // # Analyzer nilfunc 9 | // 10 | // nilfunc: check for useless comparisons between functions and nil 11 | // 12 | // A useless comparison is one like f == nil as opposed to f() == nil. 13 | package nilfunc 14 | -------------------------------------------------------------------------------- /go/analysis/passes/nilfunc/nilfunc_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package nilfunc_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/nilfunc" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, nilfunc.Analyzer, "a", "typeparams") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/pkgfact/pkgfact_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package pkgfact_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/pkgfact" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, pkgfact.Analyzer, "c") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/pkgfact/testdata/src/a/a.go: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | const _greeting_ = "hello" 4 | const _audience_ = "world" 5 | -------------------------------------------------------------------------------- /go/analysis/passes/pkgfact/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | package b 2 | 3 | import _ "a" 4 | 5 | const _pi_ = 3.14159 6 | -------------------------------------------------------------------------------- /go/analysis/passes/pkgfact/testdata/src/c/c.go: -------------------------------------------------------------------------------- 1 | // want package:`pairs\(audience="world", greeting="hello", pi=3.14159\)` 2 | 3 | package c 4 | 5 | import _ "b" // want `audience="world" greeting="hello" pi=3.14159` 6 | -------------------------------------------------------------------------------- /go/analysis/passes/printf/testdata/src/issue68744/issue68744.go: -------------------------------------------------------------------------------- 1 | package issue68744 2 | 3 | import "fmt" 4 | 5 | // The use of "any" here is crucial to exercise the bug. 6 | // (None of our earlier tests covered this vital detail!) 7 | func wrapf(format string, args ...any) { // want wrapf:"printfWrapper" 8 | fmt.Printf(format, args...) 9 | } 10 | 11 | func _() { 12 | wrapf("%s", 123) // want `issue68744.wrapf format %s has arg 123 of wrong type int` 13 | } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/printf/testdata/src/nofmt/nofmt.go: -------------------------------------------------------------------------------- 1 | package b 2 | 3 | import ( 4 | "math/big" 5 | "testing" 6 | ) 7 | 8 | func formatBigInt(t *testing.T) { 9 | t.Logf("%d\n", big.NewInt(4)) 10 | } 11 | -------------------------------------------------------------------------------- /go/analysis/passes/shadow/cmd/shadow/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The shadow command runs the shadow analyzer. 6 | package main 7 | 8 | import ( 9 | "golang.org/x/tools/go/analysis/passes/shadow" 10 | "golang.org/x/tools/go/analysis/singlechecker" 11 | ) 12 | 13 | func main() { singlechecker.Main(shadow.Analyzer) } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/shadow/shadow_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package shadow_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/shadow" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, shadow.Analyzer, "a") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/shift/shift_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package shift_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/shift" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, shift.Analyzer, "a", "typeparams") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/slog/slog_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package slog 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | ) 12 | 13 | func Test(t *testing.T) { 14 | testdata := analysistest.TestData() 15 | analysistest.Run(t, testdata, Analyzer, "a", "b") 16 | } 17 | -------------------------------------------------------------------------------- /go/analysis/passes/slog/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file contains tests for the slog checker. 6 | 7 | //go:build go1.21 8 | 9 | package b 10 | 11 | import "a" 12 | 13 | func Imported() { 14 | _ = a.MyLogger.With("a", 1, 2, 3) // want `slog.Logger.With arg "2" should be a string or a slog.Attr` 15 | } 16 | -------------------------------------------------------------------------------- /go/analysis/passes/sortslice/analyzer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package sortslice_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/sortslice" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, sortslice.Analyzer, "a") 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/stdmethods/testdata/src/a/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | type H int 8 | 9 | func (H) As(any) bool // ok 10 | -------------------------------------------------------------------------------- /go/analysis/passes/stdversion/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ignore 6 | 7 | package main 8 | 9 | import ( 10 | "golang.org/x/tools/go/analysis/passes/stdversion" 11 | "golang.org/x/tools/go/analysis/singlechecker" 12 | ) 13 | 14 | func main() { singlechecker.Main(stdversion.Analyzer) } 15 | -------------------------------------------------------------------------------- /go/analysis/passes/stringintconv/cmd/stringintconv/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The stringintconv command runs the stringintconv analyzer. 6 | package main 7 | 8 | import ( 9 | "golang.org/x/tools/go/analysis/passes/stringintconv" 10 | "golang.org/x/tools/go/analysis/singlechecker" 11 | ) 12 | 13 | func main() { singlechecker.Main(stringintconv.Analyzer) } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/stringintconv/testdata/src/fix/fix.go: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | func _(x uint64) { 4 | println(string(x)) // want `conversion from uint64 to string yields...` 5 | } 6 | -------------------------------------------------------------------------------- /go/analysis/passes/stringintconv/testdata/src/fix/fix.go.golden: -------------------------------------------------------------------------------- 1 | -- Format the number as a decimal -- 2 | package fix 3 | 4 | import "fmt" 5 | 6 | func _(x uint64) { 7 | println(fmt.Sprint(x)) // want `conversion from uint64 to string yields...` 8 | } 9 | 10 | -- Convert a single rune to a string -- 11 | package fix 12 | 13 | func _(x uint64) { 14 | println(string(rune(x))) // want `conversion from uint64 to string yields...` 15 | } 16 | 17 | -------------------------------------------------------------------------------- /go/analysis/passes/stringintconv/testdata/src/fix/fixdot.go: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import . "fmt" 4 | 5 | func _(x uint64) { 6 | Println(string(x)) // want `conversion from uint64 to string yields...` 7 | } 8 | -------------------------------------------------------------------------------- /go/analysis/passes/stringintconv/testdata/src/fix/fixdot.go.golden: -------------------------------------------------------------------------------- 1 | -- Format the number as a decimal -- 2 | package fix 3 | 4 | import . "fmt" 5 | 6 | func _(x uint64) { 7 | Println(Sprint(x)) // want `conversion from uint64 to string yields...` 8 | } 9 | 10 | -- Convert a single rune to a string -- 11 | package fix 12 | 13 | import . "fmt" 14 | 15 | func _(x uint64) { 16 | Println(string(rune(x))) // want `conversion from uint64 to string yields...` 17 | } 18 | 19 | -------------------------------------------------------------------------------- /go/analysis/passes/stringintconv/testdata/src/fix/fixnamed.go: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | type mystring string 4 | 5 | func _(x int16) mystring { 6 | return mystring(x) // want `conversion from int16 to mystring \(string\)...` 7 | } 8 | -------------------------------------------------------------------------------- /go/analysis/passes/stringintconv/testdata/src/fix/fixnamed.go.golden: -------------------------------------------------------------------------------- 1 | -- Format the number as a decimal -- 2 | package fix 3 | 4 | import "fmt" 5 | 6 | type mystring string 7 | 8 | func _(x int16) mystring { 9 | return mystring(fmt.Sprint(x)) // want `conversion from int16 to mystring \(string\)...` 10 | } 11 | 12 | -- Convert a single rune to a string -- 13 | package fix 14 | 15 | type mystring string 16 | 17 | func _(x int16) mystring { 18 | return mystring(rune(x)) // want `conversion from int16 to mystring \(string\)...` 19 | } 20 | -------------------------------------------------------------------------------- /go/analysis/passes/structtag/testdata/src/a/b/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package b 6 | 7 | type AnonymousJSONField struct { 8 | DuplicateAnonJSON int `json:"a"` 9 | } 10 | -------------------------------------------------------------------------------- /go/analysis/passes/testinggoroutine/testdata/src/a/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | import "testing" 8 | 9 | func helper(t *testing.T) { 10 | t.Skip() 11 | } 12 | -------------------------------------------------------------------------------- /go/analysis/passes/testinggoroutine/testdata/src/typeparams/typeparams.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package typeparams 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func f[P any](t *testing.T) { 12 | t.Fatal("failed") 13 | } 14 | 15 | func TestBadFatalf[P any](t *testing.T) { 16 | go f[int](t) // want "call to .+T.+Fatal from a non-test goroutine" 17 | } 18 | -------------------------------------------------------------------------------- /go/analysis/passes/tests/testdata/src/a/a.go: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | func Foo() {} 4 | -------------------------------------------------------------------------------- /go/analysis/passes/tests/testdata/src/a/ax_test.go: -------------------------------------------------------------------------------- 1 | package a_test 2 | 3 | import _ "a" 4 | 5 | func ExampleFoo() {} // OK because a.Foo exists 6 | 7 | func ExampleBar() {} // want "ExampleBar refers to unknown identifier: Bar" 8 | -------------------------------------------------------------------------------- /go/analysis/passes/tests/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | package b 2 | 3 | type Foo struct { 4 | } 5 | 6 | func (f *Foo) F() { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /go/analysis/passes/tests/testdata/src/b_x_test/b_test.go: -------------------------------------------------------------------------------- 1 | package b_x_test 2 | 3 | import ( 4 | "a" 5 | "b" 6 | ) 7 | 8 | func ExampleFoo_F() { 9 | var x b.Foo 10 | x.F() 11 | a.Foo() 12 | } 13 | 14 | func ExampleFoo_G() { // want "ExampleFoo_G refers to unknown field or method: Foo.G" 15 | 16 | } 17 | 18 | func ExampleBar_F() { // want "ExampleBar_F refers to unknown identifier: Bar" 19 | 20 | } 21 | -------------------------------------------------------------------------------- /go/analysis/passes/tests/testdata/src/divergent/buf.go: -------------------------------------------------------------------------------- 1 | // Test of examples with divergent packages. 2 | 3 | // Package buf ... 4 | package buf 5 | 6 | // Buf is a ... 7 | type Buf []byte 8 | 9 | // Append ... 10 | func (*Buf) Append([]byte) {} 11 | 12 | func (Buf) Reset() {} 13 | 14 | func (Buf) Len() int { return 0 } 15 | 16 | // DefaultBuf is a ... 17 | var DefaultBuf Buf 18 | -------------------------------------------------------------------------------- /go/analysis/passes/tests/testdata/src/typeparams/typeparams.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package typeparams 6 | 7 | func Zero[T any]() T { 8 | var zero T 9 | return zero 10 | } 11 | -------------------------------------------------------------------------------- /go/analysis/passes/timeformat/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | package b 2 | 3 | type B struct { 4 | } 5 | 6 | func Parse(string, string) B { 7 | return B{} 8 | } 9 | 10 | func (b B) Format(string) { 11 | } 12 | -------------------------------------------------------------------------------- /go/analysis/passes/unmarshal/cmd/unmarshal/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The unmarshal command runs the unmarshal analyzer. 6 | package main 7 | 8 | import ( 9 | "golang.org/x/tools/go/analysis/passes/unmarshal" 10 | "golang.org/x/tools/go/analysis/singlechecker" 11 | ) 12 | 13 | func main() { singlechecker.Main(unmarshal.Analyzer) } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/unmarshal/testdata/src/typeparams/typeparams.go: -------------------------------------------------------------------------------- 1 | package typeparams 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | func unmarshalT[T any](data []byte) T { 9 | var x T 10 | json.Unmarshal(data, x) 11 | return x 12 | } 13 | 14 | func unmarshalT2[T any](data []byte, t T) { 15 | json.Unmarshal(data, t) 16 | } 17 | 18 | func main() { 19 | x := make(map[string]interface{}) 20 | unmarshalT2([]byte(`{"a":1}`), &x) 21 | fmt.Println(x) 22 | } -------------------------------------------------------------------------------- /go/analysis/passes/unusedwrite/testdata/src/importsunsafe/i.go: -------------------------------------------------------------------------------- 1 | package importsunsafe 2 | 3 | import "unsafe" 4 | 5 | type S struct { 6 | F, G int 7 | } 8 | 9 | func _() { 10 | var s S 11 | s.F = 1 12 | // This write to G is used below, because &s.F allows access to all of s, but 13 | // the analyzer would naively report it as unused. For this reason, we 14 | // silence the analysis if unsafe is imported. 15 | s.G = 2 16 | 17 | ptr := unsafe.Pointer(&s.F) 18 | t := (*S)(ptr) 19 | println(t.G) 20 | } 21 | -------------------------------------------------------------------------------- /go/analysis/passes/usesgenerics/testdata/src/a/a.go: -------------------------------------------------------------------------------- 1 | // want package:`features{typeDecl,funcDecl,funcInstance}` 2 | 3 | package a 4 | 5 | type T[P any] int 6 | 7 | func F[P any]() {} 8 | 9 | var _ = F[int] 10 | -------------------------------------------------------------------------------- /go/analysis/passes/usesgenerics/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | // want package:`features{typeSet}` 2 | 3 | package b 4 | 5 | type Constraint interface { 6 | ~int | string 7 | } 8 | -------------------------------------------------------------------------------- /go/analysis/passes/usesgenerics/testdata/src/c/c.go: -------------------------------------------------------------------------------- 1 | // want package:`features{typeDecl,funcDecl,typeSet,typeInstance,funcInstance}` 2 | 3 | // Features funcDecl, typeSet, and funcInstance come from imported packages "a" 4 | // and "b". These features are not directly present in "c". 5 | 6 | package c 7 | 8 | import ( 9 | "a" 10 | "b" 11 | ) 12 | 13 | type T[P b.Constraint] a.T[P] 14 | -------------------------------------------------------------------------------- /go/analysis/passes/usesgenerics/testdata/src/d/d.go: -------------------------------------------------------------------------------- 1 | // want package:`features{typeSet}` 2 | 3 | package d 4 | 5 | type myInt int 6 | 7 | func _() { 8 | // Sanity check that we can both detect local types and interfaces with 9 | // embedded defined types. 10 | type constraint interface { 11 | myInt 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /go/analysis/passes/waitgroup/testdata/src/a/a.go: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | import "sync" 4 | 5 | func f() { 6 | var wg sync.WaitGroup 7 | wg.Add(1) // ok 8 | go func() { 9 | wg.Add(1) // want "WaitGroup.Add called from inside new goroutine" 10 | // ... 11 | wg.Add(1) // ok 12 | }() 13 | wg.Add(1) // ok 14 | } 15 | -------------------------------------------------------------------------------- /go/analysis/passes/waitgroup/waitgroup_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package waitgroup_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/go/analysis/passes/waitgroup" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | analysistest.Run(t, analysistest.TestData(), waitgroup.Analyzer, "a") 16 | } 17 | -------------------------------------------------------------------------------- /go/ast/astutil/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package astutil 6 | 7 | import "go/ast" 8 | 9 | // Unparen returns e with any enclosing parentheses stripped. 10 | // Deprecated: use [ast.Unparen]. 11 | // 12 | //go:fix inline 13 | func Unparen(e ast.Expr) ast.Expr { return ast.Unparen(e) } 14 | -------------------------------------------------------------------------------- /go/callgraph/cha/testdata/func.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Test of dynamic function calls; no interfaces. 4 | 5 | func A(int) {} 6 | 7 | var ( 8 | B = func(int) {} 9 | C = func(int) {} 10 | ) 11 | 12 | func f() { 13 | pfn := B 14 | pfn(0) // calls A, B, C, even though A is not even address-taken 15 | } 16 | 17 | // WANT: 18 | // Dynamic calls 19 | // f --> A 20 | // f --> init$1 21 | // f --> init$2 22 | -------------------------------------------------------------------------------- /go/callgraph/vta/testdata/src/d/d.go: -------------------------------------------------------------------------------- 1 | package d 2 | 3 | func D(i int) int { 4 | return i + 1 5 | } 6 | 7 | type Data struct { 8 | V int 9 | } 10 | 11 | func (d Data) Do() int { 12 | return d.V - 1 13 | } 14 | -------------------------------------------------------------------------------- /go/callgraph/vta/testdata/src/issue63146.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | type embedded struct{} 4 | 5 | type S struct{ embedded } 6 | 7 | func (_ S) M() {} 8 | 9 | type C interface { 10 | M() 11 | S 12 | } 13 | 14 | func G[T C]() { 15 | t := T{embedded{}} 16 | t.M() 17 | } 18 | 19 | func F() { 20 | G[S]() 21 | } 22 | 23 | // WANT: 24 | // F: G[testdata.S]() -> G[testdata.S] 25 | // G[testdata.S]: (S).M(t2) -> S.M 26 | // S.M: (testdata.S).M(t1) -> S.M 27 | -------------------------------------------------------------------------------- /go/callgraph/vta/testdata/src/simple.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package main 6 | 7 | var gl int 8 | 9 | type X struct { 10 | a int 11 | b int 12 | } 13 | 14 | func main() { 15 | print(gl) 16 | } 17 | 18 | func foo() (r int) { return gl } 19 | -------------------------------------------------------------------------------- /go/callgraph/vta/testdata/src/t/t.go: -------------------------------------------------------------------------------- 1 | package t 2 | 3 | import "d" 4 | 5 | func t(i int) int { 6 | data := d.Data{V: i} 7 | return d.D(i) + data.Do() 8 | } 9 | -------------------------------------------------------------------------------- /go/expect/testdata/go.fake.mod: -------------------------------------------------------------------------------- 1 | // This file is named go.fake.mod so it does not define a real module, which 2 | // would make the contents of this directory unavailable to the test when run 3 | // from outside the repository. 4 | 5 | module αfake1α //@mark(αMarker, "αfake1α") 6 | 7 | go 1.14 8 | 9 | require golang.org/modfile v0.0.0 //@mark(βMarker, "require golang.org/modfile v0.0.0") 10 | -------------------------------------------------------------------------------- /go/expect/testdata/go.fake.work: -------------------------------------------------------------------------------- 1 | // This file is named go.fake.mod so it does not define a real module, which 2 | // would make the contents of this directory unavailable to the test when run 3 | // from outside the repository. 4 | 5 | go 1.23.0 //@mark(αMarker, "1.23.0") 6 | 7 | use ./αβ //@mark(βMarker, "αβ") 8 | -------------------------------------------------------------------------------- /go/gccgoexportdata/testdata/errors.gox: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/go/gccgoexportdata/testdata/errors.gox -------------------------------------------------------------------------------- /go/gccgoexportdata/testdata/long.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/go/gccgoexportdata/testdata/long.a -------------------------------------------------------------------------------- /go/gccgoexportdata/testdata/short.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/go/gccgoexportdata/testdata/short.a -------------------------------------------------------------------------------- /go/internal/gccgoimporter/newInterface11.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build go1.11 6 | 7 | package gccgoimporter 8 | 9 | import "go/types" 10 | 11 | func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface { 12 | return types.NewInterfaceType(methods, embeddeds) 13 | } 14 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/complexnums.go: -------------------------------------------------------------------------------- 1 | package complexnums 2 | 3 | const NN = -1 - 1i 4 | const NP = -1 + 1i 5 | const PN = 1 - 1i 6 | const PP = 1 + 1i 7 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/complexnums.gox: -------------------------------------------------------------------------------- 1 | v1; 2 | package complexnums; 3 | pkgpath complexnums; 4 | priority 1; 5 | const NN = -0.1E1-0.1E1i ; 6 | const NP = -0.1E1+0.1E1i ; 7 | const PN = 0.1E1-0.1E1i ; 8 | const PP = 0.1E1+0.1E1i ; 9 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/conversions.go: -------------------------------------------------------------------------------- 1 | package conversions 2 | 3 | type Units string 4 | 5 | const Bits = Units("bits") 6 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/conversions.gox: -------------------------------------------------------------------------------- 1 | v2; 2 | package conversions; 3 | prefix go; 4 | package conversions go.conversions go.conversions; 5 | const Bits > = convert(, "bits"); 6 | type ; 7 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/escapeinfo.go: -------------------------------------------------------------------------------- 1 | // Test case for escape info in export data. To compile and extract .gox file: 2 | // gccgo -fgo-optimize-allocs -c escapeinfo.go 3 | // objcopy -j .go_export escapeinfo.o escapeinfo.gox 4 | 5 | package escapeinfo 6 | 7 | type T struct{ data []byte } 8 | 9 | func NewT(data []byte) *T { 10 | return &T{data} 11 | } 12 | 13 | func (*T) Read(p []byte) {} 14 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/escapeinfo.gox: -------------------------------------------------------------------------------- 1 | v2; 2 | package escapeinfo; 3 | prefix go; 4 | package escapeinfo go.escapeinfo go.escapeinfo; 5 | func NewT (data >) >; }> 6 | func (? >) Read (p >); 7 | >>; 8 | type ; 9 | checksum 3500838130783C0059CD0C81527F60E9738E3ACE; 10 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/imports.go: -------------------------------------------------------------------------------- 1 | package imports 2 | 3 | import "fmt" 4 | 5 | var Hello = fmt.Sprintf("Hello, world") 6 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/imports.gox: -------------------------------------------------------------------------------- 1 | v1; 2 | package imports; 3 | pkgpath imports; 4 | priority 7; 5 | import fmt fmt "fmt"; 6 | init imports imports..import 7 math math..import 1 runtime runtime..import 1 strconv strconv..import 2 io io..import 3 reflect reflect..import 3 syscall syscall..import 3 time time..import 4 os os..import 5 fmt fmt..import 6; 7 | var Hello ; 8 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/issue27856.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | type M struct { 4 | E E 5 | } 6 | type F struct { 7 | _ *M 8 | } 9 | type E = F 10 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/issue27856.gox: -------------------------------------------------------------------------------- 1 | v2; 2 | package main; 3 | pkgpath main; 4 | import runtime runtime "runtime"; 5 | init runtime runtime..import sys runtime_internal_sys..import; 6 | init_graph 0 1; 7 | type ; }>>>; }>>>; 8 | type ; 9 | type ; 10 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/issue30628.go: -------------------------------------------------------------------------------- 1 | package issue30628 2 | 3 | import ( 4 | "os" 5 | "sync" 6 | ) 7 | 8 | const numR = int32(os.O_TRUNC + 5) 9 | 10 | type Apple struct { 11 | hey sync.RWMutex 12 | x int 13 | RQ [numR]struct { 14 | Count uintptr 15 | NumBytes uintptr 16 | Last uintptr 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/issue31540.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package issue31540 6 | 7 | type Y struct { 8 | q int 9 | } 10 | 11 | type Z map[int]int 12 | 13 | type X = map[Y]Z 14 | 15 | type A1 = X 16 | 17 | type A2 = A1 18 | 19 | type S struct { 20 | b int 21 | A2 22 | } 23 | 24 | func Hallo() S { 25 | return S{} 26 | } 27 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/issue34182.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package issue34182 6 | 7 | type T1 struct { 8 | f *T2 9 | } 10 | 11 | type T2 struct { 12 | f T3 13 | } 14 | 15 | type T3 struct { 16 | *T2 17 | } 18 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/issue34182.gox: -------------------------------------------------------------------------------- 1 | v3; 2 | package issue34182 3 | pkgpath issue34182 4 | init issue34182 ~go.issue34182 5 | types 8 4 21 21 21 17 30 45 45 6 | type 1 "T1" 7 | type 2 "T2" 8 | type 3 "T3" 9 | type 4 * 10 | type 5 struct { ? ; } 11 | type 6 struct { .go.issue34182.f ; } 12 | type 7 struct { .go.issue34182.f ; } 13 | checksum FF02C49BAF44B06C087ED4E573F7CC880C79C208 14 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/libimportsar.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/go/internal/gccgoimporter/testdata/libimportsar.a -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/nointerface.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package nointerface 6 | 7 | type I int 8 | 9 | //go:nointerface 10 | func (p *I) Get() int { return int(*p) } 11 | 12 | func (p *I) Set(v int) { *p = I(v) } 13 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/nointerface.gox: -------------------------------------------------------------------------------- 1 | v3; 2 | package nointerface 3 | pkgpath nointerface 4 | types 3 2 133 17 5 | type 1 "I" 6 | func /*nointerface*/ (p ) Get () 7 | func (p ) Set (v ) 8 | type 2 * 9 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/notinheap.go: -------------------------------------------------------------------------------- 1 | package notinheap 2 | 3 | //go:notinheap 4 | type S struct{} 5 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/notinheap.gox: -------------------------------------------------------------------------------- 1 | v3; 2 | package notinheap 3 | pkgpath notinheap 4 | init notinheap ~notinheap 5 | types 3 2 30 18 6 | type 1 "S" notinheap 7 | type 2 struct { } 8 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/pointer.go: -------------------------------------------------------------------------------- 1 | package pointer 2 | 3 | type Int8Ptr *int8 4 | -------------------------------------------------------------------------------- /go/internal/gccgoimporter/testdata/pointer.gox: -------------------------------------------------------------------------------- 1 | v1; 2 | package pointer; 3 | pkgpath pointer; 4 | type >>; 5 | -------------------------------------------------------------------------------- /go/loader/testdata/a.go: -------------------------------------------------------------------------------- 1 | package P 2 | -------------------------------------------------------------------------------- /go/loader/testdata/b.go: -------------------------------------------------------------------------------- 1 | package P 2 | -------------------------------------------------------------------------------- /go/loader/testdata/badpkgdecl.go: -------------------------------------------------------------------------------- 1 | // this file has no package decl 2 | -------------------------------------------------------------------------------- /go/loader/testdata/issue46877/x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package x 6 | 7 | // #include "x.h" 8 | import "C" 9 | 10 | var _ C.myint 11 | -------------------------------------------------------------------------------- /go/loader/testdata/issue46877/x.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | typedef int myint; 6 | -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/one/modules/example.com/extra/help.go: -------------------------------------------------------------------------------- 1 | package extra -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/one/primarymod/main.go: -------------------------------------------------------------------------------- 1 | package one -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/modules/example.com/extra/geez/help.go: -------------------------------------------------------------------------------- 1 | package example.com/extra/geez -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/geez/help.go: -------------------------------------------------------------------------------- 1 | package example.com/extra/geez -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/me.go: -------------------------------------------------------------------------------- 1 | package example.com/extra -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/modules/example.com/extra/yo.go: -------------------------------------------------------------------------------- 1 | package example.com/extra -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/modules/example.com/tempmod/main.go: -------------------------------------------------------------------------------- 1 | package example.com/tempmod -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.0.0/main.go: -------------------------------------------------------------------------------- 1 | package example.com/what -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.1.0/main.go: -------------------------------------------------------------------------------- 1 | package example.com/what -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/primarymod/expect/yo.go: -------------------------------------------------------------------------------- 1 | package expect 2 | 3 | var X int //@check("X", "X") 4 | -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/primarymod/expect/yo_test.go: -------------------------------------------------------------------------------- 1 | package expect_test 2 | 3 | import ( 4 | "testdata/groups/two/expect" 5 | "testing" 6 | ) 7 | 8 | func TestX(t *testing.T) { 9 | _ = expect.X //@check("X", "X") 10 | } 11 | -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/groups/two/primarymod/main.go: -------------------------------------------------------------------------------- 1 | package two -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/test_test.go: -------------------------------------------------------------------------------- 1 | package fake1 2 | 3 | type ATestType string //@check("ATestType","ATestType") 4 | -------------------------------------------------------------------------------- /go/packages/packagestest/testdata/x_test.go: -------------------------------------------------------------------------------- 1 | package fake1_test 2 | 3 | type AnXTestType string //@check("AnXTestType","AnXTestType") 4 | -------------------------------------------------------------------------------- /go/ssa/TODO: -------------------------------------------------------------------------------- 1 | -*- text -*- 2 | 3 | SSA Generics to-do list 4 | =========================== 5 | 6 | DOCUMENTATION: 7 | - Read me for internals 8 | 9 | TYPE PARAMETERIZED GENERIC FUNCTIONS: 10 | - sanity.go updates. 11 | - Check source functions going to generics. 12 | - Tests, tests, tests... 13 | 14 | USAGE: 15 | - Back fill users for handling ssa.InstantiateGenerics being off. 16 | 17 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/fixedbugs/issue52342.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | var d byte 5 | 6 | d = 1 7 | d <<= 256 8 | if d != 0 { 9 | panic(d) 10 | } 11 | 12 | d = 1 13 | d >>= 256 14 | if d != 0 { 15 | panic(d) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/fixedbugs/issue52835.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | var called bool 4 | 5 | type I interface { 6 | Foo() 7 | } 8 | 9 | type A struct{} 10 | 11 | func (a A) Foo() { 12 | called = true 13 | } 14 | 15 | func lambda[X I]() func() func() { 16 | return func() func() { 17 | var x X 18 | return x.Foo 19 | } 20 | } 21 | 22 | func main() { 23 | lambda[A]()()() 24 | if !called { 25 | panic(called) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/reflect.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "reflect" 4 | 5 | func main() { 6 | // Regression test for issue 9462. 7 | got := reflect.SliceOf(reflect.TypeOf(byte(0))).String() 8 | if got != "[]uint8" && got != "[]byte" { // result varies by toolchain 9 | println("BUG: " + got) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/encoding/encoding.go: -------------------------------------------------------------------------------- 1 | package encoding 2 | 3 | type BinaryMarshaler interface { 4 | MarshalBinary() (data []byte, err error) 5 | } 6 | type BinaryUnmarshaler interface { 7 | UnmarshalBinary(data []byte) error 8 | } 9 | 10 | type TextMarshaler interface { 11 | MarshalText() (text []byte, err error) 12 | } 13 | type TextUnmarshaler interface { 14 | UnmarshalText(text []byte) error 15 | } 16 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/errors/errors.go: -------------------------------------------------------------------------------- 1 | package errors 2 | 3 | func New(text string) error { return errorString{text} } 4 | 5 | type errorString struct{ s string } 6 | 7 | func (e errorString) Error() string { return e.s } 8 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/io/io.go: -------------------------------------------------------------------------------- 1 | package io 2 | 3 | import "errors" 4 | 5 | var EOF = errors.New("EOF") 6 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/log/log.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | func Println(v ...interface{}) { 9 | fmt.Println(v...) 10 | } 11 | func Printf(format string, v ...interface{}) { 12 | fmt.Printf(format, v...) 13 | } 14 | 15 | func Fatalln(v ...interface{}) { 16 | Println(v...) 17 | os.Exit(1) 18 | } 19 | 20 | func Fatalf(format string, v ...interface{}) { 21 | Printf(format, v...) 22 | os.Exit(1) 23 | } 24 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/math/math.go: -------------------------------------------------------------------------------- 1 | package math 2 | 3 | func Copysign(float64, float64) float64 4 | 5 | func NaN() float64 6 | 7 | func Inf(int) float64 8 | 9 | func IsNaN(float64) bool 10 | 11 | func Float64bits(float64) uint64 12 | 13 | func Signbit(x float64) bool { 14 | return Float64bits(x)&(1<<63) != 0 15 | } 16 | 17 | func Sqrt(x float64) float64 18 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/os/os.go: -------------------------------------------------------------------------------- 1 | package os 2 | 3 | func Getenv(string) string 4 | 5 | func Exit(int) 6 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/runtime/runtime.go: -------------------------------------------------------------------------------- 1 | package runtime 2 | 3 | // An errorString represents a runtime error described by a single string. 4 | type errorString string 5 | 6 | func (e errorString) RuntimeError() {} 7 | 8 | func (e errorString) Error() string { 9 | return "runtime error: " + string(e) 10 | } 11 | 12 | func Breakpoint() 13 | 14 | type Error interface { 15 | error 16 | RuntimeError() 17 | } 18 | 19 | func GC() 20 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/sort/sort.go: -------------------------------------------------------------------------------- 1 | package sort 2 | 3 | func Strings(x []string) 4 | func Ints(x []int) 5 | func Float64s(x []float64) 6 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/strconv/strconv.go: -------------------------------------------------------------------------------- 1 | package strconv 2 | 3 | func Itoa(i int) string 4 | func Atoi(s string) (int, error) 5 | 6 | func FormatFloat(float64, byte, int, int) string 7 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/time/time.go: -------------------------------------------------------------------------------- 1 | package time 2 | 3 | type Duration int64 4 | 5 | func Sleep(Duration) 6 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/unicode/utf8/utf8.go: -------------------------------------------------------------------------------- 1 | package utf8 2 | 3 | func DecodeRuneInString(string) (rune, int) 4 | 5 | func DecodeRune(b []byte) (rune, int) { 6 | return DecodeRuneInString(string(b)) 7 | } 8 | 9 | const RuneError = '\uFFFD' 10 | -------------------------------------------------------------------------------- /go/ssa/interp/testdata/src/unsafe/unsafe.go: -------------------------------------------------------------------------------- 1 | package unsafe 2 | -------------------------------------------------------------------------------- /go/ssa/testdata/fixedbugs/issue66783a.go: -------------------------------------------------------------------------------- 1 | //go:build ignore 2 | // +build ignore 3 | 4 | package issue66783a 5 | 6 | type S[T any] struct { 7 | a T 8 | } 9 | 10 | func (s S[T]) M() { 11 | type A S[T] 12 | type B[U any] A 13 | _ = B[rune](s) 14 | } 15 | 16 | // M[int] 17 | 18 | // panic: in (issue66783a.S[int]).M[int]: 19 | // cannot convert term *t0 (issue66783a.S[int] [within struct{a int}]) 20 | // to type issue66783a.B[rune] [within struct{a T}] [recovered] 21 | 22 | func M() { 23 | S[int]{}.M() 24 | } 25 | -------------------------------------------------------------------------------- /go/ssa/testdata/fixedbugs/issue66783b.go: -------------------------------------------------------------------------------- 1 | //go:build ignore 2 | // +build ignore 3 | 4 | package issue66783b 5 | 6 | type I1[T any] interface { 7 | M(T) 8 | } 9 | 10 | type I2[T any] I1[T] 11 | 12 | func foo[T any](i I2[T]) { 13 | _ = i.M 14 | } 15 | 16 | type S[T any] struct{} 17 | 18 | func (s S[T]) M(t T) {} 19 | 20 | func M2() { 21 | foo[int](I2[int](S[int]{})) 22 | } 23 | -------------------------------------------------------------------------------- /go/ssa/testdata/fixedbugs/issue73594.go: -------------------------------------------------------------------------------- 1 | package issue73594 2 | 3 | // Regression test for sanity-check failure caused by not clearing 4 | // Function.subst after building a body-less instantiated function. 5 | 6 | type genericType[T any] struct{} 7 | 8 | func (genericType[T]) methodWithoutBody() 9 | 10 | func callMethodWithoutBody() { 11 | msg := &genericType[int]{} 12 | msg.methodWithoutBody() 13 | } 14 | -------------------------------------------------------------------------------- /go/ssa/testdata/indirect.txtar: -------------------------------------------------------------------------------- 1 | -- go.mod -- 2 | module testdata 3 | go 1.18 4 | 5 | -- a/a.go -- 6 | package a 7 | 8 | import "testdata/b" 9 | 10 | func A() { 11 | var x b.B 12 | x.F() 13 | } 14 | 15 | -- b/b.go -- 16 | package b 17 | 18 | import "testdata/c" 19 | 20 | type B struct { c.C } 21 | 22 | -- c/c.go -- 23 | package c 24 | 25 | type C int 26 | func (C) F() {} -------------------------------------------------------------------------------- /go/ssa/testdata/src/README.txt: -------------------------------------------------------------------------------- 1 | These files are present to test building ssa on go files that use signatures from standard library packages. 2 | 3 | Only the exported members used by the tests are needed. 4 | 5 | Providing these decreases testing time ~10x (90s -> 8s) compared to building the standard library packages form source during tests. -------------------------------------------------------------------------------- /go/ssa/testdata/src/bytes/bytes.go: -------------------------------------------------------------------------------- 1 | package bytes 2 | 3 | func Compare(a, b []byte) int 4 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/context/context.go: -------------------------------------------------------------------------------- 1 | package context 2 | 3 | type Context interface { 4 | Done() <-chan struct{} 5 | } 6 | 7 | func Background() Context 8 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/encoding/encoding.go: -------------------------------------------------------------------------------- 1 | package encoding 2 | 3 | type BinaryMarshaler interface { 4 | MarshalBinary() (data []byte, err error) 5 | } 6 | 7 | type BinaryUnmarshaler interface { 8 | UnmarshalBinary(data []byte) error 9 | } 10 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/encoding/json/json.go: -------------------------------------------------------------------------------- 1 | package json 2 | 3 | func Marshal(v any) ([]byte, error) 4 | func Unmarshal(data []byte, v any) error 5 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/encoding/xml/xml.go: -------------------------------------------------------------------------------- 1 | package xml 2 | 3 | func Marshal(v any) ([]byte, error) 4 | func Unmarshal(data []byte, v any) error 5 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/errors/errors.go: -------------------------------------------------------------------------------- 1 | package errors 2 | 3 | func New(text string) error 4 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/fmt/fmt.go: -------------------------------------------------------------------------------- 1 | package fmt 2 | 3 | func Sprint(args ...interface{}) string 4 | func Sprintln(args ...interface{}) string 5 | func Sprintf(format string, args ...interface{}) string 6 | 7 | func Print(args ...interface{}) (int, error) 8 | func Println(args ...interface{}) 9 | func Printf(format string, args ...interface{}) (int, error) 10 | 11 | func Errorf(format string, args ...interface{}) error 12 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/io/io.go: -------------------------------------------------------------------------------- 1 | package io 2 | 3 | import "errors" 4 | 5 | var EOF = errors.New("EOF") 6 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/log/log.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | func Println(v ...interface{}) 4 | func Fatalln(v ...interface{}) 5 | func Fatalf(format string, v ...any) 6 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/math/math.go: -------------------------------------------------------------------------------- 1 | package math 2 | 3 | func NaN() float64 4 | 5 | func Inf(int) float64 6 | 7 | func IsNaN(float64) bool 8 | 9 | func Float64bits(float64) uint64 10 | 11 | func Signbit(x float64) bool 12 | 13 | func Sqrt(x float64) float64 14 | 15 | func Sin(x float64) float64 16 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/os/os.go: -------------------------------------------------------------------------------- 1 | package os 2 | 3 | func Getenv(string) string 4 | 5 | func Exit(int) 6 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/runtime/runtime.go: -------------------------------------------------------------------------------- 1 | package runtime 2 | 3 | func GC() 4 | 5 | func SetFinalizer(obj, finalizer any) 6 | 7 | func Caller(skip int) (pc uintptr, file string, line int, ok bool) 8 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/sort/sort.go: -------------------------------------------------------------------------------- 1 | package sort 2 | 3 | func Strings(x []string) 4 | func Ints(x []int) 5 | func Float64s(x []float64) 6 | 7 | func Sort(data Interface) 8 | 9 | type Interface interface { 10 | Len() int 11 | Less(i, j int) bool 12 | Swap(i, j int) 13 | } 14 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/strconv/strconv.go: -------------------------------------------------------------------------------- 1 | package strconv 2 | 3 | func Itoa(i int) string 4 | func Atoi(s string) (int, error) 5 | 6 | func FormatFloat(float64, byte, int, int) string 7 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/strings/strings.go: -------------------------------------------------------------------------------- 1 | package strings 2 | 3 | func Replace(s, old, new string, n int) string 4 | func Index(haystack, needle string) int 5 | func Contains(haystack, needle string) bool 6 | func HasPrefix(s, prefix string) bool 7 | func EqualFold(s, t string) bool 8 | func ToLower(s string) string 9 | 10 | type Builder struct{} 11 | 12 | func (b *Builder) WriteString(s string) (int, error) 13 | func (b *Builder) String() string 14 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/sync/atomic/atomic.go: -------------------------------------------------------------------------------- 1 | package atomic 2 | 3 | import "unsafe" 4 | 5 | func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer) 6 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/sync/sync.go: -------------------------------------------------------------------------------- 1 | package sync 2 | 3 | type Mutex struct{} 4 | 5 | func (m *Mutex) Lock() 6 | func (m *Mutex) Unlock() 7 | 8 | type WaitGroup struct{} 9 | 10 | func (wg *WaitGroup) Add(delta int) 11 | func (wg *WaitGroup) Done() 12 | func (wg *WaitGroup) Wait() 13 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/time/time.go: -------------------------------------------------------------------------------- 1 | package time 2 | 3 | type Duration int64 4 | 5 | func Sleep(Duration) 6 | 7 | func NewTimer(d Duration) *Timer 8 | 9 | type Timer struct { 10 | C <-chan Time 11 | } 12 | 13 | func (t *Timer) Stop() bool 14 | 15 | type Time struct{} 16 | 17 | func After(d Duration) <-chan Time 18 | 19 | const ( 20 | Nanosecond Duration = iota // Specific values do not matter here. 21 | Second 22 | Minute 23 | Hour 24 | ) 25 | -------------------------------------------------------------------------------- /go/ssa/testdata/src/unsafe/unsafe.go: -------------------------------------------------------------------------------- 1 | package unsafe 2 | 3 | // Empty unsafe package helps other packages load. 4 | // TODO(taking): determine why. 5 | -------------------------------------------------------------------------------- /godoc/static/analysis/call-eg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/call-eg.png -------------------------------------------------------------------------------- /godoc/static/analysis/call3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/call3.png -------------------------------------------------------------------------------- /godoc/static/analysis/callers1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/callers1.png -------------------------------------------------------------------------------- /godoc/static/analysis/callers2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/callers2.png -------------------------------------------------------------------------------- /godoc/static/analysis/chan1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/chan1.png -------------------------------------------------------------------------------- /godoc/static/analysis/chan2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/chan2a.png -------------------------------------------------------------------------------- /godoc/static/analysis/chan2b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/chan2b.png -------------------------------------------------------------------------------- /godoc/static/analysis/error1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/error1.png -------------------------------------------------------------------------------- /godoc/static/analysis/ident-def.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/ident-def.png -------------------------------------------------------------------------------- /godoc/static/analysis/ident-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/ident-field.png -------------------------------------------------------------------------------- /godoc/static/analysis/ident-func.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/ident-func.png -------------------------------------------------------------------------------- /godoc/static/analysis/ipcg-func.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/ipcg-func.png -------------------------------------------------------------------------------- /godoc/static/analysis/ipcg-pkg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/ipcg-pkg.png -------------------------------------------------------------------------------- /godoc/static/analysis/typeinfo-pkg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/typeinfo-pkg.png -------------------------------------------------------------------------------- /godoc/static/analysis/typeinfo-src.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/analysis/typeinfo-src.png -------------------------------------------------------------------------------- /godoc/static/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package static exports a map of static file content that supports the godoc 6 | // user interface. The map should be used with the mapfs package, see 7 | // golang.org/x/tools/godoc/vfs/mapfs. 8 | package static // import "golang.org/x/tools/godoc/static" 9 | -------------------------------------------------------------------------------- /godoc/static/error.html: -------------------------------------------------------------------------------- 1 | 6 | 7 |

8 | {{html .}} 9 |

10 | -------------------------------------------------------------------------------- /godoc/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/favicon.ico -------------------------------------------------------------------------------- /godoc/static/gopher/pkg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/gopher/pkg.png -------------------------------------------------------------------------------- /godoc/static/images/minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/images/minus.gif -------------------------------------------------------------------------------- /godoc/static/images/plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/images/plus.gif -------------------------------------------------------------------------------- /godoc/static/images/treeview-black-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/images/treeview-black-line.gif -------------------------------------------------------------------------------- /godoc/static/images/treeview-black.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/images/treeview-black.gif -------------------------------------------------------------------------------- /godoc/static/images/treeview-default-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/images/treeview-default-line.gif -------------------------------------------------------------------------------- /godoc/static/images/treeview-default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/images/treeview-default.gif -------------------------------------------------------------------------------- /godoc/static/images/treeview-gray-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/images/treeview-gray-line.gif -------------------------------------------------------------------------------- /godoc/static/images/treeview-gray.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/godoc/static/images/treeview-gray.gif -------------------------------------------------------------------------------- /godoc/static/implements.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /godoc/static/methodset.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /gopls/doc/assets/add-test-for-func.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/add-test-for-func.png -------------------------------------------------------------------------------- /gopls/doc/assets/assets.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package assets is an empty package to appease "go test ./...", 6 | // as run by our CI builders, which doesn't like an empty module. 7 | package assets 8 | -------------------------------------------------------------------------------- /gopls/doc/assets/browse-assembly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/browse-assembly.png -------------------------------------------------------------------------------- /gopls/doc/assets/browse-free-symbols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/browse-free-symbols.png -------------------------------------------------------------------------------- /gopls/doc/assets/browse-pkg-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/browse-pkg-doc.png -------------------------------------------------------------------------------- /gopls/doc/assets/code-action-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/code-action-doc.png -------------------------------------------------------------------------------- /gopls/doc/assets/convert-string-interpreted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/convert-string-interpreted.png -------------------------------------------------------------------------------- /gopls/doc/assets/convert-string-raw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/convert-string-raw.png -------------------------------------------------------------------------------- /gopls/doc/assets/diagnostic-analysis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/diagnostic-analysis.png -------------------------------------------------------------------------------- /gopls/doc/assets/diagnostic-typeerror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/diagnostic-typeerror.png -------------------------------------------------------------------------------- /gopls/doc/assets/document-highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/document-highlight.png -------------------------------------------------------------------------------- /gopls/doc/assets/documentlink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/documentlink.png -------------------------------------------------------------------------------- /gopls/doc/assets/extract-function-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/extract-function-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/extract-function-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/extract-function-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/extract-to-new-file-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/extract-to-new-file-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/extract-to-new-file-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/extract-to-new-file-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/extract-val-all-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/extract-val-all-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/extract-var-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/extract-var-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/extract-var-all-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/extract-var-all-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/extract-var-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/extract-var-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/fill-struct-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/fill-struct-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/fill-struct-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/fill-struct-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/fill-switch-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/fill-switch-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/fill-switch-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/fill-switch-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/fill-switch-enum-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/fill-switch-enum-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/fill-switch-enum-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/fill-switch-enum-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/foldingrange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/foldingrange.png -------------------------------------------------------------------------------- /gopls/doc/assets/go.mod: -------------------------------------------------------------------------------- 1 | // This module contains no Go code, but serves to carve out a hole in 2 | // its parent module to avoid bloating it with large image files that 3 | // would otherwise be downloaded by "go install golang.org/x/tools/gopls@latest". 4 | 5 | module golang.org/x/tools/gopls/doc/assets 6 | 7 | go 1.23.0 8 | -------------------------------------------------------------------------------- /gopls/doc/assets/hover-basic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/hover-basic.png -------------------------------------------------------------------------------- /gopls/doc/assets/hover-doclink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/hover-doclink.png -------------------------------------------------------------------------------- /gopls/doc/assets/hover-embed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/hover-embed.png -------------------------------------------------------------------------------- /gopls/doc/assets/hover-field-tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/hover-field-tag.png -------------------------------------------------------------------------------- /gopls/doc/assets/hover-linkname.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/hover-linkname.png -------------------------------------------------------------------------------- /gopls/doc/assets/hover-size-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/hover-size-field.png -------------------------------------------------------------------------------- /gopls/doc/assets/hover-size-struct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/hover-size-struct.png -------------------------------------------------------------------------------- /gopls/doc/assets/hover-size-wasteful.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/hover-size-wasteful.png -------------------------------------------------------------------------------- /gopls/doc/assets/inlayhint-parameternames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/inlayhint-parameternames.png -------------------------------------------------------------------------------- /gopls/doc/assets/invert-if-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/invert-if-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/invert-if-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/invert-if-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/outgoingcalls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/outgoingcalls.png -------------------------------------------------------------------------------- /gopls/doc/assets/remove-unusedparam-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/remove-unusedparam-after.png -------------------------------------------------------------------------------- /gopls/doc/assets/remove-unusedparam-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/remove-unusedparam-before.png -------------------------------------------------------------------------------- /gopls/doc/assets/rename-conflict.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/rename-conflict.png -------------------------------------------------------------------------------- /gopls/doc/assets/signature-help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/signature-help.png -------------------------------------------------------------------------------- /gopls/doc/assets/subtypes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/subtypes.png -------------------------------------------------------------------------------- /gopls/doc/assets/supertypes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/assets/supertypes.png -------------------------------------------------------------------------------- /gopls/doc/features/completion.md: -------------------------------------------------------------------------------- 1 | # Gopls: Completion 2 | 3 | TODO(golang/go#62022): document 4 | -------------------------------------------------------------------------------- /gopls/doc/features/modfiles.md: -------------------------------------------------------------------------------- 1 | # Gopls: Support for go.mod and go.work files 2 | 3 | TODO: document these features for go.{mod,work} files: 4 | - hover 5 | - vulncheck 6 | - add dependency 7 | - update dependency 8 | - diagnostics 9 | 10 | -------------------------------------------------------------------------------- /gopls/doc/inline-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/inline-after.png -------------------------------------------------------------------------------- /gopls/doc/inline-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/inline-before.png -------------------------------------------------------------------------------- /gopls/doc/release/README: -------------------------------------------------------------------------------- 1 | This directory contains the draft release notes for each upcoming release. 2 | 3 | Be sure to update the file for the forthcoming release in the same CL 4 | that you add new features or fix noteworthy bugs. 5 | 6 | See https://github.com/golang/tools/releases for all past releases. 7 | 8 | Tip: when reviewing edits to markdown files in Gerrit, to see the 9 | rendered form, click the "Open in Code Search" link (magnifying glass 10 | in blue square) then click "View in > gitiles" (shortcut: `v g`). 11 | -------------------------------------------------------------------------------- /gopls/doc/zeroconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/doc/zeroconfig.png -------------------------------------------------------------------------------- /gopls/internal/analysis/deprecated/deprecated_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package deprecated 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | ) 12 | 13 | func Test(t *testing.T) { 14 | testdata := analysistest.TestData() 15 | analysistest.Run(t, testdata, Analyzer, "a") 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/analysis/deprecated/testdata/src/a/a_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package usedeprecated 6 | 7 | import "testing" 8 | 9 | func TestF(t *testing.T) { 10 | Legacy() // expect no deprecation notice. 11 | x() 12 | } 13 | -------------------------------------------------------------------------------- /gopls/internal/analysis/embeddirective/embeddirective_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package embeddirective 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | ) 12 | 13 | func Test(t *testing.T) { 14 | testdata := analysistest.TestData() 15 | analysistest.RunWithSuggestedFixes(t, testdata, Analyzer, "a") 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/analysis/embeddirective/testdata/src/a/embedText: -------------------------------------------------------------------------------- 1 | Hello World -------------------------------------------------------------------------------- /gopls/internal/analysis/embeddirective/testdata/src/a/import_missing.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | import ( 8 | "fmt" 9 | ) 10 | 11 | //go:embed embedtext // want "must import \"embed\" when using go:embed directives" 12 | var s string 13 | 14 | // This is main function 15 | func main() { 16 | fmt.Println(s) 17 | } 18 | -------------------------------------------------------------------------------- /gopls/internal/analysis/fillreturns/testdata/src/typeparams/a.go: -------------------------------------------------------------------------------- 1 | package fillreturns 2 | 3 | func hello[T any]() int { 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /gopls/internal/analysis/fillreturns/testdata/src/typeparams/a.go.golden: -------------------------------------------------------------------------------- 1 | package fillreturns 2 | 3 | func hello[T any]() int { 4 | return 5 | } 6 | -------------------------------------------------------------------------------- /gopls/internal/analysis/fillstruct/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | package fillstruct 2 | 3 | type B struct { 4 | ExportedInt int 5 | unexportedInt int 6 | } 7 | -------------------------------------------------------------------------------- /gopls/internal/analysis/fillswitch/testdata/src/b/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package b 6 | 7 | type TypeB int 8 | 9 | const ( 10 | TypeBOne TypeB = iota 11 | TypeBTwo 12 | TypeBThree 13 | ) 14 | 15 | type ExportedInterface interface { 16 | isExportedInterface() 17 | } 18 | 19 | type notExportedType struct{} 20 | 21 | func (notExportedType) isExportedInterface() {} 22 | -------------------------------------------------------------------------------- /gopls/internal/analysis/infertypeargs/testdata/src/a/imported.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | import "a/imported" 8 | 9 | func _() { 10 | var x int 11 | imported.F[int](x) // want "unnecessary type arguments" 12 | } 13 | -------------------------------------------------------------------------------- /gopls/internal/analysis/infertypeargs/testdata/src/a/imported.go.golden: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | import "a/imported" 8 | 9 | func _() { 10 | var x int 11 | imported.F(x) // want "unnecessary type arguments" 12 | } 13 | -------------------------------------------------------------------------------- /gopls/internal/analysis/infertypeargs/testdata/src/a/imported/imported.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package imported 6 | 7 | func F[T any](T) {} 8 | -------------------------------------------------------------------------------- /gopls/internal/analysis/maprange/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ignore 6 | 7 | // The unusedfunc command runs the maprange analyzer. 8 | package main 9 | 10 | import ( 11 | "golang.org/x/tools/go/analysis/singlechecker" 12 | "golang.org/x/tools/gopls/internal/analysis/maprange" 13 | ) 14 | 15 | func main() { singlechecker.Main(maprange.Analyzer) } 16 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/appendclipped/bytesclone.go: -------------------------------------------------------------------------------- 1 | package appendclipped 2 | 3 | import ( 4 | "bytes" 5 | ) 6 | 7 | var _ bytes.Buffer 8 | 9 | func _(b []byte) { 10 | print(append([]byte{}, b...)) // want "Replace append with bytes.Clone" 11 | } 12 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/appendclipped/bytesclone.go.golden: -------------------------------------------------------------------------------- 1 | package appendclipped 2 | 3 | import ( 4 | "bytes" 5 | ) 6 | 7 | var _ bytes.Buffer 8 | 9 | func _(b []byte) { 10 | print(bytes.Clone(b)) // want "Replace append with bytes.Clone" 11 | } 12 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/bloop/bloop.go: -------------------------------------------------------------------------------- 1 | package bloop 2 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/efaceany/efaceany.go: -------------------------------------------------------------------------------- 1 | package efaceany 2 | 3 | func _(x interface{}) {} // want "interface{} can be replaced by any" 4 | 5 | func _() { 6 | var x interface{} // want "interface{} can be replaced by any" 7 | const any = 1 8 | var y interface{} // nope: any is shadowed here 9 | _, _ = x, y 10 | } 11 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/efaceany/efaceany.go.golden: -------------------------------------------------------------------------------- 1 | package efaceany 2 | 3 | func _(x any) {} // want "interface{} can be replaced by any" 4 | 5 | func _() { 6 | var x any // want "interface{} can be replaced by any" 7 | const any = 1 8 | var y interface{} // nope: any is shadowed here 9 | _, _ = x, y 10 | } 11 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/fieldsseq/fieldsseq_go123.go: -------------------------------------------------------------------------------- 1 | package fieldsseq 2 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/splitseq/splitseq_go123.go: -------------------------------------------------------------------------------- 1 | package splitseq 2 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/stringscutprefix/bytescutprefix/bytescutprefix.go: -------------------------------------------------------------------------------- 1 | package bytescutprefix 2 | 3 | import ( 4 | "bytes" 5 | ) 6 | 7 | func _() { 8 | if bytes.HasPrefix(bss, bspre) { // want "HasPrefix \\+ TrimPrefix can be simplified to CutPrefix" 9 | a := bytes.TrimPrefix(bss, bspre) 10 | _ = a 11 | } 12 | if bytes.HasPrefix([]byte(""), []byte("")) { // want "HasPrefix \\+ TrimPrefix can be simplified to CutPrefix" 13 | a := bytes.TrimPrefix([]byte(""), []byte("")) 14 | _ = a 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/stringscutprefix/bytescutprefix/bytescutprefix.go.golden: -------------------------------------------------------------------------------- 1 | package bytescutprefix 2 | 3 | import ( 4 | "bytes" 5 | ) 6 | 7 | func _() { 8 | if after, ok := bytes.CutPrefix(bss, bspre); ok { // want "HasPrefix \\+ TrimPrefix can be simplified to CutPrefix" 9 | a := after 10 | _ = a 11 | } 12 | if after, ok := bytes.CutPrefix([]byte(""), []byte("")); ok { // want "HasPrefix \\+ TrimPrefix can be simplified to CutPrefix" 13 | a := after 14 | _ = a 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/stringscutprefix/bytescutprefix/bytescutprefix_dot.go: -------------------------------------------------------------------------------- 1 | package bytescutprefix 2 | 3 | import ( 4 | . "bytes" 5 | ) 6 | 7 | var bss, bspre []byte 8 | 9 | // test supported cases of pattern 1 10 | func _() { 11 | if HasPrefix(bss, bspre) { // want "HasPrefix \\+ TrimPrefix can be simplified to CutPrefix" 12 | a := TrimPrefix(bss, bspre) 13 | _ = a 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/stringscutprefix/bytescutprefix/bytescutprefix_dot.go.golden: -------------------------------------------------------------------------------- 1 | package bytescutprefix 2 | 3 | import ( 4 | . "bytes" 5 | ) 6 | 7 | var bss, bspre []byte 8 | 9 | // test supported cases of pattern 1 10 | func _() { 11 | if after, ok := CutPrefix(bss, bspre); ok { // want "HasPrefix \\+ TrimPrefix can be simplified to CutPrefix" 12 | a := after 13 | _ = a 14 | } 15 | } -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/testingcontext/testingcontext.go: -------------------------------------------------------------------------------- 1 | package testingcontext 2 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/waitgroup/waitgroup_alias.go: -------------------------------------------------------------------------------- 1 | package waitgroup 2 | 3 | import ( 4 | "fmt" 5 | sync1 "sync" 6 | ) 7 | 8 | func _() { 9 | var wg sync1.WaitGroup 10 | wg.Add(1) // want "Goroutine creation can be simplified using WaitGroup.Go" 11 | go func() { 12 | defer wg.Done() 13 | fmt.Println() 14 | }() 15 | 16 | wg.Add(1) // want "Goroutine creation can be simplified using WaitGroup.Go" 17 | go func() { 18 | fmt.Println() 19 | wg.Done() 20 | }() 21 | } 22 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/waitgroup/waitgroup_alias.go.golden: -------------------------------------------------------------------------------- 1 | package waitgroup 2 | 3 | import ( 4 | "fmt" 5 | sync1 "sync" 6 | ) 7 | 8 | func _() { 9 | var wg sync1.WaitGroup 10 | // want "Goroutine creation can be simplified using WaitGroup.Go" 11 | wg.Go(func() { 12 | fmt.Println() 13 | }) 14 | 15 | // want "Goroutine creation can be simplified using WaitGroup.Go" 16 | wg.Go(func() { 17 | fmt.Println() 18 | }) 19 | } -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/waitgroup/waitgroup_dot.go: -------------------------------------------------------------------------------- 1 | package waitgroup 2 | 3 | import ( 4 | "fmt" 5 | . "sync" 6 | ) 7 | 8 | // supported case for pattern 1. 9 | func _() { 10 | var wg WaitGroup 11 | wg.Add(1) // want "Goroutine creation can be simplified using WaitGroup.Go" 12 | go func() { 13 | defer wg.Done() 14 | fmt.Println() 15 | }() 16 | 17 | wg.Add(1) // want "Goroutine creation can be simplified using WaitGroup.Go" 18 | go func() { 19 | fmt.Println() 20 | wg.Done() 21 | }() 22 | } 23 | -------------------------------------------------------------------------------- /gopls/internal/analysis/modernize/testdata/src/waitgroup/waitgroup_dot.go.golden: -------------------------------------------------------------------------------- 1 | package waitgroup 2 | 3 | import ( 4 | "fmt" 5 | . "sync" 6 | ) 7 | 8 | // supported case for pattern 1. 9 | func _() { 10 | var wg WaitGroup 11 | // want "Goroutine creation can be simplified using WaitGroup.Go" 12 | wg.Go(func() { 13 | fmt.Println() 14 | }) 15 | 16 | // want "Goroutine creation can be simplified using WaitGroup.Go" 17 | wg.Go(func() { 18 | fmt.Println() 19 | }) 20 | } -------------------------------------------------------------------------------- /gopls/internal/analysis/nonewvars/testdata/src/a/a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package nonewvars 6 | 7 | import "log" 8 | 9 | func x() { 10 | z := 1 11 | z := 2 // want "no new variables on left side of :=" 12 | 13 | _, z := 3, 100 // want "no new variables on left side of :=" 14 | 15 | log.Println(z) 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/analysis/nonewvars/testdata/src/a/a.go.golden: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package nonewvars 6 | 7 | import "log" 8 | 9 | func x() { 10 | z := 1 11 | z = 2 // want "no new variables on left side of :=" 12 | 13 | _, z = 3, 100 // want "no new variables on left side of :=" 14 | 15 | log.Println(z) 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/analysis/nonewvars/testdata/src/typeparams/a.go: -------------------------------------------------------------------------------- 1 | package nonewvars 2 | 3 | func hello[T any]() int { 4 | var z T 5 | z := 1 // want "no new variables on left side of :=" 6 | } 7 | -------------------------------------------------------------------------------- /gopls/internal/analysis/nonewvars/testdata/src/typeparams/a.go.golden: -------------------------------------------------------------------------------- 1 | package nonewvars 2 | 3 | func hello[T any]() int { 4 | var z T 5 | z = 1 // want "no new variables on left side of :=" 6 | } 7 | -------------------------------------------------------------------------------- /gopls/internal/analysis/noresultvalues/testdata/src/a/a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package noresultvalues 6 | 7 | func x() { return nil } // want `no result values expected|too many return values` 8 | 9 | func y() { return nil, "hello" } // want `no result values expected|too many return values` 10 | -------------------------------------------------------------------------------- /gopls/internal/analysis/noresultvalues/testdata/src/a/a.go.golden: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package noresultvalues 6 | 7 | func x() { return } // want `no result values expected|too many return values` 8 | 9 | func y() { return } // want `no result values expected|too many return values` 10 | -------------------------------------------------------------------------------- /gopls/internal/analysis/noresultvalues/testdata/src/typeparams/a.go: -------------------------------------------------------------------------------- 1 | package noresult 2 | 3 | func hello[T any]() { 4 | var z T 5 | return z // want `no result values expected|too many return values` 6 | } 7 | -------------------------------------------------------------------------------- /gopls/internal/analysis/noresultvalues/testdata/src/typeparams/a.go.golden: -------------------------------------------------------------------------------- 1 | package noresult 2 | 3 | func hello[T any]() { 4 | var z T 5 | return // want `no result values expected|too many return values` 6 | } 7 | -------------------------------------------------------------------------------- /gopls/internal/analysis/unusedfunc/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ignore 6 | 7 | // The unusedfunc command runs the unusedfunc analyzer. 8 | package main 9 | 10 | import ( 11 | "golang.org/x/tools/go/analysis/singlechecker" 12 | "golang.org/x/tools/gopls/internal/analysis/unusedfunc" 13 | ) 14 | 15 | func main() { singlechecker.Main(unusedfunc.Analyzer) } 16 | -------------------------------------------------------------------------------- /gopls/internal/analysis/unusedparams/cmd/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // The unusedparams command runs the unusedparams analyzer. 6 | package main 7 | 8 | import ( 9 | "golang.org/x/tools/go/analysis/singlechecker" 10 | "golang.org/x/tools/gopls/internal/analysis/unusedparams" 11 | ) 12 | 13 | func main() { singlechecker.Main(unusedparams.Analyzer) } 14 | -------------------------------------------------------------------------------- /gopls/internal/analysis/unusedvariable/testdata/src/decl/a.go.golden: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package decl 6 | 7 | func a() { 8 | var c bool // want `declared (and|but) not used` 9 | panic(c) 10 | 11 | if 1 == 1 { 12 | } 13 | } 14 | 15 | func b() { 16 | // b is a variable 17 | } 18 | 19 | func c() { 20 | var ( 21 | d string 22 | ) 23 | panic(d) 24 | } 25 | -------------------------------------------------------------------------------- /gopls/internal/analysis/yield/yield_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package yield_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/go/analysis/analysistest" 11 | "golang.org/x/tools/gopls/internal/analysis/yield" 12 | ) 13 | 14 | func Test(t *testing.T) { 15 | testdata := analysistest.TestData() 16 | analysistest.Run(t, testdata, yield.Analyzer, "a") 17 | } 18 | -------------------------------------------------------------------------------- /gopls/internal/cache/debug.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cache 6 | 7 | // assert panics with the given msg if cond is not true. 8 | func assert(cond bool, msg string) { 9 | if !cond { 10 | panic(msg) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/api-json.hlp: -------------------------------------------------------------------------------- 1 | print JSON describing gopls API 2 | 3 | Usage: 4 | gopls [flags] api-json 5 | 6 | The api-json command prints a JSON value that describes 7 | and documents all gopls' public interfaces. 8 | Its schema is defined by golang.org/x/tools/gopls/internal/doc.API. 9 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/bug.hlp: -------------------------------------------------------------------------------- 1 | report a bug in gopls 2 | 3 | Usage: 4 | gopls [flags] bug 5 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/call_hierarchy.hlp: -------------------------------------------------------------------------------- 1 | display selected identifier's call hierarchy 2 | 3 | Usage: 4 | gopls [flags] call_hierarchy 5 | 6 | Example: 7 | 8 | $ # 1-indexed location (:line:column or :#offset) of the target identifier 9 | $ gopls call_hierarchy helper/helper.go:8:6 10 | $ gopls call_hierarchy helper/helper.go:#53 11 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/check.hlp: -------------------------------------------------------------------------------- 1 | show diagnostic results for the specified file 2 | 3 | Usage: 4 | gopls [flags] check 5 | 6 | Example: show the diagnostic results of this file: 7 | 8 | $ gopls check internal/cmd/check.go 9 | -severity=string 10 | minimum diagnostic severity (hint, info, warning, or error) (default "warning") 11 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/definition.hlp: -------------------------------------------------------------------------------- 1 | show declaration of selected identifier 2 | 3 | Usage: 4 | gopls [flags] definition [definition-flags] 5 | 6 | Example: show the definition of the identifier at syntax at offset 44 in this file (flag.FlagSet): 7 | 8 | $ gopls definition internal/cmd/definition.go:44:47 9 | $ gopls definition internal/cmd/definition.go:#1270 10 | 11 | definition-flags: 12 | -json 13 | emit output in JSON format 14 | -markdown 15 | support markdown in responses 16 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/fix.hlp: -------------------------------------------------------------------------------- 1 | apply suggested fixes (obsolete) 2 | 3 | Usage: 4 | gopls [flags] fix 5 | No longer supported; use "gopls codeaction" instead. -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/folding_ranges.hlp: -------------------------------------------------------------------------------- 1 | display selected file's folding ranges 2 | 3 | Usage: 4 | gopls [flags] folding_ranges 5 | 6 | Example: 7 | 8 | $ gopls folding_ranges helper/helper.go 9 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/help.hlp: -------------------------------------------------------------------------------- 1 | print usage information for subcommands 2 | 3 | Usage: 4 | gopls [flags] help 5 | 6 | 7 | Examples: 8 | $ gopls help # main gopls help message 9 | $ gopls help remote # help on 'remote' command 10 | $ gopls help remote sessions # help on 'remote sessions' subcommand 11 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/highlight.hlp: -------------------------------------------------------------------------------- 1 | display selected identifier's highlights 2 | 3 | Usage: 4 | gopls [flags] highlight 5 | 6 | Example: 7 | 8 | $ # 1-indexed location (:line:column or :#offset) of the target identifier 9 | $ gopls highlight helper/helper.go:8:6 10 | $ gopls highlight helper/helper.go:#53 11 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/implementation.hlp: -------------------------------------------------------------------------------- 1 | display selected identifier's implementation 2 | 3 | Usage: 4 | gopls [flags] implementation 5 | 6 | Example: 7 | 8 | $ # 1-indexed location (:line:column or :#offset) of the target identifier 9 | $ gopls implementation helper/helper.go:8:6 10 | $ gopls implementation helper/helper.go:#53 11 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/imports.hlp: -------------------------------------------------------------------------------- 1 | updates import statements 2 | 3 | Usage: 4 | gopls [flags] imports [imports-flags] 5 | 6 | Example: update imports statements in a file: 7 | 8 | $ gopls imports -w internal/cmd/check.go 9 | 10 | imports-flags: 11 | -d,-diff 12 | display diffs instead of edited file content 13 | -l,-list 14 | display names of edited files 15 | -preserve 16 | with -write, make copies of original files 17 | -w,-write 18 | write edited content to source files 19 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/inspect.hlp: -------------------------------------------------------------------------------- 1 | interact with the gopls daemon (deprecated: use 'remote') 2 | 3 | Usage: 4 | gopls [flags] inspect [arg]... 5 | 6 | Subcommand: 7 | sessions print information about current gopls sessions 8 | debug start the debug server 9 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/licenses.hlp: -------------------------------------------------------------------------------- 1 | print licenses of included software 2 | 3 | Usage: 4 | gopls [flags] licenses 5 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/links.hlp: -------------------------------------------------------------------------------- 1 | list links in a file 2 | 3 | Usage: 4 | gopls [flags] links [links-flags] 5 | 6 | Example: list links contained within a file: 7 | 8 | $ gopls links internal/cmd/check.go 9 | 10 | links-flags: 11 | -json 12 | emit document links in JSON format 13 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/prepare_rename.hlp: -------------------------------------------------------------------------------- 1 | test validity of a rename operation at location 2 | 3 | Usage: 4 | gopls [flags] prepare_rename 5 | 6 | Example: 7 | 8 | $ # 1-indexed location (:line:column or :#offset) of the target identifier 9 | $ gopls prepare_rename helper/helper.go:8:6 10 | $ gopls prepare_rename helper/helper.go:#53 11 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/references.hlp: -------------------------------------------------------------------------------- 1 | display selected identifier's references 2 | 3 | Usage: 4 | gopls [flags] references [references-flags] 5 | 6 | Example: 7 | 8 | $ # 1-indexed location (:line:column or :#offset) of the target identifier 9 | $ gopls references helper/helper.go:8:6 10 | $ gopls references helper/helper.go:#53 11 | 12 | references-flags: 13 | -d,-declaration 14 | include the declaration of the specified identifier in the results 15 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/remote.hlp: -------------------------------------------------------------------------------- 1 | interact with the gopls daemon 2 | 3 | Usage: 4 | gopls [flags] remote [arg]... 5 | 6 | Subcommand: 7 | sessions print information about current gopls sessions 8 | debug start the debug server 9 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/semtok.hlp: -------------------------------------------------------------------------------- 1 | show semantic tokens for the specified file 2 | 3 | Usage: 4 | gopls [flags] semtok 5 | 6 | Example: show the semantic tokens for this file: 7 | 8 | $ gopls semtok internal/cmd/semtok.go 9 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/signature.hlp: -------------------------------------------------------------------------------- 1 | display selected identifier's signature 2 | 3 | Usage: 4 | gopls [flags] signature 5 | 6 | Example: 7 | 8 | $ # 1-indexed location (:line:column or :#offset) of the target identifier 9 | $ gopls signature helper/helper.go:8:6 10 | $ gopls signature helper/helper.go:#53 11 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/symbols.hlp: -------------------------------------------------------------------------------- 1 | display selected file's symbols 2 | 3 | Usage: 4 | gopls [flags] symbols 5 | 6 | Example: 7 | $ gopls symbols helper/helper.go 8 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/version.hlp: -------------------------------------------------------------------------------- 1 | print the gopls version information 2 | 3 | Usage: 4 | gopls [flags] version 5 | -json 6 | outputs in json format. 7 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/vulncheck.hlp: -------------------------------------------------------------------------------- 1 | run vulncheck analysis (internal-use only) 2 | 3 | Usage: 4 | gopls [flags] vulncheck 5 | 6 | WARNING: this command is for internal-use only. 7 | 8 | By default, the command outputs a JSON-encoded 9 | golang.org/x/tools/gopls/internal/protocol/command.VulncheckResult 10 | message. 11 | Example: 12 | $ gopls vulncheck 13 | 14 | -------------------------------------------------------------------------------- /gopls/internal/cmd/usage/workspace_symbol.hlp: -------------------------------------------------------------------------------- 1 | search symbols in workspace 2 | 3 | Usage: 4 | gopls [flags] workspace_symbol [workspace_symbol-flags] 5 | 6 | Example: 7 | 8 | $ gopls workspace_symbol -matcher fuzzy 'wsymbols' 9 | 10 | workspace_symbol-flags: 11 | -matcher=string 12 | specifies the type of matcher: fuzzy, fastfuzzy, casesensitive, or caseinsensitive. 13 | The default is caseinsensitive. 14 | -------------------------------------------------------------------------------- /gopls/internal/debug/flight_go124.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !go1.25 6 | 7 | package debug 8 | 9 | import ( 10 | "errors" 11 | "net/http" 12 | ) 13 | 14 | func startFlightRecorder() (http.HandlerFunc, error) { 15 | return nil, errors.ErrUnsupported 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/lsprpc/binder.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lsprpc 6 | -------------------------------------------------------------------------------- /gopls/internal/server/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/gopls/internal/server/assets/favicon.ico -------------------------------------------------------------------------------- /gopls/internal/server/debug.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package server 6 | 7 | // assert panics with the given msg if cond is not true. 8 | func assert(cond bool, msg string) { 9 | if !cond { 10 | panic(msg) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/callhierarchy/issue66923.txt: -------------------------------------------------------------------------------- 1 | Regression test for a crash (#66923) in outgoing calls 2 | to a built-in function (unsafe.Slice). 3 | 4 | -- go.mod -- 5 | module example.com 6 | go 1.17 7 | 8 | -- a/a.go -- 9 | package a 10 | 11 | import "unsafe" 12 | 13 | func A() []int { //@ loc(A, "A") 14 | return unsafe.Slice(new(int), 1) //@ outgoingcalls(A) 15 | } 16 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/codeaction/issue64558.txt: -------------------------------------------------------------------------------- 1 | Test of an inlining failure due to an ill-typed input program (#64558). 2 | 3 | -- go.mod -- 4 | module example.com 5 | go 1.18 6 | 7 | -- a/a.go -- 8 | package a 9 | 10 | func _() { 11 | f(1, 2) //@ diag("2", re"too many arguments"), codeaction("f", "refactor.inline.call", end=")", err=re`inlining failed \("too many arguments"\), likely because inputs were ill-typed`) 12 | } 13 | 14 | func f(int) {} 15 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/codeaction/removeparam_funcvalue.txt: -------------------------------------------------------------------------------- 1 | This test exercises change signature refactoring handling of function values. 2 | 3 | TODO(rfindley): use a literalization strategy to allow these references. 4 | 5 | -- go.mod -- 6 | module unused.mod 7 | 8 | go 1.18 9 | 10 | -- a/a.go -- 11 | package a 12 | 13 | func A(x, unused int) int { //@codeaction("unused", "refactor.rewrite.removeUnusedParam", err=re"non-call function reference") 14 | return x 15 | } 16 | 17 | func _() { 18 | _ = A 19 | } 20 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/codeaction/removeparam_witherrs.txt: -------------------------------------------------------------------------------- 1 | This test checks that we can't remove parameters for packages with errors. 2 | 3 | -- p.go -- 4 | package p 5 | 6 | func foo(unused int) { //@codeaction("unused", "refactor.rewrite.removeUnusedParam", err=re"found 0") 7 | } 8 | 9 | func _() { 10 | foo("") //@diag(`""`, re"cannot use") 11 | } 12 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/codelens/generate.txt: -------------------------------------------------------------------------------- 1 | This test exercises the "generate" codelens. 2 | 3 | -- generate.go -- 4 | //@codelenses() 5 | 6 | package generate 7 | 8 | //go:generate echo Hi //@ codelens("//go:generate", "run go generate"), codelens("//go:generate", "run go generate ./...") 9 | //go:generate echo I shall have no CodeLens 10 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/completion/basic_lit.txt: -------------------------------------------------------------------------------- 1 | This test checks completion related to basic literals. 2 | 3 | -- flags -- 4 | -ignore_extra_diags 5 | 6 | -- basiclit.go -- 7 | package basiclit 8 | 9 | func _() { 10 | var a int // something for lexical completions 11 | 12 | _ = "hello." //@complete(".") 13 | 14 | _ = 1 //@complete(" //") 15 | 16 | _ = 1. //@complete(".") 17 | 18 | _ = 'a' //@complete("' ") 19 | } 20 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/completion/cast.txt: -------------------------------------------------------------------------------- 1 | This test checks completion related to casts. 2 | 3 | -- flags -- 4 | -ignore_extra_diags 5 | 6 | -- cast.go -- 7 | package cast 8 | 9 | func _() { 10 | foo := struct{x int}{x: 1} //@item(x_field, "x", "int", "field") 11 | _ = float64(foo.x) //@complete("x", x_field) 12 | } 13 | 14 | func _() { 15 | foo := struct{x int}{x: 1} 16 | _ = float64(foo. //@complete(" /", x_field) 17 | } 18 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/completion/func_sig.txt: -------------------------------------------------------------------------------- 1 | This test checks completion related to function signatures. 2 | 3 | -- flags -- 4 | -ignore_extra_diags 5 | 6 | -- func_sig.go -- 7 | package funcsig 8 | 9 | type someType int //@item(sigSomeType, "someType", "int", "type") 10 | 11 | // Don't complete "foo" in signature. 12 | func (foo someType) _() { //@item(sigFoo, "foo", "someType", "var"),complete(") {", sigSomeType) 13 | 14 | //@complete("", sigFoo, sigSomeType) 15 | } 16 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/completion/issue56505.txt: -------------------------------------------------------------------------------- 1 | Test for golang/go#56505: completion on variables of type *error should not 2 | panic. 3 | 4 | -- flags -- 5 | -ignore_extra_diags 6 | 7 | -- issue.go -- 8 | package issues 9 | 10 | func _() { 11 | var e *error 12 | e.x //@complete(" //") 13 | } 14 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/completion/issue70636.txt: -------------------------------------------------------------------------------- 1 | This test reproduces the crash of golang/go#70636, an out of bounds error when 2 | analyzing a return statement with more results than the signature expects. 3 | 4 | -- flags -- 5 | -ignore_extra_diags 6 | 7 | -- go.mod -- 8 | module example.com 9 | 10 | go 1.21 11 | 12 | -- p.go -- 13 | package p 14 | 15 | var xx int 16 | var xy string 17 | 18 | 19 | func _() { 20 | return Foo(x) //@ rank(re"x()", "xx", "xy") 21 | } 22 | 23 | func Foo[T any](t T) T {} 24 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/completion/unresolved.txt: -------------------------------------------------------------------------------- 1 | This test verifies gopls does not crash on fake "resolved" types. 2 | 3 | -- flags -- 4 | -ignore_extra_diags 5 | 6 | -- settings.json -- 7 | { 8 | "completeUnimported": false 9 | } 10 | 11 | -- unresolved.go -- 12 | package unresolved 13 | 14 | func foo(any) { 15 | foo(func(i, j f //@complete(" //") 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/diagnostics/issue59005.txt: -------------------------------------------------------------------------------- 1 | This test verifies that we don't drop type checking errors on the floor when we 2 | fail to compute positions for their related errors. 3 | 4 | -- go.mod -- 5 | module play.ground 6 | 7 | -- p.go -- 8 | package p 9 | 10 | import ( 11 | . "play.ground/foo" 12 | ) 13 | 14 | const C = 1 //@diag("C", re"C already declared through dot-import") 15 | var _ = C 16 | 17 | -- foo/foo.go -- 18 | package foo 19 | 20 | const C = 2 21 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/diagnostics/issue60544.txt: -------------------------------------------------------------------------------- 1 | This test exercises a crash due to treatment of "comparable" in methodset 2 | calculation (golang/go#60544). 3 | 4 | -- main.go -- 5 | package main 6 | 7 | type X struct{} 8 | 9 | func (X) test(x comparable) {} //@diag("comparable", re"outside a type constraint") 10 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/diagnostics/issue60605.txt: -------------------------------------------------------------------------------- 1 | This test verifies that we can export constants with unknown kind. 2 | Previously, the exporter would panic while attempting to convert such constants 3 | to their target type (float64, in this case). 4 | 5 | -- go.mod -- 6 | module mod.txt/p 7 | 8 | go 1.20 9 | -- p.go -- 10 | package p 11 | 12 | const EPSILON float64 = 1e- //@diag(re"1e-()", re"exponent has no digits") 13 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/diagnostics/issue64547.txt: -------------------------------------------------------------------------------- 1 | This test checks the fix for golang/go#64547: the lostcancel analyzer reports 2 | diagnostics that overflow the file. 3 | 4 | -- p.go -- 5 | package p 6 | 7 | import "context" 8 | 9 | func _() { 10 | _, cancel := context.WithCancel(context.Background()) //@diag("_, cancel", re"not used on all paths") 11 | if false { 12 | cancel() 13 | } 14 | } //@diag("}", re"may be reached without using the cancel") 15 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/fixedbugs/issue61543.txt: -------------------------------------------------------------------------------- 1 | This test verifies that we fail loudly if a module name contains 2 | command-line-arguments. 3 | 4 | -- flags -- 5 | -errors_ok 6 | 7 | -- go.mod -- 8 | module command-line-arguments //@diag("module", re`command-line-arguments.*disallowed`) 9 | 10 | go 1.12 11 | 12 | -- x/x.go -- 13 | package x //@diag("x", re`command-line-arguments.*disallowed`) 14 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/fixedbugs/issue66250.txt: -------------------------------------------------------------------------------- 1 | This bug checks the fix for golang/go#66250. Package references should not 2 | crash when one package file lacks a package name. 3 | 4 | TODO(rfindley): the -ignore_extra_diags flag is only necessary because of 5 | problems matching diagnostics in the broken file, likely due to poor parser 6 | recovery. 7 | 8 | -- flags -- 9 | -ignore_extra_diags 10 | 11 | -- a.go -- 12 | package x //@refs("x", "x") 13 | 14 | -- b.go -- 15 | 16 | func _() { 17 | } 18 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/fixedbugs/issue71044.txt: -------------------------------------------------------------------------------- 1 | This test checks that we don't crash while completing receivers that may happen 2 | to be builtin types (due to invalid code). This crash was reported by telemetry 3 | in golang/go#71044. 4 | 5 | -- flags -- 6 | -ignore_extra_diags 7 | 8 | -- go.mod -- 9 | module example.com/amap 10 | 11 | go 1.18 12 | 13 | -- a.go -- 14 | package amap 15 | 16 | import "unsafe" 17 | 18 | func (unsafe.Pointer) _() {} //@ rank("unsafe") 19 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/highlight/issue68918.txt: -------------------------------------------------------------------------------- 1 | Regression test for https://github.com/golang/go/issues/68918: 2 | crash due to missing type information in CompositeLit. 3 | 4 | The corresponding go/types fix in Go 1.24 introduces a 5 | new error message, hence the -ignore_extra_diags flag. 6 | 7 | -- flags -- 8 | -ignore_extra_diags 9 | 10 | -- a.go -- 11 | package a 12 | 13 | var _ = T{{ x }} //@hiloc(x, "x", text), diag("T", re"undefined"), diag("{ ", re"missing type") 14 | 15 | //@highlight(x, x) 16 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/hover/return.txt: -------------------------------------------------------------------------------- 1 | This test checks that hovering over a return statement reveals the result type. 2 | 3 | -- a.go -- 4 | package a 5 | 6 | func _() int { 7 | return 1 //@hover("return", "return 1", "returns (int)") 8 | } 9 | 10 | func _() (int, int) { 11 | return 1, 2 //@hover("return", "return 1, 2", "returns (int, int)") 12 | } 13 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/modfile/godebug_bad.txt: -------------------------------------------------------------------------------- 1 | This test checks that we surface the error for unexpected godebug values. 2 | 3 | TODO(golang/go#67623): the diagnostic should be on the bad godebug value. 4 | 5 | -- flags -- 6 | -min_go_command=go1.23 7 | -errors_ok 8 | 9 | -- go.mod -- 10 | module example.com/m //@diag("module", re`unknown godebug "gotypealias"`) 11 | 12 | go 1.23 13 | 14 | godebug ( 15 | gotypealias=0 // misspelled 16 | ) 17 | godebug gotypesalias=1 18 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/quickfix/embeddirective.txt: -------------------------------------------------------------------------------- 1 | This test checks the quick fix to add a missing "embed" import. 2 | 3 | -- embed.txt -- 4 | text 5 | -- fix_import.go -- 6 | package embeddirective 7 | 8 | import ( 9 | "io" 10 | "os" 11 | ) 12 | 13 | //go:embed embed.txt //@quickfix("//go:embed", re`must import "embed"`, fix_import) 14 | var t string 15 | 16 | func _() { 17 | _ = os.Stdin 18 | _ = io.EOF 19 | } 20 | -- @fix_import/fix_import.go -- 21 | @@ -4 +4 @@ 22 | + _ "embed" 23 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/quickfix/self_assignment.txt: -------------------------------------------------------------------------------- 1 | Test of the suggested fix to remove unnecessary assignments. 2 | 3 | -- a.go -- 4 | package quickfix 5 | 6 | import ( 7 | "log" 8 | ) 9 | 10 | func _() { 11 | s := "hiiiiiii" 12 | s = s //@quickfix("s = s", re"self-assignment", fix) 13 | log.Print(s) 14 | } 15 | 16 | -- @fix/a.go -- 17 | @@ -9 +9 @@ 18 | - s = s //@quickfix("s = s", re"self-assignment", fix) 19 | + //@quickfix("s = s", re"self-assignment", fix) 20 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/references/imports.txt: -------------------------------------------------------------------------------- 1 | Test of references to local package names (imports). 2 | 3 | -- go.mod -- 4 | module example.com 5 | go 1.12 6 | 7 | -- a/a.go -- 8 | package a 9 | 10 | import "os" //@loc(osDef, `"os"`), refs("os", osDef, osUse) 11 | 12 | import fmt2 "fmt" //@loc(fmt2Def, `fmt2`), refs("fmt2", fmt2Def, fmt2Use) 13 | 14 | func _() { 15 | os.Getwd() //@loc(osUse, "os") 16 | fmt2.Println() //@loc(fmt2Use, "fmt2") 17 | } 18 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/references/issue60622.txt: -------------------------------------------------------------------------------- 1 | Regression test for 'references' bug golang/go#60622: 2 | references to methods of generics were missing. 3 | 4 | -- go.mod -- 5 | module example.com 6 | go 1.18 7 | 8 | -- a/a.go -- 9 | package a 10 | 11 | type G[T any] struct{} 12 | 13 | func (G[T]) M() {} //@loc(Mdef, "M"), refs(Mdef, Mdef, Mref) 14 | 15 | -- b/b.go -- 16 | package b 17 | 18 | import "example.com/a" 19 | 20 | func _() { 21 | new(a.G[int]).M() //@loc(Mref, "M") 22 | } 23 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/references/shadow.txt: -------------------------------------------------------------------------------- 1 | Test of references in the presence of shadowing. 2 | 3 | -- go.mod -- 4 | module example.com 5 | go 1.12 6 | 7 | -- a/a.go -- 8 | package a 9 | 10 | func _() { 11 | x := 123 //@loc(x1, "x"), refs("x", x1, x1ref) 12 | _ = x //@loc(x1ref, "x") 13 | { 14 | x := "hi" //@loc(x2, "x"), refs("x", x2, x2ref) 15 | _ = x //@loc(x2ref, "x") 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/references/typeswitch.txt: -------------------------------------------------------------------------------- 1 | Tests of reference to implicit type switch vars, which are 2 | a special case in go/types.Info{Def,Use,Implicits}. 3 | 4 | -- go.mod -- 5 | module example.com 6 | go 1.18 7 | 8 | -- a/a.go -- 9 | package a 10 | 11 | func _(x any) { 12 | switch y := x.(type) { //@loc(yDecl, "y"), refs("y", yDecl, yInt, yDefault) 13 | case int: 14 | println(y) //@loc(yInt, "y"), refs("y", yDecl, yInt, yDefault) 15 | default: 16 | println(y) //@loc(yDefault, "y") 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/rename/issue39614.txt: -------------------------------------------------------------------------------- 1 | 2 | -- flags -- 3 | -ignore_extra_diags 4 | 5 | -- p.go -- 6 | package issue39614 7 | 8 | func fn() { 9 | var foo bool //@rename("foo", "bar", fooTobar) 10 | make(map[string]bool 11 | if true { 12 | } 13 | } 14 | 15 | -- @fooTobar/p.go -- 16 | @@ -4 +4 @@ 17 | - var foo bool //@rename("foo", "bar", fooTobar) 18 | + var bar bool //@rename("foo", "bar", fooTobar) 19 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/rename/issue61813.txt: -------------------------------------------------------------------------------- 1 | This test exercises the panic reported in golang/go#61813. 2 | 3 | -- p.go -- 4 | package p 5 | 6 | type P struct{} 7 | 8 | func (P) M() {} //@rename("M", "N", MToN) 9 | 10 | var x = []*P{{}} 11 | -- @MToN/p.go -- 12 | @@ -5 +5 @@ 13 | -func (P) M() {} //@rename("M", "N", MToN) 14 | +func (P) N() {} //@rename("M", "N", MToN) 15 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/signature/issue63804.txt: -------------------------------------------------------------------------------- 1 | Regresson test for #63804: conversion to built-in type caused panic. 2 | 3 | the server's Signature method never returns an actual error, 4 | so the best we can assert is that there is no result. 5 | 6 | -- go.mod -- 7 | module example.com 8 | go 1.18 9 | 10 | -- a/a.go -- 11 | package a 12 | 13 | var _ = int(123) //@signature("123", "", 0) 14 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/signature/issue69552.txt: -------------------------------------------------------------------------------- 1 | Regresson test for #69552: panic in activeParam of a builtin, when requesting 2 | signature help outside of the argument list. 3 | 4 | -- go.mod -- 5 | module example.com 6 | go 1.18 7 | 8 | -- a/a.go -- 9 | package a 10 | 11 | func _() { 12 | _ = len([]int{}) //@signature("en", "len(v Type) int", 0) 13 | } 14 | 15 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/token/illformed.txt: -------------------------------------------------------------------------------- 1 | This test checks semanticTokens on ill-formed code. 2 | (Regression test for #68205.) 3 | 4 | -- settings.json -- 5 | { 6 | "semanticTokens": true 7 | } 8 | 9 | -- flags -- 10 | -ignore_extra_diags 11 | 12 | -- a.go -- 13 | package p 14 | 15 | type _ <-<-chan int //@ token("<-", "operator", ""), token("chan", "keyword", "") 16 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/token/issue66809.txt: -------------------------------------------------------------------------------- 1 | This is a regression test for #66809 (missing modifiers for 2 | declarations of function-type variables). 3 | 4 | -- settings.json -- 5 | { 6 | "semanticTokens": true 7 | } 8 | 9 | -- main.go -- 10 | package main 11 | 12 | func main() { 13 | foo := func(x string) string { return x } //@token("foo", "variable", "definition signature") 14 | _ = foo //@token("foo", "variable", "signature") 15 | foo("hello") //@token("foo", "variable", "signature") 16 | } 17 | -------------------------------------------------------------------------------- /gopls/internal/test/marker/testdata/token/issue70251.txt: -------------------------------------------------------------------------------- 1 | This is a regression test for #70251 (missing modifiers for 2 | predeclared interfaces). 3 | 4 | -- settings.json -- 5 | { 6 | "semanticTokens": true 7 | } 8 | 9 | -- a/a.go -- 10 | package a 11 | 12 | var _ any //@token("any", "type", "defaultLibrary interface") 13 | var _ error //@token("error", "type", "defaultLibrary interface") 14 | -------------------------------------------------------------------------------- /gopls/internal/util/README.md: -------------------------------------------------------------------------------- 1 | # util 2 | 3 | This directory is not a Go package. 4 | 5 | Its subdirectories are for utility packages, defined as implementation 6 | helpers (not core machinery) that are used in different ways across 7 | the gopls codebase. -------------------------------------------------------------------------------- /gopls/internal/util/browser/README.md: -------------------------------------------------------------------------------- 1 | This package is a copy of cmd/internal/browser from the go distribution -------------------------------------------------------------------------------- /gopls/internal/util/morestrings/strings.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package morestrings 6 | 7 | import "strings" 8 | 9 | // CutLast is the "last" analogue of [strings.Cut]. 10 | func CutLast(s, sep string) (before, after string, ok bool) { 11 | if i := strings.LastIndex(s, sep); i >= 0 { 12 | return s[:i], s[i+len(sep):], true 13 | } 14 | return s, "", false 15 | } 16 | -------------------------------------------------------------------------------- /internal/diff/export_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package diff 6 | 7 | // This file exports some private declarations to tests. 8 | 9 | var LineEdits = lineEdits 10 | -------------------------------------------------------------------------------- /internal/diff/myers/diff_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package myers_test 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/tools/internal/diff/difftest" 11 | "golang.org/x/tools/internal/diff/myers" 12 | ) 13 | 14 | func TestDiff(t *testing.T) { 15 | difftest.DiffTest(t, myers.ComputeEdits) 16 | } 17 | -------------------------------------------------------------------------------- /internal/diffp/testdata/allnew.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | -- new -- 3 | a 4 | b 5 | c 6 | -- diff -- 7 | diff old new 8 | --- old 9 | +++ new 10 | @@ -0,0 +1,3 @@ 11 | +a 12 | +b 13 | +c 14 | -------------------------------------------------------------------------------- /internal/diffp/testdata/allold.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | a 3 | b 4 | c 5 | -- new -- 6 | -- diff -- 7 | diff old new 8 | --- old 9 | +++ new 10 | @@ -1,3 +0,0 @@ 11 | -a 12 | -b 13 | -c 14 | -------------------------------------------------------------------------------- /internal/diffp/testdata/basic.txt: -------------------------------------------------------------------------------- 1 | Example from Hunt and McIlroy, “An Algorithm for Differential File Comparison.” 2 | https://www.cs.dartmouth.edu/~doug/diff.pdf 3 | 4 | -- old -- 5 | a 6 | b 7 | c 8 | d 9 | e 10 | f 11 | g 12 | -- new -- 13 | w 14 | a 15 | b 16 | x 17 | y 18 | z 19 | e 20 | -- diff -- 21 | diff old new 22 | --- old 23 | +++ new 24 | @@ -1,7 +1,7 @@ 25 | +w 26 | a 27 | b 28 | -c 29 | -d 30 | +x 31 | +y 32 | +z 33 | e 34 | -f 35 | -g 36 | -------------------------------------------------------------------------------- /internal/diffp/testdata/dups.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | a 3 | 4 | b 5 | 6 | c 7 | 8 | d 9 | 10 | e 11 | 12 | f 13 | -- new -- 14 | a 15 | 16 | B 17 | 18 | C 19 | 20 | d 21 | 22 | e 23 | 24 | f 25 | -- diff -- 26 | diff old new 27 | --- old 28 | +++ new 29 | @@ -1,8 +1,8 @@ 30 | a 31 | $ 32 | -b 33 | - 34 | -c 35 | +B 36 | + 37 | +C 38 | $ 39 | d 40 | $ 41 | -------------------------------------------------------------------------------- /internal/diffp/testdata/end.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | 1 3 | 2 4 | 3 5 | 4 6 | 5 7 | 6 8 | 7 9 | eight 10 | nine 11 | ten 12 | eleven 13 | -- new -- 14 | 1 15 | 2 16 | 3 17 | 4 18 | 5 19 | 6 20 | 7 21 | 8 22 | 9 23 | 10 24 | -- diff -- 25 | diff old new 26 | --- old 27 | +++ new 28 | @@ -5,7 +5,6 @@ 29 | 5 30 | 6 31 | 7 32 | -eight 33 | -nine 34 | -ten 35 | -eleven 36 | +8 37 | +9 38 | +10 39 | -------------------------------------------------------------------------------- /internal/diffp/testdata/eof.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | a 3 | b 4 | c^D 5 | -- new -- 6 | a 7 | b 8 | c^D 9 | -- diff -- 10 | -------------------------------------------------------------------------------- /internal/diffp/testdata/eof1.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | a 3 | b 4 | c 5 | -- new -- 6 | a 7 | b 8 | c^D 9 | -- diff -- 10 | diff old new 11 | --- old 12 | +++ new 13 | @@ -1,3 +1,3 @@ 14 | a 15 | b 16 | -c 17 | +c 18 | \ No newline at end of file 19 | -------------------------------------------------------------------------------- /internal/diffp/testdata/eof2.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | a 3 | b 4 | c^D 5 | -- new -- 6 | a 7 | b 8 | c 9 | -- diff -- 10 | diff old new 11 | --- old 12 | +++ new 13 | @@ -1,3 +1,3 @@ 14 | a 15 | b 16 | -c 17 | \ No newline at end of file 18 | +c 19 | -------------------------------------------------------------------------------- /internal/diffp/testdata/same.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | hello world 3 | -- new -- 4 | hello world 5 | -- diff -- 6 | -------------------------------------------------------------------------------- /internal/diffp/testdata/start.txt: -------------------------------------------------------------------------------- 1 | -- old -- 2 | e 3 | pi 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -- new -- 12 | 1 13 | 2 14 | 3 15 | 4 16 | 5 17 | 6 18 | 7 19 | 8 20 | 9 21 | 10 22 | -- diff -- 23 | diff old new 24 | --- old 25 | +++ new 26 | @@ -1,5 +1,6 @@ 27 | -e 28 | -pi 29 | +1 30 | +2 31 | +3 32 | 4 33 | 5 34 | 6 35 | -------------------------------------------------------------------------------- /internal/event/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package event provides a set of packages that cover the main 6 | // concepts of telemetry in an implementation agnostic way. 7 | package event 8 | -------------------------------------------------------------------------------- /internal/expect/testdata/go.fake.mod: -------------------------------------------------------------------------------- 1 | // This file is named go.fake.mod so it does not define a real module, which 2 | // would make the contents of this directory unavailable to the test when run 3 | // from outside the repository. 4 | 5 | module αfake1α //@mark(αMarker, "αfake1α") 6 | 7 | go 1.14 8 | 9 | require golang.org/modfile v0.0.0 //@mark(βMarker, "require golang.org/modfile v0.0.0") 10 | -------------------------------------------------------------------------------- /internal/expect/testdata/go.fake.work: -------------------------------------------------------------------------------- 1 | // This file is named go.fake.mod so it does not define a real module, which 2 | // would make the contents of this directory unavailable to the test when run 3 | // from outside the repository. 4 | 5 | go 1.23.0 //@mark(αMarker, "1.23.0") 6 | 7 | use ./αβ //@mark(βMarker, "αβ") 8 | -------------------------------------------------------------------------------- /internal/gcimporter/iexport_common_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gcimporter 6 | 7 | // Temporarily expose version-related functionality so that we can test at 8 | // specific export data versions. 9 | 10 | var IExportCommon = iexportCommon 11 | 12 | const IExportVersion = iexportVersionGenerics 13 | -------------------------------------------------------------------------------- /internal/gcimporter/israce_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build race 6 | 7 | package gcimporter_test 8 | 9 | func init() { 10 | isRace = true 11 | } 12 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Input for TestIssue13566 6 | 7 | package a 8 | 9 | import "encoding/json" 10 | 11 | type A struct { 12 | a *A 13 | json json.RawMessage 14 | } 15 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/a/a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Input for TestIssue13566 6 | 7 | package a 8 | 9 | import "encoding/json" 10 | 11 | type A struct { 12 | a *A 13 | json json.RawMessage 14 | } 15 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/aliases/a/a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | type A[T any] = *T 8 | 9 | type B = struct{ F int } 10 | 11 | func F() B { 12 | type a[T any] = struct{ F T } 13 | return a[int]{} 14 | } 15 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/aliases/b/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package b 6 | 7 | import "./a" 8 | 9 | type B[S any] = struct { 10 | F a.A[[]S] 11 | } 12 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Input for TestIssue13566 6 | 7 | package b 8 | 9 | import "./a" 10 | 11 | type A a.A 12 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue15920.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package p 6 | 7 | // The underlying type of Error is the underlying type of error. 8 | // Make sure we can import this again without problems. 9 | type Error error 10 | 11 | func F() Error { return nil } 12 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue20046.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package p 6 | 7 | var V interface { 8 | M() 9 | } 10 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue25301.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package issue25301 6 | 7 | type ( 8 | A = interface { 9 | M() 10 | } 11 | T interface { 12 | A 13 | } 14 | S struct{} 15 | ) 16 | 17 | func (S) M() { println("m") } 18 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue51836/a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | type T[K any] struct { 8 | } 9 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue51836/a/a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | type T[K any] struct { 8 | } 9 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue51836/aa.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | import ( 8 | "./a" 9 | ) 10 | 11 | type T[K any] struct { 12 | t a.T[K] 13 | } 14 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue57015.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package issue57015 6 | 7 | type E error 8 | 9 | type X[T any] struct {} 10 | 11 | func F() X[interface { 12 | E 13 | }] { 14 | panic(0) 15 | } 16 | 17 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue58296/a/a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package a 6 | 7 | type A int 8 | 9 | func (A) f() {} 10 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue58296/b/b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package b 6 | 7 | import "./a" 8 | 9 | type B struct { 10 | a a.A 11 | } 12 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/issue58296/c/c.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package c 6 | 7 | import "./b" 8 | 9 | type C struct { 10 | b b.B 11 | } 12 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/p.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Input for TestIssue15517 6 | 7 | package p 8 | 9 | const C = 0 10 | 11 | var V int 12 | 13 | func F() {} 14 | -------------------------------------------------------------------------------- /internal/gcimporter/testdata/versions/test_go1.20_u.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/internal/gcimporter/testdata/versions/test_go1.20_u.a -------------------------------------------------------------------------------- /internal/gocommand/invoke_notunix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !unix 6 | 7 | package gocommand 8 | 9 | import "os" 10 | 11 | // sigStuckProcess is the signal to send to kill a hanging subprocess. 12 | // On Unix we send SIGQUIT, but on non-Unix we only have os.Kill. 13 | var sigStuckProcess = os.Kill 14 | -------------------------------------------------------------------------------- /internal/gocommand/invoke_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build unix 6 | 7 | package gocommand 8 | 9 | import "syscall" 10 | 11 | // Sigstuckprocess is the signal to send to kill a hanging subprocess. 12 | // Send SIGQUIT to get a stack trace. 13 | var sigStuckProcess = syscall.SIGQUIT 14 | -------------------------------------------------------------------------------- /internal/gofix/testdata/src/a/internal/d.go: -------------------------------------------------------------------------------- 1 | // According to the go toolchain's rule about internal packages, 2 | // this package is visible to package a, but not package b. 3 | package internal 4 | 5 | const D = 1 6 | 7 | type T int 8 | -------------------------------------------------------------------------------- /internal/gofix/testdata/src/binding_false/a.go: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | //go:fix inline 4 | func f(x, y int) int { // want f:`goFixInline a.f` 5 | return y + x 6 | } 7 | 8 | func g() { 9 | f(1, 2) // want `Call of a.f should be inlined` 10 | 11 | f(h(1), h(2)) 12 | } 13 | 14 | func h(int) int 15 | -------------------------------------------------------------------------------- /internal/gofix/testdata/src/binding_false/a.go.golden: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | //go:fix inline 4 | func f(x, y int) int { // want f:`goFixInline a.f` 5 | return y + x 6 | } 7 | 8 | func g() { 9 | _ = 2 + 1 // want `Call of a.f should be inlined` 10 | 11 | f(h(1), h(2)) 12 | } 13 | 14 | func h(int) int 15 | -------------------------------------------------------------------------------- /internal/gofix/testdata/src/binding_true/a.go: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | //go:fix inline 4 | func f(x, y int) int { // want f:`goFixInline a.f` 5 | return y + x 6 | } 7 | 8 | func g() { 9 | f(1, 2) // want `Call of a.f should be inlined` 10 | 11 | f(h(1), h(2)) // want `Call of a.f should be inlined` 12 | } 13 | 14 | func h(int) int 15 | -------------------------------------------------------------------------------- /internal/gofix/testdata/src/binding_true/a.go.golden: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | //go:fix inline 4 | func f(x, y int) int { // want f:`goFixInline a.f` 5 | return y + x 6 | } 7 | 8 | func g() { 9 | _ = 2 + 1 // want `Call of a.f should be inlined` 10 | 11 | var x int = h(1) 12 | _ = h(2) + x // want `Call of a.f should be inlined` 13 | } 14 | 15 | func h(int) int 16 | -------------------------------------------------------------------------------- /internal/gofix/testdata/src/c/c.go: -------------------------------------------------------------------------------- 1 | package c 2 | 3 | // This package is dot-imported by package b. 4 | 5 | import "io" 6 | 7 | const C = 1 8 | 9 | //go:fix inline 10 | type R = map[io.Reader]io.Reader 11 | -------------------------------------------------------------------------------- /internal/imports/imports_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package imports 6 | 7 | import ( 8 | "os" 9 | "testing" 10 | 11 | "golang.org/x/tools/internal/testenv" 12 | ) 13 | 14 | func TestMain(m *testing.M) { 15 | testenv.ExitIfSmallMachine() 16 | os.Exit(m.Run()) 17 | } 18 | -------------------------------------------------------------------------------- /internal/imports/testdata/mod/example.com_v1.0.0.txt: -------------------------------------------------------------------------------- 1 | Written by hand. 2 | Test case for module at root of domain. 3 | 4 | -- .mod -- 5 | module example.com 6 | -- .info -- 7 | {"Version": "v1.0.0"} 8 | -- x.go -- 9 | package x 10 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/meta-schemas/draft2020-12/meta/format-annotation.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", 4 | "$dynamicAnchor": "meta", 5 | 6 | "title": "Format vocabulary meta-schema for annotation results", 7 | "type": ["object", "boolean"], 8 | "properties": { 9 | "format": { "type": "string" } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/meta-schemas/draft2020-12/meta/unevaluated.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", 4 | "$dynamicAnchor": "meta", 5 | 6 | "title": "Unevaluated applicator vocabulary meta-schema", 7 | "type": ["object", "boolean"], 8 | "properties": { 9 | "unevaluatedItems": { "$dynamicRef": "#meta" }, 10 | "unevaluatedProperties": { "$dynamicRef": "#meta" } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/draft2020-12/README.md: -------------------------------------------------------------------------------- 1 | # JSON Schema test suite for 2020-12 2 | 3 | These files were copied from 4 | https://github.com/json-schema-org/JSON-Schema-Test-Suite/tree/83e866b46c9f9e7082fd51e83a61c5f2145a1ab7/tests/draft2020-12. 5 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/README.md: -------------------------------------------------------------------------------- 1 | # JSON Schema test suite: remote references 2 | 3 | These files were copied from 4 | https://github.com/json-schema-org/JSON-Schema-Test-Suite/tree/83e866b46c9f9e7082fd51e83a61c5f2145a1ab7/remotes. 5 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/different-id-ref-string.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "http://localhost:1234/real-id-ref-string.json", 3 | "$defs": {"bar": {"type": "string"}}, 4 | "$ref": "#/$defs/bar" 5 | } 6 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/baseUriChange/folderInteger.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "type": "integer" 4 | } 5 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/baseUriChangeFolder/folderInteger.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "type": "integer" 4 | } 5 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/baseUriChangeFolderInSubschema/folderInteger.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "type": "integer" 4 | } 5 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/detached-dynamicref.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "http://localhost:1234/draft2020-12/detached-dynamicref.json", 3 | "$schema": "https://json-schema.org/draft/2020-12/schema", 4 | "$defs": { 5 | "foo": { 6 | "$dynamicRef": "#detached" 7 | }, 8 | "detached": { 9 | "$dynamicAnchor": "detached", 10 | "type": "integer" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/detached-ref.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "http://localhost:1234/draft2020-12/detached-ref.json", 3 | "$schema": "https://json-schema.org/draft/2020-12/schema", 4 | "$defs": { 5 | "foo": { 6 | "$ref": "#detached" 7 | }, 8 | "detached": { 9 | "$anchor": "detached", 10 | "type": "integer" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/integer.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "type": "integer" 4 | } 5 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/locationIndependentIdentifier.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$defs": { 4 | "refToInteger": { 5 | "$ref": "#foo" 6 | }, 7 | "A": { 8 | "$anchor": "foo", 9 | "type": "integer" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/name-defs.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$defs": { 4 | "orNull": { 5 | "anyOf": [ 6 | { 7 | "type": "null" 8 | }, 9 | { 10 | "$ref": "#" 11 | } 12 | ] 13 | } 14 | }, 15 | "type": "string" 16 | } 17 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/nested/foo-ref-string.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "type": "object", 4 | "properties": { 5 | "foo": {"$ref": "string.json"} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/nested/string.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "type": "string" 4 | } 5 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/prefixItems.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "http://localhost:1234/draft2020-12/prefixItems.json", 3 | "$schema": "https://json-schema.org/draft/2020-12/schema", 4 | "prefixItems": [ 5 | {"type": "string"} 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/ref-and-defs.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$id": "http://localhost:1234/draft2020-12/ref-and-defs.json", 4 | "$defs": { 5 | "inner": { 6 | "properties": { 7 | "bar": { "type": "string" } 8 | } 9 | } 10 | }, 11 | "$ref": "#/$defs/inner" 12 | } 13 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/draft2020-12/subSchemas.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$defs": { 4 | "integer": { 5 | "type": "integer" 6 | }, 7 | "refToInteger": { 8 | "$ref": "#/$defs/integer" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/nested-absolute-ref-to-string.json: -------------------------------------------------------------------------------- 1 | { 2 | "$defs": { 3 | "bar": { 4 | "$id": "http://localhost:1234/the-nested-id.json", 5 | "type": "string" 6 | } 7 | }, 8 | "$ref": "http://localhost:1234/the-nested-id.json" 9 | } 10 | -------------------------------------------------------------------------------- /internal/mcp/jsonschema/testdata/remotes/urn-ref-string.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "urn:uuid:feebdaed-ffff-0000-ffff-0000deadbeef", 3 | "$defs": {"bar": {"type": "string"}}, 4 | "$ref": "#/$defs/bar" 5 | } 6 | -------------------------------------------------------------------------------- /internal/mcp/root.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package mcp 6 | -------------------------------------------------------------------------------- /internal/mcp/testdata/files/info.txt: -------------------------------------------------------------------------------- 1 | Contents 2 | -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/one/modules/example.com/extra/help.go: -------------------------------------------------------------------------------- 1 | package extra -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/one/primarymod/main.go: -------------------------------------------------------------------------------- 1 | package one -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/modules/example.com/extra/geez/help.go: -------------------------------------------------------------------------------- 1 | package example.com/extra/geez -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/modules/example.com/extra/v2/geez/help.go: -------------------------------------------------------------------------------- 1 | package example.com/extra/geez -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/modules/example.com/extra/v2/me.go: -------------------------------------------------------------------------------- 1 | package example.com/extra -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/modules/example.com/extra/yo.go: -------------------------------------------------------------------------------- 1 | package example.com/extra -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/modules/example.com/tempmod/main.go: -------------------------------------------------------------------------------- 1 | package example.com/tempmod -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/modules/example.com/what@v1.0.0/main.go: -------------------------------------------------------------------------------- 1 | package example.com/what -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/modules/example.com/what@v1.1.0/main.go: -------------------------------------------------------------------------------- 1 | package example.com/what -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/primarymod/expect/yo.go: -------------------------------------------------------------------------------- 1 | package expect 2 | 3 | var X int //@check("X", "X") 4 | -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/primarymod/expect/yo_test.go: -------------------------------------------------------------------------------- 1 | package expect_test 2 | 3 | import ( 4 | "testdata/groups/two/expect" 5 | "testing" 6 | ) 7 | 8 | func TestX(t *testing.T) { 9 | _ = expect.X //@check("X", "X") 10 | } 11 | -------------------------------------------------------------------------------- /internal/packagestest/testdata/groups/two/primarymod/main.go: -------------------------------------------------------------------------------- 1 | package two -------------------------------------------------------------------------------- /internal/packagestest/testdata/test_test.go: -------------------------------------------------------------------------------- 1 | package fake1 2 | 3 | type ATestType string //@check("ATestType","ATestType") 4 | -------------------------------------------------------------------------------- /internal/packagestest/testdata/x_test.go: -------------------------------------------------------------------------------- 1 | package fake1_test 2 | 3 | type AnXTestType string //@check("AnXTestType","AnXTestType") 4 | -------------------------------------------------------------------------------- /internal/pkgbits/flags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package pkgbits 6 | 7 | const ( 8 | flagSyncMarkers = 1 << iota // file format contains sync markers 9 | ) 10 | -------------------------------------------------------------------------------- /internal/pkgbits/support.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package pkgbits 6 | 7 | import "fmt" 8 | 9 | func assert(b bool) { 10 | if !b { 11 | panic("assertion failed") 12 | } 13 | } 14 | 15 | func panicf(format string, args ...any) { 16 | panic(fmt.Errorf(format, args...)) 17 | } 18 | -------------------------------------------------------------------------------- /internal/pprof/testdata/sample.pprof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golang/tools/578c1213983a83e6411536ddf6bbf3a1faf97aea/internal/pprof/testdata/sample.pprof -------------------------------------------------------------------------------- /internal/refactor/inline/export_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package inline 6 | 7 | // This file opens back doors for testing. 8 | 9 | func (callee *Callee) Effects() []int { return callee.impl.Effects } 10 | -------------------------------------------------------------------------------- /internal/refactor/inline/testdata/param-subst.txtar: -------------------------------------------------------------------------------- 1 | Test of parameter substitution. 2 | 3 | -- go.mod -- 4 | module testdata 5 | go 1.12 6 | 7 | -- a/a0.go -- 8 | package a 9 | 10 | var _ = add(2, 1+1) //@ inline(re"add", add) 11 | 12 | func add(x, y int) int { return x + 2*y } 13 | 14 | -- add -- 15 | package a 16 | 17 | var _ = 2 + 2*(1+1) //@ inline(re"add", add) 18 | 19 | func add(x, y int) int { return x + 2*y } -------------------------------------------------------------------------------- /internal/refactor/inline/testdata/std-internal.txtar: -------------------------------------------------------------------------------- 1 | 2 | std packages are a special case of the internal package check. 3 | 4 | This test assumes that syscall.ByteSliceFromString refers to internal/bytealg. 5 | 6 | -- go.mod -- 7 | module testdata 8 | go 1.12 9 | 10 | -- a/a.go -- 11 | package a 12 | 13 | import "syscall" 14 | 15 | var _, _ = syscall.ByteSliceFromString("") //@ inline(re"ByteSliceFromString", re`inaccessible package "internal/bytealg"`) 16 | -------------------------------------------------------------------------------- /internal/testenv/testenv_notunix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !(unix || aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) 6 | 7 | package testenv 8 | 9 | import "os" 10 | 11 | // Sigquit is the signal to send to kill a hanging subprocess. 12 | // On Unix we send SIGQUIT, but on non-Unix we only have os.Kill. 13 | var Sigquit = os.Kill 14 | -------------------------------------------------------------------------------- /internal/testenv/testenv_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build unix || aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris 6 | 7 | package testenv 8 | 9 | import "syscall" 10 | 11 | // Sigquit is the signal to send to kill a hanging subprocess. 12 | // Send SIGQUIT to get a stack trace. 13 | var Sigquit = syscall.SIGQUIT 14 | -------------------------------------------------------------------------------- /internal/testfiles/testdata/somefile.txt: -------------------------------------------------------------------------------- 1 | A file to try to load. -------------------------------------------------------------------------------- /internal/testfiles/testdata/versions/go.mod.test: -------------------------------------------------------------------------------- 1 | // File is versions/go.mod after expansion with TestDir() 2 | 3 | module golang.org/fake/versions 4 | 5 | go 1.22 6 | -------------------------------------------------------------------------------- /internal/testfiles/testdata/versions/mod.go: -------------------------------------------------------------------------------- 1 | // The file will be go1.22 from the go.mod. 2 | 3 | package versions // want "mod.go@go1.22" 4 | -------------------------------------------------------------------------------- /internal/testfiles/testdata/versions/post.go: -------------------------------------------------------------------------------- 1 | //go:build go1.23 2 | 3 | package versions // want "post.go@go1.23" 4 | -------------------------------------------------------------------------------- /internal/testfiles/testdata/versions/pre.go: -------------------------------------------------------------------------------- 1 | //go:build go1.21 2 | 3 | package versions // want "pre.go@go1.21" 4 | -------------------------------------------------------------------------------- /internal/testfiles/testdata/versions/sub.test/sub.go.test: -------------------------------------------------------------------------------- 1 | package sub // want "sub.go@go1.22" 2 | -------------------------------------------------------------------------------- /present/testdata/basic.md: -------------------------------------------------------------------------------- 1 | # Title 2 | Subtitle 3 | 4 | Name 5 | 6 | ## Heading 7 | 8 | Text 9 | on two lines. 10 | 11 | More text. 12 | 13 | --- 14 |

Title

15 |

Subtitle

16 | 17 |

Name

18 |
19 |
20 |

Heading

21 |

Text 22 | on two lines.

23 |

More text.

24 |
25 | -------------------------------------------------------------------------------- /present/testdata/basic.p: -------------------------------------------------------------------------------- 1 | Title 2 | Subtitle 3 | 4 | Name 5 | 6 | * Heading 7 | 8 | Text 9 | on two lines. 10 | 11 | More text. 12 | 13 | --- 14 |

Title

15 |

Subtitle

16 | 17 |

Name

18 |
19 |
20 |

Heading

21 |

Text 22 | on two lines.

23 |

More text.

24 |
25 | -------------------------------------------------------------------------------- /present/testdata/code.txt: -------------------------------------------------------------------------------- 1 | code file 2 | Snippet 3 | important // HL1 4 | -------------------------------------------------------------------------------- /present/testdata/list.md: -------------------------------------------------------------------------------- 1 | # List 2 | 3 | ## 4 | 5 | - Item 1 6 | on two lines. 7 | - Item 2. 8 | - Item 3. 9 | 10 | - Item 4 in list despite preceding blank line. 11 | - Item 5. 12 | 13 | --- 14 |

List

15 |
16 |
    17 |
  • 18 |

    Item 1 19 | on two lines.

    20 |
  • 21 |
  • 22 |

    Item 2.

    23 |
  • 24 |
  • 25 |

    Item 3.

    26 |
  • 27 |
  • 28 |

    Item 4 in list despite preceding blank line.

    29 |
  • 30 |
  • 31 |

    Item 5.

    32 |
  • 33 |
34 |
35 | -------------------------------------------------------------------------------- /present/testdata/list.p: -------------------------------------------------------------------------------- 1 | List 2 | 3 | * 4 | 5 | - Item 1 6 | on two lines. 7 | - Item 2. 8 | - Item 3. 9 | 10 | - Item 1 in new list. 11 | - Item 2. 12 | 13 | --- 14 |

List

15 |
16 |
    17 |
  • Item 1 18 | on two lines.
  • 19 |
  • Item 2.
  • 20 |
  • Item 3.
  • 21 |
22 |
    23 |
  • Item 1 in new list.
  • 24 |
  • Item 2.
  • 25 |
26 |
27 | -------------------------------------------------------------------------------- /present/testdata/media.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /present/testdata/media.md: -------------------------------------------------------------------------------- 1 | # Media 2 | 3 | ## 4 | 5 | .image gopher.jpg _ 100 6 | .caption A gopher. 7 | 8 | .iframe https://golang.org/ 9 | 10 | .link https://golang.org/ The Gopher's home. 11 | 12 | .html testdata/media.html 13 | 14 | --- 15 |

Media

16 |
17 | 18 |
A gopher.
19 | 20 | 21 | 22 |
23 | -------------------------------------------------------------------------------- /refactor/README: -------------------------------------------------------------------------------- 1 | golang.org/x/tools/refactor: libraries for refactoring tools. 2 | -------------------------------------------------------------------------------- /refactor/eg/testdata/bad_type.txtar: -------------------------------------------------------------------------------- 1 | 2 | -- go.mod -- 3 | module example.com 4 | go 1.18 5 | 6 | -- template/template.go -- 7 | package template 8 | 9 | // Test in which replacement has a different type. 10 | 11 | const shouldFail = "int is not a safe replacement for string" 12 | 13 | func before() interface{} { return "three" } 14 | func after() interface{} { return 3 } 15 | -------------------------------------------------------------------------------- /refactor/eg/testdata/no_after_return.txtar: -------------------------------------------------------------------------------- 1 | 2 | 3 | -- go.mod -- 4 | module example.com 5 | go 1.18 6 | 7 | -- template/template.go -- 8 | package template 9 | 10 | func before() int { return 0 } 11 | func after() int { println(); return 0 } 12 | -------------------------------------------------------------------------------- /refactor/eg/testdata/no_before.txtar: -------------------------------------------------------------------------------- 1 | 2 | 3 | -- go.mod -- 4 | module example.com 5 | go 1.18 6 | 7 | -- template/template.go -- 8 | package template 9 | 10 | const shouldFail = "no 'before' func found in template" 11 | 12 | func Before() {} 13 | -------------------------------------------------------------------------------- /refactor/eg/testdata/type_mismatch.txtar: -------------------------------------------------------------------------------- 1 | 2 | 3 | -- go.mod -- 4 | module example.com 5 | go 1.18 6 | 7 | -- template/template.go -- 8 | package template 9 | 10 | const shouldFail = "different signatures" 11 | 12 | func before() int { return 0 } 13 | func after() string { return "" } 14 | --------------------------------------------------------------------------------