updatechecker

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2021 License: MPL-2.0 Imports: 8 Imported by: 1

README

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.

Documentation

Index

Constants

View Source
const DateFormat string = time.UnixDate
View Source
const Filename string = "latestcheck.json"

Variables

This section is empty.

Functions

func New

func New(owner string, repo string, software string, downloadLink string, minDaysInterval int, verbose bool) updateChecker

Types

type CheckData

type CheckData struct {
	Timestamp   string `json:"timestamp"`
	Version     string `json:"version"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type GithubApiResponseData

type GithubApiResponseData struct {
	Version     string `json:"tag_name"`
	Name        string `json:"name"`
	Description string `json:"body"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL