Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      Failed to parse string: '2026-04-09T09:07:38-07:00' as a scalar of type timestamp[s]: expected no zone offset.
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1872, in _prepare_split_single
                  for key, table in generator:
                                    ^^^^^^^^^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 609, in wrapped
                  for item in generator(*args, **kwargs):
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/json/json.py", line 295, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/json/json.py", line 128, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2281, in table_cast
                  return cast_table_to_schema(table, schema)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2233, in cast_table_to_schema
                  cast_array_to_feature(
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 1804, in wrapper
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2095, in cast_array_to_feature
                  return array_cast(
                         ^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 1806, in wrapper
                  return func(array, *args, **kwargs)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 1958, in array_cast
                  return array.cast(pa_type)
                         ^^^^^^^^^^^^^^^^^^^
                File "pyarrow/array.pxi", line 1135, in pyarrow.lib.Array.cast
                File "/usr/local/lib/python3.12/site-packages/pyarrow/compute.py", line 412, in cast
                  return call_function("cast", [arr], options, memory_pool)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "pyarrow/_compute.pyx", line 604, in pyarrow._compute.call_function
                File "pyarrow/_compute.pyx", line 399, in pyarrow._compute.Function.call
                File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: Failed to parse string: '2026-04-09T09:07:38-07:00' as a scalar of type timestamp[s]: expected no zone offset.
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1342, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 907, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1739, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1925, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

commit_hash
string
author
string
date
timestamp[s]
message
string
diff
string
files_changed
int64
insertions
int64
deletions
int64
eb2d734e449d8b4affe724238eb84e1cfbcc173d
Antkites
2024-09-20T04:12:44
style: v2.4.1
diff --git a/main.go b/main.go index 915d2ac..823e3c7 100644 --- a/main.go +++ b/main.go @@ -52,7 +52,7 @@ func main() { | |\ \| | | | \ / / /_/ / (_| \__ \ <| | | | \_| \_/_|_|_| \/ \__,_|\__,_|___/_|\_\_| |_| - Wxapkg Decompiler Tool ...
1
1
1
9208f2cf43d303b9f244cc83aaaaa68cc752028d
Antkites
2024-08-24T06:39:18
fix: xml parse
diff --git a/internal/unpack/uxml.go b/internal/unpack/uxml.go index 53b4fb8..0588c8f 100644 --- a/internal/unpack/uxml.go +++ b/internal/unpack/uxml.go @@ -91,7 +91,15 @@ func getDomTree(node interface{}) string { // 处理属性 if attr, ok := node["attr"].(map[string]interface{}); ok { for key, value := range a...
1
9
1
dc55a26ddc201818415e932fb5fc41a28943d256
Antkites
2024-08-24T06:39:11
fix: json parse
diff --git a/internal/unpack/uconfig.go b/internal/unpack/uconfig.go index 840f1bb..1e740bb 100644 --- a/internal/unpack/uconfig.go +++ b/internal/unpack/uconfig.go @@ -138,6 +138,18 @@ func (p *ConfigParser) Parse(option config.WxapkgInfo) error { i++ } } + + // 去除重复的页面 + pageSet := make(map[string]...
1
12
0
fdf1d7e0605ba85185c0e033905cf6cbf8f84e88
Antkites
2024-08-24T06:38:49
fix: css transform
diff --git a/internal/util/transformCSS.go b/internal/util/transformCSS.go index 88cbf35..4e0774d 100644 --- a/internal/util/transformCSS.go +++ b/internal/util/transformCSS.go @@ -105,6 +105,7 @@ func skipValue(l *css.Lexer, sb *strings.Builder, inDeclarationBlock *bool) { func readValue(l *css.Lexer, sb *strings.Bui...
1
12
1
9a91c45130b79d38b49675d01fd52e930ca88c87
Antkites
2024-08-15T14:28:06
style: v2.3.2
diff --git a/main.go b/main.go index 6ae7509..2354a22 100644 --- a/main.go +++ b/main.go @@ -50,7 +50,7 @@ func main() { | |\ \| | | | \ / / /_/ / (_| \__ \ <| | | | \_| \_/_|_|_| \/ \__,_|\__,_|___/_|\_\_| |_| - Wxapkg Decompiler Tool ...
1
1
1
43cebb42a475da48f6d97e10e307dad6b3f49e28
Antkites
2024-08-15T14:25:00
fix: xml解析
diff --git a/internal/unpack/uxml.go b/internal/unpack/uxml.go index 2413d01..53b4fb8 100644 --- a/internal/unpack/uxml.go +++ b/internal/unpack/uxml.go @@ -259,14 +259,15 @@ func (p *XmlParser) Parse(option config.WxapkgInfo) error { // 防止报错 patch := `var noCss=true;var window={};var navigator={};navigator.userA...
1
3
2
456e847cfced106e45b4d0be688bd225cb8c0eb8
Antkites
2024-08-15T14:24:09
fix: config解析
diff --git a/internal/unpack/uconfig.go b/internal/unpack/uconfig.go index 238f2b0..840f1bb 100644 --- a/internal/unpack/uconfig.go +++ b/internal/unpack/uconfig.go @@ -139,7 +139,11 @@ func (p *ConfigParser) Parse(option config.WxapkgInfo) error { } } subPackage.Root = root - subPackage.Pages = newPages...
1
5
1
3c7f088eed2d522dd4e029b39e6b12bc7eafa207
Antkites
2024-08-13T10:25:50
fix: 修复完善js解析
diff --git a/internal/unpack/ujs.go b/internal/unpack/ujs.go index 70de4c9..5548417 100644 --- a/internal/unpack/ujs.go +++ b/internal/unpack/ujs.go @@ -5,11 +5,14 @@ import ( "log" "os" "path/filepath" + "regexp" + "strings" + + "github.com/dop251/goja" "github.com/Ackites/KillWxapkg/internal/enum" "gith...
2
137
109
69e3bc29b98d53dc3d8d4517f609cd1fd4102caa
Antkites
2024-08-13T10:25:06
fix: 修复完善解析wxml
diff --git a/internal/unpack/uxml.go b/internal/unpack/uxml.go index 5e9fa40..2413d01 100644 --- a/internal/unpack/uxml.go +++ b/internal/unpack/uxml.go @@ -23,15 +23,11 @@ type XmlParser struct { // 获取生成函数 func getFuc(code string, gwx map[string]interface{}) { - re := regexp.MustCompile(`else __wxAppCode__\['([^']...
1
5
5
dc846e7b355cd18a2ec77d563478577e4cb2099c
Antkites
2024-08-13T10:23:07
fix: 修复转义字符\n
diff --git a/internal/unpack/uxss.go b/internal/unpack/uxss.go index a4dd895..095137c 100644 --- a/internal/unpack/uxss.go +++ b/internal/unpack/uxss.go @@ -68,7 +68,7 @@ func handleEl(el interface{}, k string) string { return "" } if target != "" { - return fmt.Sprintf(`@import "%s";\n`, target) + r...
1
1
1
5fe279a725a815918ed9e0133c6a16613455c8d4
Antkites
2024-08-12T14:52:28
fix: 修复xml提取问题
diff --git a/internal/unpack/uxml.go b/internal/unpack/uxml.go index c1116db..5e9fa40 100644 --- a/internal/unpack/uxml.go +++ b/internal/unpack/uxml.go @@ -261,17 +261,18 @@ func (p *XmlParser) Parse(option config.WxapkgInfo) error { codeStr := string(code) scriptCode := codeStr - scriptCode = strings.Replace(sc...
2
6
5
e3a0830c901b4bda9ec3a5bf3b24782c5a682b1c
Antkites
2024-08-12T14:50:18
fix: 修复__wxConfig报错
diff --git a/internal/unpack/ujs.go b/internal/unpack/ujs.go index 86f07bc..70de4c9 100644 --- a/internal/unpack/ujs.go +++ b/internal/unpack/ujs.go @@ -67,7 +67,8 @@ func (p *JavaScriptParser) Parse(option config.WxapkgInfo) error { } // 防止报错 - patch := `var window={};var navigator={};navigator.userAgent="iPhone...
1
8
7
2b1686d9a1d2d41817a4f9fcc8b098f1bdca1248
Antkites
2024-08-12T14:32:35
fix: 修复非法字符输入
diff --git a/internal/unpack/uconfig.go b/internal/unpack/uconfig.go index c84203b..238f2b0 100644 --- a/internal/unpack/uconfig.go +++ b/internal/unpack/uconfig.go @@ -54,6 +54,12 @@ func changeExt(filename, newExt string) string { // save 保存内容到文件 func save(filename string, content []byte) error { + // 处理文件路径 + fi...
1
7
1
f3e8a4ae4f2528c021d70f10f206f6d232592cf1
Antkites
2024-08-12T13:09:06
fix: 修复xss空白字符匹配
diff --git a/internal/unpack/uxss.go b/internal/unpack/uxss.go index d8f9358..a4dd895 100644 --- a/internal/unpack/uxss.go +++ b/internal/unpack/uxss.go @@ -115,7 +115,7 @@ func matchScripts(code string) string { } func getCss(mainCode string) string { - setRe := regexp.MustCompile(`setCssToHead\(([\s\S]*?)\.wxss"\...
1
1
1
f3c36ce51a09141d44b1fdd666755a46c2a6e738
Antkites
2024-08-12T10:42:08
chore: 优化输入
diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index 332957b..736067d 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -46,11 +46,17 @@ func ParseInput(input, fileExt string) []string { // DetermineOutputDir 确定输出目录 func DetermineOutputDir(input, appID string) string { var baseDir string + if ...
1
6
0
8fd87b1ad8bad150565a9c90d8d1d21a0081633f
Antkites
2024-08-07T04:14:09
style: 更新版本号
diff --git a/main.go b/main.go index cfd28fe..7def5c1 100644 --- a/main.go +++ b/main.go @@ -50,7 +50,7 @@ func main() { | |\ \| | | | \ / / /_/ / (_| \__ \ <| | | | \_| \_/_|_|_| \/ \__,_|\__,_|___/_|\_\_| |_| - Wxapkg Decompiler Tool ...
1
1
1
8ef7817c3a3727f8664cf526f4e69d35d58764fe
Antkites
2024-08-05T15:45:45
feat: 新增hook功能
diff --git a/internal/hook/embed_other.go b/internal/hook/embed_other.go index f80076a..b478ed5 100644 --- a/internal/hook/embed_other.go +++ b/internal/hook/embed_other.go @@ -1,4 +1,5 @@ //go:build !windows +// +build !windows package hook diff --git a/internal/hook/embed_windows.go b/internal/hook/embed_window...
2
2
0
136d059326c854f834e4f9bbd18760afd169c606
Antkites
2024-08-04T14:17:24
fix: 还原js功能完善
diff --git a/internal/unpack/ujs.go b/internal/unpack/ujs.go index ff8e861..86f07bc 100644 --- a/internal/unpack/ujs.go +++ b/internal/unpack/ujs.go @@ -66,6 +66,20 @@ func (p *JavaScriptParser) Parse(option config.WxapkgInfo) error { return fmt.Errorf("failed to read file: %w", err) } + // 防止报错 + patch := `var ...
1
74
67
3f77b4f93c114bef058c679cfb2b5ccd4e502a09
Antkites
2024-08-04T14:15:36
feat: 新增还原wxss功能
diff --git a/internal/unpack/uxss.go b/internal/unpack/uxss.go index 45b5c32..d8f9358 100644 --- a/internal/unpack/uxss.go +++ b/internal/unpack/uxss.go @@ -1,161 +1,177 @@ package unpack import ( - "encoding/json" "fmt" "log" "os" "path/filepath" + "regexp" "strings" + "github.com/Ackites/KillWxapkg/in...
2
280
382
2e90ced6a6c2f03fbb95bc29e4eb5f39cfaadaba
Martin Tournoij
2026-04-15T15:53:05
Add Decoder.MaxTableNesting; limit table nesting to 128 by default toml currently allows infinite table nesting; a document in the form "a.«10,000 more» = 1" takes ~2 seconds to parse and uses 1.8G of memory. I suppose we can may maybe improve on that a bit, but I haven't even looked. Just limit the table nesting to ...
diff --git a/decode.go b/decode.go index 3fed2bb..4a9a876 100644 --- a/decode.go +++ b/decode.go @@ -118,14 +118,21 @@ const ( // This decoder does not handle cyclic types. Decode will not terminate if a // cyclic type is passed. type Decoder struct { - r io.Reader + r io.Reader + maxNest int } // NewDecod...
4
55
9
ddcbbe200187bfa6e6d694cb992b27cc35b54dd7
Martin Tournoij
2026-01-13T18:32:10
Fix test
diff --git a/error_test.go b/error_test.go index a350f16..4d9cdf2 100644 --- a/error_test.go +++ b/error_test.go @@ -243,6 +243,12 @@ func TestParseError(t *testing.T) { | | 15:04:05.123 | 15:04:05.856018510 + | + | The seconds part in tim...
1
6
0
f4671293d329762c2107ee7065c71572b15ba9ff
Martin Tournoij
2026-01-08T08:05:16
Remove errLexInlineTableNL No longer used since TOML 1.1
diff --git a/error.go b/error.go index b7077d3..de9e751 100644 --- a/error.go +++ b/error.go @@ -187,13 +187,12 @@ func expandTab(s string) string { } type ( - errLexControl struct{ r rune } - errLexEscape struct{ r rune } - errLexUTF8 struct{ b byte } - errParseDate struct{ v string } ...
1
22
45
e954445330492727c18483838a15f88a4fc2d03a
Alexander Bürger
2025-12-16T14:44:05
Reject duplicate arrays (#455) Fixes #454
diff --git a/parse.go b/parse.go index e3ea8a9..5fc884e 100644 --- a/parse.go +++ b/parse.go @@ -644,6 +644,11 @@ func (p *parser) setValue(key string, value any) { // Note that since it has already been defined (as a hash), we don't // want to overwrite it. So our business is done. if p.isArray(keyContext) { ...
2
5
2
011fa2bc64cec3bb4ec450d11984f5e87b8e158c
Martin Tournoij
2025-06-06T16:25:13
Ensure constant format strings in wf calls Fixes: ./encode.go:231:11: non-constant format string in call to (*github.com/BurntSushi/toml.Encoder).wf ./encode.go:233:11: non-constant format string in call to (*github.com/BurntSushi/toml.Encoder).wf ./encode.go:282:10: non-constant format string in call to (*github....
diff --git a/encode.go b/encode.go index b8eedbc..bd7aa18 100644 --- a/encode.go +++ b/encode.go @@ -228,9 +228,9 @@ func (enc *Encoder) eElement(rv reflect.Value) { } switch v.Location() { default: - enc.wf(v.Format(format)) + enc.write(v.Format(format)) case internal.LocalDatetime, internal.LocalDate,...
1
38
30
4b439bf5c6ef125a94df7a136733df5ba37d4c16
Martin Tournoij
2025-04-19T22:13:04
Remove itemNil Never referenced; not sure what it was used for in the past, but it's no longer.
diff --git a/lex.go b/lex.go index 7539879..8831eb0 100644 --- a/lex.go +++ b/lex.go @@ -13,7 +13,6 @@ type itemType int const ( itemError itemType = iota - itemNIL // used in the parser to indicate no type itemEOF itemText itemString @@ -1202,8 +1201,6 @@ func (itype itemType) String() string { ...
2
1
4
a473c125bce7078efea98a29698b7c1eb453ff0b
Martin Tournoij
2025-04-19T18:25:19
Add test for out of range float64
diff --git a/decode_test.go b/decode_test.go index e0cbd81..4a35ffc 100644 --- a/decode_test.go +++ b/decode_test.go @@ -200,6 +200,11 @@ func TestDecodeErrors(t *testing.T) { `V.N = 999999999999999`, `toml: line 1 (last key "V.N"): 999999999999999 is out of the safe float32 range`, }, + { + &struct{ F fl...
1
5
0
b535ff89e48996de98ace1301decf94a3a480aa8
Martin Tournoij
2025-04-19T18:15:15
Add some boring tests for lex.go This doesn't really need tests IMO, but easy enough to write. The end goal is to have 100% test coverage at least for lex.go and parse.go, which is helpful for finding new test cases for toml-test.
diff --git a/lex.go b/lex.go index e5de2e4..7539879 100644 --- a/lex.go +++ b/lex.go @@ -108,7 +108,7 @@ func (lx *lexer) push(state stateFn) { func (lx *lexer) pop() stateFn { if len(lx.stack) == 0 { - return lx.errorf("BUG in lexer: no states to pop") + panic("BUG in lexer: no states to pop") } last := lx....
2
93
22
6011ef0c32b214ac134b8228af2a667e171dad6e
Martin Tournoij
2025-04-19T17:42:13
Remove unreachable condition in lexTableNameStart It has lx.skip(isWhitespace), so the isWhitespace(r) can never be true.
diff --git a/lex.go b/lex.go index 940ad50..e5de2e4 100644 --- a/lex.go +++ b/lex.go @@ -392,8 +392,6 @@ func lexTableNameStart(lx *lexer) stateFn { func lexTableNameEnd(lx *lexer) stateFn { lx.skip(isWhitespace) switch r := lx.next(); { - case isWhitespace(r): - return lexTableNameEnd case r == '.': lx.igno...
1
0
2
c8ca9e6c2d5987a6c23f89d13987ac335aad90c3
Martin Tournoij
2025-04-19T17:11:41
Remove unreachable condition lexNumberOrDateStart() is only called from lexValue() on isDigit(r), so !isDigit(r) in there can never happen.
diff --git a/lex.go b/lex.go index 1c3b477..940ad50 100644 --- a/lex.go +++ b/lex.go @@ -928,19 +928,9 @@ func lexLongUnicodeEscape(lx *lexer) stateFn { // lexBaseNumberOrDate can differentiate base prefixed integers from other // types. func lexNumberOrDateStart(lx *lexer) stateFn { - r := lx.next() - switch r { - ...
1
1
11
1121f81c60f5947e13057fa5efecbf21369c651e
Martin Tournoij
2025-04-16T12:17:17
Make tomlv read from stdin
diff --git a/cmd/tomlv/main.go b/cmd/tomlv/main.go index e2f1c52..0882fbe 100644 --- a/cmd/tomlv/main.go +++ b/cmd/tomlv/main.go @@ -6,6 +6,7 @@ import ( "errors" "flag" "fmt" + "io" "log" "os" "path" @@ -38,32 +39,49 @@ func usage() { } func main() { - if flag.NArg() < 1 { - flag.Usage() + if flag.NAr...
1
39
21
f225e861e3468a688076874b34b8cf717c296538
Martin Tournoij
2025-04-15T14:09:22
Also encode large floats as exponent syntax in toml-test integration
diff --git a/decode.go b/decode.go index 639665d..ed88484 100644 --- a/decode.go +++ b/decode.go @@ -430,7 +430,7 @@ func (md *MetaData) unifyString(data any, rv reflect.Value) error { if i, ok := data.(int64); ok { rv.SetString(strconv.FormatInt(i, 10)) } else if f, ok := data.(float64); ok { - rv.SetStrin...
2
2
2
10fb0a634a2d011906d7e61a9d218fb3b6d0ccfc
Martin Tournoij
2025-04-15T13:40:32
Encode large floats as exponent syntax (#441) Otherwise round-tripping something like 5e+22 won't work.
diff --git a/encode.go b/encode.go index ac196e7..b8eedbc 100644 --- a/encode.go +++ b/encode.go @@ -297,7 +297,7 @@ func (enc *Encoder) eElement(rv reflect.Value) { } enc.wf("inf") } else { - enc.wf(floatAddDecimal(strconv.FormatFloat(f, 'f', -1, 32))) + enc.wf(floatAddDecimal(strconv.FormatFloat(f, 'g'...
2
43
37
3d3abc24416aa7391a8c145ac6ddb8fb6b22dade
Michael Vogt
2025-04-03T13:01:03
decode: mark nested fields as decoded as well (#440) This commit is a small followup for PR#426 to handle another case with the custom unmarshal. This was found in a complex TOML based image customization "blueprint".
diff --git a/decode.go b/decode.go index 3fa516c..639665d 100644 --- a/decode.go +++ b/decode.go @@ -206,6 +206,13 @@ func markDecodedRecursive(md *MetaData, tmap map[string]any) { markDecodedRecursive(md, tmap) md.context = md.context[0 : len(md.context)-1] } + if tarr, ok := tmap[key].([]map[string]any); ...
2
18
5
d10101f4fed80a8584aa2346e4701c5f5a184bc5
Martin Tournoij
2025-03-17T10:20:24
Correct encoding of comma when nested inline table ends with map The map is in fieldsSub, so when iterating over fieldsDirect the length check would think it's "last" and won't write the comma, whereas on the second writeFields() call the test would fail and it would (wrongly) write the comma. So just sum the lengths...
diff --git a/encode.go b/encode.go index 4933c05..ac196e7 100644 --- a/encode.go +++ b/encode.go @@ -503,7 +503,7 @@ func (enc *Encoder) eStruct(key Key, rv reflect.Value, inline bool) { } addFields(rt, rv, nil) - writeFields := func(fields [][]int) { + writeFields := func(fields [][]int, totalFields int) { fo...
2
29
4
75a4f17a6da92eb899b599eafc43a2e7ddd76fc2
Martin Tournoij
2024-10-30T13:18:35
Correct encoding of several layers of embedded structs I'm not entirely sure if I understand what's going on here, but this seems to fix it. Fixes #430
diff --git a/encode.go b/encode.go index bde6535..4933c05 100644 --- a/encode.go +++ b/encode.go @@ -440,8 +440,6 @@ func (enc *Encoder) eMap(key Key, rv reflect.Value, inline bool) { } } -const is32Bit = (32 << (^uint(0) >> 63)) == 32 - func pointerTo(t reflect.Type) reflect.Type { if t.Kind() == reflect.Ptr {...
2
33
11
702f5a6d00def72eaea44c3179fa22e050e208f7
Martin Tournoij
2025-03-17T09:45:58
Minor staticcheck fixes Don't need the exception as my PR to improve it got merged.
diff --git a/cmd/tomlv/main.go b/cmd/tomlv/main.go index 9c50794..e2f1c52 100644 --- a/cmd/tomlv/main.go +++ b/cmd/tomlv/main.go @@ -53,7 +53,7 @@ func main() { log.Fatalf("Error in '%s': %s", f, err) } if flagTime { - fmt.Printf("%f\n", time.Now().Sub(start).Seconds()) + fmt.Printf("%f\n", time.Since(sta...
3
2
3
6f7689d2591e3da5f945ef556af0387f75d7199f
Michael Vogt
2025-03-17T09:45:51
Mark meta keys as decoded when using Unmarshaler interface (#426) Keys were marked as "Undecoded" in the meta when using UnmarshalTOML from the Unmarshaler interface. Unlike Primitive, I don't think this makes sense as UnmarshalTOML() explicitly "decodes" the value. Also mark all values below the table or array, and ...
diff --git a/decode.go b/decode.go index c05a0b7..3fa516c 100644 --- a/decode.go +++ b/decode.go @@ -196,6 +196,19 @@ func (md *MetaData) PrimitiveDecode(primValue Primitive, v any) error { return md.unify(primValue.undecoded, rvalue(v)) } +// markDecodedRecursive is a helper to mark any key under the given tmap a...
2
69
1
4664468d6eafff56a043a217a8981cc72e901122
Juan
2024-11-22T19:09:36
Fix ErrorWithPosition panic when less than two lines Would panic if the TOML had just one line without a newline at the end of the file.
diff --git a/error_test.go b/error_test.go index bb8075f..fc439e0 100644 --- a/error_test.go +++ b/error_test.go @@ -245,6 +245,19 @@ func TestParseError(t *testing.T) { | 15:04:05.856018510 `, }, + + { + &struct{ String string }{}, + `string = "test`, + ` + | toml: error: ...
2
16
1
7234339f787c9a070e2f467c1fb3357336c20265
Martin Tournoij
2024-06-04T22:12:39
Allow custom string types as map keys (#414) Because the map keys were converted to []string, rv.MapIndex(reflect.ValueOf(mapKey)) would panic as it's the "wrong" type (string, instead of the custom string type). Just keep track of the reflect.Value instead; don't really need to convert it to strings. Fixes #...
diff --git a/encode.go b/encode.go index 73366c0..bde6535 100644 --- a/encode.go +++ b/encode.go @@ -402,31 +402,30 @@ func (enc *Encoder) eMap(key Key, rv reflect.Value, inline bool) { // Sort keys so that we have deterministic output. And write keys directly // underneath this key first, before writing sub-stru...
2
57
14
a339e1f7089ced06bae1eaf374cdfb950e92d2e8
Martin Tournoij
2024-05-26T19:31:03
Correct position on invalid files ending without value Previously it would be on the next line: % tomlv <(print 'a=') Error in '/proc/self/fd/11': toml: error: expected value but found '\n' instead At line 2, column 3: 1 | a= 2 | ^
diff --git a/error_test.go b/error_test.go index 4fd7250..d14283e 100644 --- a/error_test.go +++ b/error_test.go @@ -51,8 +51,23 @@ At line 2, column 5-15: 1 | # Date cannot end with trailing T 2 | d = 2006-01-30T ^^^^^^^^^^^`}, - } + {"key/without-value-1.toml", ` +toml: error: expected...
2
22
1
14f5b213f725cbb169ba0f4334a092c9e4efe4e6
Martin Tournoij
2024-05-26T19:30:45
tomlv: print more detailed errors
diff --git a/cmd/tomlv/main.go b/cmd/tomlv/main.go index 94799de..9c50794 100644 --- a/cmd/tomlv/main.go +++ b/cmd/tomlv/main.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" + "errors" "flag" "fmt" "log" @@ -45,6 +46,10 @@ func main() { start := time.Now() md, err := toml.DecodeFile(f, &tmp) ...
1
5
0
092fca1af5f28b5de952df96390b41db66150ffc
Martin Tournoij
2024-05-26T19:15:16
Ensure ParseError.Message is always set (#411) ParseError.Error() did: msg := pe.Message if msg == "" { msg = pe.err.Error() } That was fine, but not very useful for people wanting to access the Message field themselves, especially since err isn't exported. For example staticcheck does this to add in...
diff --git a/decode.go b/decode.go index ff9609c..c05a0b7 100644 --- a/decode.go +++ b/decode.go @@ -542,10 +542,11 @@ func (md *MetaData) parseErr(err error) error { k := md.context.String() d := string(md.data) return ParseError{ + Message: err.Error(), + err: err, LastKey: k, Position: md.keyInf...
3
12
20
3cb6f887551617a704396567d99fa882c43f7841
Martin Tournoij
2024-05-26T18:59:11
Add Position.Col (#410) Previously it wasn't easy for users to get the Column information; this has to be calculated from the Start field, but this isn't convenient. Also the start column in "column x-y" was off by one, so fix that too as a bonus.
diff --git a/decode.go b/decode.go index 7aaf462..ff9609c 100644 --- a/decode.go +++ b/decode.go @@ -540,12 +540,13 @@ func (md *MetaData) badtype(dst string, data any) error { func (md *MetaData) parseErr(err error) error { k := md.context.String() + d := string(md.data) return ParseError{ LastKey: k, - Po...
4
44
41
5bcf18649ef059072b99f1505b63076c922df682
Martin Tournoij
2024-05-23T20:44:07
toml-test-decoder: always print floats as decimal
diff --git a/internal/tag/add.go b/internal/tag/add.go index 1df6ee4..f80ddb8 100644 --- a/internal/tag/add.go +++ b/internal/tag/add.go @@ -3,6 +3,7 @@ package tag import ( "fmt" "math" + "strconv" "time" "github.com/BurntSushi/toml/internal" @@ -68,7 +69,7 @@ func Add(key string, tomlData any) any { cas...
1
2
1
a645c7b950f537b1d04ed9003413bcb96d08046a
manunio
2024-05-23T14:49:06
fuzz: ignore roundtrip err till 1.23 lands (#409)
diff --git a/ossfuzz/fuzz.go b/ossfuzz/fuzz.go index 6a29773..755f82c 100644 --- a/ossfuzz/fuzz.go +++ b/ossfuzz/fuzz.go @@ -3,6 +3,7 @@ package ossfuzz import ( "bytes" "fmt" + "strings" "github.com/BurntSushi/toml" ) @@ -27,6 +28,11 @@ func FuzzToml(data []byte) int { var v2 any _, err = toml.Decode(buf...
1
6
0
9a8066765d83926207bf134b065a95766f7b2f7f
Martin Tournoij
2024-05-10T10:27:00
Add -json flag to tomlv
diff --git a/cmd/tomlv/main.go b/cmd/tomlv/main.go index c32e005..94799de 100644 --- a/cmd/tomlv/main.go +++ b/cmd/tomlv/main.go @@ -2,6 +2,7 @@ package main import ( + "encoding/json" "flag" "fmt" "log" @@ -16,6 +17,7 @@ import ( var ( flagTypes = false + flagJSON = false flagTime = false ) @@ -2...
1
9
0
77ce8589413d1fc280be524c8992599c42027c61
Sam Autry
2024-05-02T23:39:40
Add Marshal Function (#405) Added the Marshal function which returns the TOML representation of the Go value as bytes along with any error that may occur while marshaling.
diff --git a/encode.go b/encode.go index 231ae63..73366c0 100644 --- a/encode.go +++ b/encode.go @@ -2,6 +2,7 @@ package toml import ( "bufio" + "bytes" "encoding" "encoding/json" "errors" @@ -76,6 +77,17 @@ type Marshaler interface { MarshalTOML() ([]byte, error) } +// Marshal returns a TOML representa...
2
19
0
0e879cbdab1075e5622c5c91581eb5e417e6fc1a
Martin Tournoij
2024-01-03T00:11:15
Fix panic when trying to set subkey for a value that's not a table Would panic for inline tables; regression added in 4223137. Fixes #403
diff --git a/parse.go b/parse.go index 40094a2..11ac310 100644 --- a/parse.go +++ b/parse.go @@ -485,7 +485,10 @@ func (p *parser) valueInlineTable(it item, parentIsArray bool) (any, tomlType) { h = make(map[string]any) hash[c] = h } - hash = h.(map[string]any) + hash, ok = h.(map[string]any) + if !...
2
4
4
c320c2d09774325e4cadbcfbe76a6d23935bd0e2
Martin Tournoij
2023-12-03T21:41:56
Fix utf8.RuneError test https://github.com/arp242/uni/commit/5f9eb0d056eea25817d18995013406c23727242d This is actually not really an issue here, because U+FFFD isn't valid in TOML, but it doesn't hurt to properly check.
diff --git a/lex.go b/lex.go index 0356bc4..a1016d9 100644 --- a/lex.go +++ b/lex.go @@ -166,7 +166,7 @@ func (lx *lexer) next() (r rune) { } r, w := utf8.DecodeRuneInString(lx.input[lx.pos:]) - if r == utf8.RuneError { + if r == utf8.RuneError && w == 1 { lx.error(errLexUTF8{lx.input[lx.pos]}) return utf8....
1
1
1
c0a26cb25413e31a1802d2f3d09b243ccab076bc
Martin Tournoij
2023-10-10T01:30:49
Write "inf" instead of "Inf" in JSON tests Doesn't really matter for the toml-test test runner, but we use toml-test-decoder for generating tests, and "Inf" with capital was causing issues for some: https://github.com/toml-lang/toml-test/pull/143
diff --git a/internal/tag/add.go b/internal/tag/add.go index 07fc138..1df6ee4 100644 --- a/internal/tag/add.go +++ b/internal/tag/add.go @@ -60,11 +60,16 @@ func Add(key string, tomlData any) any { case int64: return tag("integer", fmt.Sprintf("%d", orig)) case float64: - // Special case for nan since NaN == Na...
1
8
3
4f8abaa5ed7e12062a70e59dc5157053febf6cec
Martin Tournoij
2023-10-01T12:12:07
Mark Primitive, MetaData.PrimitiveDecode() as deprecated It's not really needed: if you're not sure of the structure you can use any with type switches, and if you want some custom (un)marshal logic you can use the (Un)Marshal interface. Did some basic performance tests: Primitive isn't really faster. It's also not r...
diff --git a/decode.go b/decode.go index 7aaf462..7987f4f 100644 --- a/decode.go +++ b/decode.go @@ -57,22 +57,6 @@ func DecodeFS(fsys fs.FS, path string, v any) (MetaData, error) { return NewDecoder(fp).Decode(v) } -// Primitive is a TOML value that hasn't been decoded into a Go value. -// -// This type can be us...
7
55
60
b41de9386d730194884e26e7ad1f8f58c45c73e2
Martin Tournoij
2023-10-01T11:19:15
Remove unused code This is never called, as the value here is never a pointer.
diff --git a/decode.go b/decode.go index 210bd3a..7aaf462 100644 --- a/decode.go +++ b/decode.go @@ -242,14 +242,6 @@ func (md *MetaData) unify(data any, rv reflect.Value) error { return md.unifyInt(data, rv) } switch k { - case reflect.Ptr: - elem := reflect.New(rv.Type().Elem()) - err := md.unify(data, refle...
1
0
8
1905bd7b6af5c74f1cbc141d9c27a55ef571a2d6
Martin Tournoij
2023-10-01T09:48:50
Correct error position with tab indentation Previously the ^^^s would be misplaced, e.g.: 2 | k1 = "asd" 3 | k2 = "ok" 4 | k3 = "invalid" ^^^^^^^
diff --git a/error.go b/error.go index 7eead78..b45a3f4 100644 --- a/error.go +++ b/error.go @@ -114,13 +114,22 @@ func (pe ParseError) ErrorWithPosition() string { msg, pe.Position.Line, col, col+pe.Position.Len) } if pe.Position.Line > 2 { - fmt.Fprintf(b, "% 7d | %s\n", pe.Position.Line-2, lines[pe.Position...
2
93
4
b6fe702588a6e9053045bbcce86b9193b65c0d65
Martin Tournoij
2023-10-01T09:25:02
Wrap UnmarshalTOML()/UnmarshalText return values in ParseError This adds position information. Fixes #398
diff --git a/decode.go b/decode.go index 48a8d40..210bd3a 100644 --- a/decode.go +++ b/decode.go @@ -218,7 +218,11 @@ func (md *MetaData) unify(data any, rv reflect.Value) error { rvi := rv.Interface() if v, ok := rvi.(Unmarshaler); ok { - return v.UnmarshalTOML(data) + err := v.UnmarshalTOML(data) + if err !=...
2
91
2
663cca61aec1dc828b8c67280072d04e45b2c4d9
Martin Tournoij
2023-10-01T09:03:40
Clarify error on out of safe range floats Fixes #396
diff --git a/decode.go b/decode.go index d1203c1..48a8d40 100644 --- a/decode.go +++ b/decode.go @@ -439,7 +439,7 @@ func (md *MetaData) unifyFloat64(data any, rv reflect.Value) error { if num, ok := data.(int64); ok { if (rvk == reflect.Float32 && (num < -maxSafeFloat32Int || num > maxSafeFloat32Int)) || (rvk...
4
52
26
59c762d2106e0441bd5895ae7fe66ab3c17819e8
Martin Tournoij
2023-10-01T08:11:00
Require 2-digit hour Fixes #320
diff --git a/parse.go b/parse.go index e31dc83..33d8f02 100644 --- a/parse.go +++ b/parse.go @@ -372,6 +372,9 @@ func (p *parser) valueDatetime(it item) (any, tomlType) { } t, err = time.ParseInLocation(dt.fmt, it.val, dt.zone) if err == nil { + if missingLeadingZero(it.val, dt.fmt) { + p.panicErr(it, err...
2
20
9
fb576ca7a1cbb2458926b7e4f40e6e09923207b0
Martin Tournoij
2023-10-01T06:38:15
Add -time flag to tomlv
diff --git a/cmd/tomlv/main.go b/cmd/tomlv/main.go index 0a07fdd..c32e005 100644 --- a/cmd/tomlv/main.go +++ b/cmd/tomlv/main.go @@ -9,17 +9,20 @@ import ( "path" "strings" "text/tabwriter" + "time" "github.com/BurntSushi/toml" ) var ( flagTypes = false + flagTime = false ) func init() { log.SetF...
1
7
0
d17285a027833847142f76ac28ed3a55a5bdd2e5
Martin Tournoij
2023-09-30T22:14:11
Copy signbit for -nan Is this useful? Doubtful. But doesn't hurt either, and it is useful for toml-test. Also write the signbit back, and don't write explicit +inf – just inf is enough.
diff --git a/decode_test.go b/decode_test.go index 439b803..9a09771 100644 --- a/decode_test.go +++ b/decode_test.go @@ -423,6 +423,74 @@ func TestDecodeFloatOverflow(t *testing.T) { } } +func TestDecodeSignbit(t *testing.T) { + var m struct { + N1, N2 float64 + I1, I2 float64 + Z1, Z2 float64 + ZF1, ZF2...
4
90
4
41f8cc899b822ec2a7ca30b9a31eb48ef2c4992f
Martin Tournoij
2023-09-30T21:57:39
Small performance boost by allocating arrays if we can In the case of valueArray() we don't actually know the array length, but allocating an empty array and an array with a cap of 2 is identical in terms of performance, and it saves a few allocation for the common case of len>=2.
diff --git a/parse.go b/parse.go index 39b89a6..47c2544 100644 --- a/parse.go +++ b/parse.go @@ -380,12 +380,10 @@ func (p *parser) valueArray(it item) (any, tomlType) { p.setType(p.currentKey, tomlArray, it.pos) var ( - types []tomlType - - // Initialize to a non-nil empty slice. This makes it consistent with ...
1
8
11
61d6a9c7598bb968c88c5a0987552d9616d4c236
Martin Tournoij
2023-09-23T19:38:55
Actually use errParseDate
diff --git a/error.go b/error.go index b4e9a4b..1930f59 100644 --- a/error.go +++ b/error.go @@ -163,8 +163,7 @@ type ( errLexControl struct{ r rune } errLexEscape struct{ r rune } errLexUTF8 struct{ b byte } - errLexInvalidNum struct{ v string } - errLexInvalidDate struct{ v string } +...
3
51
8
01fb725713008eb52843889a4a1993d54e4d01c0
Martin Tournoij
2023-09-23T19:24:40
Small staticcheck fixes
diff --git a/decode_test.go b/decode_test.go index 4fac4ff..439b803 100644 --- a/decode_test.go +++ b/decode_test.go @@ -1051,9 +1051,7 @@ type ( Slice *InnerArrayString } Enum int - InnerString struct{ value string } InnerInt struct{ value int } - InnerBool struct{ value bool }...
3
16
28
End of preview.
README.md exists but content is empty.
Downloads last month
6