当前位置:网站首页>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语言配置
配置安装源
边栏推荐
- 请问postgresql cdc 怎么设置单独的增量模式呀,debezium.snapshot.mo
- Coneroller执行时候的-26374及-26377错误
- 微信小程序触底加载与下拉刷新的实现
- Excerpt from "sword comes" (VII)
- Go项目实战—参数绑定,类型转换
- How to plan the career of a programmer?
- 微信小程序中,从一个页面跳转到另一个页面后,在返回后发现页面同步滚动了
- Have you learned to make money in Dingding, enterprise micro and Feishu?
- 【JS】提取字符串中的分数,汇总后算出平均分,并与每个分数比较,输出
- Workmanager learning 1
猜你喜欢
> Could not create task ‘:app:MyTest. main()‘. > SourceSet with name ‘main‘ not found. Problem repair
[论文阅读] KGAT: Knowledge Graph Attention Network for Recommendation
学习笔记4--高精度地图关键技术(下)
AtCoder Beginner Contest 258「ABCDEFG」
Learning II of workmanager
Detailed explanation of the use of staticlayout
Learning notes 5 - high precision map solution
Have you learned to make money in Dingding, enterprise micro and Feishu?
What is the most suitable book for programmers to engage in open source?
Pseudo class elements -- before and after
随机推荐
Constrained layout flow
In wechat applet, after jumping from one page to another, I found that the page scrolled synchronously after returning
SAP ui5 objectpagelayout control usage sharing
运算符、、
小程序中自定义行内左滑按钮,类似于qq和wx消息界面那种
变量///
LDAP概述
[JS] array dimensionality reduction
Have you learned to make money in Dingding, enterprise micro and Feishu?
数据类型、
【js学习笔记五十四】BFC方式
2022鹏城杯web
微信核酸检测预约小程序系统毕业设计毕设(6)开题答辩PPT
小程序框架Taro
[paper reading] ckan: collaborative knowledge aware autonomous network for adviser systems
Universal double button or single button pop-up
SLAM 01.人类识别环境&路径的模型建立
官网给的这个依赖是不是应该为flink-sql-connector-mysql-cdc啊,加了依赖调
@Jsonadapter annotation usage
Web Components