<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>LinuxSir.cn，穿越时空的Linuxsir! - go 语言</title>
    <link>http://linuxsir.cn/forum.php?mod=forumdisplay&amp;fid=209</link>
    <description>Latest 20 threads of go 语言</description>
    <copyright>Copyright(C) LinuxSir.cn，穿越时空的Linuxsir!</copyright>
    <generator>Discuz! Board by Comsenz Inc.</generator>
    <lastBuildDate>Wed, 15 Apr 2026 20:22:12 +0000</lastBuildDate>
    <ttl>60</ttl>
    <image>
      <url>http://linuxsir.cn/static/image/common/logo_88_31.gif</url>
      <title>LinuxSir.cn，穿越时空的Linuxsir!</title>
      <link>http://linuxsir.cn/</link>
    </image>
    <item>
      <title>认识指针地址和指针类型</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399026</link>
      <description><![CDATA[一个指针变量可以指向任何一个值的内存地址，它所指向的值的内存地址在 32 和 64 位机器上分别占用 4 或 8 个字节，占用字节的大小与所指向的值的大小无关。当一个指针被定义后没有分配到任何变量时，它的默认值为 nil。指针变量通常缩写为 ptr。

每个变量在运行时都拥 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Wed, 03 Jan 2024 03:08:15 +0000</pubDate>
    </item>
    <item>
      <title>Go语言指针详解，看这一篇文章就够了</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399025</link>
      <description><![CDATA[与 Java 和 .NET 等编程语言不同，Go语言为程序员提供了控制数据结构指针的能力，但是，并不能进行指针运算。Go语言允许你控制特定集合的数据结构、分配的数量以及内存访问模式，这对于构建运行良好的系统是非常重要的。指针对于性能的影响不言而喻，如果你想要做系统编 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Wed, 03 Jan 2024 03:07:38 +0000</pubDate>
    </item>
    <item>
      <title>Go语言数据类型转换</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399024</link>
      <description><![CDATA[在必要以及可行的情况下，一个类型的值可以被转换成另一种类型的值。由于Go语言不存在隐式类型转换，因此所有的类型转换都必须显式的声明：
valueOfTypeB = typeB(valueOfTypeA)

类型 B 的值 = 类型 B(类型 A 的值)

示例：
a := 5.0
b := int(a)

类型转换只能在定义 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Wed, 03 Jan 2024 03:07:16 +0000</pubDate>
    </item>
    <item>
      <title>Go语言字符类型（byte和rune）</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399023</link>
      <description><![CDATA[字符串中的每一个元素叫做“字符”，在遍历或者单个获取字符串元素时可以获得字符。

Go语言的字符有以下两种：
一种是 uint8 类型，或者叫 byte 型，代表了 ASCII 码的一个字符。
另一种是 rune 类型，代表一个 UTF-8 字符，当需要处理中文、日文或者其他复合字符时， ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Wed, 03 Jan 2024 03:06:54 +0000</pubDate>
    </item>
    <item>
      <title>字符串实现基于 UTF-8 编码</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399022</link>
      <description><![CDATA[字符串拼接符“+”
两个字符串 s1 和 s2 可以通过 s := s1 + s2 拼接在一起。将 s2 追加到 s1 尾部并生成一个新的字符串 s。

可以通过下面的方式来对代码中多行的字符串进行拼接：
str := \&quot;Beginning of the string \&quot; +
\&quot;second part of the string\&quot;
提示：因为编译器 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Wed, 03 Jan 2024 03:06:33 +0000</pubDate>
    </item>
    <item>
      <title>Go语言字符串</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398961</link>
      <description><![CDATA[一个字符串是一个不可改变的字节序列，字符串可以包含任意的数据，但是通常是用来包含可读的文本，字符串是 UTF-8 字符的一个序列（当字符为 ASCII 码表上的字符时则占用 1 个字节，其它字符根据需要占用 2-4 个字节）。

UTF-8 是一种被广泛使用的编码格式，是文本文件 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Tue, 02 Jan 2024 03:27:05 +0000</pubDate>
    </item>
    <item>
      <title>Go语言bool类型（布尔类型）</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398960</link>
      <description><![CDATA[一个布尔类型的值只有两种：true 或 false。if 和 for 语句的条件部分都是布尔类型的值，并且==和]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Tue, 02 Jan 2024 03:24:18 +0000</pubDate>
    </item>
    <item>
      <title>Go语言复数</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398959</link>
      <description><![CDATA[在计算机中，复数是由两个浮点数表示的，其中一个表示实部（real），一个表示虚部（imag）。

Go语言中复数的类型有两种，分别是  complex128（64 位实数和虚数）和 complex64（32 位实数和虚数），其中 complex128 为复数的默认类型。

复数的值由三部分组成 RE + IMi ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Tue, 02 Jan 2024 02:56:34 +0000</pubDate>
    </item>
    <item>
      <title>Go语言浮点类型（小数类型）</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398958</link>
      <description><![CDATA[Go语言提供了两种精度的浮点数 float32 和 float64，它们的算术规范由 IEEE754 浮点数国际标准定义，该浮点数规范被所有现代的 CPU 支持。

这些浮点数类型的取值范围可以从很微小到很巨大。浮点数取值范围的极限值可以在 math 包中找到：
常量 math.MaxFloat32 表示 fl ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Tue, 02 Jan 2024 02:56:10 +0000</pubDate>
    </item>
    <item>
      <title>Go语言整型（整数类型）</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398957</link>
      <description><![CDATA[Go语言的数值类型分为以下几种：整数、浮点数、复数，其中每一种都包含了不同大小的数值类型，例如有符号整数包含 int8、int16、int32、int64 等，每种数值类型都决定了对应的大小范围和是否支持正负符号。本节我们主要介绍一下整数类型。

Go语言同时提供了有符号和无 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Tue, 02 Jan 2024 02:55:39 +0000</pubDate>
    </item>
    <item>
      <title>Go语言变量的作用域</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398916</link>
      <description><![CDATA[一个变量（常量、类型或函数）在程序中都有一定的作用范围，称之为作用域。

了解变量的作用域对我们学习Go语言来说是比较重要的，因为Go语言会在编译时检查每个变量是否使用过，一旦出现未使用的变量，就会报编译错误。如果不能理解变量的作用域，就有可能会带来一些不 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Mon, 01 Jan 2024 08:05:15 +0000</pubDate>
    </item>
    <item>
      <title>Go语言匿名变量（没有名字的变量）</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398915</link>
      <description><![CDATA[在编码过程中，可能会遇到没有名称的变量、类型或方法。虽然这不是必须的，但有时候这样做可以极大地增强代码的灵活性，这些变量被统称为匿名变量。

匿名变量的特点是一个下画线“_”，“_”本身就是一个特殊的标识符，被称为空白标识符。它可以像其他标识符那样用于变 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Mon, 01 Jan 2024 08:04:42 +0000</pubDate>
    </item>
    <item>
      <title>Go语言多个变量同时赋值</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398914</link>
      <description><![CDATA[编程最简单的算法之一，莫过于变量交换。交换变量的常见算法需要一个中间变量进行变量的临时保存。用传统方法编写变量交换代码如下：
var a int = 100
var b int = 200
var t int
t = a
a = b
b = t
fmt.Println(a, b)
在计算机刚发明时，内存非常“精贵”。这种变量交 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Mon, 01 Jan 2024 08:04:13 +0000</pubDate>
    </item>
    <item>
      <title>Go语言变量的初始化</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398913</link>
      <description><![CDATA[正如上一节《Go语言变量声明》中提到的Go语言在声明变量时，自动对变量对应的内存区域进行初始化操作。每个变量会初始化其类型的默认值，例如：
整型和浮点型变量的默认值为 0 和 0.0。
字符串变量的默认值为空字符串。
布尔型变量默认为 bool。
切片、函数、指针变量的 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Mon, 01 Jan 2024 08:03:49 +0000</pubDate>
    </item>
    <item>
      <title>Go语言变量的声明（使用var关键字）</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398912</link>
      <description><![CDATA[Go语言是静态类型语言，因此变量（variable）是有明确类型的，编译器也会检查变量类型的正确性。在数学概念中，变量表示没有固定值且可改变的数。但从计算机系统实现角度来看，变量是一段或多段用来存储数据的内存。

声明变量的一般形式是使用 var 关键字：
var name t ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Mon, 01 Jan 2024 08:03:22 +0000</pubDate>
    </item>
    <item>
      <title>go run 命令</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398895</link>
      <description><![CDATA[除了使用go build命令外，Go语言还为我们提供了go run命令，go run命令将编译和执行指令合二为一，会在编译之后立即执行Go语言程序，但是不会生成可执行文件。

go run命令的语法格式如下：
go run fileName

其中 fileName 为所需要的参数，参数必须是同一 main 包下的 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Sun, 31 Dec 2023 14:57:59 +0000</pubDate>
    </item>
    <item>
      <title>go build 命令</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398894</link>
      <description><![CDATA[go build命令用来启动编译，它可以将Go语言程序与相关依赖编译成一个可执行文件，其语法格式如下。
go build fileName

其中 fileName 为所需要的参数，可以是一个或者多个 Go 源文件名（当有多个参数时需要使用空格将两个相邻的参数隔开），也可以省略不写。

使用 go  ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Sun, 31 Dec 2023 14:57:22 +0000</pubDate>
    </item>
    <item>
      <title>Go语言程序的编译和运行</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398893</link>
      <description><![CDATA[Go语言是编译型的静态语言（和C语言一样），所以在运行Go语言程序之前，先要将其编译成二进制的可执行文件。

可以通过Go语言提供的go build或者go run命令对Go语言程序进行编译：
go build命令可以将Go语言程序代码编译成二进制的可执行文件，但是需要我们手动运行该二 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Sun, 31 Dec 2023 14:56:29 +0000</pubDate>
    </item>
    <item>
      <title>第一个Go语言程序</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398892</link>
      <description><![CDATA[通过前面学习大家已经对Go语言有了一定的了解，那要怎么来创建一个Go语言程序呢？本节就来带领大家实现一个简单的程序——在控制台输出“Hello World!”。

在控制台输出“Hello World!”非常简单，仅需要几行代码就可以搞定，如下所示：
package main    // 声明 main  ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Sun, 31 Dec 2023 14:55:39 +0000</pubDate>
    </item>
    <item>
      <title>Go语言工程结构详述</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=398891</link>
      <description><![CDATA[一般的编程语言往往对工程（项目）的目录结构是没有什么规定的，但是Go语言却在这方面做了相关规定，本节我们就来聊聊Go语言在工程结构方面的有关知识。

我们前面讲搭建Go语言开发环境时提到的环境变量 GOPATH，项目的构建主要是靠它来实现的。这么说吧，如果想要构建 ...]]></description>
      <category>go 语言</category>
      <author>一起看海</author>
      <pubDate>Sun, 31 Dec 2023 14:55:10 +0000</pubDate>
    </item>
  </channel>
</rss>