From ac7ca25456864ff30b1b9beaf5e4a1fc928eb098 Mon Sep 17 00:00:00 2001 From: "rick.chan" Date: Thu, 25 Feb 2021 15:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20Go=20=E5=8C=85=E7=9A=84?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=92=8C=E4=BD=BF=E7=94=A8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: rick.chan --- .../Language/Go/Package/Go_包的创建和使用.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Software/Development/Language/Go/Package/Go_包的创建和使用.md diff --git a/Software/Development/Language/Go/Package/Go_包的创建和使用.md b/Software/Development/Language/Go/Package/Go_包的创建和使用.md new file mode 100644 index 0000000..c19ae72 --- /dev/null +++ b/Software/Development/Language/Go/Package/Go_包的创建和使用.md @@ -0,0 +1,35 @@ +# Go 包的创建和使用 + +## 1.创建包 + +```go +/** + * @file demo/pkg/pkg.go + */ +package pkg + +// ... + +``` + +## 2.使用包 + +```go +/** + * @file demo/main.go + */ +package main + +import ( + // 相对于当前路径 + "demo/pkg" + // 在 $GOPATH 下 + "my.com/mypkg" +) + +func main() { + // ... +} + +// ... +```