diff options
author | Tyler Cipriani <tcipriani@wikimedia.org> | 2017-06-29 14:42:32 -0600 |
---|---|---|
committer | Tyler Cipriani <tcipriani@wikimedia.org> | 2017-06-29 14:45:04 -0600 |
commit | 56e09bc388d5ae1791045aabdb3a0eabd497d169 (patch) | |
tree | 858f056867bfcbf7a1e85d5d5c5a1f5b06d98f24 /config | |
parent | 9f2ef14ba62f26ded606260891a648c294b50d4b (diff) | |
download | blubber-56e09bc388d5ae1791045aabdb3a0eabd497d169.tar.gz |
Run go fmt
Summary:
One of Golang's "advantages" is not quibbling over style. To this end
the `go fmt` command exists. This is the result of me running:
find . -name '*.go' -exec go fmt {} \;
Test Plan: built package, ran tests
Reviewers: dduvall, mmodell, #release-engineering-team
Reviewed By: dduvall, mmodell, #release-engineering-team
Subscribers: hashar
Tags: #release-engineering-team
Differential Revision: https://phabricator.wikimedia.org/D694
Diffstat (limited to 'config')
-rw-r--r-- | config/apt.go | 1 | ||||
-rw-r--r-- | config/artifacts.go | 4 | ||||
-rw-r--r-- | config/common.go | 13 | ||||
-rw-r--r-- | config/config.go | 2 | ||||
-rw-r--r-- | config/flag.go | 4 | ||||
-rw-r--r-- | config/flag_test.go | 1 | ||||
-rw-r--r-- | config/npm.go | 6 | ||||
-rw-r--r-- | config/reader.go | 1 | ||||
-rw-r--r-- | config/runs.go | 28 | ||||
-rw-r--r-- | config/variant.go | 4 |
10 files changed, 37 insertions, 27 deletions
diff --git a/config/apt.go b/config/apt.go index c4436c1..2382bbf 100644 --- a/config/apt.go +++ b/config/apt.go @@ -2,6 +2,7 @@ package config import ( "strings" + "phabricator.wikimedia.org/source/blubber.git/build" ) diff --git a/config/artifacts.go b/config/artifacts.go index fd7b741..a8108d0 100644 --- a/config/artifacts.go +++ b/config/artifacts.go @@ -1,7 +1,7 @@ package config type ArtifactsConfig struct { - From string `yaml:"from"` - Source string `yaml:"source"` + From string `yaml:"from"` + Source string `yaml:"source"` Destination string `yaml:"destination"` } diff --git a/config/common.go b/config/common.go index 31916dd..f627b05 100644 --- a/config/common.go +++ b/config/common.go @@ -5,12 +5,12 @@ import ( ) type CommonConfig struct { - Base string `yaml:"base"` - Apt AptConfig `yaml:"apt"` - Npm NpmConfig `yaml:"npm"` - Runs RunsConfig `yaml:"runs"` - SharedVolume Flag `yaml:"sharedvolume"` - EntryPoint []string `yaml:"entrypoint"` + Base string `yaml:"base"` + Apt AptConfig `yaml:"apt"` + Npm NpmConfig `yaml:"npm"` + Runs RunsConfig `yaml:"runs"` + SharedVolume Flag `yaml:"sharedvolume"` + EntryPoint []string `yaml:"entrypoint"` } func (cc1 *CommonConfig) Merge(cc2 CommonConfig) { @@ -28,7 +28,6 @@ func (cc1 *CommonConfig) Merge(cc2 CommonConfig) { } } - func (cc *CommonConfig) PhaseCompileableConfig() []build.PhaseCompileable { return []build.PhaseCompileable{cc.Apt, cc.Npm, cc.Runs} } diff --git a/config/config.go b/config/config.go index ee38ea8..6f4283f 100644 --- a/config/config.go +++ b/config/config.go @@ -2,5 +2,5 @@ package config type Config struct { CommonConfig `yaml:",inline"` - Variants map[string]VariantConfig `yaml:"variants"` + Variants map[string]VariantConfig `yaml:"variants"` } diff --git a/config/flag.go b/config/flag.go index aa4cc68..b841819 100644 --- a/config/flag.go +++ b/config/flag.go @@ -2,10 +2,10 @@ package config type Flag struct { True bool - set bool + set bool } -func (flag *Flag) UnmarshalYAML(unmarshal func(interface {}) error) error { +func (flag *Flag) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := unmarshal(&flag.True); err != nil { return err } diff --git a/config/flag_test.go b/config/flag_test.go index 6393dd5..e249e60 100644 --- a/config/flag_test.go +++ b/config/flag_test.go @@ -2,6 +2,7 @@ package config_test import ( "testing" + "gopkg.in/stretchr/testify.v1/assert" "phabricator.wikimedia.org/source/blubber.git/config" diff --git a/config/npm.go b/config/npm.go index 91cfc26..f6ed323 100644 --- a/config/npm.go +++ b/config/npm.go @@ -8,8 +8,8 @@ import ( const tempNpmInstallDir = "/tmp/node-deps/" type NpmConfig struct { - Install Flag `yaml:"install"` - Env string `yaml:"env"` + Install Flag `yaml:"install"` + Env string `yaml:"env"` } func (npm *NpmConfig) Merge(npm2 NpmConfig) { @@ -20,7 +20,7 @@ func (npm *NpmConfig) Merge(npm2 NpmConfig) { } } -func (npm NpmConfig) InstructionsForPhase(phase build.Phase) []build.Instruction{ +func (npm NpmConfig) InstructionsForPhase(phase build.Phase) []build.Instruction { if npm.Install.True { switch phase { case build.PhasePreInstall: diff --git a/config/reader.go b/config/reader.go index 478a312..05f50ce 100644 --- a/config/reader.go +++ b/config/reader.go @@ -3,6 +3,7 @@ package config import ( "errors" "io/ioutil" + "gopkg.in/yaml.v2" ) diff --git a/config/runs.go b/config/runs.go index 2f064b4..c61bff3 100644 --- a/config/runs.go +++ b/config/runs.go @@ -3,22 +3,31 @@ package config import ( "sort" "strconv" + "phabricator.wikimedia.org/source/blubber.git/build" ) type RunsConfig struct { - In string `yaml:"in"` - As string `yaml:"as"` - Uid int `yaml:"uid"` - Gid int `yaml:"gid"` + In string `yaml:"in"` + As string `yaml:"as"` + Uid int `yaml:"uid"` + Gid int `yaml:"gid"` Environment map[string]string `yaml:"environment"` } func (run *RunsConfig) Merge(run2 RunsConfig) { - if run2.In != "" { run.In = run2.In } - if run2.As != "" { run.As = run2.As } - if run2.Uid != 0 { run.Uid = run2.Uid } - if run2.Gid != 0 { run.Gid = run2.Gid } + if run2.In != "" { + run.In = run2.In + } + if run2.As != "" { + run.As = run2.As + } + if run2.Uid != 0 { + run.Uid = run2.Uid + } + if run2.Gid != 0 { + run.Gid = run2.Gid + } if run.Environment == nil { run.Environment = make(map[string]string) @@ -48,7 +57,7 @@ func (run RunsConfig) EnvironmentDefinitions() []string { sort.Strings(names) for _, name := range names { - defs = append(defs, name + "=" + strconv.Quote(run.Environment[name])) + defs = append(defs, name+"="+strconv.Quote(run.Environment[name])) } return defs @@ -75,7 +84,6 @@ func (run RunsConfig) InstructionsForPhase(phase build.Phase) []build.Instructio if run.In != "" { ins = append(ins, build.Instruction{build.Run, []string{ "chown ", run.As, ":", run.As, " ", run.In, - }}) } } diff --git a/config/variant.go b/config/variant.go index 808db72..0aa56de 100644 --- a/config/variant.go +++ b/config/variant.go @@ -1,8 +1,8 @@ package config type VariantConfig struct { - Includes []string `yaml:"includes"` - Artifacts []ArtifactsConfig `yaml:"artifacts"` + Includes []string `yaml:"includes"` + Artifacts []ArtifactsConfig `yaml:"artifacts"` CommonConfig `yaml:",inline"` } |