当前位置:网站首页>Go-3-第一个Go程序
Go-3-第一个Go程序
2022-07-05 10:23:00 【hahyyy】
第一个Go程序(在Linux系统下)
新建一个文件 ~/code/example.go
// 声明该文件所在包,如果是主程序就是main
// Go语言中使用包来组织代码
// 一般一个文件夹即一个包
// 包内可以暴露类型或方法供其他包使用
package main
// 导入库
// fmt是Go语言的一个标准库/包
// 用来处理标准输入输出
import "fmt"
// main 函数是整个程序的入口,main函数所在的包名也必须为 `main`
// 主包中必须包含一个main函数
func main() {
// 调用fmt包的Println方法,在屏幕输出信息
fmt.Println("Hello World!")
}
// 一行代表一个语句结束,多个语句写在同一行,则必须使用;来人为区分
// 单行注释://
// 多行注释:/* --- */
// 标识符:同python标识符规则运行代码
- 直接运行

- 先编译再执行
![]()
Go语言配置
配置安装源

边栏推荐
- [observation] with the rise of the "independent station" model of cross-border e-commerce, how to seize the next dividend explosion era?
- LDAP概述
- 数组、、、
- 运算符、、
- 爬虫(9) - Scrapy框架(1) | Scrapy 异步网络爬虫框架
- Ad20 make logo
- DDOS攻击原理,被ddos攻击的现象
- mongoDB副本集
- 【Vite】1371- 手把手开发 Vite 插件
- ByteDance Interviewer: how to calculate the memory size occupied by a picture
猜你喜欢

Timed disappearance pop-up

Window下线程与线程同步总结

The most complete is an I2C summary

> Could not create task ‘:app:MyTest. main()‘. > SourceSet with name ‘main‘ not found. Problem repair

ByteDance Interviewer: how to calculate the memory size occupied by a picture

双向RNN与堆叠的双向RNN
![[dark horse morning post] Luo Yonghao responded to ridicule Oriental selection; Dong Qing's husband Mi Chunlei was executed for more than 700million; Geely officially acquired Meizu; Huawei releases M](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] Luo Yonghao responded to ridicule Oriental selection; Dong Qing's husband Mi Chunlei was executed for more than 700million; Geely officially acquired Meizu; Huawei releases M

Comparative learning in the period of "arms race"

2022年化工自动化控制仪表考试试题及在线模拟考试

How does redis implement multiple zones?
随机推荐
数据类型、
C language QQ chat room small project [complete source code]
Learning II of workmanager
Flink CDC cannot monitor MySQL logs. Have you ever encountered this problem?
Golang应用专题 - channel
【js学习笔记五十四】BFC方式
小程序框架Taro
风控模型启用前的最后一道工序,80%的童鞋在这都踩坑
php解决redis的缓存雪崩,缓存穿透,缓存击穿的问题
Nine degrees 1480: maximum ascending subsequence sum (dynamic programming idea for the maximum value)
脚手架开发进阶
Window下线程与线程同步总结
微信核酸检测预约小程序系统毕业设计毕设(6)开题答辩PPT
PHP solves the problems of cache avalanche, cache penetration and cache breakdown of redis
想请教一下,十大券商有哪些?在线开户是安全么?
MFC宠物商店信息管理系统
分享.NET 轻量级的ORM
[paper reading] ckan: collaborative knowledge aware autonomous network for adviser systems
websocket
请问postgresql cdc 怎么设置单独的增量模式呀,debezium.snapshot.mo