Skip to content

Commit 266b2c6

Browse files
committed
deprecate -big parameter
1 parent b490b8c commit 266b2c6

File tree

3 files changed

+2
-25
lines changed

3 files changed

+2
-25
lines changed

.github/workflows/node-tests.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ jobs:
3737
echo "got: '${got}'"
3838
[[ "${got}" == "${exp}" ]]
3939
40-
- name: Run json-to-go with -big using stdin
41-
shell: bash
42-
run: |
43-
set -eEuo pipefail
44-
got=$(node json-to-go.js -big < tests/double-nested-objects.json)
45-
exp=$(cat tests/double-nested-objects.go)
46-
echo "got: '${got}'"
47-
[[ "${got}" == "${exp}" ]]
48-
4940
- name: Run json-to-go with a file
5041
shell: bash
5142
run: |

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ Contributions are welcome! Open a pull request to fix a bug, or open an issue to
2727
cat sample.json | node json-to-go.js
2828
```
2929

30-
- Read large JSON file from stdin:
31-
32-
```sh
33-
node json-to-go.js --big < sample.json
34-
cat sample.json | node json-to-go.js --big
35-
```
36-
3730
### Credits
3831

3932
JSON-to-Go is brought to you by Matt Holt ([mholt6](https://twitter.com/mholt6)).

json-to-go.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ function jsonToGo(json, typename, flatten = true, example = false, allOmitempty
495495

496496
if (typeof module != 'undefined') {
497497
if (!module.parent) {
498-
let bigstdin = false
499498
let filename = null
500499

501500
process.argv.forEach((val, index) => {
@@ -509,7 +508,7 @@ if (typeof module != 'undefined') {
509508

510509
const argument = val.replace(/-/g, '')
511510
if (argument === "big")
512-
bigstdin = true
511+
console.warn(`Warning: The argument '${argument}' has been deprecated and has no effect anymore`)
513512
else {
514513
console.error(`Unexpected argument ${val} received`)
515514
process.exit(1)
@@ -523,7 +522,7 @@ if (typeof module != 'undefined') {
523522
return
524523
}
525524

526-
if (bigstdin) {
525+
if (!filename) {
527526
bufs = []
528527
process.stdin.on('data', function(buf) {
529528
bufs.push(buf)
@@ -534,12 +533,6 @@ if (typeof module != 'undefined') {
534533
})
535534
return
536535
}
537-
538-
// read from stdin
539-
process.stdin.on('data', function(buf) {
540-
const json = buf.toString('utf8')
541-
process.stdout.write(jsonToGo(json).go)
542-
})
543536
} else {
544537
module.exports = jsonToGo
545538
}

0 commit comments

Comments
 (0)