当前位置:网站首页>Go language naming specification
Go language naming specification
2022-07-02 03:53:00 【UPythonFish】
go Language naming specification
One Variable definition specification
Go Function names in languages 、 Variable name 、 Constant names 、 Type name 、 Statement label and package name, etc , All follow a simple naming rule :
A name must have one letter (Unicode Letter ) Or start with an underscore , It can be followed by any number of letters 、 Number or underscore
Capital letters and lowercase letters are different :Name and name It's two different variables
Keywords and reserved words are not recommended as variable names
And there is only one project main package , You can't run with more or less . Learning foundation stage , You can have more than one project main function , But we must use file Form operation , Cannot run as a package .
// Hump body is recommended for variable definition
-AgeOfPerson go Language and java Language recommendation ,python Not recommended
-age_of_person Underline in , Not recommended (go Not recommended ,python recommend )
// go Name of file , Underline is recommended ( Refer to the source code )
-java In language : Hump is recommended for variables and file names
-Python in : It is recommended to underline variable names and file names
Two Keywords and reserved words
Go What are the key words in a language 25 individual ; Keywords cannot be used for custom names , It can only be used in specific grammatical structures .37 A reserved word , It mainly corresponds to built-in constants 、 Types and functions
// 25 Key words
break default func interface select
case defer go map struct
chan else goto package switch
const fallthrough if range type
continue for import return var
//37 A reserved word
Built-in Constants : true false iota nil
Built in type : int int8 int16 int32 int64
uint uint8 uint16 uint32 uint64 uintptr
float32 float64 complex128 complex64
bool byte rune string error
Built-in functions : make len cap new append copy close delete
complex real imag
panic recover
边栏推荐
- It took me only 3 months to jump out of the comfort zone and become an automated test engineer for 5 years
- 【人员密度检测】基于形态学处理和GRNN网络的人员密度检测matlab仿真
- Vite: scaffold assembly
- L'avènement de l'ère 5G, une brève discussion sur la vie passée et présente des communications mobiles
- 蓝桥杯单片机第四届省赛
- go 分支与循环
- MySQL之账号管理
- [designmode] Prototype Pattern
- Influence of air resistance on the trajectory of table tennis
- leetcode-1380. Lucky number in matrix
猜你喜欢

一文彻底理解评分卡开发中——Y的确定(Vintage分析、滚动率分析等)

手撕——排序

Get started with Aurora 8b/10b IP core in one day (5) -- learn from the official routine of framing interface

The second game of the 12th provincial single chip microcomputer competition of the Blue Bridge Cup

傅里叶级数
![[tips] use Matlab GUI to read files in dialog mode](/img/51/6d6051836bfc9caa957d0275245bd3.png)
[tips] use Matlab GUI to read files in dialog mode

2022-07-01: at the annual meeting of a company, everyone is going to play a game of giving bonuses. There are a total of N employees. Each employee has construction points and trouble points. They nee

蓝桥杯单片机省赛第六届
![[mv-3d] - multi view 3D target detection network](/img/aa/741b36ead2dfaa5a165401b8d657b7.jpg)
[mv-3d] - multi view 3D target detection network

滴滴开源DELTA:AI开发者可轻松训练自然语言模型
随机推荐
Get started with Aurora 8b/10b IP core in one day (5) -- learn from the official routine of framing interface
5G時代全面到來,淺談移動通信的前世今生
C language: examples of logical operation and judgment selection structure
Basic syntax of unity script (7) - member variables and instantiation
[personal notes] PHP common functions - custom functions
go 分支与循环
Go语言介绍
Welcome the winter vacation multi school league game 2 partial solution (B, C, D, F, G, H)
蓝桥杯单片机第四届省赛
C语言:逻辑运算和判断选择结构例题
手撕——排序
蓝桥杯单片机省赛第十二届第一场
Where can I buy cancer insurance? Which product is better?
UI (New ui:: MainWindow) troubleshooting
The 10th Blue Bridge Cup single chip microcomputer provincial competition
Fourier series
向数据库中存入数组数据,代码出错怎么解决
leetcode-1380. Lucky number in matrix
跳出舒适区,5年点工转型自动化测试工程师,我只用了3个月时间
The second game of the 12th provincial single chip microcomputer competition of the Blue Bridge Cup