当前位置:网站首页>每天坚持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
边栏推荐
- ArrayList and LinkedList
- Stone merging Board [interval DP] (ordinary stone Merging & Ring Stone merging)
- selenium 元素定位方法
- Slashgear shares 2021 life changing technology products, which are somewhat unexpected
- 混沌工程平台 ChaosBlade-Box 新版重磅发布
- Multi rotor aircraft control using PID and LQR controllers
- c# 水晶报表打印
- [deep learning] simple implementation of neural network forward propagation
- 当贝投影4K激光投影X3 Pro获得一致好评:万元投影仪首选
- ensp简单入门
猜你喜欢

Explanation: here is your UFO, Goldbach conjecture

Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred

Error function ERF

Node. JS accessing PostgreSQL database through ODBC

(POJ - 1984) navigation nightare (weighted and search set)

Runhe hi3516 development board openharmony small system and standard system burning

leetcode621. task scheduler

代码实现MNLM

QT new project_ MyNotepad++

Codeforces Round #803 (Div. 2)(A~D)
随机推荐
【文档树、设置】字体变小
Mysql5.7 installation super easy tutorial
石子合并板子【区间DP】(普通石子合并 & 环形石子合并)
Slashgear shares 2021 life changing technology products, which are somewhat unexpected
mysql ---- Oracle中的rownum转换成MySQL
故事点 vs. 人天
[USACO05JAN]Watchcow S(欧拉回路)
Memory management 01 - link script
qt中uic的使用
Qt-制作一个简单的计算器-实现四则运算-将结果以对话框的形式弹出来
Qt如何设置固定大小
Pointer from entry to advanced (1)
Error function ERF
Story point vs. Human Sky
How to use SAP's metadata framework (MDF) to build custom business rules?
P1042 [NOIP2003 普及组] 乒乓球
Detailed collection of common MySQL commands
Three talking about exception -- error handling
Why is the default of switch followed by break?
Just 1000 fans, record it