diff options
author | 2021-05-19 00:49:33 +0200 | |
---|---|---|
committer | 2021-05-18 15:49:33 -0700 | |
commit | 4f8f13fd76f065e49efdb3aa1a7504ffcafbf9a8 (patch) | |
tree | f68612e4882f707840ef0a1bc0d14477dfcb1c06 /config.go | |
parent | b627e361379b89802df4930abbc64ce26bd8f323 (diff) | |
download | sally-4f8f13fd76f065e49efdb3aa1a7504ffcafbf9a8.tar.gz sally-4f8f13fd76f065e49efdb3aa1a7504ffcafbf9a8.tar.zst sally-4f8f13fd76f065e49efdb3aa1a7504ffcafbf9a8.zip |
Allow setting branch (#46)
Support specifying the branch from which source will be served in
the YAML configuration.
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 } |