2

I'm looking for the source code of the "go test" command which afaik does some funky stuff (exports the functions, recompiles the package etc). So far I could find only "testing" and the cmd/go doc

The user with no hat
  • 10,166
  • 20
  • 57
  • 80

1 Answers1

4

You can start looking in the cmd/go package, where most of the go commands are defined:

https://github.com/golang/go/blob/1ba29926f3bfd245d46cf1f287716290bc2f1034/src/cmd/go/test.go (last known commit with src/cmd/go/test.go, Go 1.8)
Then commit 4efe925 shows src/cmd/go/test.go being renamed/moved to src/cmd/go/internal/test/test.go in Go 1.9, Jan. 2017.
Last modification: commit ca33f33 in Oct. 2018 for Go 1.12.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The link is broken, and I'm darned if I can find the current source. (I'm looking for the "go run" source.) Do you know where it is now? (https://github.com/golang/go/tree/master/src/cmd is the tree where I would have expected to find it.) – Wildcard May 11 '19 at 18:18
  • 1
    No problem: https://stackoverflow.com/a/7203551/6309 allowed me to find the last commit and https://stackoverflow.com/a/56054951/6309 show me the new location! – VonC May 11 '19 at 21:30