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:
4
internal/wire/testdata/VarValue/foo/foo.go
vendored
4
internal/wire/testdata/VarValue/foo/foo.go
vendored
@@ -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"
|
||||
|
||||
2
internal/wire/testdata/VarValue/out.txt
vendored
2
internal/wire/testdata/VarValue/out.txt
vendored
@@ -1 +1 @@
|
||||
Hello, World!
|
||||
Package init
|
||||
|
||||
Reference in New Issue
Block a user