What version of Go are you using (go version)?
go 1.12.6
$ go version
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
"darwin"
go env Output
$ go env
What did you do?
Option1:
if I have two variables one defined and other undefined then the := does not identify the defined variable and results in compile error "non-name fs.err on left side of :=" The line of code is as follows
d, fs.err := fs.client.Collection(fs.CollectionName).Doc(fs.ID).Get(fs.ctx)
In order to make it work d needs to be defined
var d *firestore.DocumentSnapshot
Option 2:
while the following fragment works and go infer the type for d
var err error
d, err := fs.client.Collection(fs.CollectionName).Doc(fs.ID).Get(fs.ctx)
In the line above fs is a struct and has been defined. In this case I am receiving it as an argument
What did you expect to see?
I expect go to infer types for non defined parameters, as it does in the second scenario above
What did you see instead?
Option 1 does not work while Option 2 works
What version of Go are you using (
go version)?go 1.12.6
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?"darwin"
go envOutputWhat did you do?
Option1:
if I have two variables one defined and other undefined then the := does not identify the defined variable and results in compile error "non-name fs.err on left side of :=" The line of code is as follows
d, fs.err := fs.client.Collection(fs.CollectionName).Doc(fs.ID).Get(fs.ctx)
In order to make it work d needs to be defined
var d *firestore.DocumentSnapshot
Option 2:
while the following fragment works and go infer the type for d
var err error
d, err := fs.client.Collection(fs.CollectionName).Doc(fs.ID).Get(fs.ctx)
In the line above fs is a struct and has been defined. In this case I am receiving it as an argument
What did you expect to see?
I expect go to infer types for non defined parameters, as it does in the second scenario above
What did you see instead?
Option 1 does not work while Option 2 works