diff options
Diffstat (limited to 'config.go')
-rw-r--r-- | config.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -10,6 +10,7 @@ import ( ) const _defaultGodocServer = "pkg.go.dev" +const _defaultBranch = "master" // Config represents the structure of the yaml file type Config struct { @@ -22,7 +23,8 @@ type Config struct { // Package details the options available for each repo type Package struct { - Repo string `yaml:"repo"` + Repo string `yaml:"repo"` + Branch string `yaml:"branch"` } // ensureAlphabetical checks that the packages are listed alphabetically in the configuration. @@ -75,5 +77,13 @@ func Parse(path string) (*Config, error) { c.Godoc.Host = host } + // set default branch + for v, p := range c.Packages { + if p.Branch == "" { + p.Branch = _defaultBranch + c.Packages[v] = p + } + } + return &c, err } |