随笔分类 - Go
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
摘要:go version go1.22.1 -- Web 开发 gorilla https://gowebexamples.com 中的示例有用到。 Routing (using gorilla/mux) go get -u github.com/gorilla/mux - Sessions "gith
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 序章 golang 项目 的代码要怎么组织?怎么放比较简洁易读?看下面这个 项目 就晓得了。 project-layout https://git
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 开发了一个 golang 程序:基于 Gin web 框架 的 服务,部署到了 ECS 的 容器(docker) 上,端口 40000 也暴露成功
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 序章 怎么获取磁盘空间信息呢?总量、剩余等。包括,Windows、Linux主机等。 使用标准库(os、fs、syscall 等)可以吗?可以,网
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux vs code 1.89.1 序章 在 vs code 开发 go程序,之前总是在 终端(terminal)输入命令(go run .)来执行。
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 序章 在 测试 标准库 sort 包的 Example (SortWrapper) 时,遇到了看不懂的代码,查询 Specification 才知
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 序章 本文介绍 golang 程序 占用内存的监控: 使用 std runtime 的 ReadMemStats 函数。 ReadMemStats
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 序章 读取文件内容,写入新文件(可能存在、也可能不存在)。 相关标准库 io fs os path filepath Show Code func
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 序章 多个 给 map 写入数据。 1、基本的map:make(map[any]any) 失败。 2、sync.Map 成功。 测试场景: 1K
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 序章 package time https://pkg.go.dev/time Package time provides functionali
阅读全文
摘要:go version go1.22.1 windows/amd64 VS code 1.89.0 序章 建立一个 web项目,使用 gin web 框架。 Tutorial: Developing a RESTful API with Go and Ginhttps://go.dev/doc/tut
阅读全文
摘要:go1.22.2 -- 序章 golang 官网的 代码汇总,汇总到一起,方便查阅。 注,如有侵权,请通知我 处理🥂。 go.dev 首页 同 https://golang.google.cn 首页。 说明,go.dev 访问时,可能存在访问失败的情况。 搜索:Try Go package mai
阅读全文
摘要:go version go1.22.1 windows/amd64 Windows 11 + amd64 x86_64 x86_64 GNU/Linux 序章 golang 支持 跨平台,支持的方式 是 在一个平台 编译其它平台的可执行程序。 本文 介绍 Windows 11(开发主机) 上 编译
阅读全文
摘要:Intel Core i5-8250U,Ubuntu 18.04(安装在虚拟机Oracle VirtualBox 5.2.12上),Go 1.11, 安装步骤如下: -进入Go文档官网; https://golang.google.cn/doc/ -进入Getting Started页面; http
阅读全文
摘要:go version go1.11 windows/amd64 本文为解读 参考链接1 中的 菊花链 一节 的示例程序,此程序和 参考链接2 中代码有些类似:前者有范围,后者是无限循环。清楚了 参考链接1 的逻辑,就能理解 参考链接2 的代码。 测试代码——测试语句使用蓝色字: 测试结果: 解读 参
阅读全文
摘要:菜鸟 Go语言教程 教程(RUNOOB.COM):http://www.runoob.com/go/go-tutorial.html Go全球官网:https://golang.org/ (2018-09-27 07:30,wow,可以访问了!) Go语言中国官网:https://golang.go
阅读全文
摘要:go version go1.11 windows/amd64 本文为阅读Go语言中文官网的规则说明书(https://golang.google.cn/ref/spec)而做的笔记,介绍Go语言的 select语句(Select statements)。 前面写了 Go语句、通道类型(也有翻译为
阅读全文
摘要:go version go1.11 windows/amd64 本文为阅读Go语言中文官网的规则说明书(https://golang.google.cn/ref/spec)而做的笔记,介绍Go语言的 通道 发送语句(send) 和 接收操作符(receive)。 通道 主要用于 协程间通信,于是,就
阅读全文
摘要:go version go1.11 windows/amd64 本文为阅读Go语言中文官网的规则说明书(https://golang.google.cn/ref/spec)而做的笔记,介绍Go语言的 通道类型(Channel types)。 通道类型 为 通信而设计。 谁会用到它呢?协程,就是Go协
阅读全文
摘要:go version go1.11 windows/amd64 本文为阅读Go语言中文官网的规则说明书(https://golang.google.cn/ref/spec)而做的笔记,介绍Go语言的 Go语句(Go statements)。 0920-0918更新: goroutine 在很多地方被
阅读全文