Day 29: Go, please
đ° Mood: Frantically refreshing the live race results every hour on the hour for Bigâs Backyard Ultra. Currently 5 people left who have run 241 miles.
đ Reading Github Issues
I read the 30 new issues since Thursday.
- Two were about fuzzing: 1, 2. Both looks do-able, but I already have an open PR for a go fuzz fix. I donât want to pick up more work until my previous work is reviewed.
- There was one about testable examples not working properly IRL (but passing tests) with local files. Looked intersting, but it sounds like the author wants to handle it.
đ What to work on next?
I started out feeling aimless today. Last week I got frustrated with the lack of documentation around go assembly. I did find assembly interesting and I could look more into a different assembly language, but I feel like I am straying further and further from the point of this sabbatical.
I wrote some testable examples for some functions in the net package (1, 2) just to give me something productive to do that wouldnât take much time.
Then I started looking through the issues marked âhelp wantedâ. Maybe youâve wondered why I didnât start here in the first place? Well, it turns out that most of the issues labeled âhelp wantedâ already have fixes submitted. I would estimate 9/10 of the issues that I think look interesting based on their title are already complete. This is a sucky (my editor claims this is spelled âsuckeyâ???) user experience, which is why I have been gravitating towards the new issues everyday.
đ„ș Go, please
Eventually after sifting through pages of âhelp wantedâ issues, I found this one from March 2021. It is about the code formatting suggestions that you get via gopls in your code editor. The feature is to add a âfix allâ option when you highlight a section. This is one of the (many) areas of go that I am unfamiliar with; seems like there could be some fun digging here.
My ideal next steps are:
- Duplicate the example in the github issue
- Find some gopls logs
- Figure out how to use a local version of gopls
- Fix it
đ„ Even before those steps, you know I had to watch some videos
- âGopherCon 2019: Rebecca Stambler - Go, pls stop breaking my editorâ
- âGopherCon 2019 Lightning Talk: Paul Jolly - gopls + vim = govimâ
I learned:
- Gopls is a language server that follows the Language Server Protocol (LSP).
- Before gopls all the editors called out to the tens of go tools to do the different editor-y things you and I love (goto definition, autocomplete, etc). This means lots of integration points and lots of breakage.
- Now every editor can speak to the gopls via a standard API.
- Now gopls can handle all of the logic of knowing if you are using modules or not.
- Now gopls is maintained by the go team and is thoroughly tested.
đŻââïž Step 1: Use gopls to duplicate the issue
I use vim for 95% of my text editor needs. I even write this blog in vim. I am
terrified of messing up my vim config, so I will not be testing this
out with vim. I decided to try it out with sublime. I installed sublime,
immediately had problems, finally figured out that they are because I used mv
to move the application into the application directory instead of finder and
that somehow screws things up? Then I had tons of problems getting it to use
gopls. Okay. Scrap sublime. Letâs try VSCode!
Wwith a few button clicks VSCode âjust workedâ with gopls.
- I duplicated the example in the github issue đ this was step 1!
- I enabled trace logging for gopls and found the logs đ this was step 2!
- Got a cool debug server up for gopls that has a ton more debug information (reference guide)
Tomorrow I will try to get my own local version of gopls running.