当前位置:网站首页>[go record] start go language from scratch -- make an oscilloscope with go language (I) go language foundation
[go record] start go language from scratch -- make an oscilloscope with go language (I) go language foundation
2022-07-08 00:51:00 【Ah Dan of maker Association】
I participated in a challenge today , Starting from scratch GO Language , For a week GO Language development of a serial port oscilloscope .
I haven't been in contact with GO Language , It's just C/C++, Learn from scratch GO, expect 8 Fast hours .
Use this for learning videos : Learning video
GO Language benefits : Simple and easy to use .
Dachang road , Yes C The foundation is easy to take off .
The goal is 
GO grammar :
GO Language variables 
Be similar to C Enumeration of languages :
Returns two values :


init and import Guide pack 


Be similar to include, stay GO It's called guide bag




Basic pointer ( Did you learn C You can skip )
defer( No define)
Finally execute in the form of stack .( It is roughly to set a stack in the function , Execute first, press in first , After the function runs , Out of the stack , The first is the last )
Follow the principle of "first in, second out" .


return The following statement is executed first .defer Finally, execute .
for loop :
len Calculate the length of the array :
The array length should match 

// What is passed is reference passing , It's a pointer ( Similar to array name , The type is int[])

slice Four methods of :
%v Is to print out variables variable It means , Joint output [].

Four statements slice The way :
by make() add to 
slice Slice addition and interception :
Capacity and length are different ,

The length is indeed 3, But capacity is an illegal pointer ptr Values outside ( from make The third parameter determines ), Want to operate the first one behind , Have to use append( Slice name [],2) It means appending a value to the slice name , by 2,
Reuse append( Slice name [],3) It can be added as the data of the fifth capacity , When it comes to the fifth or more , Reuse append( Slice name [],2) You can open up the length and capacity , The development size is the previous cap The capacity of ( Opened up at one time 5 individual , In an inch of land, an inch of gold flash Don't like to play like this )
copy function :
map Three declaration definitions of :
Now this is an empty map(==nil( Equivalent to NULL))
map usage :
边栏推荐
猜你喜欢

RPA云电脑,让RPA开箱即用算力无限?

QT establish signal slots between different classes and transfer parameters

Is Zhou Hongyi, 52, still young?

ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification

ReentrantLock 公平锁源码 第0篇

【测试面试题】页面很卡的原因分析及解决方案

Tencent security released the white paper on BOT Management | interpreting BOT attacks and exploring ways to protect

RPA cloud computer, let RPA out of the box with unlimited computing power?

第一讲:链表中环的入口结点

他们齐聚 2022 ECUG Con,只为「中国技术力量」
随机推荐
Su embedded training - Day3
Cancel the down arrow of the default style of select and set the default word of select
《因果性Causality》教程,哥本哈根大学Jonas Peters讲授
新库上线 | 中国记者信息数据
服务器防御DDOS的方法,杭州高防IP段103.219.39.x
Qt不同类之间建立信号槽,并传递参数
Lecture 1: the entry node of the link in the linked list
测试流程不完善,又遇到不积极的开发怎么办?
Play sonar
How to insert highlighted code blocks in WPS and word
Basic mode of service mesh
5G NR 系统消息
Fofa attack and defense challenge record
Summary of the third course of weidongshan
Vscode software
Reentrantlock fair lock source code Chapter 0
8道经典C语言指针笔试题解析
QT adds resource files, adds icons for qaction, establishes signal slot functions, and implements
DNS series (I): why does the updated DNS record not take effect?
NVIDIA Jetson测试安装yolox过程记录