One folder, one bounded contextLLM view

Go

Possible, and the smallest change of the four. A context is one package tree inside one Go module. The compiler guards its inside.

The files

Explorer
  • go.modone module for the whole app
  • main.goapi, worker, migrate
  • orders_gen.gogeneratedone file per context, committed
  • context.yaml
  • register.gothe one function
  • public
  • Go will not let another context import this
  • policies.yaml
  • flags.yaml

What the tools allow

QuestionAnswerTag
Tests inside the folderyes; coverage needs -coverpkgMEASURED
A planted failing testfailsMEASURED
Tests or docs in the binary0 foundMEASURED
A src/ folderno: internal/ must sit at the context's rootMEASURED
One Go module per contextno: go.work would be edited by every new contextMEASURED

Another context's inside does not compile

billing imports the inside of orders (real output)
$go build ./...
package bc1/gobase/contexts/billing/internal/domain
contexts/billing/internal/domain/zz_breach.go:3:8: use of internal package bc1/gobase/contexts/orders/internal/domain not allowed
$

What changes in the template

ChangeCountTag
Files moved4 of 248MEASURED
Config files edited10MEASURED
Project files per context0MEASURED
Generated files per context1MEASURED

What does not work cleanly

  • Two new libraries on neighbouring lines conflict in go.mod and go.sum. go mod tidy fixes it. MEASURED
  • The lint tool cannot match a context by wildcard, so our generator checks the layers. MEASURED
  • No real Go app exists to try it on. NOT TESTED