当前位置:网站首页>Go语言学习笔记 1.1
Go语言学习笔记 1.1
2022-06-26 06:13:00 【是誰萆微了承諾】
一、下载vscode
下载地址:https://code.visualstudio.com/

二、安装golang 包
下载地址:https://studygolang.com/dl

三、小试牛刀
新建一个test.go文件
package main
import "fmt"
func main(){
fmt.Println("hello,word!")
}
//打印输出有2种
1 先编译 在输出 go build test.go 会生成一个go.exe 文件 执行go.exe文件 会输出hello,word
2 直接运行 go run test.go 会输出 hello,word
四、 golang执行流程
1.先编译(go build ...)成可执行文件,可以将该文件复制到没有go开发环境的地方,是可以进行运行的。但是由于编译会把go环境编译进去所以文件会大很多。
2.go run ... 如果我们要在另一个地方(另外一台机器)运行。那么他必须有go语言开发环境,否则无法运行。
go build -o man.exe 指定生成文件名
五 Go语言开发注意事项
1.Go文件以.go文件结尾
2.Go语言的程序入口文件是main()函数。
3.Go语言严格区分大小写(注意函数里面参数单双引号的使用)
4.Go方法会自动加分号,所以不需要在手动添加分号了
5.Go语言是一行一行的进行执行,所以我们每条语句写在一行,不要写在一同一行
6.Go语言定义的变量和引用的import的包如果没有使用,则不能编译通过。
六、Go语言常用的转义字符
1.\t 制表符,实现对齐功能
2.\n 换行符
3.\\转义字符 意思是输出\
4.\r 回车 回车后面内容会替换前面的内容
边栏推荐
- Play with a variety of application scenarios and share secrets with Kwai MMU
- Library management system
- Zotero使用之自定义参考文献格式
- Logstash -- send an alert message to the nail using the throttle filter
- 跨域的五种解决方案
- Alarm operation and Maintenance Center | build an efficient and accurate alarm collaborative processing system
- Several promotion routines of data governance
- The difference between overload method and override method
- Playing RTSP streaming video on Web pages (webrtc)
- typescript的class结合接口(interface)的简单使用
猜你喜欢

Redis multithreading and ACL
The sysdig 2022 cloud native security and usage report found that more than 75% of the running containers have serious vulnerabilities

Import export simple

事务与消息语义

Five solutions across domains

Zotero文献管理工具之Jasminum(茉莉花)插件

MYSQL索引不生效的原因

消息队列-功能、性能、运维对比

Import / export function implementation

数据可视化实战:实验报告
随机推荐
MVC source code sharing
自顶向下的变成方法
MySQL-09
China micro cultivator market trend report, technical dynamic innovation and market forecast
Hot! 11 popular open source Devops tools in 2021!
Understanding of nil in go language
Gof23 - prototype mode
Pytorch uses multi GPU parallel training and its principle and precautions
Redis multithreading and ACL
04. basic data type - list, tuple
volatile应用场景
温度报警器
Logstash -- send an alert message to the nail using the throttle filter
Gof23 - builder mode
06. talk about the difference and coding between -is and = = again
Typora activation method
【Spark】Spark SQL 字段血缘如何实现
numpy.exp()
How can an enterprise successfully complete cloud migration?
Transaction and message semantics