Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sunset google.golang.org/appengine module
The appengine packages that were designed for the go1 runtime, were left functional in go111, but Google is requesting that users preemptively migrate away due to their rigid structure and incompatibility with other environments. This change affects the reviewdog module dependencies, but code changes are limited to doghouse. The appengine runtime has been increased to go112 for extended support and to enforce that appengine packages break if used. appengine/urlfetch.Client has been migrated to net/http.Client. appengine/datastore has been migrated to cloud.google.com/go/datastore. This took more work than the Client changes, since the two packages are incompatible. There may be work to further refactor the abstractions, but that is out of scope for this change. appengine.IsDevServer has no clear successor, thus its usage and conditional logic has been purged. If there is intereset to have a comprehensive local development version of doghouse, this can be added back, but you will lose all the other mocks that dev_appserver.py offers: user auth, datastore access, etc. appengine/log contains leveled print functions, Errorf/Infof/etc., that have no clear parallel in the stdlib log package. As a stopgap, [SEVERITY] prefixes have been added to all the new log.Printf calls. This is not indended as a comprehensive solution, and it may be better to move to another package for logging, say logrus or log15, but it is out of scope at the moment. Finally, a note: with the change from using appengine.Context to using http.Request.Context, there are places where an http.Request and context.Context are passed. This could be simplified, but is out of scope. Fixes #226
- Loading branch information
Showing
11 changed files
with
216 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net/http" | ||
|
||
"github.com/reviewdog/reviewdog/doghouse/server/ciutil" | ||
"google.golang.org/appengine" | ||
"google.golang.org/appengine/log" | ||
"google.golang.org/appengine/urlfetch" | ||
) | ||
|
||
func warmupHandler(w http.ResponseWriter, r *http.Request) { | ||
ctx := appengine.NewContext(r) | ||
log.Infof(ctx, "warming up server...") | ||
log.Printf("[INFO] warming up server...\n") | ||
|
||
if err := ciutil.UpdateTravisCIIPAddrs(urlfetch.Client(ctx)); err != nil { | ||
log.Errorf(ctx, "failed to update travis CI IP addresses: %v", err) | ||
if err := ciutil.UpdateTravisCIIPAddrs(&http.Client{}); err != nil { | ||
log.Printf("[ERROR] failed to update travis CI IP addresses: %v\n", err) | ||
} | ||
|
||
log.Infof(ctx, "warmup done") | ||
log.Println("[INFO] warmup done") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package storage | ||
|
||
import ( | ||
"context" | ||
|
||
"cloud.google.com/go/compute/metadata" | ||
"cloud.google.com/go/datastore" | ||
) | ||
|
||
// datastoreClient constructs a *datastore.Client using runtime introspection | ||
// to target the current project's datastore. | ||
func datastoreClient(ctx context.Context) (*datastore.Client, error) { | ||
id, err := metadata.ProjectID() | ||
if err != nil { | ||
return nil, err | ||
} | ||
return datastore.NewClient(ctx, id) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.