Skip to content

Refactor bootstrap.bash to improve readability of the bootstrap steps#200

Merged
pointlander merged 1 commit into
pointlander:mainfrom
dolmen-go:refactor-bootstrap.bash
May 22, 2026
Merged

Refactor bootstrap.bash to improve readability of the bootstrap steps#200
pointlander merged 1 commit into
pointlander:mainfrom
dolmen-go:refactor-bootstrap.bash

Conversation

@dolmen
Copy link
Copy Markdown
Contributor

@dolmen dolmen commented May 22, 2026

Refactor bootstrap.bash:

  1. Use "go run" to execute each step: this allows to build, run, and cleanup the binary in a single line
  2. Make each step a single command with an explicit list of source files which are part of the build, and aligned input and output files: this improves readibility
  3. Cleanup intermediate files in case of success.
  4. As the previous build script was leaving artefacts, add cleanup of those obsolete artefacts as they are no longer relevant and could be misleading.

Extract of the final script:

go run ../../bootstrap
go run -tags bootstrap  main.go bootstrap.peg.go     < bootstrap.peg     > peg1.peg.go
go run -tags bootstrap  main.go peg1.peg.go          < peg.bootstrap.peg > peg2.peg.go
go run -tags bootstrap  main.go peg2.peg.go          < ../../peg.peg     > peg3.peg.go
go run -tags bootstrap  main.go peg3.peg.go          < ../../peg.peg     > peg-bootstrap.peg.go
go run -tags bootstrap  main.go peg-bootstrap.peg.go < ../../peg.peg     > ../../peg.peg.go

Note: next refactor step should about refactoring ./bootstrap/main.go to make its output more explicit.

Refactor bootstrap.bash:
1. Use "go run" to execute each step: this allows to build, run, and
   cleanup the binary in a single line
2. Make each step a single command with an explicit list of source files
   which are part of the build, and aligned input and output files: this
   improves readibility
3. Cleanup intermediate files in case of success.
4. As the previous build script was leaving artefacts, add cleanup of
   those obsolete artefacts as they are no longer relevant and could be
   misleading.
@pointlander pointlander merged commit d811148 into pointlander:main May 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants