<?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 Chen's Blog</title><link>https://NamiChen.github.io/categories/golang%E5%AD%A6%E4%B9%A0%E4%B9%8B%E8%B7%AF/</link><description>Recent content in Golang学习之路 on Chen's Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Thu, 08 Oct 2020 19:35:00 +0800</lastBuildDate><atom:link href="https://NamiChen.github.io/categories/golang%E5%AD%A6%E4%B9%A0%E4%B9%8B%E8%B7%AF/index.xml" rel="self" type="application/rss+xml"/><item><title>Go实现2048小游戏</title><link>https://NamiChen.github.io/2020/a-cli-implement-of-2048-game-using-go/</link><pubDate>Thu, 08 Oct 2020 19:35:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/a-cli-implement-of-2048-game-using-go/</guid><description>&lt;p>Go 实现一个命令行界面的 2048 游戏，仅涉及 Git 和 Go，用来熟悉基本语言特性。原型项目来自 &lt;a href="https://github.com/chhabraamit/2048">https://github.com/chhabraamit/2048&lt;/a>&lt;/p></description></item><item><title>Golang深入学习9-调用栈</title><link>https://NamiChen.github.io/2020/golang-deep-learning-9-call-stack/</link><pubDate>Sat, 15 Aug 2020 09:47:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-9-call-stack/</guid><description>&lt;p>本篇介绍如何分析 Go 的调用栈。&lt;/p></description></item><item><title>Golang深入学习8-堆栈与逃逸分析</title><link>https://NamiChen.github.io/2020/golang-deep-learning-8-stack-heap-and-escape-analysis/</link><pubDate>Sat, 15 Aug 2020 08:47:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-8-stack-heap-and-escape-analysis/</guid><description>&lt;p>本篇介绍 Go 的堆栈和逃逸分析。&lt;/p></description></item><item><title>Golang查漏补缺-定义与声明的区别</title><link>https://NamiChen.github.io/2020/golang-supplement-the-difference-between-definition-and-declaration/</link><pubDate>Sat, 15 Aug 2020 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2020/golang-supplement-the-difference-between-definition-and-declaration/</guid><description>&lt;p>一直都比较纠结这个问题，所以搜了一下答案，记录在这里。&lt;/p></description></item><item><title>Golang深入学习7-调度器与垃圾回收</title><link>https://NamiChen.github.io/2020/golang-deep-learning-7-scheduler-and-garbage-collection/</link><pubDate>Thu, 30 Jul 2020 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-7-scheduler-and-garbage-collection/</guid><description>&lt;p>调度器和垃圾回收都属于 runtime 的一部分，本文我们介绍 Go 中 runtime 的含义，然后再来分析 Go 的调度器和垃圾回收策略。&lt;/p></description></item><item><title>Golang深入学习6-使用pprof进行性能分析</title><link>https://NamiChen.github.io/2020/golang-deep-learning-6-performance-analysis-pprof/</link><pubDate>Mon, 27 Jul 2020 18:46:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-6-performance-analysis-pprof/</guid><description>&lt;p>pprof 用来做 Go 程序的性能监控，让我们知道在什么地方耗费了多少 CPU、memory。&lt;/p></description></item><item><title>Golang深入学习5-使用dlv调试程序</title><link>https://NamiChen.github.io/2020/golang-deep-learning-5-debug-with-dlv/</link><pubDate>Sun, 26 Jul 2020 09:43:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-5-debug-with-dlv/</guid><description>&lt;p>在C/C++中，使用 GDB 调试程序，但在Go中，看过网上的一些文章后，发现 dlv 是个更好的选择，本文进行介绍。&lt;/p></description></item><item><title>Golang深入学习4-map</title><link>https://NamiChen.github.io/2020/golang-deep-learning-4-map/</link><pubDate>Sat, 25 Jul 2020 09:45:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-4-map/</guid><description>&lt;p>本文关心 map 的底层实现、map 的扩容机制和 map 遍历的随机性。&lt;/p></description></item><item><title>Golang深入学习3-切片</title><link>https://NamiChen.github.io/2020/golang-deep-learning-3-slice/</link><pubDate>Fri, 24 Jul 2020 16:13:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-3-slice/</guid><description>&lt;p>本篇理解切片的底层实现和扩容方式。&lt;/p></description></item><item><title>Golang深入学习2-string</title><link>https://NamiChen.github.io/2020/golang-deep-learning-2-string/</link><pubDate>Fri, 24 Jul 2020 11:19:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-2-string/</guid><description>&lt;p>Go 中字符串虽然作为基本数据类型，但本质依然是字符数组，本篇文章理解 Go 底层 string 类型是如何实现的，以及探讨它与 []byte 之间的关系。&lt;/p></description></item><item><title>Golang深入学习1-uintptr 和 Unsafe.Pointer</title><link>https://NamiChen.github.io/2020/golang-deep-learning-1-uintptr-and-unsafe.pointer/</link><pubDate>Thu, 23 Jul 2020 12:15:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-deep-learning-1-uintptr-and-unsafe.pointer/</guid><description>&lt;p>本篇介绍 Go 中的指针、uintptr 和 unsafe.Pointer 三个概念。&lt;/p></description></item><item><title>基于Go语言开发在线论坛9-部署Go Web应用</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-9-deploy-go-web-application/</link><pubDate>Sun, 07 Jun 2020 20:50:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-9-deploy-go-web-application/</guid><description>&lt;p>部署 Go 应用相对简单，因为所有应用代码都被打包成一个二进制文件了（视图模板、静态资源和配置文件等非 Go 代码除外），并且不需要依赖其他库，不需要额外的运行时环境（比如 Java 需要再安装 JVM），也不需要部署额外的 HTTP 服务器。&lt;/p></description></item><item><title>基于Go语言开发在线论坛8-消息、视图和日期时间本地化</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-8-message-view-and-date-time-localizationsingleton-mode/</link><pubDate>Sun, 07 Jun 2020 20:30:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-8-message-view-and-date-time-localizationsingleton-mode/</guid><description>&lt;p>由于之前所有页面和消息文本都是英文的，而我们开发的应用基本都是面向中文用户的，所以需要对项目进行本地化，因此本篇介绍如何在 Go Web 应用中进行国际化和本地化编程，由于项目比较简单，只介绍消息提示、视图模板和日期格式的本地化。&lt;/p></description></item><item><title>基于Go语言开发在线论坛7-通过单例模式获取全局配置</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-7-get-global-configuration-through-singleton-mode/</link><pubDate>Sun, 07 Jun 2020 16:25:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-7-get-global-configuration-through-singleton-mode/</guid><description>&lt;p>本文介绍如何将敏感信息或可变信息通过配置文件进行配置，然后在应用中读取这些配置文件来获取配置信息。&lt;/p></description></item><item><title>基于Go语言开发在线论坛6-日志与错误处理</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-6-log-and-error/</link><pubDate>Sun, 07 Jun 2020 11:03:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-6-log-and-error/</guid><description>&lt;p>到现在为止，我们已经完成了在线论坛项目基本功能的开发，对 Go 语言 Web 编程中如何实现 MVC 架构模式以及 CRUD（数据库增删改查）基本操作有了初步的认识。不过现在所有的日志和错误处理都是杂糅在业务代码中，本篇介绍如何对它们统一进行处理，使得业务代码和日志及错误处理逻辑分离。&lt;/p></description></item><item><title>Golang日志系统</title><link>https://NamiChen.github.io/2020/golang-log-system/</link><pubDate>Sun, 07 Jun 2020 09:48:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-log-system/</guid><description>&lt;p>日志是一个系统必不可少的部分，本篇介绍Golang中的日志系统。&lt;/p></description></item><item><title>基于Go语言开发在线论坛5-创建群组和主题功能实现</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-5-create-thread-and-post/</link><pubDate>Fri, 05 Jun 2020 11:41:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-5-create-thread-and-post/</guid><description>&lt;p>上篇文章基于 Cookie + Session 实现了简单的用户认证功能，用户认证之后，就可以创建群组和主题了，本篇介绍如何创建群组和主题，并将其渲染到前端页面。&lt;/p></description></item><item><title>基于Go语言开发在线论坛4-通过Cookie和Session实现用户认证</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-4-user-authentication/</link><pubDate>Thu, 04 Jun 2020 11:01:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-4-user-authentication/</guid><description>&lt;p>上篇演示了首页路由、处理器、视图模板的实现，接着就要实现群组、主题的增删查改，不过，需要在认证后才能执行这些操作，所以本篇介绍如何实现用户认证相关功能。&lt;/p></description></item><item><title>Golang设置与使用cookie</title><link>https://NamiChen.github.io/2020/golang-set-and-use-cookie/</link><pubDate>Mon, 01 Jun 2020 20:11:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-set-and-use-cookie/</guid><description>&lt;p>关于 Cookie 的使用是 Web 编程中的重要一部分，本篇介绍 Cookie 的基本知识和 Golang 中使用的方法。&lt;/p></description></item><item><title>Golang模板</title><link>https://NamiChen.github.io/2020/golang-template/</link><pubDate>Fri, 29 May 2020 17:08:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-template/</guid><description>&lt;p>模板就是在写动态页面时不变的部分，服务端程序渲染可变部分生成动态网页，Go 语言提供了 html/template 包来支持模板渲染。&lt;/p></description></item><item><title>Golang使用gorilla、mux包</title><link>https://NamiChen.github.io/2020/golang-use-gorilla/mux-package/</link><pubDate>Fri, 29 May 2020 13:38:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-use-gorilla/mux-package/</guid><description>&lt;p>本文介绍 &lt;a href="https://github.com/gorilla/mux" target="_blank">gorilla/mux&lt;/a> 包的使用。&lt;/p></description></item><item><title>Golang启动HTTP服务器</title><link>https://NamiChen.github.io/2020/golang-start-http-server/</link><pubDate>Fri, 29 May 2020 09:32:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/golang-start-http-server/</guid><description>&lt;p>本文介绍 Golang 如何实现 HTTP 服务端及客户端。&lt;/p></description></item><item><title>基于Go语言开发在线论坛3-访问论坛首页</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-3-visit-forum-homepage/</link><pubDate>Fri, 29 May 2020 09:08:00 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-3-visit-forum-homepage/</guid><description>&lt;p>前两篇分别介绍了整体设计及数据表的创建、模型类的编写，本篇了解如何在服务端处理用户请求，并启动论坛首页。文章转自学院君的教程，略有改动。&lt;/p></description></item><item><title>Golang密码学算法</title><link>https://NamiChen.github.io/2020/golang-cryptographic-algorithm/</link><pubDate>Thu, 28 May 2020 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2020/golang-cryptographic-algorithm/</guid><description>&lt;p>在 Go 中，加密是很重要的一部分，本文对此进行介绍。&lt;/p></description></item><item><title>基于Go语言开发在线论坛2-通过模型类与MySQL数据库交互</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-2-interact-with-mysql/</link><pubDate>Wed, 27 May 2020 18:25:20 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-2-interact-with-mysql/</guid><description>&lt;p>在本篇教程中，我们将在 MySQL 中创建一个 &lt;code>chitchat&lt;/code> 数据库作为论坛项目的数据库。我选择了在本地安装 MySQL Server，但也可以基于 Docker 容器运行。转自学院君的教程，略有改动。&lt;/p></description></item><item><title>基于Go语言开发在线论坛1-整体设计与数据模型</title><link>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-1-overall-design-and-data-model/</link><pubDate>Wed, 27 May 2020 18:12:20 +0800</pubDate><guid>https://NamiChen.github.io/2020/development-of-online-forum-based-on-golang-1-overall-design-and-data-model/</guid><description>转自学院君的教程1 ，这里进行复现并深入理解，文章内容可能略有调整。 1. 项目介绍 要完成的是一个简单的在线论坛项目，主要仿照 Google 网上论坛 进行开发，但</description></item><item><title>Golang数据库编程</title><link>https://NamiChen.github.io/2020/golang-interact-with-mysql/</link><pubDate>Tue, 26 May 2020 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2020/golang-interact-with-mysql/</guid><description>Go 官方提供了database 包，database 包下有 sql/driver。该包用来定义操作数据库的接口，这保证了无论使用哪种数据库，操作方</description></item><item><title>Golang语法基础12-测试</title><link>https://NamiChen.github.io/2019/golang-syntax-12-test/</link><pubDate>Sun, 22 Dec 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-12-test/</guid><description>实际开发中对代码进行测试是不可缺少的工作，在go中可以通过testing包来进行代码的测试。testing包和go test命令相互配合，能够</description></item><item><title>Golang语法基础11-错误处理</title><link>https://NamiChen.github.io/2019/golang-syntax-11-error-and-panic/</link><pubDate>Fri, 20 Dec 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-11-error-and-panic/</guid><description>&lt;p>Go中有两套错误处理的方式&lt;/p>
&lt;ul>
&lt;li>普通错误： 在函数和方法中返回错误对象作为它们的唯一或最后一个返回值 ，如果返回nil，表示没有错误&lt;/li>
&lt;li>异常：使用panic和recover&lt;/li>
&lt;/ul>
&lt;p>主调函数总是应该检查收到的错误，不要忽略，否则可能导致严重的后果。&lt;/p></description></item><item><title>Golang语法基础10-协程与通道</title><link>https://NamiChen.github.io/2019/golang-syntax-10-goroutine-and-channel/</link><pubDate>Mon, 16 Dec 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-10-goroutine-and-channel/</guid><description>首先来回顾在操作系统中学过的一些概念。进程(processes)是程序执行的基本单位，运行在一个独立的内存地址空间中；一个进程由多个线程(t</description></item><item><title>Golang语法基础8-结构体与方法</title><link>https://NamiChen.github.io/2019/golang-syntax-8-struct-and-method/</link><pubDate>Tue, 26 Nov 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-8-struct-and-method/</guid><description>&lt;p>结构体是一种非常重要的结构，用到的地方非常多，在 Go 中，结构体还是实现面向对象编程的基础。&lt;/p></description></item><item><title>Golang语法基础9-接口与反射</title><link>https://NamiChen.github.io/2019/golang-syntax-9-interface-and-reflect/</link><pubDate>Tue, 26 Nov 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-9-interface-and-reflect/</guid><description>&lt;p>本篇介绍 Golang 中的接口与反射。&lt;/p></description></item><item><title>Golang语法基础7-函数</title><link>https://NamiChen.github.io/2019/golang-syntax-7-function/</link><pubDate>Mon, 25 Nov 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-7-function/</guid><description>1. 函数声明与定义 Go中有三种类型的函数： 普通的带有名字的函数 匿名函数 方法（Methods，在结构体部分介绍） 普通函数声明的基本格式为 1 func functionName(param1 type1,</description></item><item><title>Golang语法基础6-数组、切片与映射</title><link>https://NamiChen.github.io/2019/golang-syntax-6-array-slice-and-map/</link><pubDate>Mon, 18 Nov 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-6-array-slice-and-map/</guid><description>只有基本的数据类型无法适应所有的情况，当需要存储和处理大量数据时，通常会使用数组、映射、链表等数据结构，称之为容器(container)。在</description></item><item><title>Golang语法基础5-字符串操作与输入输出</title><link>https://NamiChen.github.io/2019/golang-syntax-5-string-input-and-output/</link><pubDate>Mon, 11 Nov 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-5-string-input-and-output/</guid><description>&lt;p>本篇介绍字符串的相关操作，涉及&lt;code>string&lt;/code>和&lt;code>strconv&lt;/code>两个标准库，以及介绍输入输出的基本方法，涉及&lt;code>fmt&lt;/code>和&lt;code>bufio&lt;/code>两个标准库。&lt;/p></description></item><item><title>Golang语法基础4-运算符与流程控制</title><link>https://NamiChen.github.io/2019/golang-syntax-4-operators-and-flow-control/</link><pubDate>Tue, 29 Oct 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-4-operators-and-flow-control/</guid><description>&lt;p>本文介绍 Golang 中的运算符和流程控制&lt;/p></description></item><item><title>Golang语法基础3-常量变量与基本数据类型</title><link>https://NamiChen.github.io/2019/golang-syntax-3-constants-variables-and-elementary-types/</link><pubDate>Tue, 22 Oct 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-syntax-3-constants-variables-and-elementary-types/</guid><description>&lt;p>本文介绍 Go 中的常量、变量、基本数据类型和常用的类型转换。&lt;/p></description></item><item><title>Golang语法基础2-命令、包与模块</title><link>https://NamiChen.github.io/2019/golang-basic-grammer-2-command-package-module/</link><pubDate>Thu, 19 Sep 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-basic-grammer-2-command-package-module/</guid><description>本篇介绍Go中的基础命令，包和模块。 1. 命令 Go 在安装后自带一个命令行工具，名为 go，用来下载、编译、安装、测试 Go 的包和源文件，关于 Go CLI 的发展历</description></item><item><title>Golang语法基础1-背景与初探</title><link>https://NamiChen.github.io/2019/golang-basic-grammar-1-background-and-preliminary-exploration/</link><pubDate>Fri, 13 Sep 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang-basic-grammar-1-background-and-preliminary-exploration/</guid><description>1. 起源与发展 Go/Golang 起源于2007年，并于2009年正式对外发布，是一个完全开源的项目，背后的支持者是谷歌公司，核心设计者是三位著名IT工程师：K</description></item><item><title>Golang查漏补缺-bufio读取的字符串无法直接进行类型转换</title><link>https://NamiChen.github.io/2019/golang%E6%9F%A5%E6%BC%8F%E8%A1%A5%E7%BC%BA-bufio%E8%AF%BB%E5%8F%96%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%97%A0%E6%B3%95%E7%9B%B4%E6%8E%A5%E8%BF%9B%E8%A1%8C%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2/</link><pubDate>Tue, 27 Aug 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang%E6%9F%A5%E6%BC%8F%E8%A1%A5%E7%BC%BA-bufio%E8%AF%BB%E5%8F%96%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%97%A0%E6%B3%95%E7%9B%B4%E6%8E%A5%E8%BF%9B%E8%A1%8C%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2/</guid><description>如下列代码，在使用bufio包中的ReadString读取字符串之后，这个字符串无法进行类型转换，每次使用strconv.Atoi()函数返</description></item><item><title>Golang查漏补缺-对自定义类型排序</title><link>https://NamiChen.github.io/2019/golang%E6%9F%A5%E6%BC%8F%E8%A1%A5%E7%BC%BA-%E5%AF%B9%E8%87%AA%E5%AE%9A%E4%B9%89%E7%B1%BB%E5%9E%8B%E6%8E%92%E5%BA%8F/</link><pubDate>Fri, 16 Aug 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang%E6%9F%A5%E6%BC%8F%E8%A1%A5%E7%BC%BA-%E5%AF%B9%E8%87%AA%E5%AE%9A%E4%B9%89%E7%B1%BB%E5%9E%8B%E6%8E%92%E5%BA%8F/</guid><description>PAT乙级25分的题好多需要根据一个结构体类型的某个字段进行排序，第一次遇到时确实不知所措，然后查了不少解决方案，这里做个总结。 这一问题一般</description></item><item><title>Golang查漏补缺-程序执行时间优化</title><link>https://NamiChen.github.io/2019/golang%E6%9F%A5%E6%BC%8F%E8%A1%A5%E7%BC%BA-%E7%A8%8B%E5%BA%8F%E6%89%A7%E8%A1%8C%E6%97%B6%E9%97%B4%E4%BC%98%E5%8C%96/</link><pubDate>Fri, 16 Aug 2019 00:00:00 +0000</pubDate><guid>https://NamiChen.github.io/2019/golang%E6%9F%A5%E6%BC%8F%E8%A1%A5%E7%BC%BA-%E7%A8%8B%E5%BA%8F%E6%89%A7%E8%A1%8C%E6%97%B6%E9%97%B4%E4%BC%98%E5%8C%96/</guid><description>最近在刷PAT乙级的题，因为PAT考点一般只提供C/C++或Java环境的缘故，网上找到的90%都是C++代码，剩下的又绝大部分是Java，</description></item></channel></rss>