GO Language Chapter: Publishing Open Source Software Packages

GO Language Chapter: Publishing Open Source Software Packages

When we write GO language programs, we will inevitably refer to third-party software packages. So do you know how others publish their own software packages? Don’t worry, this blog will teach you how to do it.

Create a new warehouse

Create a new warehouse

Pull to local

git clone https://github.com/go75/my-package.git

Initialize project

go mod init github.com/go75/my-package.git

Write code

mkdir utils
echo "
package utils

func PrintHello() {
    print("Hello")
}" > utils/hello.go

Submit code

git add .
git commit -m "update"
git push

release

releaserelease

Reference package

go get github.com/go75/my-package/utils

Reference package

So far, you have released your first GO language open source software package.

Guess you like

Origin blog.csdn.net/qq_67733273/article/details/132797126