当前位置:网站首页>03. Preliminary use of golang
03. Preliminary use of golang
2022-07-02 15:29:00 【Thubier (segment new)】
Since early 2016 From the year onwards , There is an internal trend of mobile priority and cloud priority , But based on the current situation , We cannot advance quickly . Over the years, the entire enterprise operating environment has been deployed in the cloud , The basic platform within the enterprise is basically formed : Private cloud , Public cloud , The government cloud is constantly upgrading / to update .
In the environment , We have also completed the preliminary internal transformation , From monomer application (C# edition ) To the micro application version (Java edition ). Already has containerization / The basic conditions of cloud deployment . The next step will continue to promote the transformation of cloud environment .
When we enter cloud deployment , The mature market plan is :k8s+docker, These two core components are oriented golang. As a developer , It is definitely impossible to just stay on the use of tools , And will continue to explore the implementation behind the tool .golang Become the language we must face .
Used nearly 5 Hours , hold golang Running environment /vscode go Related to the plug-in , And right golang The documents on the official website have been sorted out completely , Form a pair of golang Preliminary experience of language .
1. Code organization
golang The language uses module---->package----->func Three levels of management , There is no concept of a class , But there is information such as interface definition .
2. grammar
Grammar adopts a natural language oriented model , The general way is still according to c The parsing framework of language . Like a function :

The above picture is from the official website :
func Declare for method ;ReverseRunes Method NOUN ;(s string):(s Parameters string Is the data type ) string Return type .
This rule is in line with natural language thinking .
3. data type
Data type and c#/java similar , Basic types are defined , Structure can be provided / Interface definition and other information .
4. Variable
The assignment of variables adopts var Make a statement , It also adopts inferential direct assignment across domains .

5. Control language
Natural language oriented model is adopted to build , See the description on the official website for details .

Effective Go - The Go Programming Language (google.cn)
6. External package management
Adopted import Import packages , In order to download external packages to the local , After setting the import package , perform go get . /go mod tidy Wait for the operation .
because golang The package management of adopts the default configuration ,golang Official Website Package Management , In China, it is often slow . So ,go Open package management agent configuration variables , You can add GOPROXY Variable to point to a specific package management service . The domestic image addresses are :https://proxy.golang.com.cn,direct
7. Running environment
because golang Language is a relatively new language , The original intention of the design is to revise c/c++/java Such as the inhuman content of language . So while giving priority to performance , It provides a large number of highly self consistent standard expansion packages , Such as http/net/sqldb etc. , Ordinary users only need to use the standard package with high cohesion , You can quickly achieve web service , Data access and other information , Let these components, which are already recognized services, become the foundation , Make it easy for users / Quickly build business implementation ......
It can be understood as golang It's close to c Language , But it provides a large number of development platforms for basic application implementation . The code implementation pattern is between process oriented and object-oriented , Finally, the balance between performance and implementation difficulty is achieved .........
8. ecology
golang Language proximity c Language , But there are more standard expansion packs , And adopted the open source mode to operate . The full open source model has attracted a large number of enterprises , And grasp the cloud oriented implementation , At present golang Cloud based platform implementation language that has become a reality :docker/k8s Have been used golang Realization . And is constantly moving towards web Application extension .
边栏推荐
- How to solve the problem of database content output
- TiDB 环境与系统配置检查
- Download blender on Alibaba cloud image station
- . Net again! Happy 20th birthday
- Evaluation of embedded rz/g2l processor core board and development board of Feiling
- 11_ Redis_ Hyperloglog_ command
- How to test tidb with sysbench
- Map introduction
- 03.golang初步使用
- Guangzhou Emergency Management Bureau issued a high temperature and high humidity chemical safety reminder in July
猜你喜欢

Build your own semantic segmentation platform deeplabv3+

Application and practice of Jenkins pipeline

【网络安全】网络资产收集

Evaluation of embedded rz/g2l processor core board and development board of Feiling

Base64 coding can be understood this way

Bing.com網站

NBA player analysis

Solution of Queen n problem

15_ Redis_ Redis. Conf detailed explanation

Be a good gatekeeper on the road of anti epidemic -- infrared thermal imaging temperature detection system based on rk3568
随机推荐
20_ Redis_ Sentinel mode
02_线性表_顺序表
Application of CDN in game field
SQL transaction
How to conduct TPC-C test on tidb
Sharp tool SPL for post SQL calculation
LeetCode刷题——奇偶链表#328#Medium
06_ Stack and queue conversion
Steps for Navicat to create a new database
Be a good gatekeeper on the road of anti epidemic -- infrared thermal imaging temperature detection system based on rk3568
LeetCode刷题——统计各位数字都不同的数字个数#357#Medium
Yolov5 code reproduction and server operation
Tidb data migration scenario overview
Table responsive layout tips
15_ Redis_ Redis. Conf detailed explanation
How to solve the problem of database content output
06_栈和队列转换
Topology architecture of the minimum deployment of tidb cluster
. Solution to the problem of Chinese garbled code when net core reads files
4. Jctree related knowledge learning