随笔分类 -  go问题指南

go语言开发
摘要:1、http://www.oschina.net/code/snippet_173630_12006 :效果: 源代码: 2、https://github.com/dchest/captcha它比较强大,可以生成图片的验证码或者音频验证码。 [mw_shl_code=erlang,true]p... 阅读全文
posted @ 2014-08-12 18:01 开心编码源 阅读(1257) 评论(0) 推荐(0)
摘要:1.0 controller get请求type MainController struct { beego.Controller}func (this *MainController) Get() { this.Data["IsHome"] = true this.Data["W... 阅读全文
posted @ 2014-08-12 17:58 开心编码源 阅读(661) 评论(0) 推荐(0)
摘要:package main import ( "encoding/json" "fmt" "os") type ConfigStruct struct { Host string `json:"host"` Port ... 阅读全文
posted @ 2014-08-12 02:57 开心编码源 阅读(9883) 评论(1) 推荐(0)
摘要:1.0 数据表模型(mode)func GetMyads(zoneid string) ([]orm.ParamsList, error) { tidNum, err := strconv.ParseInt(zoneid, 10, 32) if err != nil { r... 阅读全文
posted @ 2014-08-11 22:24 开心编码源 阅读(3872) 评论(0) 推荐(0)
摘要:手动内存管理(MRC)带来的问题: 1.0 由于开发者疏漏或不能正确的释放内存而导致的内存泄漏,从而引起程序的崩溃 2.0由于指针的到处传递而无法确定何时可以释放该指针所 指向的内存块。假如代码中某个位置释放了内存,而另一些地方还在使用指向这块内存的指针, 那么这些指针就变成了所谓的“野指针”(... 阅读全文
posted @ 2014-08-10 16:59 开心编码源 阅读(753) 评论(0) 推荐(0)
摘要:1.0 这方面的资料在网站上确实很少2.0 在用bee工具创建一个go项目后,接下来我们有2件事要做了,当然之前一只觉得GO的IDE实在不知道选着那个,因为在Mac电脑上开发,又不支持文件创建所以有点麻烦 最终还是确定用sublime来开发。sublime本身集合了命令行插件这样开发起来就... 阅读全文
posted @ 2014-07-29 11:17 开心编码源 阅读(18022) 评论(0) 推荐(0)
摘要:1.0 配置环境变量export GOPATH=/website/apple/appsexport PATH="/usr/local/bin:${PATH}:${GOPATH}/bin"2.0 bee快速创建beego项目tt:~ tusm$ bee new apptt:~ tusm$ cd $G... 阅读全文
posted @ 2014-07-28 16:15 开心编码源 阅读(298) 评论(0) 推荐(0)
摘要:1.0 在Go中,布尔值的类型为bool,值是true或false,默认为false。//示例代码var isActive bool // 全局变量声明var enabled, disabled = true, false // 忽略类型的声明func test() { var avai... 阅读全文
posted @ 2014-07-28 13:33 开心编码源 阅读(178) 评论(0) 推荐(0)
摘要:1.0 变量的含义:变数或变量,是指没有固定的值,可以改变的数。变量以非数字的符号来表达,一般用拉丁字母。变量是常数的相反。变量的用处在于能一般化描述指令的方式。若果只能使用真实的值,指令只能应用于某些情况下。变量能够作为某特定种类的值中任何一个的保留器。2.0 GO语言 变量的表现形式 ... 阅读全文
posted @ 2014-07-28 13:25 开心编码源 阅读(348) 评论(0) 推荐(0)
摘要:1. 常量:所谓常量,也就是在程序编译阶段就确定下来的值,而程序在运行时则无法改变该值。在Go程序中,常量可定义为数值、布尔值或字符串等类型。 示例 1->语法形式const constantName = value//如果需要,也可以明确指定常量的类型:const Pi float32 = 3.... 阅读全文
posted @ 2014-07-28 12:03 开心编码源 阅读(142) 评论(0) 推荐(0)
摘要:1.0 安装subtext2 后在view点击下拉菜单 弹出下拉后选择showconsole2.0 在弹出的输入框中执行代码 安装Package Control 功能import urllib2,os; pf='Package Control.sublime-package'; ipp=sub... 阅读全文
posted @ 2014-07-28 10:50 开心编码源 阅读(487) 评论(0) 推荐(0)
摘要:1. 安装Homebrewruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"2. 下载sqllite3brew install pkgconfigbrew install sqlite33. 安... 阅读全文
posted @ 2014-07-27 20:34 开心编码源 阅读(3297) 评论(0) 推荐(0)
摘要:1.0 进入项目创建文件夹 cd $GOPATH/src2.0 创建项目 mkdir localeasy3.0 创建go文件 touch helloworld.go4.0 打开并编辑 open helloworld.gohelloworld.go中... 阅读全文
posted @ 2014-07-27 17:42 开心编码源 阅读(603) 评论(0) 推荐(0)
摘要:1.0 查看是否存在bash_profilecd ~/.bash_profile2.0 如果不存在则创建bash_profile Mac环境配置文件touch ~/.bash_profile3.0 打开bash_profileopen -t ~/.bash_profile4.0 添加go 环... 阅读全文
posted @ 2014-07-27 17:11 开心编码源 阅读(6547) 评论(0) 推荐(0)
摘要:1.0 访问下载地址,32位系统下载go1.0.3.darwin-386.pkg,64位系统下载go1.0.3.darwin-amd64.pkg,双击下载文件,一路默认安装点击下一步,这个时候go已经安装到你的系统中,默认已经在PATH中增加了相应的~/go/bin,2.0 这个时候打开命令行终... 阅读全文
posted @ 2014-07-27 16:55 开心编码源 阅读(199) 评论(0) 推荐(0)