Saki's 研究记录

golang 关于函数的返回值问题
函数返回值的一些实践 123456789101112131415type Mystruct struct{ Val int}func myfunc() Mystruct{ return Mystruct{Val:1}}func myfunc() *MyStruct { return &MyStruct{}}func myfunc(s *MyStruct) { s.Val = 1} 三种方式的不同点: 第一个返回 struct 的 co...
减小 golang 编译出的程序体积
安装 upx1234# CentOSyum install -y upx# Macbrew install upx 进行压缩参数 -o 指定压缩后的文件名; -9 指定压缩级别,1-9。 12345678910upx -9 -o gin_admin_empty_upx gin_admin_emptyUltimate Packer for eXecutables Copyright (C) 1996 - 2020UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reise...
yum install/update golang
InstallInstall EPEL package by using yum install epel-release command: 1yum install -y epel-release Update your system: 1yum update Install Golang using yum: 1yum install -y golang Check Golang version: 12go versiongo version go1.15.14 linux/amd64 UpdateUnless someone either adds Go 1.7+ to a...