You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the compiler throws an error. People at community say that it is impossible to do such thing because every value must have "home variable". This is the workaround:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I wrote a golang library that allows nil or not-nil state, which is very useful for JSON and SQL.
What did you expect to see?
It should be written like this:
What did you see instead?
However, the compiler throws an error. People at community say that it is impossible to do such thing because every value must have "home variable". This is the workaround:
The problem is compactness of source code. I felt like coding in C++ rather than Go.
Using SQL's scan method is actually possible, but there is no pre-compile error in case of wrong assignment, which is dangerous.
If there is no solution for allowing both nil and not-nil value with homogenous type, please consider to mark this issue as proposal. Thank you!
The text was updated successfully, but these errors were encountered: