From 14a371447f7abb5a94158f92675cffef78e6cf26 Mon Sep 17 00:00:00 2001 From: asahi Date: Sun, 5 Jan 2025 21:23:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E8=AF=BBgolang=20mod=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Golang/Golang Document.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Golang/Golang Document.md diff --git a/Golang/Golang Document.md b/Golang/Golang Document.md new file mode 100644 index 0000000..a890adf --- /dev/null +++ b/Golang/Golang Document.md @@ -0,0 +1,14 @@ +# Golang +## Get Started +### Enable dependency tracking +当代码对其他module中包含的package进行了import时,在自己的module中来管理依赖。 + +自己的module通过`go.mod`文件来定义,`go.mod`文件中会track项目所需要的依赖。 + +#### go mod init +`go mod init `命令会创建一个`go.mod`文件,其中``会是module path。 + +在实际开发中,module name通常是source code被保存的repository location,例如,`uuid`module的module name为`github.com/google/uuid`。 + +#### go mod tidy +`go mod tidy`命令会根据import添加缺失的module并且移除未使用的module。 \ No newline at end of file