hincky的主页 hincky的主页
  • 2023

    • nginx
    • prometheus
    • 小工具
    • 部署
  • 数据库

    • MySQL是怎么使用/运行的
    • Redis核心技术与实战
  • 极客时间

    • Web协议详解与抓包实战
    • SQL必知必会
    • MySQL45讲
个人日常
  • 分类
  • 标签
  • 归档
  • 随笔
GitHub (opens new window)

Hincky

当有趣的人,做想做的事
  • 2023

    • nginx
    • prometheus
    • 小工具
    • 部署
  • 数据库

    • MySQL是怎么使用/运行的
    • Redis核心技术与实战
  • 极客时间

    • Web协议详解与抓包实战
    • SQL必知必会
    • MySQL45讲
个人日常
  • 分类
  • 标签
  • 归档
  • 随笔
GitHub (opens new window)
  • 2022

  • 2023

    • 一月

    • 五月

    • nginx

    • prometheus

    • tools

    • http状态码

    • 监控

    • Go

      • 系统需求说明
      • installation
        • linux安装Go
      • hello world
        • 开启依赖追踪
        • 编写hello world
        • 调用外部模块的函数
      • go-tour
        • 官网在线教程
    • python

    • linux性能优化

    • PHP

    • elastic

    • chatgpt

    • 小工具

    • js

    • django

    • centos7.6配置

    • 部署

    • 部署资源整理

    • MySQL数据库

  • 工作记录
  • 2023
  • Go
hincky
2023-04-24
目录

hello world

  • 开启依赖追踪
  • 编写hello world
  • 调用外部模块的函数

# 开启依赖追踪

按照官网的介绍,在确定好了工作目录之后的第一步,就是开启依赖追踪。

一个go.mod文件可以记录并追踪所有代码里面所用到的依赖,所以要在正式写代码之前,创建初始化一个go.mod文件用来管理所有相关依赖。

名称是模块的模块路径。

go mod init example.com/hello
1

# 编写hello world

mkdir -p demo-1 && cd $_
go mod init example.com/hello
cat > hello.go << EOF
package main

import "fmt"

func main()  {
	  fmt.Println("hello world")
}
EOF

go run .
1
2
3
4
5
6
7
8
9
10
11
12
13

# 调用外部模块的函数

编辑 (opens new window)
installation
go-tour

← installation go-tour→

最近更新
01
集成chatgpt的工具
05-24
02
修改服务器ssh默认连接端口
05-22
03
阿里云免费证书
05-15
更多文章>
Theme by Vdoing | Copyright © 2022-2023 Hincky | MIT License | 粤ICP备2022120427号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式