Literate programming example using noweb

Full article: 6 lessons from literate programming

Install noweb with brew (macOS):

brew install noweb

To generate the files:

notangle -Rgo.mod hello.nw > go.mod
mkdir -p mypackage
notangle -R'mypackage/mypackage.go' hello.nw > mypackage/mypackage.go
notangle -Rmain.go hello.nw > main.go
noweave -html hello.nw > hello.html

To run the program:

go run main.go

To view docs as HTML (on macOS):

open hello.html