cmd/coordinator: delete some code earlier copied to the buildgo package
Change-Id: I7244c0d272a112adb6682793eca8563fc3c78e49
Reviewed-on: https://go-review.googlesource.com/51433
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/coordinator/coordinator.go b/cmd/coordinator/coordinator.go
index 07fa0a4..44d75cf 100644
--- a/cmd/coordinator/coordinator.go
+++ b/cmd/coordinator/coordinator.go
@@ -12,9 +12,7 @@
package main // import "golang.org/x/build/cmd/coordinator"
import (
- "archive/tar"
"bytes"
- "compress/gzip"
"context"
"crypto/rand"
"crypto/sha1"
@@ -1890,7 +1888,7 @@
func (st *buildStatus) writeGoSourceTo(bc *buildlet.Client) error {
// Write the VERSION file.
sp := st.CreateSpan("write_version_tar")
- if err := bc.PutTar(versionTgz(st.Rev), "go"); err != nil {
+ if err := bc.PutTar(buildgo.VersionTgz(st.Rev), "go"); err != nil {
return sp.Done(fmt.Errorf("writing VERSION tgz: %v", err))
}
@@ -3287,34 +3285,6 @@
return st.output.Write(p)
}
-// versionTgz returns an io.Reader of a *.tar.gz file containing only
-// a VERSION file containing the contents of the provided rev string.
-func versionTgz(rev string) io.Reader {
- var buf bytes.Buffer
- zw := gzip.NewWriter(&buf)
- tw := tar.NewWriter(zw)
-
- // Writing to a bytes.Buffer should never fail, so check
- // errors with an explosion:
- check := func(err error) {
- if err != nil {
- panic("previously assumed to never fail: " + err.Error())
- }
- }
-
- contents := fmt.Sprintf("devel " + rev)
- check(tw.WriteHeader(&tar.Header{
- Name: "VERSION",
- Mode: 0644,
- Size: int64(len(contents)),
- }))
- _, err := io.WriteString(tw, contents)
- check(err)
- check(tw.Close())
- check(zw.Close())
- return bytes.NewReader(buf.Bytes())
-}
-
func useGitMirror() bool {
return *mode != "dev"
}