fixes#2078
A status with invalid utf-8 characters could still be created, but invalid characters will be replaced with [Unicode replacement character](https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character) before being sent out. Those bytes will still be percent encoded.
All details added to this invalid status will be dropped.
Reverts grpc/grpc-go#2098
Appengine will fail with the error below:
```
go-app-builder: Failed parsing input: parser: bad import "syscall" in google.golang.org/grpc/channelz/funcs.go from GOPATH
```
The root cause of it is in type_linux.go.
629f6bc5e5/channelz/types_linux.go (L21-L25)
This PR splits out grpclb from grpc. I have made the PR in several commits so you can see more clearly the steps that happened.
There are a few possibly contentious points that I would like to make clear up front:
* grpclb will no longer autoload as a load balancer. I think this is okay, as service config is not widely (at all?) used, and I believe this is the only way to access it.
* `internal` is used more, as a way of having code shared between packages without exposing types
* ConnectivityStateEvaluator, as used by grpclb, is no longer thread safe. I believe there is an outer mutex that guards access, but I want to point out this subtle change up here.
All but one tests pass with this, due to another cyclic dependency. I can fix this, but it is a little more widely scoped (such as exposing grpc.server and grpc.errorDesc in the internal package). This PR is a nearly-passing sample of that last step to get this working.
PTAL @menghanl @dfawley
Marshalling a Code to JSON and unmarshalling it failed with an
"invalid code" error message.
Code is of type uint32. It has no custom MarshalJson() implemented
therefore it is marshalled into an JSON integer value.
The UnmarshalJSON() function expected that the marshalled Code is a
String type, unmarshalling failed.
Check in UnmarshalJSON() if the value is an uint32 in the range of the
defined Code values. If it is, unmarshal it.
This commit also adds an Marshal/Unmarshal testcase.
This reverts commit 7cc2837209c4fa87008717b4e94a085820d7d779.
The PR breaks darwin builds
src/google.golang.org/grpc/channelz/types_unix.go:35:15: undefined: unix.TCPInfo
This is a partial revert of #2027 which seems to have broken the ability
to inject payload inspecting client interceptors. Specifically it causes
this test to break:
eb0079f598/bigtable/bigtable_test.go (L949-L971)
With:
panic: interface conversion: grpc.ClientStream is *bigtable.requestCountingInterceptor, not *grpc.clientStream [recovered]
panic: interface conversion: grpc.ClientStream is *bigtable.requestCountingInterceptor, not *grpc.clientStream
Which seems to be caused by invoke() expecting a clientStream from a
ClientConn:
7c204fd174/call.go (L74)