Most languages support the concept of null string values. Java, C/C++/
C#, javascript, etc.
For interoperability reasons it would be useful if Go supported a null
string value.
For instance, in the json package, Marshal and Unmarshal can't really
work with null strings. If you run the following code, the result is
not really correct:
var a struct{ A string} { };
json.Unmarshal(`{"a": null}`, &a);
fmt.Printf("%q", a.A); // prints "", which is is not technically
correct. null != ""
There's also question recently on stack overflow about this:
http://stackoverflow.com/questions/1799374/how-to-have-a-function-with-a-nullable-string-parameter-in-go
Is there a plan to support null strings in Go?
- Mike