Windows sometimes does support symlinks, so we shouldn't over-skip on
that platform. On the other hand, wasip1 sometimes does not support
symlinks, so we should allow Symlink to fail on that platform.
Instead of hard-coding which platforms *don't* support symlinks,
let's hard-code the ones that always do, and skip on error otherwise.
That way, these tests will be robust to new platforms going forward,
and will default to running the tests if Symlink actually works.
Fixesgolang/go#64702.
Fixesgolang/go#64701.
Change-Id: I1cd5034effa4d8d66fd2cd3092926c0a2e3e76d8
Cq-Include-Trybots: luci.golang.try:x_tools-gotip-wasip1-wasm_wasmtime,x_tools-gotip-wasip1-wasm_wazero,x_tools-gotip-windows-amd64-longtest,x_tools-gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/tools/+/549555
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
ioutil defines 7 functions. 6 of these are replaced by
functions in io or os with the same signature.
ReadDir is deprecated, but the suggested replacement has a different
signature.
These changes were generated by a program, with some manual adjutments.
The program replaces ReadDir with a call to a function named ioutilReadDir
that has the same signature. The code for this function
is added to files if necessary. The program replaces all the others
with their new versions. The program removes the 'io/ioutil' import
and adds, as necessary, 'os', 'io', and 'io/fs', the latter being
needed for the signature of ioutilReadDir.
The automatic process fails in a few ways:
1. ReadFile occurs only in a comment but the program adds an unneeded import.
2. ioutilReadDir is added to more than one file in the same package
Both of these could be viewed as bugs and fixed by looking harder.
After manual adjustment, two tests failed:
1. gopls/internal/lsp/regtesg/mis:TestGenerateProgress. The reason
was a use of ioutil in a txtar constant. The calls were changed,
but the code is not smart enough to change the import inside the
string constant. (Or it's not smart enough not to change the
contents of a string.)
2. gopls/internal/lsp/analysis/deprecated, which wants to see a use
of ioutil
These tests were adjused by hand, and all tests (-short) pass.
Change-Id: If9efe40bbb0edda36173d9a88afaf71245db8e79
Reviewed-on: https://go-review.googlesource.com/c/tools/+/527675
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Peter Weinberger <pjw@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Also fix the failing new gopls command integration tests, which observe
a different exit code on plan9.
Change-Id: I5d0c11549deb3d3643f4d7772f0659dfda3600ea
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464297
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Fix the bug that gopls finds the wrong content when formatting an open
URI whose spelling does not match the spelling on disk (i.e. because of
case insensitivity).
Remove the whole View.filesByBase mechanism: it is problematic as we
can't generally know whether or not we want to associate two different
spellings of the same file: for the purposes of finding packages we may
want to treat Foo.go as foo.go, but we don't want to treat a symlink of
foo.go in another directory the same.
Instead, use robustio.FileID to de-duplicate content in the cache, and
otherwise treat URIs as we receive them. This fixes the formatting
corruption, but means that we don't find packages for the corresponding
file (because go/packages.Load("file=foo.go") fails). A failing test is
added for the latter bug.
Also: use a seenFiles map in the view to satisfy the concern of tracking
relevant files, with a TODO to delete this problematic map.
Along the way, refactor somewhat to separate and normalize the
implementations of source.FileSource.
For golang/go#57081
Change-Id: I02971a1702f057b644fa18a873790e8f0d98a323
Reviewed-on: https://go-review.googlesource.com/c/tools/+/462819
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Moves gopls/internal/robustio to internal/robustio.
Allows usage by packages in x/tools outside of gopls.
Change-Id: I71743c3a91458b77f12606b743b5de7e23cc5051
Reviewed-on: https://go-review.googlesource.com/c/tools/+/460116
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>