golang 切片的使用
// 使用指针切片的情况: 1. 结构体大(>64字节)且切片长(>1000) 2. 数据经常需要修改 3. 需要在多个地方共享相同的数据实例 4. 结构体包含需要维护的资源(如连接、文件句柄等) // 使用值切片的情况: 1. 结构体小(
// 使用指针切片的情况: 1. 结构体大(>64字节)且切片长(>1000) 2. 数据经常需要修改 3. 需要在多个地方共享相同的数据实例 4. 结构体包含需要维护的资源(如连接、文件句柄等) // 使用值切片的情况: 1. 结构体小(
######################## default ############################ server { listen 80; server_name _; access_log /data/wwwlogs/access_nginx.log combined; root /data/wwwroot/default; index index.html index.htm index.php; #error_page 404 /404.html; #error_page 502 /502.html; location / { proxy_pass http://127.0.0.1:8888; proxy_set_header Accept-Encoding ”; proxy_set_header Host $http_host; proxy_set_header Referer $http_referer; proxy_set_header Cookie $http_cookie; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ########################## vhost #############################
go mod init namecost go mod tidy go run main.go 函数外的每个语句都必须以关键字开始(var、const、func等) :=不能使用在函数外。 _多用于占位,表示忽略值。 const ( n1 = 100 n2 n3 ) const ( n1 = iota //0 n2 = 100 //100 n3 = iota //2 n4 //3 ) const n5 = iota //0 const ( a, b = iota + 1, iota + 2 //1,2 … Continue reading “golang学习”