当前位置:网站首页>每天坚持20分钟go的基础二
每天坚持20分钟go的基础二
2022-07-02 10:31:00 【李子健】
变量
每个语言都需要使用变量,声明规则也不一样
类似的规则:易懂的,统一规范的命名规则
go可以声明一个,也可以声明多个,多个时可以用括号组织
var (
numberOne int
numberTwo int
numberThree string
)
运算符
go支持的运算符
- 算术运算符
- 逻辑运算符
数组和切片
arr1 := [4]int{1,2,3}
slice1 := []int{1,2,3}
slice2 := slice1[1:2]
字典
map1 := make(map[string]string)
map1["abc"] = "test"
if val,ok:= map1["a"];ok {
fmt.Println(val)
}else {
fmt.Println("error")
}
结构体
type Location struct {
Addr string
}
type Person struct{
Name string
Age int
Location
}
接口
type DoIt interface{
Do()string
}
库(包)管理
导入包import
导入不使用 import _ "xxx"
不显示库名 import . "xxx"
多个包导入import( a, b, c)
项目组织结构
领域模式
- app
- domain
- infra
- main
- scheduler
- ui
- api-server
- api_server.go
- router_function.go
- parse
- parser.go
- api-server
业务迭代模式
- cmd
- configs
- deploments
- docs
- initalizers
- logs
- pkg
- scripts
- src
- tools
- verndors
- main.go
- Makefile
边栏推荐
- Just 1000 fans, record it
- uniapp小程序 subPackages分包配置
- Node. JS accessing PostgreSQL database through ODBC
- Sum of the first n terms of Fibonacci (fast power of matrix)
- Dingtalk send message
- Development skills of rxjs observable custom operator
- How to explain binary search to my sister? This is really difficult, fan!
- The global special paper revenue in 2021 was about $27 million, and it is expected to reach $35 million in 2028. From 2022 to 2028, the CAGR was 3.8%
- Story point vs. Human Sky
- 【模板】最长公共子序列 (【DP or 贪心】板子)
猜你喜欢
Téléchargement par navigateur
Codeforces Round #803 (Div. 2)(A~D)
刚好1000粉丝,记录一下
Qt新项目_MyNotepad++
Runhe hi3516 development board openharmony small system and standard system burning
2022家用投影仪首选!当贝F5强悍音画效果带来极致视听体验
Gee learning notes 2
Unity skframework framework (XII), score scoring module
Development skills of rxjs observable custom operator
自定义事件,全局事件总线,消息订阅与发布,$nextTick
随机推荐
[unity] using GB2312, the solution to abnormal program after packaging
Skillfully use SSH to get through the Internet restrictions
P1042 [NOIP2003 普及组] 乒乓球
P1908 reverse sequence pair
Launcher startup process
错误:EACCES:权限被拒绝,访问“/usr/lib/node_modules”
默认插槽,具名插槽,作用域插槽
Unity small map production [2]
三谈exception——错误处理
Unity skframework framework (XII), score scoring module
c# 水晶报表打印
故事點 vs. 人天
Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred
Use bloc to build a page instance of shutter
selenium的特点
P3807 [template] Lucas theorem /lucas theorem
Achievements in science and Technology (27)
Selenium element positioning method
Android kotlin material design technology points
Simple introduction to ENSP