Golang 生成dll动态库并调用

Jackey Golang 8,298 次浏览 0 评论 ,
安装gcc环境 运行环境:window10 64位 下载路径:http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.8.2/threads-posix/seh/x86_64-4.8.2-release-posix-seh-r...

Golang 静态库的编译和使用

Jackey Golang 4,307 次浏览 0 评论
本文主要介绍go语言静态库的编译和使用方法,以windows平台为例,linux平台步骤一样,具体环境如下: [codesyntax lang="bash"] >echo %GOPATH% E:\share\git\go_practice\ >echo %GOROOT% C:\Go\ >tree /F %GOP...

Golang 生成动态库及调用

Jackey Golang 4,193 次浏览 0 评论
plugin.go [codesyntax lang="c"] /************************************************************ go build --buildmode=plugin plugin.go **********************************************************/ package main ...

Golang 数值型字符串比较大小

Jackey Golang 9,110 次浏览 0 评论
代码: [codesyntax lang="c"] package main import ( "fmt" ) func main() { var str1 = "2" var str2 = "11" fmt.Println(str1 < str2) str1 = "02" str2 = "11" fmt.Println(str1 < str2) } [/c...

go get 使用时的附加参数

Jackey Golang 2,992 次浏览 0 评论
使用 go get 时可以配合附加参数显示更多的信息及实现特殊的下载和安装操作 [table id=2 /]  

Golang 插件式开发

Jackey Golang 5,713 次浏览 0 评论
接口定义: [codesyntax lang="c"] package testPlugin type PluginFunc interface { Hello() World() } type Plugins struct { Plist map[string]PluginFunc } func (p *Plugins) Init() { p.Plist = make(m...

Golang recover捕获panic异常

Jackey Golang 2,621 次浏览 0 评论 , ,
[codesyntax lang="c"] package main import ( "fmt" ) func test() int { defer func() { err := recover() if err != nil { fmt.Println(err) } }() var a int = 10 var b int = 0 return a/b } ...

Golang 闭包最佳实践

Jackey Golang 2,823 次浏览 0 评论 ,
[codesyntax lang="c"] package main import ( "fmt" "strings" ) // 构建闭包,判断传入的 name 是否包含 suffix 后缀,如果不包含,则添加后缀 // 如果包含,则直接返回 name func dealSuffix(suffix string) func(st...

Golang服务的文件句柄超出系统限制(too many open files)

Jackey Golang 5,331 次浏览 0 评论 ,
最近在项目中遇到一个很奇怪的问题,因为修改配置(redis中缓存的),nginx服务突然报upstream timed out (110: Connection timed out),然后去查为什么会出现这样的问题,发现出问题的服务是一个golang的http server,查看程序日志,...

Golang 推送消息到 kafka(生产者)

Jackey Golang 4,223 次浏览 2 评论 ,
配置相关依赖包: [codesyntax lang="bash"] mkdir -p $GOPATH/src/golang.org/x cd $GOPATH/src/golang.org/x git clone https://github.com/golang/net.git git clone https://github.com/golang/crypto.git go get github....

Beego Httplib 设置代理

Jackey Golang 4,596 次浏览 0 评论 ,
[codesyntax lang="c"] package main import ( "fmt" "github.com/astaxie/beego/httplib" "net/http" "net/url" "time" ) func main() { content := "提交内容" req := httplib.Post("https://www.baidu.com")...
Go