
go
sun007700
这个作者很懒,什么都没留下…
展开
-
golang编译和链接参数,运行时
编译,链接原创 2022-06-10 16:03:24 · 228 阅读 · 0 评论 -
golang获取时间
golang 时间原创 2022-06-07 16:43:44 · 803 阅读 · 0 评论 -
使用 Go 进行 iOS 和 Android 编程
在 iOS 和 Android 上运行 Go 代码-技术圈使用Go进行iOS和Android编程 - Go - srcmini使用 Go 进行 iOS 和 Android 编程 - 云+社区 - 腾讯云原创 2022-05-24 17:36:23 · 914 阅读 · 0 评论 -
Golang 获取当前外网IP/地址/运营商
Golang 获取当前外网IP/地址/运营商 - Go语言中文网 - Golang中文社区package mainimport ( "fmt" "io/ioutil" "net/http")func main() { responseClient, errClient := http.Get("http://ip.dhcp.cn/?ip") // 获取外网 IP if errClient != nil { fmt.Printf("..原创 2022-05-16 16:11:36 · 2569 阅读 · 0 评论 -
golang编译动态库(linux,windows)
Golang:Golang生成动态库及调用 - Go语言中文网 - Golang中文社区package mainimport ( "fmt" )func DCall(){ fmt.Println("plugin.so was called") }func DCallWithParam(msg string){ fmt.Println("参数内容为:",msg) }func main() { fmt.Pri...原创 2022-04-08 17:18:32 · 1886 阅读 · 0 评论 -
golang 监控 子进程 退出
【转】Go 中如何优雅关闭子进程? - 立志做一个好的程序员 - 博客园golang子进程的启动和停止-原创极客博文golang子进程的启动和停止,mac与linux的区别_weixin_34211761的博客-优快云博客golang exec后台进程并获取其pid--优快云问答func HandleFileWatch(FilewatchParams string) { sep := " " arrParam := strings.Split(FilewatchParams..原创 2022-02-22 15:26:20 · 1154 阅读 · 0 评论 -
golang 传参 不确定数组个数
golang 传参 不确定数组个数func Command(name string, arg ...string) *Cmd { cmd := &Cmd{ Path: name, Args: append([]string{name}, arg...), } if filepath.Base(name) == name { if lp, err := LookPath(name); err != nil { cmd.lookPathErr = err } els原创 2022-02-21 17:17:38 · 575 阅读 · 0 评论 -
golang监控文件是否有改变
pomeriumimport ("github.com/rjeczalik/notify")func (watcher *Watcher) Add(filePath string) {ch := make(chan notify.EventInfo, 1) go func() { for evt := range ch { log.Info(ctx).Str("event", evt.Event().String()).Msg("filemgr: detected ..原创 2022-01-07 14:45:26 · 1184 阅读 · 0 评论 -
golang的interface类型
interface理解 Go interface 的 5 个关键点 | 三月沙//1type I interface { Get() int Set(int)}//2type S struct { Age int}func (s S) Get() int { return s.Age}func (s *S) Set(age int) { s.Age = age}//3func f(i I) { i.Set(10) fmt.Println(i.Get().原创 2022-01-07 13:20:47 · 601 阅读 · 0 评论 -
golang 函数返回局部变量地址,指针数组。指针和引用等
https://groups.google.com/g/golang-china/c/xz9JdKqHi-cfunc fn() *int { a := 10 return &a}type Config struct { val int str string}func fn2() *Config { b := &Config{val: 5, str: "ni"} return b}func main() { x2 := fn2() x3 :原创 2022-01-07 10:20:32 · 1495 阅读 · 0 评论 -
golang性能优化
衡量Golang代码执行时间_neweastsun的专栏-优快云博客_golang 运行时间Golang相关的技术选型细节 - 知乎没有衡量(测量)就没有改进.有一句话说得好,“no measurement no improvement”。不管我们是改进应用逻辑还是性能,如果没有度量或监控,就无法做好优化,或者说即便优化了也无法自证。这会是我一直推崇的信念,也已在我们的线上环境得到无数次验证,很多线上问题也都是通过这个监控系统发现的。"go.opencensus.io/sta..原创 2022-01-05 10:53:06 · 310 阅读 · 0 评论 -
golang三方开源库
延时队列GitHub - cfanbo/delayqueue: 基于Golang实现的延时队列 delay queue原创 2021-12-13 17:56:50 · 416 阅读 · 0 评论 -
golang跨项目调用
golang 本地测试跨项目调用 - frange - 博客园go.modrequire (baseline_server v1.0.0)replace baseline_server => ../../src/baseline_serverimport(my_json "baseline_server/json")原创 2021-11-24 10:00:26 · 598 阅读 · 0 评论 -
golang的vector
Go语言中使用切片(slice)实现一个Vector容器_weixin_30467087的博客-优快云博客package vectorimport ( "reflect")// 小写 只能通过工厂函数创建type vector struct { values []interface{}}// 创建工厂函数func New(cap int) *vector { this := new(vector) this.values = make([]in..原创 2021-11-19 14:36:37 · 1564 阅读 · 0 评论 -
golang string 读取一行
在golang里面正确读取一行 - Go语言中文网 - Golang中文社区https://github.com/guonaihong/jianshu-example/blob/master/readline/readline.gopackage mainimport ( "bufio" "fmt" "io" "os" "strings")func errorReadLine1(r io.Reader) { br := bufio.NewReader(r) for {..原创 2021-11-17 13:23:19 · 2309 阅读 · 0 评论 -
Linux 查看端口占用情况
Linux 查看端口占用情况 | 菜鸟教程netstat -tunlp用于显示 tcp,udp 的端口和进程等相关情况。原创 2021-11-17 09:34:15 · 702 阅读 · 0 评论 -
Go语言函数回调使用事件系统实现事件的响应和处理
Go语言使用事件系统实现事件的响应和处理package mainimport "fmt"// 声明角色的结构体type Actor struct {}// 为角色添加一个事件处理函数func (a *Actor) OnEvent(param interface{}) { fmt.Println("actor event:", param)}// 全局事件func GlobalEvent(param interface{}) { fmt.Printl..原创 2021-11-16 19:27:08 · 576 阅读 · 0 评论 -
linux 有名管道c++,golang
linux C++ 有名管道_dasgk的专栏-优快云博客/* * main.cpp * * Created on: Jul 16, 2014 * Author: john */ #include<sys/types.h>#include<sys/stat.h>#include<string.h>#include<iostream>#include<errno.h>#include<fcnt..原创 2021-11-11 09:55:15 · 1421 阅读 · 0 评论 -
golang调用c++库
全面总结: Golang 调用 C/C++,例子式教程 - 指尖下的幽灵 - 博客园全面总结: Golang 调用 C/C++,例子式教程_zdy0_2004的专栏-优快云博客_go调用c++库导入动态库 .so 或 .dll 的形式 package main /*#cgo CFLAGS: -Iinclude#cgo LDFLAGS: -Llib -llibvideo#include "video.h"*/import "C" import "fmt" func ma原创 2021-11-10 17:02:11 · 536 阅读 · 0 评论 -
golang 操作 mysql
golangGolang 操作 MySQL 数据库 | 程序员技术之旅原创 2021-10-19 10:16:40 · 132 阅读 · 0 评论 -
Golang去除字符串前后空格
v.EthName = strings.Trim(v.EthName, " ")//两种方法都可以.v.EthName = strings.TrimSpace(v.EthName)原创 2021-10-18 10:52:12 · 21851 阅读 · 0 评论 -
vscode golang 导入自己的包,跳转
xxxx是自己工程名字go mod init xxxxgo mod tidy假设有个db的包,代码如下即可.import("xxxx/db")原创 2021-10-15 17:55:27 · 922 阅读 · 0 评论 -
golang 调用 python
Golang中调用Python3 - 知乎go get github.com/DataDog/go-python3pkg-config --list-alllocate python3.pc……apt-get install aptitudeaptitude remove python3.7-devaptitude remove python3-devaptitude remove python-dev……could not determine kind of n.原创 2021-09-30 15:12:46 · 1286 阅读 · 0 评论 -
Package python-2.7 was not found in the pkg-config search path.
Package **** was not found in the pkg-config search path._空大白-优快云博客st$ go get github.com/sbinet/go-python# pkg-config --cflags -- python-2.7Package python-2.7 was not found in the pkg-config search path.Perhaps you should add the directory containin.原创 2021-09-30 09:37:31 · 1783 阅读 · 0 评论 -
在linux上编译arm64平台的二进制
sudo apt-get install gcc-aarch64-linux-gnuCGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build原创 2021-09-26 14:24:31 · 3319 阅读 · 0 评论 -
glog日志级别
Golang glog使用详解 - sunsky303 - 博客园原创 2021-09-16 15:31:03 · 829 阅读 · 0 评论 -
vscode远程调试golang
vscode-go/debugging.md at master · golang/vscode-go · GitHub "version": "0.2.0", "configurations": [ { "name": "Launch Package", "type": "go", "request": "launch", "mode": "debug", ...原创 2021-09-15 14:59:50 · 591 阅读 · 0 评论 -
golang 字符串包含 不区分大小写
Go有一个不区分大小写的字符串包含()函数吗? - VoidCCret := strings.Contains(strings.ToLower(stringA), strings.ToLower(stringB)golang判断字符串出现的位置及是否包含 - Go语言中文网 - Golang中文社区原创 2021-09-13 17:14:20 · 2823 阅读 · 0 评论 -
golang采集网络流量等系统指标,监控
采集linux指标, 可用于监控https://github.com/lycclsltt/system原创 2021-09-10 11:20:16 · 4135 阅读 · 0 评论 -
golang goland 使用go mod
必须这样设置,否则不起作用.原创 2021-09-09 20:15:21 · 207 阅读 · 0 评论 -
go实现的webrtc
https://gitee.com/mirrors/Pion-WebRTC原创 2020-10-21 15:30:48 · 3111 阅读 · 0 评论 -
go开发小程序等
https://gitee.com/xiaochengtechhttps://gitee.com/xiaochengtech/wechat原创 2020-07-25 20:27:43 · 610 阅读 · 0 评论 -
python,Julia、Go和Rust
https://mp.weixin.qq.com/s/_xrU4jMa38lrp7dPvjzu5A这就是为什么越来越多的程序员开始采用其他语言的原因,这些语言中最受欢迎的是Julia、Go和Rust。Julia非常适合数学和技术任务,Go非常适合模块化程序,而Rust是系统编程的首选。由于数据科学家和人工智能专家需要处理许多数学问题,因此Julia成为他们的赢家。即使经过严格的审视,Julia仍然具有Python无法战胜的优势。...原创 2020-06-02 12:32:50 · 1531 阅读 · 0 评论 -
go语言数据结构和算法库GoSTL
https://segmentfault.com/a/1190000020912998 数据结构 切片(slice) 数组(array) 向量(vector) 列表(list) 双端队列(deque) 队列(queue) 优先队列(priority_queue) 栈(stack) 红黑树(rbtree) 映射(map/multimap) 集合(se...原创 2020-03-07 23:26:58 · 2019 阅读 · 0 评论 -
golang中使用cgo调用c++程序
https://blog.youkuaiyun.com/a1368783069/article/details/84142924https://github.com/yangh1368/cgo_cplusplus原创 2020-03-03 00:09:58 · 388 阅读 · 0 评论 -
golang判断字符串是不是数字
参考https://bbs.youkuaiyun.com/topics/394514067func IsNum(s string) bool { _, err := strconv.ParseFloat(s, 64) return err == nil}原创 2020-02-24 00:39:49 · 19931 阅读 · 0 评论 -
golang编写http server
https://blog.youkuaiyun.com/lengyuezuixue/article/details/79094323https://www.cnblogs.com/pluse/p/7927768.htmlgo语言实现httpserverhttp://blog.sina.com.cn/s/blog_61d758500102y6ba.htmlg】golang HT...原创 2020-02-23 11:07:49 · 396 阅读 · 0 评论 -
go-restful使用
参考https://www.jianshu.com/p/4724fd7084cb安装go get -u -v github.com/emicklei/go-restfulgo get -u -v github.com/emicklei/go-restful-swagger12失败去网站 上下载,解压如下https://github.com/emicklei/go-res...原创 2020-02-20 20:02:18 · 1149 阅读 · 0 评论 -
golang 数据类型转换
bool转string a := strconv.FormatBool(resp.Response.Result) if a == "true"{ res.Result = 1 }原创 2020-02-18 11:48:49 · 158 阅读 · 0 评论 -
Zinx开发API文档】Golang轻量级并发服务器框架
https://www.jianshu.com/p/90fe2c7ffbb0原创 2020-02-17 21:20:09 · 525 阅读 · 0 评论