<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Go on HecMisio's Blog</title><link>https://blog.hecmisio.com/tags/go/</link><description>Recent content in Go on HecMisio's Blog</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Thu, 03 Apr 2025 09:31:24 +0800</lastBuildDate><atom:link href="https://blog.hecmisio.com/tags/go/index.xml" rel="self" type="application/rss+xml"/><item><title>In-Depth Understanding of Go Concurrency</title><link>https://blog.hecmisio.com/posts/go/chapter_4/</link><pubDate>Thu, 03 Apr 2025 09:31:24 +0800</pubDate><guid>https://blog.hecmisio.com/posts/go/chapter_4/</guid><description>&lt;p&gt;The Go language is renowned for its powerful concurrency model, which enables developers to easily write efficient and scalable concurrent programs. In this article, we will delve into the core concepts of Go concurrency, including the use of Goroutines, the communication mechanism of Channels, the context management of Context, and Go&amp;rsquo;s unique GMP model (the scheduling model of Goroutines, threads, and processors). Through these topics, you will gain a comprehensive understanding of the design philosophy and implementation details of Go concurrency, laying a solid foundation for writing high-performance Go applications.&lt;/p&gt;</description></item><item><title>Built-in functions and keywords in Go</title><link>https://blog.hecmisio.com/posts/go/chapter_3/</link><pubDate>Thu, 20 Mar 2025 09:23:38 +0800</pubDate><guid>https://blog.hecmisio.com/posts/go/chapter_3/</guid><description>&lt;p&gt;The Go language provides many built-in functions and keywords to simplify the development process and support the core functionality of the language. However, some of these functions and keywords require extra attention during development as they can easily cause unexpected errors.&lt;/p&gt;&#10;&lt;h2 id="built-in-functions"&gt;Built-in Functions&lt;/h2&gt;&#10;&lt;h3 id="new-and-make"&gt;New And Make&lt;/h3&gt;&#10;&lt;p&gt;In the Go language, &lt;code&gt;new&lt;/code&gt; and &lt;code&gt;make&lt;/code&gt; are two built-in functions used for memory allocation, but they behave differently.&lt;/p&gt;&#10;&lt;p&gt;The &lt;code&gt;new&lt;/code&gt; keyword is used to allocate memory for a type and return a pointer to the zero value of that type. It can be applied to any type, including reference types, interfaces, and functions. However, interface pointers and function pointers are rarely seen as they are not very useful.&lt;/p&gt;</description></item><item><title>The Implementation Principle of Map</title><link>https://blog.hecmisio.com/posts/go/chapter_2/</link><pubDate>Wed, 19 Feb 2025 10:39:10 +0800</pubDate><guid>https://blog.hecmisio.com/posts/go/chapter_2/</guid><description>&lt;p&gt;Hash tables are a very common data structure and have different names in various programming languages, such as dictionaries or maps. In Go, they are called &lt;code&gt;map&lt;/code&gt;.&lt;/p&gt;&#10;&lt;h2 id="design-principle"&gt;Design Principle&lt;/h2&gt;&#10;&lt;p&gt;Hash tables offer O(1) read and write performance and provide a mapping between keys and values. To implement a hash table, two points need to be noted - the hash function and the solution to hash collisions.&lt;/p&gt;&#10;&lt;h3 id="hash-function"&gt;Hash Function&lt;/h3&gt;&#10;&lt;p&gt;A hash function is a function that maps inputs of arbitrary length to outputs of a fixed length. Ideally, a hash function should map different inputs to different outputs, which requires the output range of the hash function to be larger than the input range. However, this is impossible, and the situation where different inputs are mapped to the same output is called a hash collision. A more practical approach is to make the results of the hash function as evenly distributed as possible to minimize the occurrence of hash collisions, and then use engineering methods to solve the hash collision problem. Therefore, the selection of a hash function is crucial for achieving a high-performance hash table.&lt;/p&gt;</description></item><item><title>Byte, Rune And String</title><link>https://blog.hecmisio.com/posts/go/chapter_1/</link><pubDate>Thu, 13 Feb 2025 10:58:33 +0800</pubDate><guid>https://blog.hecmisio.com/posts/go/chapter_1/</guid><description>&lt;h2 id="byte"&gt;Byte&lt;/h2&gt;&#10;&lt;p&gt;The &lt;code&gt;byte&lt;/code&gt; type in Go language is an alias of the &lt;code&gt;uint8&lt;/code&gt; type, which distinguishes the byte type from the integer type and fully supports ASCII codes.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="sc"&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// 97&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;ASCII code is a computer coding system based on the Latin alphabet, using 1 byte (8 bits) for representation. The first bit of the 8 binary digits is uniformly set to 0, and the remaining 7 bits are used to represent specific characters. It can represent 128 characters, with the numbering range being 0-127. Among them, the displayable characters (A-Za-z, 0-9, English symbols) have a numbering range of 32-126, while 0-31 and 127 represent control characters.&lt;/p&gt;</description></item></channel></rss>