go/gopls/internal/hooks
Alan Donovan 2af106efed gopls/internal/hooks: fixes to diff disaster logic
Previously, the disaster logic in the new diff implementation
would "encrypt" the before/after files using a monoalphabetic
substitution, which has been insecure since the 9th century.
Instead, save plain text, in file with mode 0600, and invite
the user to audit the file before sharing it with us.

Also, separate the two files using a NUL byte, not a newline,
which is highly ambiguous.

Also, in the JSON diff stats writer:
- print a warning if we can't create the log file.
  (The previous code was subtle--it stored a nil *os.File in
  an io.Writer, which caused Writes to fail with an error,
  in effect, silently.)
- Don't hold the mutex around the write operation.
- Fix minor off-by-one error (re: 15)
- Crash if JSON encoding fails; it "can't happen".

Change-Id: I9b6a4145451afd77594f0ef9868143634a9c4561
Reviewed-on: https://go-review.googlesource.com/c/tools/+/445580
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-27 00:23:26 +00:00
..
analysis.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
analysis_117.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
diff.go gopls/internal/hooks: fixes to diff disaster logic 2022-10-27 00:23:26 +00:00
diff_test.go gopls/internal/hooks: fixes to diff disaster logic 2022-10-27 00:23:26 +00:00
gen-licenses.sh all: replace deprecated egrep with grep -E 2022-09-23 13:31:09 +00:00
hooks.go internal/diff: abolish errors 2022-10-05 20:30:46 +00:00
licenses.go gopls/internal/hooks: improve license file test 2021-01-26 00:28:59 +00:00
licenses_test.go gopls: upgrade staticcheck to v0.3.0 2022-04-07 14:59:24 +00:00