1
0
mirror of https://github.com/golang/go synced 2024-11-18 10:04:43 -07:00

cmd/tip: also fetch x/net repository before building cmd/godoc

x/tools/cmd/godoc uses at least one Go package from x/net as of
CL 157197.

Don't add it to signature because we don't want the signature to
change whenever new commits to x/net are pushed, causing tip.golang.org
to be redeployed. This is because x/net is not considered a critical
component of the website at this time, and that's not expected to
change soon.

When the website begins using modules, it will specify the x/net
version precisely and this decision will no longer matter.

Fixes golang/go#29874

Change-Id: I1fa76bb81f8d2ffc2314375e2dfe4898c3af58de
Reviewed-on: https://go-review.googlesource.com/c/158937
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Dmitri Shuralyov 2019-01-22 17:47:02 -05:00
parent 9c309ee22f
commit 9279ec27fd

View File

@ -25,13 +25,18 @@ func prefix8(s string) string {
} }
func (b godocBuilder) Signature(heads map[string]string) string { func (b godocBuilder) Signature(heads map[string]string) string {
// x/net is intentionally not a part of the signature, because
// at this time it does not contribute substantially to the deployed
// website, and so we don't want tip.golang.org redeployed whenever
// x/net changes. This will no longer matter when the Go website uses
// modules to pin its dependencies to specific versions.
return fmt.Sprintf("go=%v/tools=%v", prefix8(heads["go"]), prefix8(heads["tools"])) return fmt.Sprintf("go=%v/tools=%v", prefix8(heads["go"]), prefix8(heads["tools"]))
} }
func (b godocBuilder) Init(logger *log.Logger, dir, hostport string, heads map[string]string) (*exec.Cmd, error) { func (b godocBuilder) Init(logger *log.Logger, dir, hostport string, heads map[string]string) (*exec.Cmd, error) {
goDir := filepath.Join(dir, "go") goDir := filepath.Join(dir, "go")
toolsDir := filepath.Join(dir, "gopath/src/golang.org/x/tools") toolsDir := filepath.Join(dir, "gopath/src/golang.org/x/tools")
netDir := filepath.Join(dir, "gopath/src/golang.org/x/net")
logger.Printf("checking out go repo ...") logger.Printf("checking out go repo ...")
if err := checkout(repoURL+"go", heads["go"], goDir); err != nil { if err := checkout(repoURL+"go", heads["go"], goDir); err != nil {
return nil, fmt.Errorf("checkout of go: %v", err) return nil, fmt.Errorf("checkout of go: %v", err)
@ -40,6 +45,10 @@ func (b godocBuilder) Init(logger *log.Logger, dir, hostport string, heads map[s
if err := checkout(repoURL+"tools", heads["tools"], toolsDir); err != nil { if err := checkout(repoURL+"tools", heads["tools"], toolsDir); err != nil {
return nil, fmt.Errorf("checkout of tools: %v", err) return nil, fmt.Errorf("checkout of tools: %v", err)
} }
logger.Printf("checking out net repo ...")
if err := checkout(repoURL+"net", heads["net"], netDir); err != nil {
return nil, fmt.Errorf("checkout of net: %v", err)
}
var logWriter io.Writer = toLoggerWriter{logger} var logWriter io.Writer = toLoggerWriter{logger}