当前位置:网站首页>Adhere to the foundation of 20 minutes go every day II
Adhere to the foundation of 20 minutes go every day II
2022-07-02 14:07:00 【Lizijian】
Variable
Every language needs to use variables , The declaration rules are also different
Similar rules : Understandable , Unified and standardized naming rules
go Can declare a , You can also declare multiple , Multiple times can be organized with brackets
var (
numberOne int
numberTwo int
numberThree string
)
Operator
go Supported operators
- Arithmetic operator
- Logical operators
Arrays and slices
arr1 := [4]int{1,2,3}
slice1 := []int{1,2,3}
slice2 := slice1[1:2]
Dictionaries
map1 := make(map[string]string)
map1["abc"] = "test"
if val,ok:= map1["a"];ok {
fmt.Println(val)
}else {
fmt.Println("error")
}
Structure
type Location struct {
Addr string
}
type Person struct{
Name string
Age int
Location
}
Interface
type DoIt interface{
Do()string
}
library ( package ) management
Import package import
Import not used import _ "xxx"
Do not display library name import . "xxx"
Multiple package imports import( a, b, c)
Project organization structure
Domain model
- app
- domain
- infra
- main
- scheduler
- ui
- api-server
- api_server.go
- router_function.go
- parse
- parser.go
- api-server
Business iteration pattern
- cmd
- configs
- deploments
- docs
- initalizers
- logs
- pkg
- scripts
- src
- tools
- verndors
- main.go
- Makefile
边栏推荐
猜你喜欢
MySQL 45 lecture - learning from the actual battle of geek time MySQL 45 Lecture Notes - 04 | easy to understand index (Part 1)
全屋Wi-Fi:一个谁也解决不好的痛点?
Browser driven Download
Chaos engineering platform chaosblade box new heavy release
2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect
c# 水晶报表打印
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 04 | 深入浅出索引(上)
刚好1000粉丝,记录一下
Qt入门-制作一个简易的计算器
QT new project_ MyNotepad++
随机推荐
P1908 逆序对
Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?
Design of non main lamp: how to make intelligent lighting more "intelligent"?
Qt-制作一个简单的计算器-实现四则运算
MySQL 45 lecture - learning the actual battle of MySQL in Geek time 45 Lecture Notes - 05 | easy to understand index (Part 2)
OpenFOAM:lduMatrix&lduAddressing
Systemserver process
Halcon extract orange (Orange)
故事點 vs. 人天
一般来讲,如果频繁出现inconsistent tab and space的报错
Characteristics of selenium
Launcher启动过程
Simple introduction to ENSP
693. Travel sequencing (map + topology)
Qt新项目_MyNotepad++
[usaco05jan]watchcow s (Euler loop)
Origin绘制热重TG和微分热重DTG曲线
Pattern matching and regular expressions in PostgreSQL - Das
联合搜索:搜索中的所有需求
BeanUtils--浅拷贝--实例/原理