Skip to content

Commit 0c7f7a8

Browse files
authored
run gofmt with go1.19 release candidate (#282)
1 parent ca3835e commit 0c7f7a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+119
-90
lines changed

aetest/instance_classic.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build appengine
12
// +build appengine
23

34
package aetest
@@ -13,7 +14,7 @@ func NewInstance(opts *Options) (Instance, error) {
1314
var aeOpts *aetest.Options
1415
if opts != nil {
1516
aeOpts = &aetest.Options{
16-
AppID: opts.AppID,
17+
AppID: opts.AppID,
1718
StronglyConsistentDatastore: opts.StronglyConsistentDatastore,
1819
}
1920
}

aetest/instance_vm.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !appengine
12
// +build !appengine
23

34
package aetest

appengine.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ import (
3535
//
3636
// Main is designed so that the app's main package looks like this:
3737
//
38-
// package main
38+
// package main
3939
//
40-
// import (
41-
// "google.golang.org/appengine"
40+
// import (
41+
// "google.golang.org/appengine"
4242
//
43-
// _ "myapp/package0"
44-
// _ "myapp/package1"
45-
// )
43+
// _ "myapp/package0"
44+
// _ "myapp/package1"
45+
// )
4646
//
47-
// func main() {
48-
// appengine.Main()
49-
// }
47+
// func main() {
48+
// appengine.Main()
49+
// }
5050
//
5151
// The "myapp/packageX" packages are expected to register HTTP handlers
5252
// in their init functions.

appengine_vm.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build !appengine
56
// +build !appengine
67

78
package appengine

capability/capability.go

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ for specific API capabilities.
99
This package does not work in App Engine "flexible environment".
1010
1111
Example:
12+
1213
if !capability.Enabled(c, "datastore_v3", "write") {
1314
// show user a different page
1415
}

cloudsql/cloudsql.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ with protocol "cloudsql" and an address of the Cloud SQL instance.
1414
1515
A Go MySQL driver that has been tested to work well with Cloud SQL
1616
is the go-sql-driver:
17+
1718
import "database/sql"
1819
import _ "github.com/go-sql-driver/mysql"
1920
2021
db, err := sql.Open("mysql", "user@cloudsql(project-id:instance-name)/dbname")
2122
22-
2323
Another driver that works well with Cloud SQL is the mymysql driver:
24+
2425
import "database/sql"
2526
import _ "github.com/ziutek/mymysql/godrv"
2627
2728
db, err := sql.Open("mymysql", "cloudsql:instance-name*dbname/user/password")
2829
29-
3030
Using either of these drivers, you can perform a standard SQL query.
3131
This example assumes there is a table named 'users' with
3232
columns 'first_name' and 'last_name':

cloudsql/cloudsql_classic.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build appengine
56
// +build appengine
67

78
package cloudsql

cloudsql/cloudsql_vm.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build !appengine
56
// +build !appengine
67

78
package cloudsql

cmd/aebundler/aebundler.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
// A main func is synthesized if one does not exist.
99
//
1010
// A sample Dockerfile to be used with this bundler could look like this:
11-
// FROM gcr.io/google-appengine/go-compat
12-
// ADD . /app
13-
// RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe
11+
//
12+
// FROM gcr.io/google-appengine/go-compat
13+
// ADD . /app
14+
// RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe
1415
package main
1516

1617
import (

datastore/doc.go

+7-14
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
/*
66
Package datastore provides a client for App Engine's datastore service.
77
8-
9-
Basic Operations
8+
# Basic Operations
109
1110
Entities are the unit of storage and are associated with a key. A key
1211
consists of an optional parent key, a string application ID, a string kind
@@ -74,8 +73,7 @@ GetMulti, PutMulti and DeleteMulti are batch versions of the Get, Put and
7473
Delete functions. They take a []*Key instead of a *Key, and may return an
7574
appengine.MultiError when encountering partial failure.
7675
77-
78-
Properties
76+
# Properties
7977
8078
An entity's contents can be represented by a variety of types. These are
8179
typically struct pointers, but can also be any type that implements the
@@ -137,8 +135,7 @@ Example code:
137135
J int `datastore:",noindex" json:"j"`
138136
}
139137
140-
141-
Structured Properties
138+
# Structured Properties
142139
143140
If the struct pointed to contains other structs, then the nested or embedded
144141
structs are flattened. For example, given these definitions:
@@ -179,8 +176,7 @@ equivalent field would instead be: FooDotZ bool `datastore:"Foo.Z"`.
179176
If an outer struct is tagged "noindex" then all of its implicit flattened
180177
fields are effectively "noindex".
181178
182-
183-
The PropertyLoadSaver Interface
179+
# The PropertyLoadSaver Interface
184180
185181
An entity's contents can also be represented by any type that implements the
186182
PropertyLoadSaver interface. This type may be a struct pointer, but it does
@@ -230,8 +226,7 @@ Example code:
230226
The *PropertyList type implements PropertyLoadSaver, and can therefore hold an
231227
arbitrary entity's contents.
232228
233-
234-
Queries
229+
# Queries
235230
236231
Queries retrieve entities based on their properties or key's ancestry. Running
237232
a query yields an iterator of results: either keys or (key, entity) pairs.
@@ -284,8 +279,7 @@ Example code:
284279
io.Copy(w, b)
285280
}
286281
287-
288-
Transactions
282+
# Transactions
289283
290284
RunInTransaction runs a function in a transaction.
291285
@@ -323,8 +317,7 @@ Example code:
323317
fmt.Fprintf(w, "Count=%d", count)
324318
}
325319
326-
327-
Metadata
320+
# Metadata
328321
329322
The datastore package provides access to some of App Engine's datastore
330323
metadata. This metadata includes information about the entity groups,

datastore/metadata.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ func keyNames(keys []*Key) []string {
5050
// The properties are returned as a map of property names to a slice of the
5151
// representation types. The representation types for the supported Go property
5252
// types are:
53-
// "INT64": signed integers and time.Time
54-
// "DOUBLE": float32 and float64
55-
// "BOOLEAN": bool
56-
// "STRING": string, []byte and ByteString
57-
// "POINT": appengine.GeoPoint
58-
// "REFERENCE": *Key
59-
// "USER": (not used in the Go runtime)
53+
//
54+
// "INT64": signed integers and time.Time
55+
// "DOUBLE": float32 and float64
56+
// "BOOLEAN": bool
57+
// "STRING": string, []byte and ByteString
58+
// "POINT": appengine.GeoPoint
59+
// "REFERENCE": *Key
60+
// "USER": (not used in the Go runtime)
6061
func KindProperties(ctx context.Context, kind string) (map[string][]string, error) {
6162
// TODO(djd): Support range queries.
6263
kindKey := NewKey(ctx, kindKind, kind, 0, nil)

datastore/query.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ func callNext(c context.Context, res *pb.QueryResult, offset, count int32) error
476476
// The keys returned by GetAll will be in a 1-1 correspondence with the entities
477477
// added to dst.
478478
//
479-
// If q is a ``keys-only'' query, GetAll ignores dst and only returns the keys.
479+
// If q is a keys-only query, GetAll ignores dst and only returns the keys.
480480
//
481481
// The running time and number of API calls made by GetAll scale linearly with
482482
// the sum of the query's offset and limit. Unless the result count is

delay/delay.go

+14-6
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ To declare a function that may be executed later, call Func
1010
in a top-level assignment context, passing it an arbitrary string key
1111
and a function whose first argument is of type context.Context.
1212
The key is used to look up the function so it can be called later.
13+
1314
var laterFunc = delay.Func("key", myFunc)
15+
1416
It is also possible to use a function literal.
17+
1518
var laterFunc = delay.Func("key", func(c context.Context, x string) {
1619
// ...
1720
})
1821
1922
To call a function, invoke its Call method.
23+
2024
laterFunc.Call(c, "something")
25+
2126
A function may be called any number of times. If the function has any
2227
return arguments, and the last one is of type error, the function may
2328
return a non-nil error to signal that the function should be retried.
@@ -37,9 +42,9 @@ with the string key that was passed to the Func function. Updating an app
3742
with pending function invocations should safe as long as the relevant
3843
functions have the (filename, key) combination preserved. The filename is
3944
parsed according to these rules:
40-
* Paths in package main are shortened to just the file name (github.com/foo/foo.go -> foo.go)
41-
* Paths are stripped to just package paths (/go/src/github.com/foo/bar.go -> github.com/foo/bar.go)
42-
* Module versions are stripped (/go/pkg/mod/github.com/foo/[email protected]/baz.go -> github.com/foo/bar/baz.go)
45+
- Paths in package main are shortened to just the file name (github.com/foo/foo.go -> foo.go)
46+
- Paths are stripped to just package paths (/go/src/github.com/foo/bar.go -> github.com/foo/bar.go)
47+
- Module versions are stripped (/go/pkg/mod/github.com/foo/[email protected]/baz.go -> github.com/foo/bar/baz.go)
4348
4449
There is some inherent risk of pending function invocations being lost during
4550
an update that contains large changes. For example, switching from using GOPATH
@@ -208,10 +213,13 @@ type invocation struct {
208213
}
209214

210215
// Call invokes a delayed function.
211-
// err := f.Call(c, ...)
216+
//
217+
// err := f.Call(c, ...)
218+
//
212219
// is equivalent to
213-
// t, _ := f.Task(...)
214-
// _, err := taskqueue.Add(c, t, "")
220+
//
221+
// t, _ := f.Task(...)
222+
// _, err := taskqueue.Add(c, t, "")
215223
func (f *Function) Call(c context.Context, args ...interface{}) error {
216224
t, err := f.Task(args...)
217225
if err != nil {

demos/guestbook/guestbook.go

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// license that can be found in the LICENSE file.
44

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

89
package main

demos/helloworld/helloworld.go

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// license that can be found in the LICENSE file.
44

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

89
package main

internal/api.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build !appengine
56
// +build !appengine
67

78
package internal

internal/api_classic.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build appengine
56
// +build appengine
67

78
package internal

internal/api_race_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build race
56
// +build race
67

78
package internal

internal/api_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build !appengine
56
// +build !appengine
67

78
package internal

internal/identity_classic.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build appengine
56
// +build appengine
67

78
package internal

internal/identity_flex.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build appenginevm
56
// +build appenginevm
67

78
package internal

internal/identity_vm.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build !appengine
56
// +build !appengine
67

78
package internal

internal/internal_vm_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build !appengine
56
// +build !appengine
67

78
package internal

internal/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build appengine
56
// +build appengine
67

78
package internal

internal/main_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !appengine
12
// +build !appengine
23

34
package internal

internal/main_vm.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build !appengine
56
// +build !appengine
67

78
package internal

internal/net_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by the Apache 2.0
33
// license that can be found in the LICENSE file.
44

5+
//go:build !appengine
56
// +build !appengine
67

78
package internal

internal/user/user_service.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

log/log.go

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Package log provides the means of writing and querying an application's logs
77
from within an App Engine application.
88
99
Example:
10+
1011
c := appengine.NewContext(r)
1112
query := &log.Query{
1213
AppLogs: true,

mail/mail.go

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Package mail provides the means of sending email from an
77
App Engine application.
88
99
Example:
10+
1011
msg := &mail.Message{
1112
Sender: "[email protected]",
1213
To: []string{"Juliet <[email protected]>"},

0 commit comments

Comments
 (0)