Skip to content

Instantly share code, notes, and snippets.

@mitchallen
Last active April 15, 2023 09:53
Show Gist options
  • Save mitchallen/8c841a412838bf38b2dc5e4995fc6667 to your computer and use it in GitHub Desktop.
Save mitchallen/8c841a412838bf38b2dc5e4995fc6667 to your computer and use it in GitHub Desktop.
Example Go package README

github.com/mitchallen/go-lib

Usage

Initialize your module

go mod init example.com/my-golib-demo

Get the go-lib module

Note that you need to include the v in the version tag.

go get github.com/mitchallen/[email protected]
package main

import (
    "fmt"

    "github.com/mitchallen/go-lib"
)

func main() {
    fmt.Println(golib.Add(2,3))
    fmt.Println(golib.Subtract(2,3))
}

Testing

go test

Tagging

git tag v0.1.0
git push origin --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment