blob: 59b7cf115c7112ceb0950a0982eff2959080f2d7 [file] [log] [blame]
<!doctype html><html lang=en class=no-js><headclass="live-site"><meta name=ROBOTS content="INDEX, FOLLOW"><link rel=canonical href=https://dubbo.apache.org/en/docs3-v2/golang-sdk/tutorial/develop/protocol/choose_protocol/><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=generator content="Hugo 0.120.4"><link rel="shortcut icon" type=image/png href=/imgs/favicon.png><link rel=apple-touch-icon href=/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=manifest href=/manifest.webmanifest><title>Select the network protocol to use | Apache Dubbo</title><meta property="og:title" content="Select the network protocol to use">
<meta property="og:description" content="Select the network protocol to use"><meta property="og:type" content="article"><meta property="og:url" content="https://dubbo.apache.org/en/docs3-v2/golang-sdk/tutorial/develop/protocol/choose_protocol/"><meta property="article:section" content="docs3-v2"><meta property="article:modified_time" content="2023-01-02T22:00:39+08:00"><meta itemprop=name content="Select the network protocol to use"><meta itemprop=description content="Select the network protocol to use"><meta itemprop=dateModified content="2023-01-02T22:00:39+08:00"><meta itemprop=wordCount content="741"><meta itemprop=keywords content><meta name=twitter:card content="summary"><meta name=twitter:title content="Select the network protocol to use"><meta name=twitter:description content="Select the network protocol to use"><script async src="https://www.googletagmanager.com/gtag/js?id=G-1TFHM5YBH0"></script><script>var doNotTrack=!1;if(!doNotTrack){window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag("js",new Date),gtag("config","G-1TFHM5YBH0",{anonymize_ip:!1})}</script><link rel=preload href=/scss/main.min.fe7176cbe3102a33d3e8c0c9cec61eb52508abd24a2cc1ae23ccf535a481ffde.css as=style><link href=/scss/main.min.fe7176cbe3102a33d3e8c0c9cec61eb52508abd24a2cc1ae23ccf535a481ffde.css rel=stylesheet integrity><script src=/js/jquery-3.5.1.min.js integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin=anonymous></script><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@docsearch/css@3><meta name=theme-color content="#326ce5"><link rel=stylesheet href=/css/feature-states.css><meta name=description content="Select the network protocol to use"><meta property="og:description" content="Select the network protocol to use"><meta name=twitter:description content="Select the network protocol to use"><meta property="og:url" content="https://dubbo.apache.org/en/docs3-v2/golang-sdk/tutorial/develop/protocol/choose_protocol/"><meta property="og:title" content="Select the network protocol to use"><meta name=twitter:title content="Select the network protocol to use"><meta name=twitter:image:alt content="Apache Dubbo"><meta property="og:type" content="article"><meta name=viewport content="width=device-width"><script async defer src=/js/github-buttons.js></script><link href=/css/community.css rel=stylesheet><link href=/css/contactus.css rel=stylesheet><link href=/css/language.css rel=stylesheet><script src=/js/script.js></script></head><body class=td-page><header><nav class="js-navbar-scroll navbar navbar-expand navbar-dark flex-column flex-md-row td-navbar" data-auto-burger=primary><a class=navbar-brand href=/en/><span class=navbar-logo></span><span class="text-uppercase font-weight-bold">Apache Dubbo</span></a><div class="td-navbar-nav-scroll ml-md-auto" id=main_navbar><ul class="navbar-nav mt-2 mt-lg-0"><li class="nav-item mr-4 mb-2 mb-lg-0"><a class=nav-link href=/en/overview/><span>Overview</span></a></li><li class="nav-item mr-4 mb-2 mb-lg-0"><a class="nav-link active" href=/en/docs3-v2/><span class=active>SDK Manual</span></a></li><li class="nav-item mr-4 mb-2 mb-lg-0"><a class=nav-link href=/en/blog/><span>Blog</span></a></li><li class="nav-item mr-4 mb-2 mb-lg-0"><a class=nav-link href=/en/download/><span>Download</span></a></li><li class="nav-item mr-4 mb-2 mb-lg-0"><a class=nav-link href=https://start.dubbo.apache.org/bootstrap.html target=_blank><span>Initializer</span><i class='fas fa-external-link-alt'></i></a></li><li class="nav-item dropdown d-lg-block"><a class="nav-link dropdown-toggle" href=# id=navbarDropdownMenuLink role=button data-toggle=dropdown aria-haspopup=true aria-expanded=false>English</a><div class="dropdown-menu dropdown-menu-right" aria-labelledby=navbarDropdownMenuLink><a class=dropdown-item href=/zh-cn/>中文</a></div></li><li class="nav-item dropdown d-lg-block"><div class="nav-item d-none d-lg-block"><div id=docsearch></div></div></li></ul></div></nav></header><div class=td-outer><main role=main class=td-main><h1 id=modify-the-protocol-used>Modify the protocol used</h1><h2 id=1-preparations>1. Preparations</h2><ul><li>dubbo-go cli tools and dependent tools have been installed</li><li>Create a new demo application</li></ul><h2 id=2-how-to-configure-the-network-protocol>2. How to configure the network protocol</h2><p>As you can see in the Quick Start section, the generated Demo sets the Protocol to tri, indicating that the Triple protocol is used for service exposure and service invocation. The configuration API used in the quick start chapter writes the configuration, which has the advantage of not needing to use configuration files. We extract and explain the content related to the network protocol.</p><h3 id=using-configuration-files>Using configuration files</h3><p>See samples/helloworld</p><ul><li>The client uses a configuration file to set the network protocol</li></ul><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#268bd2>dubbo</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>consumer</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>references</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>GreeterClientImpl</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>protocol</span>: tri <span style=color:#586e75># set protocol to tri</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>interface</span>: com.apache.dubbo.sample.basic.IGreeter
</span></span></code></pre></div><ul><li>The server uses the configuration file to set the network protocol</li></ul><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#268bd2>dubbo</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>protocols</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>triple</span>: <span style=color:#586e75># define protocol-id &#39;triple&#39;</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>name</span>: tri <span style=color:#586e75># set protocol to tri</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>port</span>: <span style=color:#2aa198>20000</span> <span style=color:#586e75># set port to be listened</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>provider</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>services</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>GreeterProvider</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>protocol-ids</span>: triple <span style=color:#586e75># use protocol-ids named &#39;triple&#39;</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>interface</span>: com.apache.dubbo.sample.basic.IGreeter
</span></span></code></pre></div><h2 id=3-write-the-interface-and-implementation-of-dubbo-protocol>3. Write the interface and implementation of Dubbo protocol</h2><h3 id=31-define-the-interface-and-transmission-structure-located-in-apiapigo>3.1 Define the interface and transmission structure, located in api/api.go</h3><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-go data-lang=go><span style=display:flex><span><span style=color:#719e07>package</span> api
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#719e07>import</span> (
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;context&#34;</span>
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;dubbo.apache.org/dubbo-go/v3/config&#34;</span>
</span></span><span style=display:flex><span>hessian <span style=color:#2aa198>&#34;github.com/apache/dubbo-go-hessian2&#34;</span>
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;time&#34;</span>
</span></span><span style=display:flex><span>)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#586e75>//1. Define the transmission structure. If Java intercommunication is required, the field needs to correspond to the Java side, and the first letter is capitalized
</span></span></span><span style=display:flex><span><span style=color:#586e75></span><span style=color:#268bd2>type</span> User <span style=color:#268bd2>struct</span> {
</span></span><span style=display:flex><span>ID <span style=color:#dc322f>string</span>
</span></span><span style=display:flex><span>name <span style=color:#dc322f>string</span>
</span></span><span style=display:flex><span>Age <span style=color:#dc322f>int32</span>
</span></span><span style=display:flex><span>Time time. Time
</span></span><span style=display:flex><span>}
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#268bd2>func</span> (u <span style=color:#719e07>*</span>User) <span style=color:#268bd2>JavaClassName</span>() <span style=color:#dc322f>string</span> {
</span></span><span style=display:flex><span><span style=color:#719e07>return</span> <span style=color:#2aa198>&#34;org.apache.dubbo.User&#34;</span> <span style=color:#586e75>// If it communicates with Java, it needs to correspond to the full name of the User class on the Java side,
</span></span></span><span style=display:flex><span><span style=color:#586e75></span>}
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#268bd2>var</span> (
</span></span><span style=display:flex><span>UserProviderClient = <span style=color:#719e07>&amp;</span>UserProvider{} <span style=color:#586e75>// client pointer
</span></span></span><span style=display:flex><span><span style=color:#586e75></span>)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#586e75>// 2. Define the client stub class: UserProvider
</span></span></span><span style=display:flex><span><span style=color:#586e75></span><span style=color:#268bd2>type</span> UserProvider <span style=color:#268bd2>struct</span> {
</span></span><span style=display:flex><span><span style=color:#586e75>// The dubbo label is used to adapt the uppercase method name of the go side client -&gt; the lowercase method name of the java side, only the dubbo protocol client needs to use it
</span></span></span><span style=display:flex><span><span style=color:#586e75></span>GetUser <span style=color:#268bd2>func</span>(ctx context.Context, req <span style=color:#dc322f>int32</span>) (<span style=color:#719e07>*</span>User, <span style=color:#dc322f>error</span>) <span style=color:#586e75>//`dubbo:&#34;getUser&#34;`
</span></span></span><span style=display:flex><span><span style=color:#586e75></span>}
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#268bd2>func</span> <span style=color:#268bd2>init</span>(){
</span></span><span style=display:flex><span>hessian.<span style=color:#268bd2>RegisterPOJO</span>(<span style=color:#719e07>&amp;</span>User{}) <span style=color:#586e75>// register transfer structure to hessian library
</span></span></span><span style=display:flex><span><span style=color:#586e75>// Register the client stub class to the framework, and instantiate the client interface pointer userProvider
</span></span></span><span style=display:flex><span><span style=color:#586e75></span>config. <span style=color:#268bd2>SetConsumerService</span>(UserProviderClient)
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h3 id=22-write-go-server-configuration-and-code>2.2 Write Go-Server configuration and code</h3><p>server/dubbogo.yaml</p><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#268bd2>dubbo</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>registries</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>demoZK</span>: <span style=color:#586e75># Define the service registration discovery center</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>protocol</span>: zookeeper
</span></span><span style=display:flex><span> <span style=color:#268bd2>address</span>: <span style=color:#2aa198>127.0.0.1</span>:<span style=color:#2aa198>2181</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>protocols</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>dubbo</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>name</span>: dubbo <span style=color:#586e75># protocol name dubbo</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>port</span>: <span style=color:#2aa198>20000</span> <span style=color:#586e75># Listening port</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>provider</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>services</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>UserProvider</span>: <span style=color:#586e75># service provider structure class name</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>interface</span>: org.apache.dubbo.UserProvider <span style=color:#586e75># The interface needs to correspond to the go/java client</span>
</span></span></code></pre></div><p>server/server.go</p><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-go data-lang=go><span style=display:flex><span><span style=color:#719e07>package</span> main
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#719e07>import</span> (
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;context&#34;</span>
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;dubbo.apache.org/dubbo-go/v3/common/logger&#34;</span> <span style=color:#586e75>// dubbogo framework log
</span></span></span><span style=display:flex><span><span style=color:#586e75></span><span style=color:#2aa198>&#34;dubbo.apache.org/dubbo-go/v3/config&#34;</span>
</span></span><span style=display:flex><span>_ <span style=color:#2aa198>&#34;dubbo.apache.org/dubbo-go/v3/imports&#34;</span> <span style=color:#586e75>// dubbogo framework dependency, all dubbogo processes need to import once implicitly
</span></span></span><span style=display:flex><span><span style=color:#586e75></span><span style=color:#2aa198>&#34;dubbo3-demo/api&#34;</span>
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;strconv&#34;</span>
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;time&#34;</span>
</span></span><span style=display:flex><span>)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#268bd2>type</span> UserProvider <span style=color:#268bd2>struct</span> {
</span></span><span style=display:flex><span>}
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#586e75>// implement the interface method
</span></span></span><span style=display:flex><span><span style=color:#586e75></span><span style=color:#268bd2>func</span> (u <span style=color:#719e07>*</span>UserProvider) <span style=color:#268bd2>GetUser</span>(ctx context.Context, req <span style=color:#dc322f>int32</span>) (<span style=color:#719e07>*</span>api.User, <span style=color:#dc322f>error</span>) {
</span></span><span style=display:flex><span><span style=color:#268bd2>var</span> err <span style=color:#dc322f>error</span>
</span></span><span style=display:flex><span>logger.<span style=color:#268bd2>Infof</span>(<span style=color:#2aa198>&#34;req:%#v&#34;</span>, req)
</span></span><span style=display:flex><span>user <span style=color:#719e07>:=</span> <span style=color:#719e07>&amp;</span>api. User{}
</span></span><span style=display:flex><span>user.ID = strconv.<span style=color:#268bd2>Itoa</span>(<span style=color:#b58900>int</span>(req))
</span></span><span style=display:flex><span>user.Name = <span style=color:#2aa198>&#34;Laurence&#34;</span>
</span></span><span style=display:flex><span>user.Age = <span style=color:#2aa198>22</span>
</span></span><span style=display:flex><span>user.Time = time.<span style=color:#268bd2>Now</span>()
</span></span><span style=display:flex><span><span style=color:#719e07>return</span> user, err
</span></span><span style=display:flex><span>}
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#586e75>//// MethodMapper defines method name mapping, from Go method name to Java lowercase method name, only dubbo protocol service interface needs to use
</span></span></span><span style=display:flex><span><span style=color:#586e75>//// go -&gt; go interoperability does not need to be used
</span></span></span><span style=display:flex><span><span style=color:#586e75>//func (s *UserProvider) MethodMapper() map[string]string {
</span></span></span><span style=display:flex><span><span style=color:#586e75>// return map[string]string{
</span></span></span><span style=display:flex><span><span style=color:#586e75>// &#34;GetUser&#34;: &#34;getUser&#34;,
</span></span></span><span style=display:flex><span><span style=color:#586e75>// }
</span></span></span><span style=display:flex><span><span style=color:#586e75>//}
</span></span></span><span style=display:flex><span><span style=color:#586e75></span>
</span></span><span style=display:flex><span><span style=color:#268bd2>func</span> <span style=color:#268bd2>init</span>(){
</span></span><span style=display:flex><span>config.<span style=color:#268bd2>SetProviderService</span>(<span style=color:#719e07>&amp;</span>UserProvider{}) <span style=color:#586e75>// Register the service provider class, the class name corresponds to the service in the configuration file
</span></span></span><span style=display:flex><span><span style=color:#586e75></span>}
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#586e75>// export DUBBO_GO_CONFIG_PATH=dubbogo.yml needs to set environment variables before running, and specify the location of the configuration file
</span></span></span><span style=display:flex><span><span style=color:#586e75></span><span style=color:#268bd2>func</span> <span style=color:#268bd2>main</span>() {
</span></span><span style=display:flex><span><span style=color:#719e07>if</span> err <span style=color:#719e07>:=</span> config.<span style=color:#268bd2>Load</span>(); err <span style=color:#719e07>!=</span> <span style=color:#cb4b16>nil</span> {
</span></span><span style=display:flex><span><span style=color:#b58900>panic</span>(err)
</span></span><span style=display:flex><span>}
</span></span><span style=display:flex><span><span style=color:#719e07>select</span> {}
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h3 id=23-write-go-client-configuration-and-code>2.3 Write Go-Client configuration and code</h3><p>client/dubbogo.yaml</p><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#268bd2>dubbo</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>registries</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>demoZK</span>: <span style=color:#586e75># Define the service registration discovery center</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>protocol</span>: zookeeper
</span></span><span style=display:flex><span> <span style=color:#268bd2>address</span>: <span style=color:#2aa198>127.0.0.1</span>:<span style=color:#2aa198>2181</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>consumer</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>references</span>:
</span></span><span style=display:flex><span> <span style=color:#268bd2>UserProvider</span>: <span style=color:#586e75># stub class name</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>protocol</span>: dubbo <span style=color:#586e75># dubbo protocol, default hessian2 serialization method</span>
</span></span><span style=display:flex><span> <span style=color:#268bd2>interface</span>: org.apache.dubbo.UserProvider <span style=color:#586e75># The interface needs to correspond to the go/java client</span>
</span></span></code></pre></div><p>client/client.go</p><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-go data-lang=go><span style=display:flex><span><span style=color:#719e07>package</span> main
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#719e07>import</span> (
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;context&#34;</span>
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;dubbo.apache.org/dubbo-go/v3/common/logger&#34;</span>
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;dubbo.apache.org/dubbo-go/v3/config&#34;</span>
</span></span><span style=display:flex><span>_ <span style=color:#2aa198>&#34;dubbo.apache.org/dubbo-go/v3/imports&#34;</span>
</span></span><span style=display:flex><span><span style=color:#2aa198>&#34;dubbo3-demo/api&#34;</span>
</span></span><span style=display:flex><span>)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#268bd2>func</span> <span style=color:#268bd2>main</span>(){
</span></span><span style=display:flex><span> <span style=color:#586e75>// start frame
</span></span></span><span style=display:flex><span><span style=color:#586e75></span><span style=color:#719e07>if</span> err <span style=color:#719e07>:=</span> config.<span style=color:#268bd2>Load</span>(); err <span style=color:#719e07>!=</span> <span style=color:#cb4b16>nil</span>{
</span></span><span style=display:flex><span><span style=color:#b58900>panic</span>(err)
</span></span><span style=display:flex><span>}
</span></span><span style=display:flex><span><span style=color:#268bd2>var</span> i <span style=color:#dc322f>int32</span> = <span style=color:#2aa198>1</span>
</span></span><span style=display:flex><span> <span style=color:#586e75>// initiate the call
</span></span></span><span style=display:flex><span><span style=color:#586e75></span>user, err <span style=color:#719e07>:=</span> api.UserProviderClient.<span style=color:#268bd2>GetUser</span>(context.<span style=color:#268bd2>TODO</span>(), i)
</span></span><span style=display:flex><span><span style=color:#719e07>if</span> err <span style=color:#719e07>!=</span> <span style=color:#cb4b16>nil</span> {
</span></span><span style=display:flex><span><span style=color:#b58900>panic</span>(err)
</span></span><span style=display:flex><span>}
</span></span><span style=display:flex><span>logger.<span style=color:#268bd2>Infof</span>(<span style=color:#2aa198>&#34;response result: %+v&#34;</span>, user)
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h2 id=4-start-the-service>4. Start the service</h2><p>Open two terminals and enter the server client directory respectively</p><p>execute separately;</p><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#b58900>export</span> <span style=color:#268bd2>DUBBO_GO_CONFIG_PATH</span><span style=color:#719e07>=</span>dubbogo.yml
</span></span><span style=display:flex><span>go run .
</span></span></code></pre></div><p>Start the server and the client successively, and you can see the output on the client:</p><div class=highlight><pre tabindex=0 style=color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>response result: &amp;<span style=color:#719e07>{</span>ID:1 Name:laurence Age:22 Time:2021-11-12 17:59:39.185 +0800 CST<span style=color:#719e07>}</span>
</span></span></code></pre></div><p>successful call</p></main></div><footer class="bg-dark py-5 row d-print-none footer-margin-0"><div class="container-fluid mx-sm-5"><div class=row><div class="col-6 col-sm-4 text-xs-center order-sm-2"><ul class="list-inline mb-0"><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title="Dubbo mailing list archive" aria-label="Dubbo mailing list archive"><a class=text-white target=_blank rel="noopener noreferrer" href=https://lists.apache.org/list.html?dev@dubbo.apache.org><i class="fa fa-envelope"></i></a></li></ul></div><div class="col-6 col-sm-4 text-right text-xs-center order-sm-3"><ul class="list-inline mb-0"><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=GitHub aria-label=GitHub><a class=text-white target=_blank rel="noopener noreferrer" href=https://github.com/apache/dubbo><i class="fab fa-github"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title="Subscribe to mailing list" aria-label="Subscribe to mailing list"><a class=text-white target=_blank rel="noopener noreferrer" href=mailto:dev-subscribe@dubbo.apache.org><i class="fa fa-envelope"></i></a></li></ul></div><div class="col-12 col-sm-4 text-center py-2 order-sm-2"><small class=text-white>&copy; 2023 The Apache Software Foundation. Apache and the Apache feather logo are trademarks of The Apache Software Foundation. All Rights Reserved</small></div></div></div></footer><div class="row pt-2 pb-2 footer-margin-0"><div class="container-fluid mx-sm-5"><div class=text-center id=my-footer><img style=float:left alt=apache_logo src=/imgs/apache_logo.png><ul><li><a href=https://www.apache.org>Foundation</a></li><li><a href=https://www.apache.org/licenses/>License</a></li><li><a href=https://dubbo.apache.org/en/docs/notices/security/>Security</a></li><li><a href=https://www.apache.org/events/current-event>Events</a></li><li><a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a></li><li><a href=https://privacy.apache.org/policies/privacy-policy-public.html>Privacy</a></li><li><a href=https://www.apache.org/foundation/thanks.html>Thanks</a></li></ul></div></div></div><script src=/js/popper.min.js integrity=sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49 crossorigin=anonymous></script><script src=/js/bootstrap.min.js integrity=sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy crossorigin=anonymous></script><script src=/js/main.min.a4534a01940be8c082c4c0e6777b61df9884f202b61c9519352adb6d1039d5aa.js integrity="sha256-pFNKAZQL6MCCxMDmd3th35iE8gK2HJUZNSrbbRA51ao=" crossorigin=anonymous></script><script src=https://cdn.jsdelivr.net/npm/@docsearch/js@3></script><script>docsearch({appId:"L5F4T9F0I1",apiKey:"364ae307e1da9d02b2335675e9db1eb1",indexName:"apache_dubbo",container:"#docsearch",debug:!1}),docsearch({appId:"L5F4T9F0I1",apiKey:"364ae307e1da9d02b2335675e9db1eb1",indexName:"apache_dubbo",container:"#docsearch_zh_home",debug:!1})</script></body></html>