当前位置:网站首页>Go language identifier and package name specification
Go language identifier and package name specification
2022-06-30 20:23:00 【Zen and the art of computer programming】
The definition of identifier
identifier (identifier) A symbol used to identify an entity , It has different meanings in different application environments . In computer programming languages , Identifier is the name used by the user when programming , Used to give variables 、 Constant 、 function 、 Statement block and so on , To establish a relationship between the name and the use .
go Variables in language , function , And package name, etc. all belong to a kind of identifier .
Package naming rules
(1) As far as possible, the package name should be consistent with the directory name where it is located , Do not conflict with the standard library .
(2) with main The package of the function must put it package Defined as main, So that we can use go run To run the file ,go build To generate an executable file .
(3) Variable name 、 Function name 、 Constant names are named by hump method
(4) Variable name 、 Function name 、 Constant names are capitalized , Can be accessed by other packages . Lowercase letters can only be used in this package .
(5) Custom packages are referenced , It will be automatically replenished $GOPATH/src/ , The folder in the path is / Division .(GOPATH For environment variables , You have to configure it yourself ).
边栏推荐
猜你喜欢

25:第三章:开发通行证服务:8:【注册/登录】接口:接收并校验“手机号和验证码”参数;(重点需要知道【利用redis来暂存数据,获取数据的】的应用场景)(使用到了【@Valid注解】参数校验)

为什么一定要从DevOps走向BizDevOps?

分析超700万个研发需求发现,这八大编程语言才是行业最需要的

exness:流动性系列-流动性清洗和反转、决策区间

Why must a digital transformation strategy include continuous testing?

NLP技能树学习路线-(一)路线总览

计网 | 【五 传输层、六 应用层】知识点及例题

Enterprise middle office planning and it architecture microservice transformation
![Jerry's touch key recognition process [chapter]](/img/cf/8dacbb7f80e427276df6201dddd377.png)
Jerry's touch key recognition process [chapter]

Halcon知识:盘点一下计量对象【1】
随机推荐
Solution to rollback of MySQL database by mistake deletion
Big God explains open source buff gain strategy live broadcast
NLP 论文领读|文本生成模型退化怎么办?SimCTG 告诉你答案
Jerry's question about long press boot detection [chapter]
杰理之触摸按键识别流程【篇】
Maya house modeling
discuz 论坛提速之删除data/log下的xxx.php文件
网上炒股开户安全嘛!?
Exness: liquidity series - liquidity cleaning and reversal, decision interval
VB的基本语法
Tensorflow2.4 implementation of repvgg
Primary school, session 3 - afternoon: Web_ sessionlfi
Transport layer uses sliding window to realize flow control
Summary of operating system interview questions (updated from time to time)
neo4j load csv 配置和使用
【Try to Hack】Windows系统账户安全
Description of the latest RTSP address rules for Hikvision camera, NVR, streaming media server, playback and streaming [easy to understand]
PM这样汇报工作,老板心甘情愿给你加薪
Jerry's touch key recognition process [chapter]
Jerry's touch key recognition process [chapter]