Nikolai Emil Damm
d3ae574bf2
fix: copy scanner bytes in FromStream to prevent aliasing data race
...
FromStream set each Resource's Bytes to scanner.Bytes(), which aliases
the bufio.Scanner's internal buffer. Resources are emitted on a channel
and retained/parsed by the consumer concurrently with the producer
goroutine; when the scanner refills its buffer for later documents it
overwrites the slices earlier Resources still point at. Consumers that
parse resources as they arrive (e.g. ValidateWithContext) then read
corrupted bytes — a later document spliced into the one being parsed —
surfacing as non-deterministic YAML parse errors on large multi-document
streams (a different resource fails on each run).
Clone the scanner bytes so each Resource owns its slice. Adds a
regression test that streams >4MB (forcing the scanner to refill) and
asserts every resource's bytes are intact after draining.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 02:50:27 +02:00
Yann Hamon
1f6792c093
Small fixes, better sanitization ( #359 )
2026-06-04 21:55:22 +02:00
Yann Hamon
d412494432
Read resources from multiple workers ( #354 )
ci / kubeconform-test (push) Has been cancelled
ci / openapi2jsonschema-test (push) Has been cancelled
ci / goreleaser (push) Has been cancelled
2026-06-01 12:56:27 +02:00
Andrea Tosatto
d8e348a597
Allow to skip resources using the GVK notation ( #92 )
...
* Allow to skip resources using the GVK notation
* Update flags description, add integration tests and update readme
Co-authored-by: Yann Hamon <yann@mandragor.org>
2022-10-16 14:59:48 +02:00
Maxime Brunet
ff2ab3d770
feat(output/tap): Output qualified resource name
2021-12-17 19:18:55 -08:00
Yann Hamon
ab4745ddf0
Small clean-up
2021-09-26 22:55:01 +02:00
Yann Hamon
b5c823d6b5
Also read up to 256MB from stdin
2021-09-26 17:45:27 +02:00
Yann Hamon
8bb87b9a63
Allow bufio.Scanner to resize buffer when reading large files
2021-09-26 17:27:20 +02:00
Yann Hamon
df386fc1fd
Reformat strings
2021-07-03 16:01:51 +02:00
Yann Hamon
4eb75860d9
support for lists
2021-07-03 15:49:37 +02:00
Christoph Mertz
65968cf540
remove gosimple offences
2021-02-19 17:01:54 +01:00
Yann Hamon
c1f0e9010d
add tests for yaml scanning
2021-01-02 14:06:13 +01:00
Yann Hamon
92f8f4593d
break down FromFiles for easier testing
2021-01-02 12:52:58 +01:00
Yann Hamon
f7a9c86717
Add / update a few tests
2021-01-02 12:32:12 +01:00
Yann Hamon
509ad8e997
add test for missing apiVersion - better error message
2020-12-23 18:25:46 +01:00
Yann Hamon
031f83cbde
linting
2020-12-15 22:20:02 +01:00
Yann Hamon
c5aa8e6da3
fix closing files
2020-12-15 19:36:22 +01:00
Yann Hamon
29a8f4c09e
avoid double unmarshalling
2020-12-15 18:35:33 +01:00
Yann Hamon
4afe9b1977
reduce allocations done when splitting
2020-12-15 17:04:44 +01:00
Yann Hamon
905f5e7417
set max resource size
2020-11-15 17:08:45 +01:00
Yann Hamon
7d9bb98a35
increase max size of k8s resource
2020-11-15 17:05:11 +01:00
Yann Hamon
4ae74305d1
Updated names for schema-location vars, added documentation, updated openapi2jsonschema
2020-11-15 16:19:49 +01:00
Yann Hamon
300b571c33
linting / refactor
2020-11-15 12:12:37 +01:00
Yann Hamon
94f8e9e631
fix race condition when shutting down
2020-11-11 22:50:59 +01:00
Yann Hamon
3a2d4705f5
better yaml splitting - not perfect but similar to k8s - fix path logging
2020-11-08 23:48:02 +01:00
Yann Hamon
d64a376779
do not buffer all of stdin before starting to process resources
2020-11-08 22:54:41 +01:00
Yann Hamon
4b16128b75
Add comments to most exported functions/types
2020-11-08 22:35:17 +01:00
Yann Hamon
f78b65b025
add -ignore-filename-pattern option
2020-11-08 19:57:01 +01:00
Yann Hamon
358f145023
Add support for -exit-on-error
2020-11-08 10:08:14 +01:00
Yann Hamon
99bc85d016
rename signature.go -> resource.go
2020-11-01 23:32:52 +01:00
Yann Hamon
0152d8c209
add tests for command line parsing
2020-11-01 23:18:39 +01:00
Yann Hamon
51e5f38430
Add unit tests for reading resources from an io.Reader
2020-11-01 22:41:18 +01:00
Yann Hamon
423b9536da
Refactor resource discovery
2020-11-01 20:10:03 +01:00
Yann Hamon
0a7f885768
Refactor resource discovery
2020-11-01 20:09:48 +01:00
Yann Hamon
1bc9283240
refactor
2020-11-01 16:28:32 +01:00
Yann Hamon
490c789632
Merge pull request #7 from cmertz/reorder-imports
...
reorder imports
2020-10-18 14:10:22 +02:00
Yann Hamon
54d899f8f6
add more acceptance tests
2020-10-18 13:13:37 +02:00
Yann Hamon
52437c00d1
Add resource name to logging
2020-10-18 12:50:52 +02:00
Christoph Mertz
0cffc7994d
reorder imports
...
Reorder imports with `goimports`.
2020-10-18 11:30:20 +02:00
Yann Hamon
d9a6468d09
add a few comments on exported vars
2020-06-06 18:42:44 +02:00
Yann Hamon
90e53c74d0
rename package files
2020-06-01 23:32:20 +02:00
Yann Hamon
8fc1df8d8b
minor nits
2020-06-01 12:20:15 +02:00
Yann Hamon
a33ba035fa
first test
2020-06-01 04:53:37 +02:00
Yann Hamon
93f7dbc83a
remove comment - files with multiple resources are now supported
2020-05-31 17:09:52 +02:00
Yann Hamon
8eb297d4c4
better logic mgmt in output plugins, go fmt
2020-05-31 02:10:19 +02:00
Yann Hamon
79c9197f38
better errors
2020-05-30 05:34:21 +02:00
Yann Hamon
96e35cb926
try to validate
2020-05-30 03:37:40 +02:00
Yann Hamon
fe33d14dc4
first commit
2020-05-30 02:44:13 +02:00