1. 17 Jul, 2018 7 commits
    • Michael Munday's avatar
      cmd/compile: keep autos if their address reaches a control value · 1546ab5a
      Michael Munday authored
      Autos must be kept if their address reaches the control value of a
      block. We didn't see this before because it is rare for an auto's
      address to reach a control value without also reaching a phi or
      being written to memory. We can probably optimize away the
      comparisons that lead to this scenario since autos cannot alias
      with pointers from elsewhere, however for now we take the
      conservative approach and just ensure the auto is properly
      initialised if its address reaches a control value.
      
      Fixes #26407.
      
      Change-Id: I02265793f010a9e001c3e1a5397c290c6769d4de
      Reviewed-on: https://go-review.googlesource.com/124335Reviewed-by: default avatarDavid Chase <drchase@google.com>
      1546ab5a
    • Russ Cox's avatar
      cmd/go: add new test script facility · 5890e25b
      Russ Cox authored
      The original cmd/go tests were tiny shell scripts
      written against a library of shell functions.
      They were okay to write but difficult to run:
      you couldn't select individual tests (with -run)
      they didn't run on Windows, they were slow, and so on.
      
      CL 10464 introduced go_test.go's testgo framework
      and later CLs translated the test shell script over to
      individual go tests. This let us run tests selectively,
      run tests on Windows, run tests in parallel, isolate
      different tests, and so on. It was a big advance.
      
      The tests had always been awkward to write.
      Here was the first test in test.bash:
      
      	TEST 'file:line in error messages'
      	# Test that error messages have file:line information at beginning of
      	# the line. Also test issue 4917: that the error is on stderr.
      	d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX)
      	fn=$d/err.go
      	echo "package main" > $fn
      	echo 'import "bar"' >> $fn
      	./testgo run $fn 2>$d/err.out || true
      	if ! grep -q "^$fn:" $d/err.out; then
      		echo "missing file:line in error message"
      		cat $d/err.out
      		ok=false
      	fi
      	rm -r $d
      
      The final Go version of this test was:
      
      	func TestFileLineInErrorMessages(t *testing.T) {
      		tg := testgo(t)
      		defer tg.cleanup()
      		tg.parallel()
      		tg.tempFile("err.go", `package main; import "bar"`)
      		path := tg.path("err.go")
      		tg.runFail("run", path)
      		shortPath := path
      		if rel, err := filepath.Rel(tg.pwd(), path); err == nil && len(rel) < len(path) {
      			shortPath = rel
      		}
      		tg.grepStderr("^"+regexp.QuoteMeta(shortPath)+":", "missing file:line in error message")
      	}
      
      It's better but still quite difficult to skim.
      
      This CL introduces a new facility meant as a successor to the testgo
      approach that brings back the style of writing tests as little scripts,
      but they are now scripts in a built-for-purpose shell-like language,
      not bash itself. In this new form, the test above is a single file,
      testdata/script/fileline.txt:
      
      	# look for short, relative file:line in error message
      	! go run ../../gopath/x/y/z/err.go
      	stderr ^..[\\/]x[\\/]y[\\/]z[\\/]err.go:
      
      	-- ../x/y/z/err.go --
      	package main; import "bar"
      
      The file is a txtar text archive (see CL 123359) in which the leading comment
      is the test script and the files are the initial state of the temporary file
      system where the script runs.
      
      Each script runs as a subtest, so that they can still be selected individually.
      
      The scripts are kept isolated from each other by default,
      so all script subtests are treated as parallel tests, for the
      testing package to run in parallel. Even for the 15 tests in
      this CL, that cuts the time for TestScript from 5.5s to 2.5s.
      
      The scripts do not have access to the cmd/go source directory,
      nor to cmd/go/testdata, so they are prevented from creating temporary
      files in those places or modifying existing ones. (Many existing tests
      scribble in testdata, unfortunately, especially testdata/pkg when
      they run builds with GOPATH=testdata.)
      
      This CL introduces the script facility and converts 15 tests.
      The txtar archive form will allow us to delete the large trees of trivial
      files in testdata; a few are deleted in this CL.
      
      See testdata/script/README for details and a larger conversion example.
      
      As part of converting testdata/script/test_badtest.txt,
      I discovered that 'go test' was incorrectly printing a FAIL line
      to stderr (not stdout) in one corner case. This CL fixes that
      to keep the test passing.
      
      Future CLs will convert more tests.
      
      Change-Id: I11aa9e18dd2d4c7dcd8e310dbdc6a1ea5f7e54c1
      Reviewed-on: https://go-review.googlesource.com/123577
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      5890e25b
    • Rob Pike's avatar
      doc: update Usage section of the FAQ · b59b42ce
      Rob Pike authored
      This is close to a complete rewrite, as the content was pretty old.
      
      The CL includes links to the Wiki for information about companies
      using Go, a new section about IDEs and editors¹, and a restatement
      of the foreign function interface story. It also modernizes and
      expands a little on the use of Go inside Google.
      
      ¹ Ed is the standard editor.
      
      Change-Id: I5e54aafa53d00d86297b2691960a376b40f6225b
      Reviewed-on: https://go-review.googlesource.com/123922Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b59b42ce
    • Rob Pike's avatar
      doc: rewrite run-on sentence in garbage collection discussion · c4f30481
      Rob Pike authored
      Change-Id: I60cb7010448757ca4c7a2973bee2277b3d5fc439
      Reviewed-on: https://go-review.googlesource.com/124175Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      c4f30481
    • Ian Lance Taylor's avatar
      cmd/go: fix handling of vet.cfg with buggyInstall · f17220c2
      Ian Lance Taylor authored
      The vet action assumes that a.Deps[0] is the compilation action for
      which vet information should be generated. However, when using
      -linkshared, the action graph is built with a ModeBuggyInstall action
      to install the shared library built from the compilation action.
      Adjust the set up of the vet action accordingly. Also don't clean up
      the working directory after completing the buggy install.
      
      Updates #26400
      
      Change-Id: Ia51f9f6b8cde5614a6f2e41b6207478951547770
      Reviewed-on: https://go-review.googlesource.com/124275
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      f17220c2
    • Zev Goldstein's avatar
      cmd/go/internal/cache: squelch cache init warnings when $HOME is / · 0c319ee4
      Zev Goldstein authored
      Docker sets $HOME to / when running with a UID that doesn't exist within
      the container.  This not  uncommon on CI servers.
      
      Fixes #26280
      
      Change-Id: Ic7ff62b41403fe6e7c0cef12814667ef73f6c954
      Reviewed-on: https://go-review.googlesource.com/122487
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      0c319ee4
    • Eric Daniels's avatar
      http/internal: document final CRLF behavior on chunkedWriter · 6e4e2940
      Eric Daniels authored
      Change-Id: I0f76b40dbfda2d382c88aec377db1851c4ac7441
      
      Change-Id: I0f76b40dbfda2d382c88aec377db1851c4ac7441
      GitHub-Last-Rev: ab42559278d8cba9e025b431a459d117500a73da
      GitHub-Pull-Request: golang/go#26410
      Reviewed-on: https://go-review.googlesource.com/124255Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      6e4e2940
  2. 16 Jul, 2018 15 commits
  3. 15 Jul, 2018 5 commits
  4. 14 Jul, 2018 1 commit
  5. 13 Jul, 2018 12 commits