modfile: make marking for removal a method on Line instead of FileSyntax

The act of marking a line for removal intentionally does not depend on
the rest of the syntax tree, in order to avoid quadratic behavior.
Make that property more explicit by defining it as a method on Line
rather than FileSyntax.

For golang/go#45965

Change-Id: I475625eddf57396411a3fb73eaedd624dd7af3d6
Trust: Bryan C. Mills <>
Run-TryBot: Bryan C. Mills <>
TryBot-Result: Go Bot <>
Reviewed-by: Michael Matloob <>
2 files changed
tree: ec864f00355c7fbb20d96880596be5db89fc7f85
  4. codereview.cfg
  5. go.mod
  6. go.sum
  7. gosumcheck/
  8. internal/
  9. modfile/
  10. module/
  11. semver/
  12. sumdb/
  13. zip/



This repository holds packages for writing tools that work directly with Go module mechanics. That is, it is for direct manipulation of Go modules themselves.

It is NOT about supporting general development tools that need to do things like load packages in module mode. That use case, where modules are incidental rather than the focus, should remain in x/tools, specifically x/tools/go/packages.

The specific case of loading packages should still be done by invoking the go command, which remains the single point of truth for package loading algorithms.