tools/imports
Peter Weinbergr 559c4300da tools: replace references to obsolete package ioutils
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>
2023-09-12 20:13:37 +00:00
..
forward.go tools: replace references to obsolete package ioutils 2023-09-12 20:13:37 +00:00