开源发布go项目包

88 阅读1分钟

1 新建仓库

Screenshot_select-area_20230605162016.png 填写相关信息后(注:需选择Public), 创建仓库

2 初始化项目代码

获取远程仓库代码

git clone https://github.com/{YOUR_GITHUB_NAME}/{YOUR_GITHUB_PROJECT}.git

例子

git clone https://github.com/go75/gol.git

初始化项目

go mod init github.com/{YOUR_GITHUB_NAME}/{YOUR_GITHUB_PROJECT}

例子

go mod init github.com/go75/gol

3 编写项目代码

image.png

4 发布代码

提交到远程仓库

git add -A
git commit -m "update project"
git push

image.png

填写发布信息, 发布代码

5 引用包

拉取包

go get github.com/{YOUR_GITHUB_NAME}/{YOUR_GITHUB_PROJECT}

例子

go get github.com/go75/gol

导入包

image.png