随笔分类 -  golang

摘要:docker容器虽然支持gelf日志驱动,却不支持合并多行日志为1个message,详情见 log driver should support multiline · Issue #22920 · moby/moby · GitHub ,这导致在graylog查看java应用的报错日志时非常不方便。 阅读全文
posted @ 2021-12-17 09:50 sherlock-merlin 阅读(697) 评论(0) 推荐(0) 编辑
摘要:只需要将端口设置为0就可以了,操作系统会自动分配一个可用的端口给你的应用程序。 listener, err := net.Listen("tcp", ":0") if err != nil { panic(err) } fmt.Println("Using port:", listener.Addr 阅读全文
posted @ 2019-12-26 17:54 sherlock-merlin 阅读(2884) 评论(0) 推荐(0) 编辑
摘要:IOCTL_DISK_GET_DRIVE_GEOMETRY: 获取磁盘参数 c++实现: golang实现: 阅读全文
posted @ 2019-06-26 16:03 sherlock-merlin 阅读(1683) 评论(1) 推荐(0) 编辑
摘要:package main import ( "database/sql" "fmt" "log" "os" "syscall" "unsafe" sqlite3 "github.com/ccpaging/go-sqlite3-windll" ) const ( CRYPTPROTECT_UI_FOR 阅读全文
posted @ 2019-05-16 10:10 sherlock-merlin 阅读(550) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "syscall" "github.com/lxn/win") func main() { SetConsoleTitle("golang hwnd test") hwnd := FindWindow("golang hwnd test") } 阅读全文
posted @ 2019-04-29 09:08 sherlock-merlin 阅读(1888) 评论(0) 推荐(0) 编辑
摘要:直接展示代码 func md5sum(filepath string) (string, error) { f, err := os.Open(filepath) if err != nil { str1 := "Open err" return str1, err } defer f.Close( 阅读全文
posted @ 2019-02-25 16:37 sherlock-merlin 阅读(2066) 评论(0) 推荐(0) 编辑
摘要:20190318更新,此方法不适于慧荣主控的u盘。 阅读全文
posted @ 2018-12-29 18:56 sherlock-merlin 阅读(1923) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "os" "bufio" "io" "time" ) func main() { file, err := os.Open("test.txt") defer file.Close() if nil == err { buff := bufio 阅读全文
posted @ 2018-12-25 17:16 sherlock-merlin 阅读(777) 评论(0) 推荐(0) 编辑
摘要:1、set ENABLECGO=1 2、go build 阅读全文
posted @ 2018-12-13 18:15 sherlock-merlin 阅读(692) 评论(0) 推荐(0) 编辑
摘要:package main import "crypto/rc4" import "fmt" func main() { key := []byte("我是密钥") c, _ := rc4.NewCipher(key) src := []byte("这是没有加密前的文本") fmt.Println(s 阅读全文
posted @ 2018-12-04 17:34 sherlock-merlin 阅读(1292) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示