Go lo 使用 go get github.com/samber/lo 使用 // 将切片中的重复元素去掉,只保留第一个出现的元素。 names := lo.Uniq([]string{"Samuel", "John", "Samuel"}) // []string{"Samuel", "John"} // 生成map // 将切片或数组转换为map,key是call
Go Set 集合 Github地址:https://github.com/deckarep/golang-set 使用: go get github.com/deckarep/golang-set/v2 集合里的元素不会重复 示例:
Goose 数据库版本管理 Goose 是一个用于管理数据库迁移的工具,类似于 Flyway 和 Liquibase。它可以方便地管理数据库模式的版本,并应用相应的 SQL 脚本。你提到
Java 一、基础 1、helloworld public class Hello { public static void main(String[] args) { System.out.println("Hello, world!"); } } [root@Sugar j1]🐳 java Hello.java Hello, world! 2、变量定义 int n = 100; n = 200; // 变量n赋值为200 int i2 = -2147483648; int i3 =
cloud-init https://hmli.ustc.edu.cn/doc/linux/ubuntu-autoinstall/ubuntu-autoinstall.html ubuntu 安装后获取当前的user-data: /var/log/installer/autoinstall-user-data 示例: #cloud-config autoinstall: version: 1 apt: disable_components: [] fallback: offline-install geoip: true mirror-selection: primary: - uri: http://mirrors.ustc.edu.cn/ubuntu-ports - country-mirror - arches: &id001 - amd64 - i386 uri: http://mirrors.ustc.edu.cn/ubuntu/ - arches: &id002 - s390x - arm64 - armhf - powerpc - ppc64el - riscv64 uri: http://mirrors.ustc.edu.cn/ubuntu-ports preserve_sources_list:
Go conc 参考链接 https://www.liwenzhou.com/posts/Go/conc/ go package main import ( "fmt" "time" ) func main() { for i := 0; i < 5; i++ { go func(num int) { fmt.Println(num) }(i) } time.Sleep(5 * time.Second) } sync.WaitGroup 控制并发 package main import ( "fmt" "sync" ) var wg sync.WaitGroup func hello(i int) { defer wg.Done() fmt.Println("Hello Goroutine!", i) } func main() { for i := 0;