<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>GoLang高级 on 杨刚的个人网站</title>
    <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/</link>
    <description>Recent content in GoLang高级 on 杨刚的个人网站</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh</language>
    <copyright>Copyright © 2018-2025 GradyYoung. All rights reserved.</copyright>
    <lastBuildDate>Fri, 27 Jun 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://www.ygang.top/posts/2d3150b2/0e0cf2f4/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>1、结构体</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/57ece345/</link>
      <pubDate>Tue, 13 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/57ece345/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;结构体 
    &lt;div id=&#34;结构体&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e7%bb%93%e6%9e%84%e4%bd%93&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;Go 语言使用结构体和结构体成员来描述真实世界的实体和实体对应的各种属性，结构体是类型中带有成员的&lt;strong&gt;复合类型&lt;/strong&gt;，属于&lt;strong&gt;值类型&lt;/strong&gt;。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>2、接口</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/b1cccbc6/</link>
      <pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/b1cccbc6/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;接口 
    &lt;div id=&#34;接口&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e6%8e%a5%e5%8f%a3&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;Go 语言的接口设计是&lt;strong&gt;非侵入式&lt;/strong&gt;的，接口编写者无须知道接口被哪些类型实现。而接口实现者只需知道实现的是什么样子的接口，但无须指明实现哪一个接口。编译器知道最终编译时使用哪个类型实现哪个接口，或者接口应该由谁来实现。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>3、错误处理与异常机制</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/cd7d5be7/</link>
      <pubDate>Wed, 25 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/cd7d5be7/</guid>
      <description>&lt;p&gt;Go语言的错误处理思想及设计包含以下特征：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;一个可能造成错误的函数，需要返回值中返回一个错误接口（error），如果调用是成功的，错误接口将返回 &lt;code&gt;nil&lt;/code&gt;，否则返回错误。&lt;/li&gt;
&lt;li&gt;在函数调用后需要检查错误，如果发生错误，则进行必要的错误处理。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Go语言没有类似Java或.NET中的异常处理机制，虽然可以使用 defer、panic、recover 模拟，但官方并不主张这样做，Go语言的设计者认为其他语言的异常机制已被过度使用，上层逻辑需要为函数发生的异常付出太多的资源，同时，如果函数使用者觉得错误处理很麻烦而忽略错误，那么程序将在不可预知的时刻崩溃。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>4、IO操作</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/40d22fb7/</link>
      <pubDate>Mon, 19 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/40d22fb7/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;Go 的 IO 模型 
    &lt;div id=&#34;go-的-io-模型&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#go-%e7%9a%84-io-%e6%a8%a1%e5%9e%8b&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;

&lt;h3 class=&#34;relative group&#34;&gt;核心接口 
    &lt;div id=&#34;核心接口&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e6%a0%b8%e5%bf%83%e6%8e%a5%e5%8f%a3&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h3&gt;
&lt;p&gt;Go语言的IO操作建立在几个核心接口上，这些接口构成了灵活而一致的IO模型。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>5、并发编程</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/14012a79/</link>
      <pubDate>Fri, 16 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/14012a79/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;并发编程概念 
    &lt;div id=&#34;并发编程概念&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e5%b9%b6%e5%8f%91%e7%bc%96%e7%a8%8b%e6%a6%82%e5%bf%b5&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;并发从程序设计的角度，就是希望通过某些机制让计算机可以在一个时间段内，执行多个任务。让一个或多个物理 CPU 在多个程序之间多路复用，提高对计算机资源的利用率。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>6、反射</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/66945220/</link>
      <pubDate>Fri, 27 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/66945220/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;反射的基本概念 
    &lt;div id=&#34;反射的基本概念&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e5%8f%8d%e5%b0%84%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;在Go编程中，反射（Reflection）是一项强大而复杂的特性，它允许程序在运行时检查和修改自己的结构和行为。虽然在日常编程中我们可能会尽量避免过度使用反射（因为它会带来复杂性和性能损失），但了解反射机制对于理解许多高级库和框架的工作原理至关重要。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>7、网络编程</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/9ee4721e/</link>
      <pubDate>Sat, 11 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/9ee4721e/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;网络编程 
    &lt;div id=&#34;网络编程&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;网络编程的本质是两个设备之间的数据交换，在计算机网络中，设备主要指计算机。数据传递本身没有多大的难度，不就是把一个设备中的数据发送给另外一个设备，然后接受另外一个设备反馈的数据。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>8、单元测试</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/a39de38c/</link>
      <pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/a39de38c/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;单元测试 
    &lt;div id=&#34;单元测试&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e5%8d%95%e5%85%83%e6%b5%8b%e8%af%95&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;

&lt;h3 class=&#34;relative group&#34;&gt;Go测试的基本概念 
    &lt;div id=&#34;go测试的基本概念&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#go%e6%b5%8b%e8%af%95%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h3&gt;
&lt;p&gt;Go语言自带了 &lt;code&gt;testing&lt;/code&gt; 测试包，可以进行自动化的单元测试，输出结果验证，并且可以测试性能。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>9、泛型</title>
      <link>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/8897d525/</link>
      <pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/0e0cf2f4/8897d525/</guid>
      <description>&lt;p&gt;2022年3月15日，争议非常大但同时也备受期待的泛型终于伴随着&lt;code&gt;Go1.18&lt;/code&gt;发布了。&lt;/p&gt;</description>
      
    </item>
    
  </channel>
</rss>
