Skip to content

Commit

Permalink
run gofmt with go1.19 release candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
zevdg committed Jul 11, 2022
1 parent ca3835e commit 02a1513
Show file tree
Hide file tree
Showing 48 changed files with 119 additions and 90 deletions.
3 changes: 2 additions & 1 deletion aetest/instance_classic.go
@@ -1,3 +1,4 @@
//go:build appengine
// +build appengine

package aetest
Expand All @@ -13,7 +14,7 @@ func NewInstance(opts *Options) (Instance, error) {
var aeOpts *aetest.Options
if opts != nil {
aeOpts = &aetest.Options{
AppID: opts.AppID,
AppID: opts.AppID,
StronglyConsistentDatastore: opts.StronglyConsistentDatastore,
}
}
Expand Down
1 change: 1 addition & 0 deletions aetest/instance_vm.go
@@ -1,3 +1,4 @@
//go:build !appengine
// +build !appengine

package aetest
Expand Down
18 changes: 9 additions & 9 deletions appengine.go
Expand Up @@ -35,18 +35,18 @@ import (
//
// Main is designed so that the app's main package looks like this:
//
// package main
// package main
//
// import (
// "google.golang.org/appengine"
// import (
// "google.golang.org/appengine"
//
// _ "myapp/package0"
// _ "myapp/package1"
// )
// _ "myapp/package0"
// _ "myapp/package1"
// )
//
// func main() {
// appengine.Main()
// }
// func main() {
// appengine.Main()
// }
//
// The "myapp/packageX" packages are expected to register HTTP handlers
// in their init functions.
Expand Down
1 change: 1 addition & 0 deletions appengine_vm.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build !appengine
// +build !appengine

package appengine
Expand Down
1 change: 1 addition & 0 deletions capability/capability.go
Expand Up @@ -9,6 +9,7 @@ for specific API capabilities.
This package does not work in App Engine "flexible environment".
Example:
if !capability.Enabled(c, "datastore_v3", "write") {
// show user a different page
}
Expand Down
4 changes: 2 additions & 2 deletions cloudsql/cloudsql.go
Expand Up @@ -14,19 +14,19 @@ with protocol "cloudsql" and an address of the Cloud SQL instance.
A Go MySQL driver that has been tested to work well with Cloud SQL
is the go-sql-driver:
import "database/sql"
import _ "github.com/go-sql-driver/mysql"
db, err := sql.Open("mysql", "user@cloudsql(project-id:instance-name)/dbname")
Another driver that works well with Cloud SQL is the mymysql driver:
import "database/sql"
import _ "github.com/ziutek/mymysql/godrv"
db, err := sql.Open("mymysql", "cloudsql:instance-name*dbname/user/password")
Using either of these drivers, you can perform a standard SQL query.
This example assumes there is a table named 'users' with
columns 'first_name' and 'last_name':
Expand Down
1 change: 1 addition & 0 deletions cloudsql/cloudsql_classic.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build appengine
// +build appengine

package cloudsql
Expand Down
1 change: 1 addition & 0 deletions cloudsql/cloudsql_vm.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build !appengine
// +build !appengine

package cloudsql
Expand Down
7 changes: 4 additions & 3 deletions cmd/aebundler/aebundler.go
Expand Up @@ -8,9 +8,10 @@
// A main func is synthesized if one does not exist.
//
// A sample Dockerfile to be used with this bundler could look like this:
// FROM gcr.io/google-appengine/go-compat
// ADD . /app
// RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe
//
// FROM gcr.io/google-appengine/go-compat
// ADD . /app
// RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe
package main

import (
Expand Down
21 changes: 7 additions & 14 deletions datastore/doc.go
Expand Up @@ -5,8 +5,7 @@
/*
Package datastore provides a client for App Engine's datastore service.
Basic Operations
# Basic Operations
Entities are the unit of storage and are associated with a key. A key
consists of an optional parent key, a string application ID, a string kind
Expand Down Expand Up @@ -74,8 +73,7 @@ GetMulti, PutMulti and DeleteMulti are batch versions of the Get, Put and
Delete functions. They take a []*Key instead of a *Key, and may return an
appengine.MultiError when encountering partial failure.
Properties
# Properties
An entity's contents can be represented by a variety of types. These are
typically struct pointers, but can also be any type that implements the
Expand Down Expand Up @@ -137,8 +135,7 @@ Example code:
J int `datastore:",noindex" json:"j"`
}
Structured Properties
# Structured Properties
If the struct pointed to contains other structs, then the nested or embedded
structs are flattened. For example, given these definitions:
Expand Down Expand Up @@ -179,8 +176,7 @@ equivalent field would instead be: FooDotZ bool `datastore:"Foo.Z"`.
If an outer struct is tagged "noindex" then all of its implicit flattened
fields are effectively "noindex".
The PropertyLoadSaver Interface
# The PropertyLoadSaver Interface
An entity's contents can also be represented by any type that implements the
PropertyLoadSaver interface. This type may be a struct pointer, but it does
Expand Down Expand Up @@ -230,8 +226,7 @@ Example code:
The *PropertyList type implements PropertyLoadSaver, and can therefore hold an
arbitrary entity's contents.
Queries
# Queries
Queries retrieve entities based on their properties or key's ancestry. Running
a query yields an iterator of results: either keys or (key, entity) pairs.
Expand Down Expand Up @@ -284,8 +279,7 @@ Example code:
io.Copy(w, b)
}
Transactions
# Transactions
RunInTransaction runs a function in a transaction.
Expand Down Expand Up @@ -323,8 +317,7 @@ Example code:
fmt.Fprintf(w, "Count=%d", count)
}
Metadata
# Metadata
The datastore package provides access to some of App Engine's datastore
metadata. This metadata includes information about the entity groups,
Expand Down
15 changes: 8 additions & 7 deletions datastore/metadata.go
Expand Up @@ -50,13 +50,14 @@ func keyNames(keys []*Key) []string {
// The properties are returned as a map of property names to a slice of the
// representation types. The representation types for the supported Go property
// types are:
// "INT64": signed integers and time.Time
// "DOUBLE": float32 and float64
// "BOOLEAN": bool
// "STRING": string, []byte and ByteString
// "POINT": appengine.GeoPoint
// "REFERENCE": *Key
// "USER": (not used in the Go runtime)
//
// "INT64": signed integers and time.Time
// "DOUBLE": float32 and float64
// "BOOLEAN": bool
// "STRING": string, []byte and ByteString
// "POINT": appengine.GeoPoint
// "REFERENCE": *Key
// "USER": (not used in the Go runtime)
func KindProperties(ctx context.Context, kind string) (map[string][]string, error) {
// TODO(djd): Support range queries.
kindKey := NewKey(ctx, kindKind, kind, 0, nil)
Expand Down
2 changes: 1 addition & 1 deletion datastore/query.go
Expand Up @@ -476,7 +476,7 @@ func callNext(c context.Context, res *pb.QueryResult, offset, count int32) error
// The keys returned by GetAll will be in a 1-1 correspondence with the entities
// added to dst.
//
// If q is a ``keys-only'' query, GetAll ignores dst and only returns the keys.
// If q is a keys-only query, GetAll ignores dst and only returns the keys.
//
// The running time and number of API calls made by GetAll scale linearly with
// the sum of the query's offset and limit. Unless the result count is
Expand Down
20 changes: 14 additions & 6 deletions delay/delay.go
Expand Up @@ -10,14 +10,19 @@ To declare a function that may be executed later, call Func
in a top-level assignment context, passing it an arbitrary string key
and a function whose first argument is of type context.Context.
The key is used to look up the function so it can be called later.
var laterFunc = delay.Func("key", myFunc)
It is also possible to use a function literal.
var laterFunc = delay.Func("key", func(c context.Context, x string) {
// ...
})
To call a function, invoke its Call method.
laterFunc.Call(c, "something")
A function may be called any number of times. If the function has any
return arguments, and the last one is of type error, the function may
return a non-nil error to signal that the function should be retried.
Expand All @@ -37,9 +42,9 @@ with the string key that was passed to the Func function. Updating an app
with pending function invocations should safe as long as the relevant
functions have the (filename, key) combination preserved. The filename is
parsed according to these rules:
* Paths in package main are shortened to just the file name (github.com/foo/foo.go -> foo.go)
* Paths are stripped to just package paths (/go/src/github.com/foo/bar.go -> github.com/foo/bar.go)
* Module versions are stripped (/go/pkg/mod/github.com/foo/bar@v0.0.0-20181026220418-f595d03440dc/baz.go -> github.com/foo/bar/baz.go)
- Paths in package main are shortened to just the file name (github.com/foo/foo.go -> foo.go)
- Paths are stripped to just package paths (/go/src/github.com/foo/bar.go -> github.com/foo/bar.go)
- Module versions are stripped (/go/pkg/mod/github.com/foo/bar@v0.0.0-20181026220418-f595d03440dc/baz.go -> github.com/foo/bar/baz.go)
There is some inherent risk of pending function invocations being lost during
an update that contains large changes. For example, switching from using GOPATH
Expand Down Expand Up @@ -208,10 +213,13 @@ type invocation struct {
}

// Call invokes a delayed function.
// err := f.Call(c, ...)
//
// err := f.Call(c, ...)
//
// is equivalent to
// t, _ := f.Task(...)
// _, err := taskqueue.Add(c, t, "")
//
// t, _ := f.Task(...)
// _, err := taskqueue.Add(c, t, "")
func (f *Function) Call(c context.Context, args ...interface{}) error {
t, err := f.Task(args...)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions demos/guestbook/guestbook.go
Expand Up @@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.

// This example only works on App Engine "flexible environment".
//go:build !appengine
// +build !appengine

package main
Expand Down
1 change: 1 addition & 0 deletions demos/helloworld/helloworld.go
Expand Up @@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.

// This example only works on App Engine "flexible environment".
//go:build !appengine
// +build !appengine

package main
Expand Down
1 change: 1 addition & 0 deletions internal/api.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build !appengine
// +build !appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/api_classic.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build appengine
// +build appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/api_race_test.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build race
// +build race

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/api_test.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build !appengine
// +build !appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/identity_classic.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build appengine
// +build appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/identity_flex.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build appenginevm
// +build appenginevm

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/identity_vm.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build !appengine
// +build !appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/internal_vm_test.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build !appengine
// +build !appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/main.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build appengine
// +build appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/main_test.go
@@ -1,3 +1,4 @@
//go:build !appengine
// +build !appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/main_vm.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build !appengine
// +build !appengine

package internal
Expand Down
1 change: 1 addition & 0 deletions internal/net_test.go
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

//go:build !appengine
// +build !appengine

package internal
Expand Down
2 changes: 1 addition & 1 deletion internal/user/user_service.pb.go

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

1 change: 1 addition & 0 deletions log/log.go
Expand Up @@ -7,6 +7,7 @@ Package log provides the means of writing and querying an application's logs
from within an App Engine application.
Example:
c := appengine.NewContext(r)
query := &log.Query{
AppLogs: true,
Expand Down
1 change: 1 addition & 0 deletions mail/mail.go
Expand Up @@ -7,6 +7,7 @@ Package mail provides the means of sending email from an
App Engine application.
Example:
msg := &mail.Message{
Sender: "romeo@montague.com",
To: []string{"Juliet <juliet@capulet.org>"},
Expand Down

0 comments on commit 02a1513

Please sign in to comment.