jondot / hygen

The simple, fast, and scalable code generator that lives in your project.
http://www.hygen.io
MIT License
5.57k stars 252 forks source link

Help Wanted - Generator Fails Inconsistently Without Any Indication Of Error #431

Open sean-caruthers opened 1 year ago

sean-caruthers commented 1 year ago

OS: Linux, Ubuntu: 20.04.1 LTS Hygen v6.2.11

Note that this is behavior has been witnessed across multiple dev machines while both running from binary and running via npx.

Observed behavior -

  1. Project generation fails without any displayed error without any variance in input.
  2. Failure occurs without any modification to template files or user input.
  3. Exit status is 0 on successful run and exit status is 1 on failed generation. Nothing is logged out to indicate any type of error.
  4. This behavior is observed when running directly from hygen from the command line.
  5. This behavior is occurs more frequently when running hygen within an ubuntu:jammy container.
  6. The frequency of failure varies and we have not been able to identify the underlying pattern/issue that causes this.

An insight or clues into resolving this issue/getting any logs would be highly appreciated.

See below for example output. It can be seen that template generation succeeds the first few times and then fails. No modifications were made to the underlying files between runs.

USER@HOSTNAME:~/PATH$ hygen hello-world go
✔ What's the name of this project? (no spaces) [e.g.: "my-project"] · a
✔ Would you like to add a UI? (y/N) · false

Loaded templates: _templates
       FORCED: src/a/file1.sh
       shell: cd /home/USER/PATH && chmod +x src/a/file1.sh
       FORCED: src/a/file2.sh
       shell: cd /home/USER/PATH && chmod +x src/a/file2.sh
       FORCED: src/a/Dockerfile
       FORCED: src/a/.dockerignore
       FORCED: src/a/go.mod
       FORCED: src/a/go.sum
       FORCED: src/a/main.go

USER@HOSTNAME:~/PATH$ hygen hello-world go
✔ What's the name of this project? (no spaces) [e.g.: "my-project"] · a
✔ Would you like to add a UI? (y/N) · false

Loaded templates: _templates
       FORCED: src/a/file1.sh
       shell: cd /home/USER/PATH && chmod +x src/a/file1.sh
       FORCED: src/a/file2.sh
       shell: cd /home/USER/PATH && chmod +x src/a/file2.sh
       FORCED: src/a/Dockerfile
       FORCED: src/a/.dockerignore
       FORCED: src/a/go.mod
       FORCED: src/a/go.sum
       FORCED: src/a/main.go

USER@HOSTNAME:~/PATH$ hygen hello-world go
✔ What's the name of this project? (no spaces) [e.g.: "my-project"] · a
✔ Would you like to add a UI? (y/N) · false

Loaded templates: _templates
       FORCED: src/a/file1.sh
       shell: cd /home/USER/PATH && chmod +x src/a/file1.sh
       FORCED: src/a/file2.sh
       shell: cd /home/USER/PATH && chmod +x src/a/file2.sh
       FORCED: src/a/Dockerfile
       FORCED: src/a/.dockerignore
       FORCED: src/a/go.mod
       FORCED: src/a/go.sum
       FORCED: src/a/main.go

USER@HOSTNAME:~/PATH$ hygen hello-world go
✔ What's the name of this project? (no spaces) [e.g.: "my-project"] · a
✔ Would you like to add a UI? (y/N) · false

Loaded templates: _templates
       FORCED: src/a/file1.sh