Skip to content

Commit 0a90047

Browse files
committed
fix: toml multiline string
1 parent d66ff11 commit 0a90047

16 files changed

+609
-538
lines changed

pkg/commands/internal/migrate/cloner/cloner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func convertStructTag(value string) string {
159159
return wrapStructTag(`yaml:",inline"`)
160160
}
161161

162-
return wrapStructTag(fmt.Sprintf(`yaml:"%[1]s,omitempty" toml:"%[1]s,omitempty"`, key))
162+
return wrapStructTag(fmt.Sprintf(`yaml:"%[1]s,omitempty" toml:"%[1]s,multiline,omitempty"`, key))
163163
}
164164

165165
func wrapStructTag(s string) string {

pkg/commands/internal/migrate/testdata/empty.golden.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ version = '2'
33
[linters]
44
[linters.exclusions]
55
generated = 'lax'
6-
paths = ['third_party$', 'builtin$', 'examples$']
6+
paths = [
7+
'third_party$',
8+
'builtin$',
9+
'examples$'
10+
]
711

812
[formatters]
913
[formatters.exclusions]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version = '2'
2+
3+
[linters]
4+
[linters.settings]
5+
[linters.settings.goheader]
6+
template = """
7+
Put here copyright header template for source code files
8+
For example:
9+
Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
10+
11+
{{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
12+
SPDX-License-Identifier: Apache-2.0
13+
14+
Licensed under the Apache License, Version 2.0 (the \"License\");
15+
you may not use this file except in compliance with the License.
16+
You may obtain a copy of the License at:
17+
18+
http://www.apache.org/licenses/LICENSE-2.0
19+
20+
Unless required by applicable law or agreed to in writing, software
21+
distributed under the License is distributed on an \"AS IS\" BASIS,
22+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23+
See the License for the specific language governing permissions and
24+
"""
25+
template-path = '/path/to/my/template.tmpl'
26+
27+
[linters.settings.goheader.values]
28+
[linters.settings.goheader.values.const]
29+
COMPANY = 'MY COMPANY'
30+
31+
[linters.settings.goheader.values.regexp]
32+
AUTHOR = '.*@mycompany\.com'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[issues]
2+
exclude-generated = "strict"
3+
exclude-dirs-use-default = false
4+
5+
[linters-settings]
6+
7+
[linters-settings.goheader]
8+
template = """
9+
Put here copyright header template for source code files
10+
For example:
11+
Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
12+
13+
{{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
14+
SPDX-License-Identifier: Apache-2.0
15+
16+
Licensed under the Apache License, Version 2.0 (the "License");
17+
you may not use this file except in compliance with the License.
18+
You may obtain a copy of the License at:
19+
20+
http://www.apache.org/licenses/LICENSE-2.0
21+
22+
Unless required by applicable law or agreed to in writing, software
23+
distributed under the License is distributed on an "AS IS" BASIS,
24+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25+
See the License for the specific language governing permissions and
26+
"""
27+
template-path = "/path/to/my/template.tmpl"
28+
29+
[linters-settings.goheader.values]
30+
31+
[linters-settings.goheader.values.const]
32+
COMPANY = "MY COMPANY"
33+
34+
[linters-settings.goheader.values.regexp]
35+
AUTHOR = ".*@mycompany\\.com"

pkg/commands/internal/migrate/versiontwo/base_rule.go

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/internal/migrate/versiontwo/config.go

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/internal/migrate/versiontwo/formatters.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/internal/migrate/versiontwo/formatters_settings.go

+23-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/internal/migrate/versiontwo/issues.go

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/internal/migrate/versiontwo/linters.go

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/internal/migrate/versiontwo/linters_exclusions.go

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)