Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 132ea90

Browse files
authored
Merge pull request #1461 from sdboyer/toml-array-newlines
Output multi-element TOML arrays on newlines
2 parents 7744710 + 566dba0 commit 132ea90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2016
-3069
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ NEW FEATURES:
77
* Allow override of cache directory location using environment variable
88
`DEPCACHEDIR`. ([#1234](https://github.com/golang/dep/pull/1234))
99
* Add support for template output in `dep status`. (#1389)
10+
* Each element in a multi-item TOML array is output on its own line. (#1461)
1011

1112
BUG FIXES:
1213

Gopkg.lock

Lines changed: 1 addition & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/dep/testdata/harness_tests/ensure/add/all-new-double/final/Gopkg.lock

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/dep/testdata/harness_tests/init/glide/case1/final/Gopkg.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
ignored = ["github.com/golang/notexist/samples","github.com/sdboyer/dep-test"]
1+
ignored = [
2+
"github.com/golang/notexist/samples",
3+
"github.com/sdboyer/dep-test"
4+
]
25

36
[[constraint]]
47
name = "github.com/sdboyer/deptestdos"

cmd/dep/testdata/harness_tests/init/govendor/case1/final/Gopkg.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
ignored = ["github.com/golang/notexist/samples*","github.com/sdboyer/dep-test*"]
1+
ignored = [
2+
"github.com/golang/notexist/samples*",
3+
"github.com/sdboyer/dep-test*"
4+
]
25

36
[[constraint]]
47
name = "github.com/sdboyer/deptestdos"

lock.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@ func (l *Lock) toRaw() rawLock {
173173
// MarshalTOML serializes this lock into TOML via an intermediate raw form.
174174
func (l *Lock) MarshalTOML() ([]byte, error) {
175175
raw := l.toRaw()
176-
result, err := toml.Marshal(raw)
177-
return result, errors.Wrap(err, "Unable to marshal lock to TOML string")
176+
var buf bytes.Buffer
177+
enc := toml.NewEncoder(&buf).ArraysWithOneElementPerLine(true)
178+
err := enc.Encode(raw)
179+
return buf.Bytes(), errors.Wrap(err, "Unable to marshal lock to TOML string")
178180
}
179181

180182
// LockFromSolution converts a gps.Solution to dep's representation of a lock.

manifest.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,10 @@ func toProject(raw rawProject) (n gps.ProjectRoot, pp gps.ProjectProperties, err
454454
// MarshalTOML serializes this manifest into TOML via an intermediate raw form.
455455
func (m *Manifest) MarshalTOML() ([]byte, error) {
456456
raw := m.toRaw()
457-
result, err := toml.Marshal(raw)
458-
return result, errors.Wrap(err, "unable to marshal the lock to a TOML string")
457+
var buf bytes.Buffer
458+
enc := toml.NewEncoder(&buf).ArraysWithOneElementPerLine(true)
459+
err := enc.Encode(raw)
460+
return buf.Bytes(), errors.Wrap(err, "unable to marshal the lock to a TOML string")
459461
}
460462

461463
// toRaw converts the manifest into a representation suitable to write to the manifest file

vendor/github.com/pelletier/go-buffruneio/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendor/github.com/pelletier/go-buffruneio/.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

vendor/github.com/pelletier/go-buffruneio/README.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)