cmd/getgo: fix builds
A couple fixes:
* Disable integration tests in short mode.
* Remove import of "google.golang.org/appengine" package. App Engine has
two ways to create an app: as a main package and calling
appengine.Main(), and as any regular Go package with handlers registered
in init().
Change-Id: Ib416111786c1c86cf428d91c60dc406c251d3ca1
Reviewed-on: https://go-review.googlesource.com/52211
Run-TryBot: Chris Broadfoot <cbro@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
diff --git a/cmd/getgo/main_test.go b/cmd/getgo/main_test.go
index 9da726e..932a739 100644
--- a/cmd/getgo/main_test.go
+++ b/cmd/getgo/main_test.go
@@ -31,6 +31,11 @@
// TestMain creates a getgo command for testing purposes and
// deletes it after the tests have been run.
func TestMain(m *testing.M) {
+ if os.Getenv("GOGET_INTEGRATION") == "" {
+ fmt.Fprintln(os.Stderr, "main_test: Skipping integration tests with GOGET_INTEGRATION unset")
+ return
+ }
+
args := []string{"build", "-tags", testbin, "-o", testbin + exeSuffix}
out, err := exec.Command("go", args...).CombinedOutput()
if err != nil {
diff --git a/cmd/getgo/server/main.go b/cmd/getgo/server/main.go
index 0bd3337..b599506 100644
--- a/cmd/getgo/server/main.go
+++ b/cmd/getgo/server/main.go
@@ -4,15 +4,13 @@
// Command server serves get.golang.org, redirecting users to the appropriate
// getgo installer based on the request path.
-package main
+package server
import (
"fmt"
"net/http"
"strings"
"time"
-
- "google.golang.org/appengine"
)
const (
@@ -30,9 +28,8 @@
"Darwin": macInstaller,
}
-func main() {
+func init() {
http.HandleFunc("/", handler)
- appengine.Main()
}
func handler(w http.ResponseWriter, r *http.Request) {