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>
This commit is contained in:
parent
001b4ec819
commit
f2b3bb0049
|
@ -31,6 +31,11 @@ func init() {
|
||||||
// TestMain creates a getgo command for testing purposes and
|
// TestMain creates a getgo command for testing purposes and
|
||||||
// deletes it after the tests have been run.
|
// deletes it after the tests have been run.
|
||||||
func TestMain(m *testing.M) {
|
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}
|
args := []string{"build", "-tags", testbin, "-o", testbin + exeSuffix}
|
||||||
out, err := exec.Command("go", args...).CombinedOutput()
|
out, err := exec.Command("go", args...).CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -4,15 +4,13 @@
|
||||||
|
|
||||||
// Command server serves get.golang.org, redirecting users to the appropriate
|
// Command server serves get.golang.org, redirecting users to the appropriate
|
||||||
// getgo installer based on the request path.
|
// getgo installer based on the request path.
|
||||||
package main
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"google.golang.org/appengine"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -30,9 +28,8 @@ var stringMatch = map[string]string{
|
||||||
"Darwin": macInstaller,
|
"Darwin": macInstaller,
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func init() {
|
||||||
http.HandleFunc("/", handler)
|
http.HandleFunc("/", handler)
|
||||||
appengine.Main()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handler(w http.ResponseWriter, r *http.Request) {
|
func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in New Issue