4311b73361
* docs: compare Go Micro with Google ADK in the comparison guide Adds a 'vs Agent Frameworks (Google ADK)' section: ADK builds an agent, Go Micro builds the distributed system the agent lives in (agents are services in the mesh). Covers the category difference, a feature table, when to choose each, and MCP/A2A interoperability. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL * docs: replace ADK comparison slogan with concrete explanation State plainly what each tool provides (ADK builds an agent process; Go Micro builds the surrounding service mesh) instead of marketing phrasing. * lint: apply golangci-lint autofixes; exclude ST1003 and demo errcheck Mechanical, behaviour-preserving fixes applied by 'golangci-lint run --fix': gofmt, misspell (US spelling), usestdlibvars (http.Method*/Status*), unconvert, and the auto-fixable staticcheck simplifications (QF*, S1017/S1019/S1023/S1039). Config: exclude ST1003 (remaining offenders are exported API renames, e.g. web.Id, which would break compatibility) and skip errcheck for examples/ and internal/harness/ (demo code where fire-and-forget is intentional). Build and test compilation verified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL * lint: WIP cleanup checkpoint (errcheck config + partial fixes) Checkpoint of an in-progress golangci-lint cleanup (background pass). Builds cleanly; lint is not yet zero. Follow-up commit will complete the cleanup and switch CI to a blocking full-tree lint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL --------- Co-authored-by: Claude <noreply@anthropic.com>
108 lines
1.7 KiB
Go
108 lines
1.7 KiB
Go
package server
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"go-micro.dev/v6/codec"
|
|
"go-micro.dev/v6/internal/util/buf"
|
|
"go-micro.dev/v6/transport"
|
|
)
|
|
|
|
type rpcRequest struct {
|
|
socket transport.Socket
|
|
codec codec.Codec
|
|
rawBody interface{}
|
|
header map[string]string
|
|
service string
|
|
method string
|
|
endpoint string
|
|
contentType string
|
|
body []byte
|
|
stream bool
|
|
first bool
|
|
}
|
|
|
|
type rpcMessage struct {
|
|
payload interface{}
|
|
header map[string]string
|
|
codec codec.NewCodec
|
|
topic string
|
|
contentType string
|
|
body []byte
|
|
}
|
|
|
|
func (r *rpcRequest) Codec() codec.Reader {
|
|
return r.codec
|
|
}
|
|
|
|
func (r *rpcRequest) ContentType() string {
|
|
return r.contentType
|
|
}
|
|
|
|
func (r *rpcRequest) Service() string {
|
|
return r.service
|
|
}
|
|
|
|
func (r *rpcRequest) Method() string {
|
|
return r.method
|
|
}
|
|
|
|
func (r *rpcRequest) Endpoint() string {
|
|
return r.endpoint
|
|
}
|
|
|
|
func (r *rpcRequest) Header() map[string]string {
|
|
return r.header
|
|
}
|
|
|
|
func (r *rpcRequest) Body() interface{} {
|
|
return r.rawBody
|
|
}
|
|
|
|
func (r *rpcRequest) Read() ([]byte, error) {
|
|
// got a body
|
|
if r.first {
|
|
b := r.body
|
|
r.first = false
|
|
return b, nil
|
|
}
|
|
|
|
var msg transport.Message
|
|
err := r.socket.Recv(&msg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
r.header = msg.Header
|
|
|
|
return msg.Body, nil
|
|
}
|
|
|
|
func (r *rpcRequest) Stream() bool {
|
|
return r.stream
|
|
}
|
|
|
|
func (r *rpcMessage) ContentType() string {
|
|
return r.contentType
|
|
}
|
|
|
|
func (r *rpcMessage) Topic() string {
|
|
return r.topic
|
|
}
|
|
|
|
func (r *rpcMessage) Payload() interface{} {
|
|
return r.payload
|
|
}
|
|
|
|
func (r *rpcMessage) Header() map[string]string {
|
|
return r.header
|
|
}
|
|
|
|
func (r *rpcMessage) Body() []byte {
|
|
return r.body
|
|
}
|
|
|
|
func (r *rpcMessage) Codec() codec.Reader {
|
|
b := buf.New(bytes.NewBuffer(r.body))
|
|
return r.codec(b)
|
|
}
|