当前位置:网站首页>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 .
边栏推荐
- Bing.com网站
- MySQL calculate n-day retention rate
- LeetCode_ String_ Simple_ 412.Fizz Buzz
- Table responsive layout tips
- How to conduct TPC-C test on tidb
- SQL transaction
- Steps for Navicat to create a new database
- 03_ Linear table_ Linked list
- 18_ Redis_ Redis master-slave replication & cluster building
- 16_Redis_Redis持久化
猜你喜欢

4. Jctree related knowledge learning

XML Configuration File

Practice of compiling principle course -- implementing an interpreter or compiler of elementary function operation language

飞凌嵌入式RZ/G2L处理器核心板及开发板上手评测

Map介绍

Map introduction

Equipped with Ti am62x processor, Feiling fet6254-c core board is launched!
![[c voice] explain the advanced pointer and points for attention (2)](/img/fb/515e25899bd9a2905ee63cb041934a.png)
[c voice] explain the advanced pointer and points for attention (2)

Kibana basic operation

Solve the problem of frequent interruption of mobaxterm remote connection
随机推荐
TiDB数据迁移场景综述
How to write sensor data into computer database
Application and practice of Jenkins pipeline
19_ Redis_ Manually configure the host after downtime
6.12 企业内部upp平台(Unified Process Platform)的关键一刻
12_Redis_Bitmap_命令
[solution] educational codeforces round 82
Learn the method code of using PHP to realize the conversion of Gregorian calendar and lunar calendar
Libcurl Lesson 13 static library introduces OpenSSL compilation dependency
Common English abbreviations for data analysis (I)
Storage read-write speed and network measurement based on rz/g2l | ok-g2ld-c development board
13_Redis_事务
数据分析常见的英文缩写(一)
03.golang初步使用
学习使用php实现公历农历转换的方法代码
LeetCode刷题——两整数之和#371#Medium
Force deduction solution summary 2029 stone game IX
05_队列
Huffman tree: (1) input each character and its weight (2) construct Huffman tree (3) carry out Huffman coding (4) find hc[i], and get the Huffman coding of each character
党史纪实主题公益数字文创产品正式上线