Member-only story
Publishing a Go Module on pkg.go.dev
Creating and publishing a Go module on pkg.go.dev is a great way to share your Go package with other developers. This guide will walk you through the steps you need for publishing your own Go module.
Step 1: Install Go
Before creating a Go module, you need to install Go on your computer. Here’s how:
- Download Go: Download the version of Go for your operating system (Windows, macOS, or Linux) and follow the instructions for your operating system to install Go.
- Verify Go Installation: Open a terminal (Command Prompt on Windows, or Terminal on macOS and Linux) and type:
go version
if after installing Go the package didn’t update your
PATH
environment, you might need to update it yourself, for example in Mac you can runexport PATH=$PATH:/usr/local/go/bin
If the installation was successful, you will see the installed Go version (for example, `go version go1.18`).
Now, Go is installed, and you’re ready to create your Go module!
Step 2: Create Your Go Module
First, you need to have a public github repository which does have the source code for your module. Feel free to create one and once you have it, clone it in a folder which…