[roll] Roll fuchsia [go] Use testing.T.TempDir and other cleanup in garnet and src

- TempDir() is new in Go 1.15.
- Reduce the risk of junk being left around. Some tests didn't clean up properly
  or the temporary file/dir lifetime was hard to understand.
- This uses consistent naming for temporary directories, so we know what leaks.
- Use consistent temporary directory ACL 0o700.
- Use consistent temporary file ACL 0o600.
- Use 0o octal naming convention. This is supported since Go 1.13.
- Don't use ioutil.TempFile() when filepath.Join() does the job.
- Reduce the risk of file locking issue if this code is ever used on Windows by
  closing before sharing.
- Replace many temporary files by bytes.Buffer{} or strings.NewReader().
- Replace panic() calls with t.Fatal() everywhere possible.
- Inline panic() calls at the remaining places. Using a function caused the bad
  habit of calling it from unit tests, oops.
- Improve documentation by adding comments. Comments 💡.
- Improve test writing style. There was a lot of t.Fatalf("blah blah") that was
  better replaced as t.Fatal(err).
- Have test-only functions accept a *testing.T instead of returning an error.
- This removes 340 lines of test code!

Do not fix build.TestConfig() yet, since it'll require a new package and
BUILD.gn updates. It's the last major cause of random defer os.RemoveAll() in
the test cases.

Started with:
  vi $(git grep --name-only ioutil.Temp -- "*_test.go")

and went from there.

Test only change.

Original-Bug: 58804
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/452895
Original-Revision: 824d259b6078d585223e31e20e2f0ad58a4309b0
GitOrigin-RevId: 4d18ec526cc7d61f55eb867f1fca3bd71ed09fb9
Change-Id: Ia49e88bab41102a483ae9bb145611d2c21dc0b97
1 file changed
tree: bdde1f429cd7ac57907f1e004b5037e7a5145934
  1. garnet/
  2. infra/
  3. peridot/
  4. third_party/
  5. topaz/
  6. zircon/
  7. flower
  8. jiri.lock
  9. minimal
  10. prebuilts
  11. README.md
  12. stem
  13. test_durations
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.