4 ms·
This is not a piece of code I would commit, obviously! It's a piece of code in the middle of being written and re-written (and re-run, a la REPL), and constantl
by Joker_vD 2y ago
This is not a piece of code I would commit, obviously! It's a piece of code in the middle of being written and re-written (and re-run, a la REPL), and constantly replacing "resp2" with "_" and back again with "resp2" is friction. Go doesn't have REPL but having a TestWhatever(t *testing.T) function is a mostly good enough replacement, except for this one small problem.
- politician 2y agoWhew, that's a relief! If I understand correctly, then I think you'll have a better experience if you practice doing something like this when writing tests: foo, fooErr := doit() require.NotNil(foo) require.NoError(fooErr) _, _ = foo, fooErr // alternative if you don't want the asserts for some reason, remember to come back later and delete though // ...repl churn code... Using the stretchr/testify/require package. This code defines both variables, gives the error a unique name in the scope, and then references the names in two asserts. You won't have to deal with unreferenced name errors in the "repl churn", so you can comment/uncomment code as you go.