
Golang
Golang
昵称6550523
在哪
展开
-
基于 Echarts + Golang gin 实现的动态实时可视化数据大屏展示范例二
参考这个案例https://blog.youkuaiyun.com/lildkdkdkjf/article/details/106783264,手痒,改成Golang版:)先看效果图:看起来和Python版的一模一样:)实现原理:前端Echarts实现:https://echarts.apache.org/zh/index.html,前端就不贴了,参考Python版或在最后的网盘地址里下载。后台Golang实现,用https://github.com/gin-gonic/gin启动一个http服原创 2020-07-08 10:01:55 · 1823 阅读 · 0 评论 -
基于 Echarts + Golang gin 实现的动态实时可视化数据大屏展示范例一
参考这个案例https://blog.youkuaiyun.com/lildkdkdkjf/article/details/106571356,手痒,改成Golang版:)先看效果图:看起来和Python版的一模一样:)实现原理:前端Echarts实现:https://echarts.apache.org/zh/index.html后台Golang实现,用https://github.com/gin-gonic/gin启动一个http服务,加载页面。再用https://github.com/zs原创 2020-06-23 19:40:37 · 4840 阅读 · 5 评论 -
Golang实现最简单https服务器,免费申请https证书
package mainimport ( "fmt" "net/http")func handler(w http.ResponseWriter, r *http.Request) { // fmt.Fprintf(w, // "Hi, This is an example of https service in golang!") w.Header().Set("Content-Type", "text/plain") w.Write([]byte("This is an exa.原创 2021-04-09 09:53:53 · 905 阅读 · 0 评论 -
利用谷歌翻译把ini配置信息翻译成想要的语言
代码仓库https://github.com/6550523/TranslateIni把[demo]demo1 = "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. "demo2 = "Python can be easy to pick up whether you're a first time programm.原创 2020-11-04 14:57:41 · 670 阅读 · 0 评论 -
beego查内存泄漏方法get memprof
开启调试功能,修改配置文件app.conf:EnableAdmin = trueAdminAddr = "0.0.0.0"AdminPort = 8088访问管理页面:http://your ip:8088/点击菜单:get memprof,提示create heap profile mem-948.memprof ,说明内存信息文件生成成功执行go tool pprof your_app mem-948.memprof,输入svg命令,如果提示dot未安装,则在https://gra原创 2020-10-13 10:54:50 · 1053 阅读 · 0 评论 -
go-echarts编译成功,页面空白的问题
修改源码github.com\go-echarts\go-echarts\charts\base.goAssetsHost string `default:"https://go-echarts.github.io/go-echarts-assets/assets/"`改成:AssetsHost string `default:"/assets/"`在你的工程目录里增加\assets和\assets\themes文件夹放入文件:https://download.youkuaiyun.com/do原创 2020-09-29 16:39:06 · 463 阅读 · 0 评论 -
发邮件SendEmail精简成一个函数,各种开发语言都可调用
把Golang版github.com/jordan-wright/email发邮件的库做成dll动态库,精简成一个函数SendEmail即可发邮件,各种开发语言都可调用。代码已开源:https://github.com/6550523/EmailDllC++调用发邮件范例:#include "stdafx.h"#include <stdio.h>#include <stdlib.h>#include <Windows.h>#define ERR_LE.原创 2020-09-19 11:13:34 · 680 阅读 · 1 评论 -
读写Excel的动态库版本2,供各种开发语言调用,不需安装Office
之前写了个读写Excel的动态库,接口较少。换了个新版本,采用的https://github.com/360EntSecGroup-Skylar/excelize,接口更丰富,可以写入图片。代码已开源https://github.com/6550523/ExcelDll2C++读写Excel范例:#include "stdafx.h"#include <Windows.h>#define ERR_LEN 1024#define TEXT_LEN 32767#ifdef _W原创 2020-09-14 15:28:31 · 335 阅读 · 0 评论 -
读写Excel的动态库,供各种开发语言调用,不需安装Office
C++读写Excel的常用方法是ODBC,前提条件是你得先找个Office,安装excel。如果没安装怎么办?所以就找到https://github.com/tealeg/xlsx这个Go语言开发的库,把常用接口改装成dll,各种开发语言都可调用。代码已开源https://github.com/6550523/ExcelDllC++读写Excel范例:#include "stdafx.h"#include <stdio.h>#include <stdlib.h>#原创 2020-09-09 18:20:14 · 655 阅读 · 0 评论 -
Golang读写xlsx(不能读写xls)的库:github.com/tealeg/xlsx
读取:package mainimport( "fmt" "github.com/tealeg/xlsx")var ( inFile = "1.xlsx")func main(){ // 打开文件 xlFile, err := xlsx.OpenFile(inFile) if err != nil { fmt.Println(err.Error()) return } // 遍历sheet页读取原创 2020-09-09 11:36:19 · 3315 阅读 · 0 评论 -
ddns-go0.0.4发布,简单好用的DDNS动态域名工具
https://github.com/jeessy2/ddns-go/releases下载可执行程序,以windows为例,直接双击ddns-go.exe。浏览器打开http://127.0.0.1:9876/以阿里云为例,购买了itgcs.tech域名。在https://ram.console.aliyun.com/manage/ak创建访问密钥,填入。Domains里填入你想要的域名,例如blog.itgcs.tech。系统会自动在阿里域名解析里帮你把blog.itgcs.tech解析.原创 2020-09-02 18:09:10 · 1948 阅读 · 0 评论 -
Windows下 Golang 交叉编译批处理
写个bat文件,内容如下:SET CGO_ENABLED=0SET GOOS=linuxSET GOARCH=amd64go build -o netbus64 main.goSET CGO_ENABLED=0SET GOOS=linuxSET GOARCH=386go build -o netbus32 main.goSET CGO_ENABLED=0SET GOOS=windowsSET GOARCH=amd64go build -o netbus64.exe main.g原创 2020-08-05 17:42:32 · 557 阅读 · 0 评论 -
浮点数float32、float64高精度表示金额问题
package mainimport ( "fmt" "strconv" "math/big" "github.com/shopspring/decimal")func main() { //32位浮点,错误 var a1,b1,c1 float32 a1 = 1.69 b1 = 1.7 c1 = a1*b1 fmt.Println(c1) //64位浮点,错误 var a2,b2,c2 float64.原创 2020-07-24 10:19:09 · 1079 阅读 · 0 评论 -
Golang x509: certificate signed by unknown authority 问题
方法一,使用匹配的证书方法:rootCA := `*.pem 文件的内容`roots := x509.NewCertPool()ok := roots.AppendCertsFromPEM([]byte(rootCA))if !ok { panic("failed to parse root certificate")}client = &http.Client{ Transport: &http.Transport{ TLSClientConfig:原创 2020-07-20 18:37:57 · 5053 阅读 · 0 评论 -
Golang限制N个并发同时运行
package mainimport ( "fmt" "sync" "time")var wg sync.WaitGroupfunc main() { var wg sync.WaitGroup sem := make(chan struct{}, 2) // 最多允许2个并发同时执行 taskNum := 10 for i := 0; i < taskNum; i++ { wg.Add(1) .原创 2020-07-13 11:23:11 · 792 阅读 · 0 评论 -
Golang实现的Windows版supervisord
#win-supervisorWindows版的supervisord,基于https://github.com/smartlink-ventures/win-supervisor修改的实现原理:注册Windows服务,监控进程名称。任务列表里没有找到就开启一个进程。##编译配置方法运行gobuild编译出win-supervisor.exe修改winsupervisor.conf,范例:[program:win32calc.exe]Name=win32calc.ex...原创 2020-07-03 11:52:19 · 2661 阅读 · 0 评论 -
Golang 两个发邮件的库,send email 亲测好用
package main import ( "github.com/jordan-wright/email" "net/smtp" "net/textproto")func main() { e := &email.Email { To: []string{"8888@qq.com"}, From: "8888@qq.com", Subject: "Email Send Test 8888", Text: []byte.原创 2020-07-01 09:54:41 · 4468 阅读 · 0 评论 -
Golang两款编辑器:Goland 2020 和国产的LiteIDE
Goland 2020:http://www.opdown.com/soft/220835.html国产的LiteIDE:http://liteide.org/cn/原创 2020-06-28 13:59:39 · 1342 阅读 · 0 评论 -
Golang Webview跨平台桌面程序:github.com/zserge/lorca
github.com/zserge/lorca直接借用chrome实现跨平台桌面程序,支持Windows、Linux、Mac OS等要求,先安装Chrome/Chromium >= 70package mainimport ( "github.com/zserge/lorca")func main() { ui, err := lorca.New("http://www.baidu.com", "", 1024, 768) if err != nil { log.Fata原创 2020-06-08 15:34:23 · 4669 阅读 · 0 评论 -
Golang GUI编程:walk.WebView实现web app
本程序采用github.com/lxn/walk的walk.WebView实现一个GUI程序,启动一个http server,GUI访问本地http server。支持写日志、响应键盘事件等。完整代码:main.go//先安装mingw64package mainimport ( "os" "strings" "time" "github.com/go-vgo/robotgo" "github.com/lxn/walk" . "github.com/lxn/walk/d原创 2020-06-08 14:18:20 · 2518 阅读 · 0 评论 -
github.com/go-vgo/robotgo 编译错误
D:\gotest> go build -ldflags="-H windowsgui -linkmode internal" -o webview-example.exe# github.com/go-vgo/robotgoIn file included from ./bitmap/../base/str_io_c.h:2, from ./bitmap/goBitmap.h:17, from E:\code\src\githu...原创 2020-06-05 15:22:18 · 1743 阅读 · 0 评论 -
github.com/zserge/webview 编译错误
Golang引用webviewpackage mainimport "github.com/zserge/webview"func main() { debug := true w := webview.New(debug) defer w.Destroy() w.SetTitle("Minimal webview example") w.SetSize(800, 600, webview.HintNone) w.Navigate("https://www.baidu.com")原创 2020-06-05 12:44:59 · 682 阅读 · 0 评论 -
Golang监控键盘按键
package mainimport ( "fmt" "github.com/go-vgo/robotgo" hook "github.com/robotn/gohook")func main() { for 1==1 { fmt.Println("--- Please press esc ---") robotgo.EventHook(hook.KeyDown, []string{"esc"}, func(e hook.Event) { .原创 2020-06-04 17:09:57 · 4958 阅读 · 1 评论 -
Golang 使用walk编写GUI程序
安装库:go get github.com/lxn/walk代码:package mainimport ( "strings" "github.com/lxn/walk" . "github.com/lxn/walk/declarative")func main() { var le *walk.LineEdit var wv *walk.WebView var mw *walk.MainWindow MainWindow{ AssignTo: &mw原创 2020-06-03 15:42:07 · 1908 阅读 · 1 评论 -
客户需求:网站禁止国内访问
本范例采用golang实现了一个最简单webserver,缓存使用的memcached,数据库使用的sqlite3。实现原理是:浏览器访问网站,服务器获取客户端的ip地址,先在缓存里查找;缓存里没有,就去数据查找;数据库里没有,就去公开服务器获取。例如访问 http://ip-api.com/json/45.65.32.46,返回的countryCode是FR运行前先获取库:go get github.com/bradfitz/gomemcache/memcachego get gi..原创 2020-05-29 17:49:11 · 1755 阅读 · 0 评论 -
Python调用Golang,字符串处理
main.gopackage mainimport ( "C" "bytes" "fmt" "io/ioutil" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/transform")//export cstrfunc cstr(s *C.char) *C.char { gostr := C.GoString(s) fmt.Println("go:" + gostr) return C原创 2020-05-25 15:28:41 · 649 阅读 · 0 评论 -
Golang各版本特点以及安装包下载地址
安装包下载:链接:https://pan.baidu.com/s/1AJdXS8P-dFA-UoK7vuosuw提取码:ekks对每一个开发者来说,Go 的发展历史是必须知道的知识。了解几年来每个发行版本的主要变化,有助于理解 Go 的设计思想和每个版本的优势/弱点。想了解特定版本的更详细信息,可以点击每个版本号的链接来查看修改记录。Go 1.0— 2012 年 3 月:Go 的第一个版本,带着一份兼容性说明文档来保证与未来发布版本的兼容性,进而不会破坏已有的程序。第一个版本已经有..转载 2020-05-15 16:54:19 · 1878 阅读 · 0 评论