ver

package module
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 6 Imported by: 2

README

go-kit/ver

Go Reference GitHub Release GoCard GitHub license

Назначение

По метаданным приложения

  • адрес git репозитория
  • номер версии

запросить git репозиторий на предмет истории релизов и, если последний релиз отличается от номера версии, выдать предупреждение в лог.

Использование

см ver_test.go

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(repo, version string)

Check called as goroutine

Example
package main

import (
	"log/slog"
	"os"

	"github.com/LeKovr/go-kit/ver"
)

var (
	version = "0.0-dev"

	repo = "git@github.com:LeKovr/dbrpc.git"
)

func replace(groups []string, a slog.Attr) slog.Attr {

	if a.Key == slog.TimeKey {
		return slog.Attr{}
	}
	return a
}

func main() {
	logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{ReplaceAttr: replace}))
	slog.SetDefault(logger)
	ver.Check(repo, version)
}
Output:

{"level":"INFO","msg":"App version is outdated","appVersion":"0.0-dev","sourceVersion":"v0.31","sourceUpdated":"2017-10-17T08:56:03Z","sourceLink":" See https://github.com/LeKovr/dbrpc/releases/tag/v0.31"}

func IsCheckOk

func IsCheckOk(repo, version string) (bool, error)

IsCheckOk does version check at git repo and returns result

Types

This section is empty.

Jump to

Keyboard shortcuts

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