Skip to content

Commit b24239f

Browse files
authored
Merge pull request #49 from Skarlso/remove_string_builder
Removed strings.Builder which was a go 1.10 feature. Closes #47
2 parents 7ad299e + 37181bb commit b24239f

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

pipeline/build_golang_test.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package pipeline
22

33
import (
4+
"bytes"
45
"context"
56
"fmt"
67
"io/ioutil"
@@ -112,10 +113,10 @@ func TestExecuteBuildFailPipelineBuild(t *testing.T) {
112113
}()
113114
gaia.Cfg = new(gaia.Config)
114115
gaia.Cfg.HomePath = tmp
115-
var logOutput strings.Builder
116+
buf := new(bytes.Buffer)
116117
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
117118
Level: hclog.Trace,
118-
Output: &logOutput,
119+
Output: buf,
119120
Name: "Gaia",
120121
})
121122
b := new(BuildPipelineGolang)
@@ -142,10 +143,10 @@ func TestExecuteBuildContextTimeout(t *testing.T) {
142143
gaia.Cfg = new(gaia.Config)
143144
gaia.Cfg.HomePath = tmp
144145
// Initialize shared logger
145-
var logOutput strings.Builder
146+
buf := new(bytes.Buffer)
146147
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
147148
Level: hclog.Trace,
148-
Output: &logOutput,
149+
Output: buf,
149150
Name: "Gaia",
150151
})
151152
b := new(BuildPipelineGolang)
@@ -164,10 +165,10 @@ func TestExecuteBuildBinaryNotFoundError(t *testing.T) {
164165
gaia.Cfg = new(gaia.Config)
165166
gaia.Cfg.HomePath = tmp
166167
// Initialize shared logger
167-
var logOutput strings.Builder
168+
buf := new(bytes.Buffer)
168169
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
169170
Level: hclog.Trace,
170-
Output: &logOutput,
171+
Output: buf,
171172
Name: "Gaia",
172173
})
173174
currentPath := os.Getenv("PATH")
@@ -189,10 +190,10 @@ func TestCopyBinary(t *testing.T) {
189190
gaia.Cfg = new(gaia.Config)
190191
gaia.Cfg.HomePath = tmp
191192
// Initialize shared logger
192-
var logOutput strings.Builder
193+
buf := new(bytes.Buffer)
193194
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
194195
Level: hclog.Trace,
195-
Output: &logOutput,
196+
Output: buf,
196197
Name: "Gaia",
197198
})
198199
b := new(BuildPipelineGolang)
@@ -224,10 +225,10 @@ func TestCopyBinarySrcDoesNotExist(t *testing.T) {
224225
gaia.Cfg = new(gaia.Config)
225226
gaia.Cfg.HomePath = tmp
226227
// Initialize shared logger
227-
var logOutput strings.Builder
228+
buf := new(bytes.Buffer)
228229
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
229230
Level: hclog.Trace,
230-
Output: &logOutput,
231+
Output: buf,
231232
Name: "Gaia",
232233
})
233234
b := new(BuildPipelineGolang)

pipeline/git_test.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package pipeline
22

33
import (
4+
"bytes"
45
"os"
56
"strconv"
67
"strings"
@@ -28,10 +29,10 @@ func TestUpdateAllPipelinesRepositoryNotFound(t *testing.T) {
2829
gaia.Cfg = new(gaia.Config)
2930
gaia.Cfg.HomePath = tmp
3031
// Initialize shared logger
31-
var b strings.Builder
32+
b := new(bytes.Buffer)
3233
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
3334
Level: hclog.Trace,
34-
Output: &b,
35+
Output: b,
3536
Name: "Gaia",
3637
})
3738

@@ -49,10 +50,10 @@ func TestUpdateAllPipelinesAlreadyUpToDate(t *testing.T) {
4950
gaia.Cfg = new(gaia.Config)
5051
gaia.Cfg.HomePath = "tmp"
5152
// Initialize shared logger
52-
var b strings.Builder
53+
b := new(bytes.Buffer)
5354
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
5455
Level: hclog.Trace,
55-
Output: &b,
56+
Output: b,
5657
Name: "Gaia",
5758
})
5859
repo := &gaia.GitRepo{
@@ -82,10 +83,10 @@ func TestUpdateAllPipelinesAlreadyUpToDateWithMoreThanOnePipeline(t *testing.T)
8283
gaia.Cfg = new(gaia.Config)
8384
gaia.Cfg.HomePath = "tmp"
8485
// Initialize shared logger
85-
var b strings.Builder
86+
b := new(bytes.Buffer)
8687
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
8788
Level: hclog.Trace,
88-
Output: &b,
89+
Output: b,
8990
Name: "Gaia",
9091
})
9192
repo := &gaia.GitRepo{
@@ -124,10 +125,10 @@ func TestUpdateAllPipelinesHundredPipelines(t *testing.T) {
124125
gaia.Cfg = new(gaia.Config)
125126
gaia.Cfg.HomePath = "tmp"
126127
// Initialize shared logger
127-
var b strings.Builder
128+
b := new(bytes.Buffer)
128129
gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{
129130
Level: hclog.Trace,
130-
Output: &b,
131+
Output: b,
131132
Name: "Gaia",
132133
})
133134
repo := &gaia.GitRepo{

0 commit comments

Comments
 (0)