Get Your Go Package on pkg.go.dev: A Simple Guide
To get your Go package on pkg.go.dev
, you need to publish your code, create a go.mod
file, and tag a version.
1. Publish Your Code Publicly
Host your package on a public repository like GitHub, GitLab, or Bitbucket. pkg.go.dev
can only access public code.
2. Create a Go Module
Ensure your project's root directory has a go.mod
file. If not, run this command, replacing the placeholder with your repository URL:
go mod init github.com/your-username/your-repo-name
3. Tag and Push a Version
pkg.go.dev
indexes stable versions, which are marked by a Git tag. The tag must start with a "v".
# Create the tag
git tag v1.0.0
# Push the tag to your remote repository
git push origin v1.0.0
4. Manually Request Indexing
Finally, ask pkg.go.dev
to crawl your repository by visiting this URL:
https://pkg.go.dev/github.com/your-username/your-repo-name@v1.0.0
Then click "Request button" on the screen
It may take a few minutes for your page to appear.
Top comments (0)