Skip to content

Commit

Permalink
Update to use app engine runtime go112 (#34)
Browse files Browse the repository at this point in the history
* app.yaml: update to go112

Make the required changes to use go112 due to the deprecation of Go 1.9.

Migration doc:
- https://cloud.google.com/appengine/docs/standard/go111/go-differences

References:
- #29 (comment)
- etcd-io/maintainers#17

* go.mod: initial commit

Migrate this project to use go.mod and update the README.

This is part of the recommended steps to runtime: go111 and beyond.
https://cloud.google.com/appengine/docs/standard/go111/go-differences

* vendor: add dependent packages

Add all dependencies for the project via vendoring for offline builds.

* travis.yml: drop go 1.6 for 1.12

Go 1.6 is too old to have a number of builtin packages for the latest
appengine package. Remove and update to match app engine version: 1.12.

* appengine.go: remove unused file

From the go111 migration doc:
"The appengine build tag is deprecated and will not be used when
building your app for deployment.  Ensure your code still functions
correctly without it being set."

https://cloud.google.com/appengine/docs/standard/go111/go-differences

* main: respect PORT environment variable

The go111 runtime should use the PORT variable to decide the listening
http port.

"PORT The port that receives HTTP requests."
https://cloud.google.com/appengine/docs/standard/go111/runtime
  • Loading branch information
philips committed Feb 6, 2020
1 parent 682d637 commit 26a09c4
Show file tree
Hide file tree
Showing 98 changed files with 33,743 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: false
language: go
go:
- 1.6
- 1.12
- 1.x
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Setup a [custom domain](https://cloud.google.com/appengine/docs/standard/python/

Get the application:
```
go get -u -d github.com/GoogleCloudPlatform/govanityurls
cd $(go env GOPATH)/src/github.com/GoogleCloudPlatform/govanityurls
git clone https://github.com/GoogleCloudPlatform/govanityurls
cd govanityurls
```

Edit `vanity.yaml` to add any number of git repos. E.g., `customdomain.com/portmidi` will
Expand Down
5 changes: 2 additions & 3 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
runtime: go
api_version: go1
runtime: go112

handlers:
- url: /.*
script: _go_app
script: auto
42 changes: 0 additions & 42 deletions appengine.go

This file was deleted.

10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/GoogleCloudPlatform/govanityurls

go 1.13

require (
github.com/golang/protobuf v1.3.3 // indirect
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
google.golang.org/appengine v1.6.5
gopkg.in/yaml.v2 v2.2.8
)
18 changes: 18 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65 h1:+rhAzEzT3f4JtomfC371qB+0Ola2caSKcY69NUBZrRQ=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//+build !appengine

package main

import (
Expand Down Expand Up @@ -42,7 +40,12 @@ func main() {
log.Fatal(err)
}
http.Handle("/", h)
if err := http.ListenAndServe(":8080", nil); err != nil {

port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
if err := http.ListenAndServe(":"+port, nil); err != nil {
log.Fatal(err)
}
}
Expand Down
3 changes: 3 additions & 0 deletions vendor/github.com/golang/protobuf/AUTHORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/golang/protobuf/CONTRIBUTORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions vendor/github.com/golang/protobuf/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 26a09c4

Please sign in to comment.