Skip to content

A simple update checker to compare a local version number against a github release

License

Notifications You must be signed in to change notification settings

Christian1984/go-update-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version Checker for Go

go-update-checker is a go library for checking the version of a currently installed application or package against its latest release on github. It also enables caching and setting a minimum interval of days after which a updatecheck against the github API should be performed to prevent spamming the API.

Versions used with go-update-checker must follow SemVer.

Installation and Usage

Installation can be done with a normal go get:

$ go get github.com/Christian1984/go-update-checker

Update Check Example

import (
    "fmt"

    updatechecker "github.com/Christian1984/go-update-checker"
)

func main() {
    uc := updatechecker.New("Christian1984", "go-update-checker", "Go Update Checker", "", 0, true, false)
    uc.CheckForUpdate("0.0.1")
    uc.PrintMessage()
    /*
    =============================================================
    === INFO: A new update is available for Go Update Checker ===

    Version: 0.0.2

    Title: Go Update Checker - 0.0.2

    Description:
    Changed receivers to pointer receivers


    Download the latest version here:
    https://github.com/Christian1984/go-update-checker/releases
    =============================================================
    */

    uc.CheckForUpdate("0.0.2")
    uc.PrintMessage()
    /*
    ========================================================================
    === INFO: You are running the latestest Version of Go Update Checker ===
    ========================================================================
    */

    /* alternatively use uc.Message (type string) in any other context */
}

Issues and Contributing

If you find an issue with this library, please report an issue. If you'd like, we welcome any contributions. Fork this library and submit a pull request.

About

A simple update checker to compare a local version number against a github release

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages