common

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogs

func InitLogs(config *BaseConfig)

InitLogs - initialize log facility

func LoadConfig

func LoadConfig(file io.Reader, config Config) error

LoadConfig - Creates and validates config from given reader

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

Analyzer -

func NewAnalyzer

func NewAnalyzer(config *BaseConfig, metrics *Metrics) *Analyzer

NewAnalyzer -

func (*Analyzer) ProcessProject

func (a *Analyzer) ProcessProject(config *GitConfig) error

ProcessProject - analyze a single project

func (*Analyzer) RunForever

func (a *Analyzer) RunForever(interval time.Duration)

RunForever - starts endless analyze loop

type BaseConfig

type BaseConfig struct {
	Log      LogConfig   `yaml:"log"`
	Projects []GitConfig `yaml:"projects"`
}

BaseConfig -

func (*BaseConfig) Validate

func (c *BaseConfig) Validate() error

Validate - Validate configuration object

type Config

type Config interface {
	Validate() error
}

Config - Interface

type GitAuth

type GitAuth struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

GitAuth -

type GitConfig

type GitConfig struct {
	URL  string   `yaml:"url"`
	Auth *GitAuth `yaml:"auth"`
}

GitConfig -

func (*GitConfig) AuthMethod

func (c *GitConfig) AuthMethod() transport.AuthMethod

AuthMethod - create transport Auth handler

func (*GitConfig) Entry

func (c *GitConfig) Entry() *log.Entry

Entry - generate log entry for current object

type LogConfig

type LogConfig struct {
	JSON    bool   `yaml:"json"`
	Level   string `yaml:"level"`
	NoColor bool   `yaml:"no_color"`
}

LogConfig -

type Metrics

type Metrics struct {
	Info       *prometheus.GaugeVec
	Deprecated *prometheus.GaugeVec
	Status     *prometheus.GaugeVec
	Duration   prometheus.Gauge
	Registry   *prometheus.Registry
}

Metrics - hold metrics and initialized registry

func NewMetrics

func NewMetrics(ns string) *Metrics

NewMetrics - create Metrics object

type ModuleError

type ModuleError struct {
	Err string // error text
}

ModuleError -

type ModulePublic

type ModulePublic struct {
	Path      string        `json:",omitempty"` // module path
	Version   string        `json:",omitempty"` // module version
	Versions  []string      `json:",omitempty"` // available module versions
	Replace   *ModulePublic `json:",omitempty"` // replaced by this module
	Time      *time.Time    `json:",omitempty"` // time version was created
	Update    *ModulePublic `json:",omitempty"` // available update (with -u)
	Main      bool          `json:",omitempty"` // is this the main module?
	Indirect  bool          `json:",omitempty"` // module is only indirectly needed by main module
	Dir       string        `json:",omitempty"` // directory holding local copy of files, if any
	GoMod     string        `json:",omitempty"` // path to go.mod file describing module, if any
	GoVersion string        `json:",omitempty"` // go version used in module
	Error     *ModuleError  `json:",omitempty"` // error loading module
}

ModulePublic -

Jump to

Keyboard shortcuts

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