
Go
风.foxwho
资深架构师
展开
-
go语言简单入门
如何安装go语言macOs系统https://foxwho.blog.csdn.net/article/details/70216964Linux系统https://foxwho.blog.csdn.net/article/details/26163927入门基础类型package mainimport "fmt"func main() { //字符型 var str1 string fmt.Println(str1) str1 = "sxxxxx" str1 += "sx原创 2021-03-08 17:27:13 · 179 阅读 · 0 评论 -
golang 读取Excel 或者map字符型返回结构体数组
需求使用github.com/360EntSecGroup-Skylar/excelize/v2 包,读取excel时没有返回结构体数组,非常不方便,目前网上没有直接转换的包抽个时间,做了一个简单转换包风.foxwho依赖引入依赖go get github.com/liangzibo/go-excel使用案例案例地址 https://github.com/liangzibo/go-excel测试结构体type ExcelTest struct { Name string原创 2021-01-04 18:56:10 · 2062 阅读 · 0 评论 -
MAC 开发环境搭建及工具
更新或下载xcode这个是必须的,否则在执行安装命令时,也会自动去下载,命令行自动下载反而速度更慢。如果有爬墙,那请PASS安装 brew方式一/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp原创 2018-04-21 14:16:08 · 1550 阅读 · 0 评论 -
golang xorm cmd xorm工具使用 reverse 反转一个数据库结构,生成代码
golang xorm工具使用 reverse 反转mysql数据库结构 风.foxwho源码安装go get github.com/go-xorm/cmd/xormmysql 驱动安装go get -u github.com/go-sql-driver/mysql编译驱动一定要到项目目录下go build -tags mysql反转数据库结构...原创 2018-05-06 13:46:32 · 6121 阅读 · 0 评论 -
GOLand 创建 golang项目 类似 github.com/foxiswho/fox-shop 这样的项目时 报项目不存在或引用路径为红色时
原因:GoLand 没有自动把第二个gopath目录中的项目 自动引入。 风.foxwho重现问题:gopath环境变量配置了超过 1个目录。 例如(本地配置):export GOPATH=/Users/fox/go/gopath:/Volumes/work/go/fox #我的开发目录,冒号前面为第一开发目录,所有下载包都在那个里面,冒号后面为第二开发目录2.创建 ...原创 2018-05-06 16:25:50 · 2744 阅读 · 0 评论 -
golang 编译 执行时候报错cannot declare name db.Query
go run main.go 风.foxwho 编译 执行时候报错# github.com/foxiswho/fox-shop/models/Users/fox/go/gopath/src/github.com/foxiswho/fox-shop/models/admin.go:53:40: cannot declare name db.Query/Users/fox/go/go...原创 2018-05-06 22:27:49 · 576 阅读 · 0 评论 -
golang 生成定单号
年(2位)+一年中的第几天(3位)+指定位数随机数 风.foxwho//生成单号//06123xxxxx//sum 最少10位,sum 表示全部单号位数func MakeYearDaysRand(sum int) string { //年 strs := time.Now().Format("06") //一年中的第几天 days := strcon...原创 2018-05-21 16:49:25 · 7247 阅读 · 0 评论 -
golang echo框架案例
代码库:https://github.com/foxiswho/echo-go风.foxwho 本案例是站在巨人的肩膀上, 针对对 echo-web 的增强版, 涉及到的功能都有演示案例生成models#进入项目根目录cd src/github.com/foxiswho/echo-go/#使用命令xorm reverse mysql root:root@/shop_go?...原创 2018-05-22 11:21:34 · 7687 阅读 · 0 评论 -
go lang chrome 爬虫 (MAC 系统)
Chrome-headless 模式, Google 针对 Chrome 浏览器 59版 新增加的一种模式,可以让你不打开UI界面的情况下使用 Chrome 浏览器,所以运行效果与 Chrome 保持完美一致。原创 2018-10-05 19:01:49 · 2953 阅读 · 0 评论 -
省市区获取,根据 中国行政区划代码及淘宝部分数据整合而成
爬虫爬 省市区数据中国行政区划代码http://www.mca.gov.cn/article/sj/xzqh/http://www.mca.gov.cn/article/sj/xzqh/2018/统计用区划和城乡划分代码http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/风.foxwho源码编译go get -u github.com/...原创 2018-10-05 19:11:51 · 4349 阅读 · 3 评论 -
mac go build 或 go run 会报下面错误 ld: warning: text-based stub file
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out o...原创 2018-11-21 14:15:13 · 3060 阅读 · 0 评论 -
拉取 google.golang.org/grpc 报错
go get google.golang.org/grpc报如下错误package google.golang.org/grpc: unrecognized import path “google.golang.org/grpc” (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:...原创 2019-01-13 01:02:57 · 9384 阅读 · 1 评论 -
Mac 系统 go-kit安装
Go-kit官网Go-kit 更便捷的使用方式: truss 使用https://github.com/gitwak/truss#install1.安装protoc 3或最新版本从 https://github.com/google/protobuf/releases 下载相对应的版本这里的系统是Mac 系统下载protoc-3.6.1-osx-x86_64.zip然后解压缩.把解压...原创 2019-01-12 00:22:31 · 1342 阅读 · 0 评论 -
mac 系统中 go lang环境变量 设置,以安装GO LANG(GO语言)环境变量设置为例
有条件使用 官网http://golang.org/dl/没有条件的使用国内的地址http://www.golangtc.com/download (也包含百度网盘)https://storage.googleapis.com/golang 官方一个xml 列表打开下载地址下载 darwin-amd64的压缩包风.foxGO Lang 下载下载包选择为...原创 2017-04-17 22:28:46 · 6178 阅读 · 0 评论 -
consul 服务发现 集群 docker 版
consul 其他介绍请看http://blog.csdn.net/fenglailea/article/details/79093848 fox.风docker 镜像拉取https://hub.docker.com/_/consul/以docker 为例,下载镜像docker pull consulconsul 服务端consul 服务端 nod原创 2018-01-18 21:32:34 · 5801 阅读 · 0 评论 -
GO 语言
数据库工具xormhttp://www.xorm.io/ https://github.com/go-xorm/xorm/xormplushttps://github.com/xormplus/xormgolang 配置工具 TOMLhttps://github.com/toml-lang/toml 配置文件的使用由来已久,从.ini、XML、JSON、YA...原创 2017-02-24 15:46:29 · 588 阅读 · 0 评论 -
go语言模版
模版变量赋值 模版内赋值给新变量,新变量名必须以$号开头{{$OtherData := .OtherData}}OtherData为控制器内变量命令.OtherData为模版中取变量$OtherData 新变量{{$tags:=map_get $OtherData .info.BlogId }}map_get 为定义模版处理函数,该函数的参数用空格隔开{{range $i,$...原创 2017-02-24 15:45:22 · 917 阅读 · 0 评论 -
GO 语言错误处理
1.invalid method expression service.AdminUser.Auth (needs pointer receiver: (*service.AdminUser).Auth) 指针只能使用指针方式调用service.AdminUser.Auth要改为以下方式调用(*service.AdminUser).Auth2.invalid method e原创 2016-12-27 20:16:20 · 12385 阅读 · 1 评论 -
windows 下 LITE IDE go lang 安装配置使用
windows 下 LITE IDE go lang 安装配置使用原创 2014-11-27 14:46:02 · 2559 阅读 · 0 评论 -
window 下 go lang 环境变量一键批处理设置
window 下 go lang 环境变量一键批处理设置原创 2014-11-24 14:03:34 · 3769 阅读 · 0 评论 -
blackfriday markdown的自动换行 go lang 正则替换字符串时遇到的坑,转义解析其中的 $1 $name 等
在 使用go lang中 blackfriday的 markdown 解释器时遇到换行问题,在他的配置里面没有回车自动换行这个配置(还是我没找到?),所以自己做了一个 风.foxwho 以下是错误的,改正的在最后/** Markdown自动换行 */func MarkdownAutoNewline(str string) string { re, _ := regexp原创 2017-04-23 12:37:02 · 1497 阅读 · 0 评论 -
GO 语言博客 搬家部署,NGINX作为代理
这段时间刚好 服务器到期,换了另一个服务器,新服务器GO环境要部署,这里记录一下,方便 使用GO语言的博客小伙伴们 风.fox环境Centos 7.X lanmps套件 已安装(http://www.lanmps.com/)go 语言安装按照该网址安装就可以安装成功 http://blog.csdn.net/fenglailea/article/details/26163927 在 go 语原创 2017-04-10 20:44:34 · 5616 阅读 · 0 评论 -
MAC下 Intellij IDEA GO语言插件安装及简单案例
GO lang 已经有专有IDE了,直接使用 这个最好 GoLand http://www.jetbrains.com/go/1.下载地址风.fox Intellij IDEA下载(community版 就可以) https://www.jetbrains.com/idea/download/ GO语言 下载 https://golang.org/dl/ LINUX原创 2016-11-06 16:14:41 · 24063 阅读 · 6 评论 -
golang 包管理工具
Gopm 包管理器http://gopm.io/gopm 安装go get -u github.com/gpmgo/gopmgopm 使用案例安装 数据库 xormplus 操作gopm get github.com/xormplus/xormgolang dephttps://github.com/golang/dep https://golan...原创 2018-01-19 16:17:24 · 5381 阅读 · 1 评论 -
ubuntu 20 /CentOS 8.x/MAC 系统 中安装GO LANG(GO语言)
更新日期:2017-04-10获取源码列表地址,选择适合自己系统的(我的是go1.8.1.linux-amd64.tar.gz)国内下载地址:http://www.golangtc.com/download https://dl.gocn.io/http://golang.org/dl/wget https://storage.g...原创 2014-05-18 20:20:33 · 4198 阅读 · 0 评论 -
go lang go get There is no tracking information for the current branch.Please specify which
go lang go get -v -u github.com/gorilla/securecookie 出现 There is no tracking information for the current branch. Please specify which branch you want to merge with. 时 ,问题解决方法 fox.风# cd /Volumes/w原创 2018-01-10 13:52:35 · 3471 阅读 · 0 评论 -
consul服务发现与注册于配置 (mac版为例)
consul 介绍Consul是HashiCorp公司推出的开源工具,用于实现分布式系统的服务发现与配置。与其他分布式服务注册与发现的方案,比如 Airbnb的SmartStack等相比,Consul的方案更“一站式”,内置了服务注册与发现框 架、分布一致性协议实现、健康检查、Key/Value存储、多数据中心方案,不再需要依赖其他工具(比如ZooKeeper等)。使用起来也较 为简单。Con原创 2018-01-18 14:52:24 · 7497 阅读 · 0 评论 -
Beego 使用笔记
1.自动创建 modelbee generate appcode -conn="root:root@tcp(127.0.0.1:3306)/fox" -level=1-level: 1模型 2模型和控制器 3模型,控制器和路由 -tables: 指定表,多个用逗号隔开原创 2017-02-24 15:48:42 · 942 阅读 · 0 评论