当前位置:网站首页>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
边栏推荐
- [untitled]
- 蓝桥杯单片机数码管技巧
- Unity脚本的基础语法(6)-特定文件夹
- Basic operations of MySQL database (based on tables)
- MySQL index, transaction and storage engine
- Oracle的md5
- UI (New ui:: MainWindow) troubleshooting
- The fourth provincial competition of Bluebridge cup single chip microcomputer
- 一文彻底理解评分卡开发中——Y的确定(Vintage分析、滚动率分析等)
- 向数据库中存入数组数据,代码出错怎么解决
猜你喜欢

Raspberry pie GPIO pin controls traffic light and buzzer

毕设-基于SSM电影院购票系统

软件测试人的第一个实战项目:web端(视频教程+文档+用例库)

Didi open source Delta: AI developers can easily train natural language models

0基础如何学习自动化测试?按照这7步一步一步来学习就成功了

JVM knowledge points

The 8th Blue Bridge Cup single chip microcomputer provincial competition

高性能 低功耗Cortex-A53核心板 | i.MX8M Mini

PR zero foundation introductory guide note 2
![[personnel density detection] matlab simulation of personnel density detection based on morphological processing and GRNN network](/img/11/4a8b52603e6e14a1ed6da1264dee57.png)
[personnel density detection] matlab simulation of personnel density detection based on morphological processing and GRNN network
随机推荐
Basic syntax of unity script (7) - member variables and instantiation
In wechat applet, the externally introduced JS is used in xwml for judgment and calculation
[tips] use Matlab GUI to read files in dialog mode
Network connection mode of QT
Account management of MySQL
What is the logical structure of database file
QT designer plug-in implementation of QT plug-in
Unity脚本的基础语法(7)-成员变量和实例化
2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板,老板也有建设积分和捣乱积分, 排好队后,所有
潘多拉 IOT 开发板学习(HAL 库)—— 实验2 蜂鸣器实验(学习笔记)
【小技巧】使用matlab GUI以对话框模式读取文件
u本位合约爆仓清算解决方案建议
Cloud service selection of enterprises: comparative analysis of SaaS, PAAS and IAAs
Failed to upgrade schema, error: “file does not exist
VS2010 plug-in nuget
高性能 低功耗Cortex-A53核心板 | i.MX8M Mini
Monkey test
Unity脚本的基础语法(6)-特定文件夹
Welcome the winter vacation multi school league game 2 partial solution (B, C, D, F, G, H)
[live broadcast review] the first 8 live broadcasts of battle code Pioneer have come to a perfect end. Please look forward to the next one!