Go PTSD — A practical implementation of PTSD in Golang.

Trần Thiện Khiêm
3 min readApr 18, 2023

If you are not familiar with the PTSD method (Program to Speedily delete), then you can refer to this article of mine: The PTSD Method in Software Development, before following on with the article.

If you are too lazy to read, here you go:

The main idea is to think about how to delete the code before writing any code, in order to remove introduced bugs and adapt to rapid changes. By being able to delete code easily, the impact on a project can be significant.

In this article, I’ll focus on implementing that idealogy following best practices in Golang.

The Big Bad Program structure

I don’t have a strong preference for structuring the Big Bad Program, but here is a recommendation approach:

- internal // the internal packages - very very deletable
- deletableunit1
- deletableunit2
- deletablegroup
- pkg // public packages - deletable but you may need to talk to others first
- api1 // (this is where the 1LI happen)
- api2
- README.md // DO NOT DELETE

We try to design the BBP so that everything is deletable and split it into two different sections:

  • internal is where you can freely delete your code
  • pkg is where you may need…

--

--

Trần Thiện Khiêm

Software Engineer at Facebook — a coder, a dreamer and a Dota 2 Herald.