run gofmt with go1.19 release candidate (#282)
Zev Goldstein authored 1 year, 10 months ago
GitHub committed 1 year, 10 months ago
0 | //go:build appengine | |
0 | 1 | // +build appengine |
1 | 2 | |
2 | 3 | package aetest |
12 | 13 | var aeOpts *aetest.Options |
13 | 14 | if opts != nil { |
14 | 15 | aeOpts = &aetest.Options{ |
15 | AppID: opts.AppID, | |
16 | AppID: opts.AppID, | |
16 | 17 | StronglyConsistentDatastore: opts.StronglyConsistentDatastore, |
17 | 18 | } |
18 | 19 | } |
34 | 34 | // |
35 | 35 | // Main is designed so that the app's main package looks like this: |
36 | 36 | // |
37 | // package main | |
37 | // package main | |
38 | 38 | // |
39 | // import ( | |
40 | // "google.golang.org/appengine" | |
39 | // import ( | |
40 | // "google.golang.org/appengine" | |
41 | 41 | // |
42 | // _ "myapp/package0" | |
43 | // _ "myapp/package1" | |
44 | // ) | |
42 | // _ "myapp/package0" | |
43 | // _ "myapp/package1" | |
44 | // ) | |
45 | 45 | // |
46 | // func main() { | |
47 | // appengine.Main() | |
48 | // } | |
46 | // func main() { | |
47 | // appengine.Main() | |
48 | // } | |
49 | 49 | // |
50 | 50 | // The "myapp/packageX" packages are expected to register HTTP handlers |
51 | 51 | // in their init functions. |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package appengine |
8 | 8 | This package does not work in App Engine "flexible environment". |
9 | 9 | |
10 | 10 | Example: |
11 | ||
11 | 12 | if !capability.Enabled(c, "datastore_v3", "write") { |
12 | 13 | // show user a different page |
13 | 14 | } |
13 | 13 | |
14 | 14 | A Go MySQL driver that has been tested to work well with Cloud SQL |
15 | 15 | is the go-sql-driver: |
16 | ||
16 | 17 | import "database/sql" |
17 | 18 | import _ "github.com/go-sql-driver/mysql" |
18 | 19 | |
19 | 20 | db, err := sql.Open("mysql", "user@cloudsql(project-id:instance-name)/dbname") |
20 | 21 | |
22 | Another driver that works well with Cloud SQL is the mymysql driver: | |
21 | 23 | |
22 | Another driver that works well with Cloud SQL is the mymysql driver: | |
23 | 24 | import "database/sql" |
24 | 25 | import _ "github.com/ziutek/mymysql/godrv" |
25 | 26 | |
26 | 27 | db, err := sql.Open("mymysql", "cloudsql:instance-name*dbname/user/password") |
27 | ||
28 | 28 | |
29 | 29 | Using either of these drivers, you can perform a standard SQL query. |
30 | 30 | This example assumes there is a table named 'users' with |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build appengine | |
4 | 5 | // +build appengine |
5 | 6 | |
6 | 7 | package cloudsql |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package cloudsql |
7 | 7 | // A main func is synthesized if one does not exist. |
8 | 8 | // |
9 | 9 | // A sample Dockerfile to be used with this bundler could look like this: |
10 | // FROM gcr.io/google-appengine/go-compat | |
11 | // ADD . /app | |
12 | // RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe | |
10 | // | |
11 | // FROM gcr.io/google-appengine/go-compat | |
12 | // ADD . /app | |
13 | // RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe | |
13 | 14 | package main |
14 | 15 | |
15 | 16 | import ( |
4 | 4 | /* |
5 | 5 | Package datastore provides a client for App Engine's datastore service. |
6 | 6 | |
7 | ||
8 | Basic Operations | |
7 | # Basic Operations | |
9 | 8 | |
10 | 9 | Entities are the unit of storage and are associated with a key. A key |
11 | 10 | consists of an optional parent key, a string application ID, a string kind |
73 | 72 | Delete functions. They take a []*Key instead of a *Key, and may return an |
74 | 73 | appengine.MultiError when encountering partial failure. |
75 | 74 | |
76 | ||
77 | Properties | |
75 | # Properties | |
78 | 76 | |
79 | 77 | An entity's contents can be represented by a variety of types. These are |
80 | 78 | typically struct pointers, but can also be any type that implements the |
136 | 134 | J int `datastore:",noindex" json:"j"` |
137 | 135 | } |
138 | 136 | |
139 | ||
140 | Structured Properties | |
137 | # Structured Properties | |
141 | 138 | |
142 | 139 | If the struct pointed to contains other structs, then the nested or embedded |
143 | 140 | structs are flattened. For example, given these definitions: |
178 | 175 | If an outer struct is tagged "noindex" then all of its implicit flattened |
179 | 176 | fields are effectively "noindex". |
180 | 177 | |
181 | ||
182 | The PropertyLoadSaver Interface | |
178 | # The PropertyLoadSaver Interface | |
183 | 179 | |
184 | 180 | An entity's contents can also be represented by any type that implements the |
185 | 181 | PropertyLoadSaver interface. This type may be a struct pointer, but it does |
229 | 225 | The *PropertyList type implements PropertyLoadSaver, and can therefore hold an |
230 | 226 | arbitrary entity's contents. |
231 | 227 | |
232 | ||
233 | Queries | |
228 | # Queries | |
234 | 229 | |
235 | 230 | Queries retrieve entities based on their properties or key's ancestry. Running |
236 | 231 | a query yields an iterator of results: either keys or (key, entity) pairs. |
283 | 278 | io.Copy(w, b) |
284 | 279 | } |
285 | 280 | |
286 | ||
287 | Transactions | |
281 | # Transactions | |
288 | 282 | |
289 | 283 | RunInTransaction runs a function in a transaction. |
290 | 284 | |
322 | 316 | fmt.Fprintf(w, "Count=%d", count) |
323 | 317 | } |
324 | 318 | |
325 | ||
326 | Metadata | |
319 | # Metadata | |
327 | 320 | |
328 | 321 | The datastore package provides access to some of App Engine's datastore |
329 | 322 | metadata. This metadata includes information about the entity groups, |
49 | 49 | // The properties are returned as a map of property names to a slice of the |
50 | 50 | // representation types. The representation types for the supported Go property |
51 | 51 | // types are: |
52 | // "INT64": signed integers and time.Time | |
53 | // "DOUBLE": float32 and float64 | |
54 | // "BOOLEAN": bool | |
55 | // "STRING": string, []byte and ByteString | |
56 | // "POINT": appengine.GeoPoint | |
57 | // "REFERENCE": *Key | |
58 | // "USER": (not used in the Go runtime) | |
52 | // | |
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) | |
59 | 60 | func KindProperties(ctx context.Context, kind string) (map[string][]string, error) { |
60 | 61 | // TODO(djd): Support range queries. |
61 | 62 | kindKey := NewKey(ctx, kindKind, kind, 0, nil) |
475 | 475 | // The keys returned by GetAll will be in a 1-1 correspondence with the entities |
476 | 476 | // added to dst. |
477 | 477 | // |
478 | // If q is a ``keys-only'' query, GetAll ignores dst and only returns the keys. | |
478 | // If q is a “keys-only” query, GetAll ignores dst and only returns the keys. | |
479 | 479 | // |
480 | 480 | // The running time and number of API calls made by GetAll scale linearly with |
481 | 481 | // the sum of the query's offset and limit. Unless the result count is |
9 | 9 | in a top-level assignment context, passing it an arbitrary string key |
10 | 10 | and a function whose first argument is of type context.Context. |
11 | 11 | The key is used to look up the function so it can be called later. |
12 | ||
12 | 13 | var laterFunc = delay.Func("key", myFunc) |
14 | ||
13 | 15 | It is also possible to use a function literal. |
16 | ||
14 | 17 | var laterFunc = delay.Func("key", func(c context.Context, x string) { |
15 | 18 | // ... |
16 | 19 | }) |
17 | 20 | |
18 | 21 | To call a function, invoke its Call method. |
22 | ||
19 | 23 | laterFunc.Call(c, "something") |
24 | ||
20 | 25 | A function may be called any number of times. If the function has any |
21 | 26 | return arguments, and the last one is of type error, the function may |
22 | 27 | return a non-nil error to signal that the function should be retried. |
36 | 41 | with pending function invocations should safe as long as the relevant |
37 | 42 | functions have the (filename, key) combination preserved. The filename is |
38 | 43 | parsed according to these rules: |
39 | * Paths in package main are shortened to just the file name (github.com/foo/foo.go -> foo.go) | |
40 | * Paths are stripped to just package paths (/go/src/github.com/foo/bar.go -> github.com/foo/bar.go) | |
41 | * Module versions are stripped (/go/pkg/mod/github.com/foo/bar@v0.0.0-20181026220418-f595d03440dc/baz.go -> github.com/foo/bar/baz.go) | |
44 | - Paths in package main are shortened to just the file name (github.com/foo/foo.go -> foo.go) | |
45 | - Paths are stripped to just package paths (/go/src/github.com/foo/bar.go -> github.com/foo/bar.go) | |
46 | - Module versions are stripped (/go/pkg/mod/github.com/foo/bar@v0.0.0-20181026220418-f595d03440dc/baz.go -> github.com/foo/bar/baz.go) | |
42 | 47 | |
43 | 48 | There is some inherent risk of pending function invocations being lost during |
44 | 49 | an update that contains large changes. For example, switching from using GOPATH |
207 | 212 | } |
208 | 213 | |
209 | 214 | // Call invokes a delayed function. |
210 | // err := f.Call(c, ...) | |
215 | // | |
216 | // err := f.Call(c, ...) | |
217 | // | |
211 | 218 | // is equivalent to |
212 | // t, _ := f.Task(...) | |
213 | // _, err := taskqueue.Add(c, t, "") | |
219 | // | |
220 | // t, _ := f.Task(...) | |
221 | // _, err := taskqueue.Add(c, t, "") | |
214 | 222 | func (f *Function) Call(c context.Context, args ...interface{}) error { |
215 | 223 | t, err := f.Task(args...) |
216 | 224 | if err != nil { |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | 4 | // This example only works on App Engine "flexible environment". |
5 | //go:build !appengine | |
5 | 6 | // +build !appengine |
6 | 7 | |
7 | 8 | package main |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | 4 | // This example only works on App Engine "flexible environment". |
5 | //go:build !appengine | |
5 | 6 | // +build !appengine |
6 | 7 | |
7 | 8 | package main |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build appengine | |
4 | 5 | // +build appengine |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build race | |
4 | 5 | // +build race |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build appengine | |
4 | 5 | // +build appengine |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build appenginevm | |
4 | 5 | // +build appenginevm |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build appengine | |
4 | 5 | // +build appengine |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package internal |
37 | 37 | 5: "OAUTH_ERROR", |
38 | 38 | } |
39 | 39 | var UserServiceError_ErrorCode_value = map[string]int32{ |
40 | "OK": 0, | |
40 | "OK": 0, | |
41 | 41 | "REDIRECT_URL_TOO_LONG": 1, |
42 | 42 | "NOT_ALLOWED": 2, |
43 | 43 | "OAUTH_INVALID_TOKEN": 3, |
6 | 6 | from within an App Engine application. |
7 | 7 | |
8 | 8 | Example: |
9 | ||
9 | 10 | c := appengine.NewContext(r) |
10 | 11 | query := &log.Query{ |
11 | 12 | AppLogs: true, |
6 | 6 | App Engine application. |
7 | 7 | |
8 | 8 | Example: |
9 | ||
9 | 10 | msg := &mail.Message{ |
10 | 11 | Sender: "romeo@montague.com", |
11 | 12 | To: []string{"Juliet <juliet@capulet.org>"}, |
4 | 4 | /* |
5 | 5 | Package search provides a client for App Engine's search service. |
6 | 6 | |
7 | ||
8 | Basic Operations | |
7 | # Basic Operations | |
9 | 8 | |
10 | 9 | Indexes contain documents. Each index is identified by its name: a |
11 | 10 | human-readable ASCII string. |
53 | 52 | return err |
54 | 53 | } |
55 | 54 | |
56 | ||
57 | Search and Listing Documents | |
55 | # Search and Listing Documents | |
58 | 56 | |
59 | 57 | Indexes have two methods for retrieving multiple documents at once: Search and |
60 | 58 | List. |
97 | 95 | fmt.Fprintf(w, "%s -> %#v\n", id, doc) |
98 | 96 | } |
99 | 97 | |
100 | ||
101 | Fields and Facets | |
98 | # Fields and Facets | |
102 | 99 | |
103 | 100 | A document's contents can be represented by a variety of types. These are |
104 | 101 | typically struct pointers, but they can also be represented by any type |
144 | 141 | I float64 `search:",facet" json:"i"` |
145 | 142 | } |
146 | 143 | |
147 | ||
148 | The FieldLoadSaver Interface | |
144 | # The FieldLoadSaver Interface | |
149 | 145 | |
150 | 146 | A document's contents can also be represented by any type that implements the |
151 | 147 | FieldLoadSaver interface. This type may be a struct pointer, but it |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build appengine | |
4 | 5 | // +build appengine |
5 | 6 | |
6 | 7 | package socket |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package socket |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build appengine | |
4 | 5 | // +build appengine |
5 | 6 | |
6 | 7 | package user |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package user |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build !appengine | |
4 | 5 | // +build !appengine |
5 | 6 | |
6 | 7 | package user |
34 | 34 | // |
35 | 35 | // Main is designed so that the app's main package looks like this: |
36 | 36 | // |
37 | // package main | |
37 | // package main | |
38 | 38 | // |
39 | // import ( | |
40 | // "google.golang.org/appengine/v2" | |
39 | // import ( | |
40 | // "google.golang.org/appengine/v2" | |
41 | 41 | // |
42 | // _ "myapp/package0" | |
43 | // _ "myapp/package1" | |
44 | // ) | |
42 | // _ "myapp/package0" | |
43 | // _ "myapp/package1" | |
44 | // ) | |
45 | 45 | // |
46 | // func main() { | |
47 | // appengine.Main() | |
48 | // } | |
46 | // func main() { | |
47 | // appengine.Main() | |
48 | // } | |
49 | 49 | // |
50 | 50 | // The "myapp/packageX" packages are expected to register HTTP handlers |
51 | 51 | // in their init functions. |
8 | 8 | This package does not work in App Engine "flexible environment". |
9 | 9 | |
10 | 10 | Example: |
11 | ||
11 | 12 | if !capability.Enabled(c, "datastore_v3", "write") { |
12 | 13 | // show user a different page |
13 | 14 | } |
7 | 7 | // A main func is synthesized if one does not exist. |
8 | 8 | // |
9 | 9 | // A sample Dockerfile to be used with this bundler could look like this: |
10 | // FROM gcr.io/google-appengine/go-compat | |
11 | // ADD . /app | |
12 | // RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe | |
10 | // | |
11 | // FROM gcr.io/google-appengine/go-compat | |
12 | // ADD . /app | |
13 | // RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe | |
13 | 14 | package main |
14 | 15 | |
15 | 16 | import ( |
4 | 4 | /* |
5 | 5 | Package datastore provides a client for App Engine's datastore service. |
6 | 6 | |
7 | ||
8 | Basic Operations | |
7 | # Basic Operations | |
9 | 8 | |
10 | 9 | Entities are the unit of storage and are associated with a key. A key |
11 | 10 | consists of an optional parent key, a string application ID, a string kind |
73 | 72 | Delete functions. They take a []*Key instead of a *Key, and may return an |
74 | 73 | appengine.MultiError when encountering partial failure. |
75 | 74 | |
76 | ||
77 | Properties | |
75 | # Properties | |
78 | 76 | |
79 | 77 | An entity's contents can be represented by a variety of types. These are |
80 | 78 | typically struct pointers, but can also be any type that implements the |
136 | 134 | J int `datastore:",noindex" json:"j"` |
137 | 135 | } |
138 | 136 | |
139 | ||
140 | Structured Properties | |
137 | # Structured Properties | |
141 | 138 | |
142 | 139 | If the struct pointed to contains other structs, then the nested or embedded |
143 | 140 | structs are flattened. For example, given these definitions: |
178 | 175 | If an outer struct is tagged "noindex" then all of its implicit flattened |
179 | 176 | fields are effectively "noindex". |
180 | 177 | |
181 | ||
182 | The PropertyLoadSaver Interface | |
178 | # The PropertyLoadSaver Interface | |
183 | 179 | |
184 | 180 | An entity's contents can also be represented by any type that implements the |
185 | 181 | PropertyLoadSaver interface. This type may be a struct pointer, but it does |
229 | 225 | The *PropertyList type implements PropertyLoadSaver, and can therefore hold an |
230 | 226 | arbitrary entity's contents. |
231 | 227 | |
232 | ||
233 | Queries | |
228 | # Queries | |
234 | 229 | |
235 | 230 | Queries retrieve entities based on their properties or key's ancestry. Running |
236 | 231 | a query yields an iterator of results: either keys or (key, entity) pairs. |
283 | 278 | io.Copy(w, b) |
284 | 279 | } |
285 | 280 | |
286 | ||
287 | Transactions | |
281 | # Transactions | |
288 | 282 | |
289 | 283 | RunInTransaction runs a function in a transaction. |
290 | 284 | |
322 | 316 | fmt.Fprintf(w, "Count=%d", count) |
323 | 317 | } |
324 | 318 | |
325 | ||
326 | Metadata | |
319 | # Metadata | |
327 | 320 | |
328 | 321 | The datastore package provides access to some of App Engine's datastore |
329 | 322 | metadata. This metadata includes information about the entity groups, |
49 | 49 | // The properties are returned as a map of property names to a slice of the |
50 | 50 | // representation types. The representation types for the supported Go property |
51 | 51 | // types are: |
52 | // "INT64": signed integers and time.Time | |
53 | // "DOUBLE": float32 and float64 | |
54 | // "BOOLEAN": bool | |
55 | // "STRING": string, []byte and ByteString | |
56 | // "POINT": appengine.GeoPoint | |
57 | // "REFERENCE": *Key | |
58 | // "USER": (not used in the Go runtime) | |
52 | // | |
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) | |
59 | 60 | func KindProperties(ctx context.Context, kind string) (map[string][]string, error) { |
60 | 61 | // TODO(djd): Support range queries. |
61 | 62 | kindKey := NewKey(ctx, kindKind, kind, 0, nil) |
475 | 475 | // The keys returned by GetAll will be in a 1-1 correspondence with the entities |
476 | 476 | // added to dst. |
477 | 477 | // |
478 | // If q is a ``keys-only'' query, GetAll ignores dst and only returns the keys. | |
478 | // If q is a “keys-only” query, GetAll ignores dst and only returns the keys. | |
479 | 479 | // |
480 | 480 | // The running time and number of API calls made by GetAll scale linearly with |
481 | 481 | // the sum of the query's offset and limit. Unless the result count is |
219 | 219 | } |
220 | 220 | |
221 | 221 | // Call invokes a delayed function. |
222 | // err := f.Call(c, ...) | |
222 | // | |
223 | // err := f.Call(c, ...) | |
224 | // | |
223 | 225 | // is equivalent to |
224 | // t, _ := f.Task(...) | |
225 | // _, err := taskqueue.Add(c, t, "") | |
226 | // | |
227 | // t, _ := f.Task(...) | |
228 | // _, err := taskqueue.Add(c, t, "") | |
226 | 229 | func (f *Function) Call(c context.Context, args ...interface{}) error { |
227 | 230 | t, err := f.Task(args...) |
228 | 231 | if err != nil { |
446 | 446 | MustRegister("invalid", func() {}) |
447 | 447 | } |
448 | 448 | |
449 | ||
450 | 449 | func TestGetRequestHeadersFromContext(t *testing.T) { |
451 | 450 | for _, testTarget := range []*Function{requestFunc, requestRegister} { |
452 | 451 | c := newFakeContext() |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build race | |
4 | 5 | // +build race |
5 | 6 | |
6 | 7 | package internal |
1 | 1 | // Use of this source code is governed by the Apache 2.0 |
2 | 2 | // license that can be found in the LICENSE file. |
3 | 3 | |
4 | //go:build appenginevm | |
4 | 5 | // +build appenginevm |
5 | 6 | |
6 | 7 | package internal |
6 | 6 | App Engine application. |
7 | 7 | |
8 | 8 | Example: |
9 | ||
9 | 10 | msg := &mail.Message{ |
10 | 11 | Sender: "romeo@montague.com", |
11 | 12 | To: []string{"Juliet <juliet@capulet.org>"}, |