wire: store value expressions in package variables (google/go-cloud#135)

The code assigns a local unnecessarily, but this should have no
appreciable effect on semantics, just readability.

Fixes google/go-cloud#104
This commit is contained in:
Ross Light
2018-06-27 08:17:45 -07:00
parent 2eb9d5ea1f
commit 338b1da068
5 changed files with 103 additions and 18 deletions

View File

@@ -304,9 +304,10 @@ func injectFoo() Foo {
}
```
It's important to note that the expression will be copied, so references to
variables will be evaluated during the call to the injector. `gowire` will emit
an error if the expression calls any functions.
It's important to note that the expression will be copied to the injector's
package; references to variables will be evaluated during the injector
package's initialization. `gowire` will emit an error if the expression calls
any functions or receives from any channels.
### Cleanup functions