// Gogo proto support
421171
func (address *Address) Marshal() ([]byte, error) {
	if address == nil {
		return nil, nil
	}
	return address.Bytes(), nil
}
25976
func assignGoTypeToProtoPackage(p *protobufPackage, t *types.Type, local, global typeNameSet, optional map[types.Name]struct{}) {
	newT, isProto := isFundamentalProtoType(t)
	if isProto {
		t = newT
	}
	if otherP, ok := global[t.Name]; ok {
		if _, ok := local[t.Name]; !ok {
			p.Imports.AddType(&types.Type{
				Kind: types.Protobuf,
				Name: otherP.ProtoTypeName(),
			})
		}
		return
	}
	if t.Name.Package == p.PackagePath {
		// Associate types only to their own package
		global[t.Name] = p
	}
	if _, ok := local[t.Name]; ok {
		return
	}
	// don't recurse into existing proto types
	if isProto {
		p.Imports.AddType(t)
		return
	}

	local[t.Name] = p
	for _, m := range t.Members {
		if namer.IsPrivateGoName(m.Name) {
			continue
		}
		field := &protoField{}
		tag := reflect.StructTag(m.Tags).Get("protobuf")
		if tag == "-" {
			continue
		}
		if err := protobufTagToField(tag, field, m, t, p.ProtoTypeName()); err == nil && field.Type != nil {
			assignGoTypeToProtoPackage(p, field.Type, local, global, optional)
			continue
		}
		assignGoTypeToProtoPackage(p, m.Type, local, global, optional)
	}
	// TODO: should methods be walked?
	if t.Elem != nil {
		assignGoTypeToProtoPackage(p, t.Elem, local, global, optional)
	}
	if t.Key != nil {
		assignGoTypeToProtoPackage(p, t.Key, local, global, optional)
	}
	if t.Underlying != nil {
		if t.Kind == types.Alias && isOptionalAlias(t) {
			optional[t.Name] = struct{}{}
		}
		assignGoTypeToProtoPackage(p, t.Underlying, local, global, optional)
	}
}
721264
func (mux *Multiplexer) NewProtoConnection(name string, serializer keyval.Serializer) *ProtoConnection {
	return &ProtoConnection{ProtoConnectionFields{multiplexer: mux, serializer: serializer, name: name}}
}
355511
func golua_callgofunction(gostateindex uintptr, fid uint) int {
	L1 := getGoState(gostateindex)
	if fid < 0 {
		panic(&LuaError{0, "Requested execution of an unknown function", L1.StackTrace()})
	}
	f := L1.registry[fid].(LuaGoFunction)
	return f(L1)
}
568634
func (t Term) Gt(args ...interface{}) Term {
	return constructMethodTerm(t, "Gt", p.Term_GT, args, map[string]interface{}{})
}
903731
func Proto3ToResult(qr *querypb.QueryResult) *Result {
	if qr == nil {
		return nil
	}
	return &Result{
		Fields:       qr.Fields,
		RowsAffected: qr.RowsAffected,
		InsertID:     qr.InsertId,
		Rows:         proto3ToRows(qr.Fields, qr.Rows),
		Extras:       qr.Extras,
	}
}
483648
func (g *Generator) Fail(msgs ...string) {
	s := strings.Join(msgs, " ")
	log.Print("protoc-gen-go: error:", s)
	os.Exit(1)
}
638883
func (h *BrandsHandler) GTG() gtg.Status {
	statusCheck := func() gtg.Status {
		return gtgCheck(h.Checker)
	}
	return gtg.FailFastParallelCheck([]gtg.StatusChecker{statusCheck})()
}
899517
func (r *RangeOp) Gt(fieldName string, value interface{}) *RangeOp {
	r.appendOp(Gt, fieldName, value)
	return r
}
1356363
func (m *ChannelMap) InitMono() {
	cmap := &C.pa_channel_map{}
	C.pa_channel_map_init_mono(cmap)
	m.fromC(cmap)
}
762669
func (p Port) Proto() string {
	parts := strings.Split(string(p), "/")
	if len(parts) == 1 {
		return "tcp"
	}
	return parts[1]
}
469088
func (p *peer) OnGossipUnicast(src mesh.PeerName, buf []byte) error {
	message, err := DecodeKVState(buf)
	if err != nil {
		glog.Warningf("error decoding OnGossipUnicast: %v", err)
		return err
	}

	p.st.merge(message, nil)

	glog.V(4).Infof("OnGossipUnicast %s %v => complete %v", src, message, p.st)
	return nil
}
1299783
func (g *Generator) Error(err error, msgs ...string) {
	s := strings.Join(msgs, " ") + ":" + err.Error()
	log.Print("protoc-gen-go: error:", s)
	os.Exit(1)
}
528286
func (m *Message) ToProto() (proto.Message, error) {
	ptr := m.typ.NewProtoMessage() // ~ ptr := &ProtoMessage{}
	msg := ptr.Elem()              // ~ msg := *ptr (a reference)

	for name, val := range m.fields {
		fd, ok := m.typ.fields[name]
		if !ok {
			panic("should not happen, SetField and Attr checks the structure already")
		}
		if err := assign(fd.onProtoReflection(msg, reflectToProto), val); err != nil {
			return nil, fmt.Errorf("bad value for field %q of %q - %s", name, m.Type(), err)
		}
	}

	return ptr.Interface().(proto.Message), nil
}
3683
func (as ArraySpec) GTE(val Input) Input {
	return as.proc(func(i Input) Input {
		return i.GTE(val)
	})
}
1112797
func ProtoToValue(v *querypb.Value) Value {
	return MakeTrusted(v.Type, v.Value)
}
921825
func (proto *Protocol) HELO(args string) (reply *Reply) {
	proto.logf("Got HELO command, switching to MAIL state")
	proto.State = MAIL
	proto.Message.Helo = args
	return ReplyOk("Hello " + args)
}