![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
go
小刘同学++
这个作者很懒,什么都没留下…
展开
-
下载安装使用upx
upx混淆原创 2022-10-17 15:58:31 · 10571 阅读 · 0 评论 -
go 实现unicode码和中文之间的转换
package mainimport ( "fmt" "strconv" "strings")func main() { sText := "\u4e2d\u6587" textQuoted := strconv.QuoteToASCII(sText) textUnquoted := textQuoted[1 : len(textQuoted)-1] fmt.Println(textUnquoted) sUnicodev := st原创 2022-02-23 11:20:40 · 1286 阅读 · 0 评论 -
go项目代码固定类型函数读取并追加当前代码文件末尾
package mainimport ( "os" "log" "fmt" "bufio" "strings" "path/filepath")func main() { files, _ := WalkDir("E:/work/scWeb_new", ".go") for i := 0; i < len(files); i++ { fmt.Println((files[i])) err := HandleText((files[i]))原创 2022-02-23 10:03:13 · 228 阅读 · 0 评论 -
golang 压缩文件 过滤指定文件的前缀名
package mainimport ( "path/filepath" "io" "os" "strings" "archive/zip")func ZipFilesPrefixExcept(srcFile string, destZip string,ExcptFiles []string) error { zipfile, err := os.Create(destZip) if err != nil { return err } defer zipfile.原创 2021-11-05 14:42:34 · 404 阅读 · 0 评论 -
golang 读取linux磁盘空间占用情况
改代码读取liunx系统下的/etc/mtab文件获取当前系统的磁盘列表package mainimport ( "bufio" "fmt" "os" "strings" "syscall")type DiskStatus struct { All uint64 `json:"all"` Used uint64 `json:"used"` Free uint64 `json:"free"`}const ( B = 1 KB = 1024 * B MB = 1024原创 2021-09-07 10:30:04 · 1543 阅读 · 0 评论 -
golang 生成图片验证码
核心绘图方案利用 “github.com/fogleman/gg” 这个包来处理package mainimport ( "flag" "fmt" "io/ioutil" "log" "math" "math/rand" "reflect" "time" "github.com/golang/freetype/truetype" "github.com/golang/gg")func GetRandStr(n int) (w []interface{}) { chars原创 2021-09-07 09:57:40 · 1036 阅读 · 0 评论 -
go基本语法数据类型转换变量作用域的使用案例
package mainimport ( "bufio" "fmt" "log" "os" "strconv" "strings")//main函数在程序启动时调用func main() { fmt.Printf("Enter a grade:") //提示用户输入一个百分比数 reader := bufio.NewReader(os.Stdin) //创建一个bufio.Reader,它允许我们读取键盘输入 input, err := reader.Re原创 2021-06-11 15:16:51 · 58 阅读 · 0 评论 -
go猜数字游戏(1-100之间随机生成数字)
package mainimport ( "bufio" "fmt" "log" "math/rand" "os" "strconv" "strings" "time")//main函数在程序启动时调用func main() { seconds := time.Now().Unix() //获取当前日期和时间的整数形式 rand.Seed(seconds) //播种随机生成器 target := rand.Intn(100) + 1 //生成一个介于1和原创 2021-06-11 17:10:03 · 948 阅读 · 1 评论 -
golang map
map可以自动扩容a := make(map[string]string, 4) //如果key还没有就是 增加,如果key存在就是修改 a["l"] = "zhang" a["z"] = "wang" a["c"] = "li" a["h"] = "zhao" a["h"] = "ssss" delete(a, "h")//清空map[a] //a = make(map[string]string) //清空mapmap遍历for key, value := range a {原创 2021-08-11 10:53:49 · 75 阅读 · 0 评论 -
golang 发送邮件编写了一个struck支持ssl和非ssl发送邮件
package mainimport ( "fmt" "net/smtp" "strings")type Email struct { Host string Server string User string Password string To string Subject string Msg string} return nil}func SendEmail(email *Email) error { auth原创 2021-08-27 16:58:42 · 415 阅读 · 0 评论