![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Go语言
Bearki-CN
勇于探索,才会有新发现!
展开
-
Gin + Grpc同时使用(监听同一端口)
package main// 入口func main() { // 初始化一个空Gin路由 router := gin.New() // 初始化grpc服务 grpcServer := grpc.NewServer() // 全局拦截 router.Use(func(ctx *gin.Context) { // 判断协议是否为http/2 // 判断是否是grpc if ctx.Request.ProtoMajor == 2 && strings.HasP.原创 2022-04-10 03:59:47 · 2817 阅读 · 2 评论 -
Go 处理zip压缩文件
golang处理zip数据的二次封装,减少一些外部操作流程原创 2021-09-16 14:11:11 · 1876 阅读 · 0 评论 -
beego v2.0解决跨域问题
package mainimport ( beego "github.com/beego/beego/v2/server/web" "github.com/beego/beego/v2/server/web/filter/cors")func init() { //InsertFilter是提供一个过滤函数 beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ //允许访问所有源原创 2021-03-10 08:49:10 · 1089 阅读 · 0 评论 -
GO语言查询指定年份指定月份有多少天
func getYearMonthToDay(year int, month int) int { // 有31天的月份 day31 := map[int]bool{ 1: true, 3: true, 5: true, 7: true, 8: true, 10: true, 12: true, } if day31[month] == true { return 31 } // 有30天的月份 day30 := map[int]bool{ 4:原创 2021-03-08 15:49:10 · 2676 阅读 · 0 评论