随笔分类 - GO
go学习
摘要:# 定义示例类型和变量 type Human struct { Name string } var people = Human{Name:"zhangsan"} 普通占位符 占位符 说明 举例 输出 %v 相应值的默认格式。 Printf("%v", people) {zhangsan}, %+v
阅读全文
摘要:package hostsimport ( "bufio" "errors" "fmt" "io" "net" "os" "strings" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils
阅读全文
摘要:前言 随着时间的推移,语言爱好者已经构建和共享了许多 Go 框架和库。这些包执行不同的功能,从开发微服务到制作 discord 机器人,一直到构建 Web 应用程序!在本文中,我将尝试让您熟悉一些有用的方法,这些方法是我在尝试使用这种有趣的新编程语言学习和构建应用程序时发现的。 这绝不是一个详尽的列
阅读全文
摘要:/*Copyright The Helm Authors.Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the Li
阅读全文
摘要:go-zero 是一个集成了各种工程实践的 web 和 rpc 框架。通过弹性设计保障了大并发服务端的稳定性,并经受了充分的实战检验(好未来-晓黑板)。 go-zero 包含极简的 API 定义和生成工具 goctl(go control),可以根据定义的 api 文件一键生成 Go, iOS, A
阅读全文
摘要:简介 https://blog.csdn.net/weixin_46618592/article/details/125570527 就在上周,Go 发布了 GO1.16 版本,此次更新带来了几个新特性,如 embed 原生支持,macos M1 处理器的支持,默认开启 go modules 等等。
阅读全文
摘要:https://github.com/gookit/gcli/blob/master/interact/steps.go package interactimport ( "context" "fmt")// StepHandler for steps runtype StepHandler fun
阅读全文
摘要:package mainimport "fmt"type DD stringconst ( C DD = "dd" D DD = "cc")func (DD) JoinString() DD { return C + D}func main() { C.JoinString() D.JoinStri
阅读全文
摘要:并发控制 Golang基础库中已经提供不少并发控制工具,比如Channel、WaitGroup、各种锁等等。 ErrGroup WaitGroup可以等待多个Goroutine执行结束,但很多时候并发执行多个任务,如果其中一个任务出错那么整体失败,需要直接返回,这种情况下我们可以使用ErrGroup
阅读全文
摘要:本文代码基于:Go1.19.3 net/http库的一个小demo 服务端: import ( "fmt" "net/http")func getProfile(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "asong")}fu
阅读全文
摘要:原创 学习与分享 Go语言圈 2022-12-05 08:30 发表于广东 收录于合集#为什么要学Go语言141个 学习与交流:Go语言技术微信群 商务合作加微信:LetsFeng goland 全家桶激活码,支持所有版本,支持所有系统 链接:http://web.52shizhan.cn/acti
阅读全文
摘要:package mainimport ( "fmt")type Test struct {}func (t *Test) Gname() { fmt.Println("test")}func main() { var t *Test t.Gname()}//test
阅读全文
摘要:例子1 package mainimport ( "awesomeProject/logger" "fmt" "github.com/opencontainers/runtime-tools/filepath" "os")type Goods struct { ID uint MonTs strin
阅读全文
摘要:学习与交流:Go语言技术微信群 商务合作加微信:LetsFeng goland 全家桶激活码,支持所有版本,支持所有系统 链接:http://web.52shizhan.cn/activity/s2abxc 提取码:GJF9B1DK 现在就开始你的Go语言学习之旅吧!人生苦短,let’s Go. 1
阅读全文
摘要:https://blog.csdn.net/u012986012/article/details/126833564 func WriteKey(keyPath string, data []byte) error { if err := os.MkdirAll(filepath.Dir(keyPa
阅读全文
摘要:o install it, run: go get gopkg.in/yaml.v3 API documentation If opened in a browser, the import path itself leads to the API documentation: https://go
阅读全文
摘要:func Confirm(prompt, cancel string) (bool, error) { var yesRx = regexp.MustCompile("^(?:y(?:es)?)$") var noRx = regexp.MustCompile("^(?:n(?:o)?)$") va
阅读全文
摘要:package clusterfileimport ( "errors" "sync" "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1")var ErrTypeNotFou
阅读全文
摘要:https://github.com/labring/sealos/blob/main/pkg/utils/logger/logger.go // Copyright © 2022 sealos.//// Licensed under the Apache License, Version 2.0
阅读全文

浙公网安备 33010602011771号