Skip to content
Soren L. Hansen edited this page Nov 28, 2022 · 1 revision

I just want to build it, I don't care about working on the code!

The most straightforward way to just build GoTTY is to use docker. This way you need neither Go nor node.js installed. Check out the source and run make build. The last few lines will look something like this:

Step 15/16 : COPY --from=go-build /gotty/gotty /usr/bin/
 ---> f51afa9a149d
Step 16/16 : CMD ["gotty",  "-w", "bash"]
 ---> Running in a5d21752f2c8
Removing intermediate container a5d21752f2c8
 ---> 386a3609dcbe
Successfully built 386a3609dcbe
Successfully tagged gotty-bash:v1.5.0-21-g5b8ba12

You can extract the binary from Docker like so:

$ docker run  gotty-bash:v1.5.0-21-g5b8ba12 cat /usr/bin/gotty > gotty ; chmod +x gotty

That is a terrible workflow for development, so let's dive into that instead.

I want to actually work on GoTTY!

Cool! Welcome aboard. GoTTY has two parts to it. A frontend written in Typescript and a backend written in Go.

You can use whatever tools you want. These instructions assume you're using VSCode.

Fire up VSCode and clone the repo.

The Go parts

There is a "Launch GoTTY" debugging target in VSCode (because it's in the repo's .vscode/launch.json). If you run that target, GoTTY will be launched and you have full debugger integration in VSCode. You can set breakpoints, watches, etc. If you make any code changes, you have to stop the debugging session and start it again.

The typescript parts

There is another debugging target, "Launch Chrome". It launches Chrome and loads http://localhost:8080 which is where the "Launch GoTTY" target runs. Like the Go stuff, you can set breakpoints and watches, etc.

If you're actively working on the Typescript parts, you can run the "webpack watch" task. This will monitor js/src for changes and recompile everything as needed. This generally happens in 3-5 seconds. Once recompiled, you can simply reload the page. No need to restart the debug target or anything.

Happy hacking!