summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Cipriani <tcipriani@wikimedia.org>2017-06-29 14:42:32 -0600
committerTyler Cipriani <tcipriani@wikimedia.org>2017-06-29 14:45:04 -0600
commit56e09bc388d5ae1791045aabdb3a0eabd497d169 (patch)
tree858f056867bfcbf7a1e85d5d5c5a1f5b06d98f24
parent9f2ef14ba62f26ded606260891a648c294b50d4b (diff)
downloadblubber-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
-rw-r--r--build/instructions.go2
-rw-r--r--config/apt.go1
-rw-r--r--config/artifacts.go4
-rw-r--r--config/common.go13
-rw-r--r--config/config.go2
-rw-r--r--config/flag.go4
-rw-r--r--config/flag_test.go1
-rw-r--r--config/npm.go6
-rw-r--r--config/reader.go1
-rw-r--r--config/runs.go28
-rw-r--r--config/variant.go4
-rw-r--r--docker/compiler.go3
-rw-r--r--docker/compiler_test.go1
-rw-r--r--main.go2
14 files changed, 42 insertions, 30 deletions
diff --git a/build/instructions.go b/build/instructions.go
index eda651c..e807b5b 100644
--- a/build/instructions.go
+++ b/build/instructions.go
@@ -9,6 +9,6 @@ const (
)
type Instruction struct {
- Type InstructionType
+ Type InstructionType
Arguments []string
}
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"`
}
diff --git a/docker/compiler.go b/docker/compiler.go
index 7f030cf..33c31cc 100644
--- a/docker/compiler.go
+++ b/docker/compiler.go
@@ -3,6 +3,7 @@ package docker
import (
"bytes"
"strings"
+
"phabricator.wikimedia.org/source/blubber.git/build"
"phabricator.wikimedia.org/source/blubber.git/config"
)
@@ -62,7 +63,7 @@ func CompileStage(buffer *bytes.Buffer, stage string, vcfg *config.VariantConfig
if vcfg.SharedVolume.True {
Writeln(buffer, "VOLUME [\"", vcfg.Runs.In, "\"]")
- } else {
+ } else {
Writeln(buffer, "COPY . .")
}
diff --git a/docker/compiler_test.go b/docker/compiler_test.go
index 0b2d907..8981683 100644
--- a/docker/compiler_test.go
+++ b/docker/compiler_test.go
@@ -3,6 +3,7 @@ package docker_test
import (
"bytes"
"testing"
+
"gopkg.in/stretchr/testify.v1/assert"
"phabricator.wikimedia.org/source/blubber.git/build"
diff --git a/main.go b/main.go
index d774b12..61eec13 100644
--- a/main.go
+++ b/main.go
@@ -18,7 +18,7 @@ func main() {
if err != nil {
fmt.Println("Error reading config:\n", err)
os.Exit(2)
- }
+ }
docker.Compile(cfg, os.Args[2]).WriteTo(os.Stdout)
}