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

@@ -17,10 +17,10 @@ package main
import "fmt"
func main() {
// Value should be deferred until function call.
// Mutating value; value should have been stored at package initialization.
msg = "Hello, World!"
fmt.Println(injectedMessage())
}
var msg string
var msg string = "Package init"

View File

@@ -1 +1 @@
Hello, World!
Package init