mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
20191215 code improvements (#790)
* Upgrade godo to latest * Fix a bunch of issues found by * Running staticcheck on a codebase for the first time is a sobering experience * go mod tidy * More static improvements Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -7,11 +7,18 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultTitle = "Buildkite"
|
||||
defaultFocusable = true
|
||||
)
|
||||
|
||||
// PipelineSettings defines the configuration properties for a pipeline
|
||||
type PipelineSettings struct {
|
||||
slug string
|
||||
branches []string
|
||||
}
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
apiKey string `help:"Your Buildkite API Token"`
|
||||
@@ -19,9 +26,7 @@ type Settings struct {
|
||||
pipelines []PipelineSettings `help:"An array of pipelines to get data from"`
|
||||
}
|
||||
|
||||
const defaultTitle = "Buildkite"
|
||||
const defaultFocusable = true
|
||||
|
||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
@@ -33,10 +38,12 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
||||
return &settings
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func buildPipelineSettings(ymlConfig *config.Config) []PipelineSettings {
|
||||
pipelines := []PipelineSettings{}
|
||||
|
||||
for slug, _ := range ymlConfig.UMap("pipelines") {
|
||||
for slug := range ymlConfig.UMap("pipelines") {
|
||||
branches := utils.ToStrs(ymlConfig.UList("pipelines." + slug + ".branches"))
|
||||
if len(branches) == 0 {
|
||||
branches = []string{"master"}
|
||||
|
||||
Reference in New Issue
Block a user