From a8498a77d5b6ca3adbb0ff41125bd05af0f21f2b Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Tue, 5 Jan 2016 09:56:55 +1100 Subject: [PATCH] godoc: hide appengine dependencies behind build tags Fixes the continuous build. Change-Id: If55b08c3b702ba705d84a30fdbce842438477883 Reviewed-on: https://go-review.googlesource.com/18241 Reviewed-by: Andrew Gerrand --- godoc/dl/dl.go | 2 ++ godoc/dl/dl_test.go | 2 ++ godoc/dl/tmpl.go | 2 ++ godoc/proxy/appengine.go | 13 ------------- godoc/proxy/proxy.go | 6 +++--- godoc/short/short.go | 2 ++ godoc/short/tmpl.go | 2 ++ 7 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 godoc/proxy/appengine.go diff --git a/godoc/dl/dl.go b/godoc/dl/dl.go index e66b75a3..6c219d26 100644 --- a/godoc/dl/dl.go +++ b/godoc/dl/dl.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +// +build appengine + // Package dl implements a simple downloads frontend server. // // It accepts HTTP POST requests to create a new download metadata entity, and diff --git a/godoc/dl/dl_test.go b/godoc/dl/dl_test.go index 207604e8..9d6a057f 100644 --- a/godoc/dl/dl_test.go +++ b/godoc/dl/dl_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +// +build appengine + package dl import ( diff --git a/godoc/dl/tmpl.go b/godoc/dl/tmpl.go index e1727c9f..0274d487 100644 --- a/godoc/dl/tmpl.go +++ b/godoc/dl/tmpl.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +// +build appengine + package dl // TODO(adg): refactor this to use the tools/godoc/static template. diff --git a/godoc/proxy/appengine.go b/godoc/proxy/appengine.go deleted file mode 100644 index 5a13027a..00000000 --- a/godoc/proxy/appengine.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build appengine - -package proxy - -import "google.golang.org/appengine" - -func init() { - onAppengine = !appengine.IsDevAppServer() -} diff --git a/godoc/proxy/proxy.go b/godoc/proxy/proxy.go index 4d9ac66b..5b331ee8 100644 --- a/godoc/proxy/proxy.go +++ b/godoc/proxy/proxy.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build appengine + // Package proxy proxies requests to the sandbox compiler service and the // playground share handler. // It is designed to run only on the instance of godoc that serves golang.org. @@ -155,10 +157,8 @@ func share(w http.ResponseWriter, r *http.Request) { p.ServeHTTP(w, r) } -var onAppengine = false // will be overriden by appengine.go and appenginevm.go - func allowShare(r *http.Request) bool { - if !onAppengine { + if appengine.IsDevAppServer() { return true } switch r.Header.Get("X-AppEngine-Country") { diff --git a/godoc/short/short.go b/godoc/short/short.go index da72b0d6..44d3c936 100644 --- a/godoc/short/short.go +++ b/godoc/short/short.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +// +build appengine + // Package short implements a simple URL shortener, serving an administrative // interface at /s and shortened urls from /s/key. // It is designed to run only on the instance of godoc that serves golang.org. diff --git a/godoc/short/tmpl.go b/godoc/short/tmpl.go index 66f5401e..95e4c2a8 100644 --- a/godoc/short/tmpl.go +++ b/godoc/short/tmpl.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +// +build appengine + package short const templateHTML = `