gddo/lintapp: move to go gettable app engine libraries
This change moves from libraries like "appengine/urlfetch" to libraries
like "google.golang.org/appengine/urlfetch". These are mostly drop in
replacements and only a few changes needed to be made. Unfortunately, it
appears that the lintapp was already broken so it still will not compile.
This is being done to fix an issue I am having importing the code into
bazel.
Change-Id: I4d7c00fe39ac864706fceaf9c9b1b2d112c47acc
Reviewed-on: https://go-review.googlesource.com/33199
Reviewed-by: Benjamin Staffin <benley@gmail.com>
Reviewed-by: Tuo Shan <shantuo@google.com>
diff --git a/lintapp/main.go b/lintapp/main.go
index fbfba87..7f184f8 100644
--- a/lintapp/main.go
+++ b/lintapp/main.go
@@ -19,9 +19,11 @@
"strings"
"time"
- "appengine"
- "appengine/datastore"
- "appengine/urlfetch"
+ "golang.org/x/net/context"
+ "google.golang.org/appengine"
+ "google.golang.org/appengine/datastore"
+ "google.golang.org/appengine/log"
+ "google.golang.org/appengine/urlfetch"
"github.com/golang/gddo/gosrc"
"github.com/golang/gddo/httputil"
@@ -150,7 +152,7 @@
Link string
}
-func putPackage(c appengine.Context, importPath string, pkg *lintPackage) error {
+func putPackage(c context.Context, importPath string, pkg *lintPackage) error {
var buf bytes.Buffer
if err := gob.NewEncoder(&buf).Encode(pkg); err != nil {
return err
@@ -161,7 +163,7 @@
return err
}
-func getPackage(c appengine.Context, importPath string) (*lintPackage, error) {
+func getPackage(c context.Context, importPath string) (*lintPackage, error) {
var spkg storePackage
if err := datastore.Get(c, datastore.NewKey(c, "Package", importPath, 0, nil), &spkg); err != nil {
if err == datastore.ErrNoSuchEntity {
@@ -253,10 +255,10 @@
} else if gosrc.IsNotFound(err) {
writeErrorResponse(w, 404)
} else if e, ok := err.(*gosrc.RemoteError); ok {
- c.Infof("Remote error %s: %v", e.Host, e)
+ log.Infof(c, "Remote error %s: %v", e.Host, e)
writeResponse(w, 500, errorTemplate, fmt.Sprintf("Error accessing %s.", e.Host))
} else if err != nil {
- c.Errorf("Internal error %v", err)
+ log.Errorf(c, "Internal error %v", err)
writeErrorResponse(w, 500)
}
}