go toolachain cheat sheet Environment go env: see go environment go mod tidy: add all used libraries to the mod-file and download them go get -u: update and download all dependencies go tool <go repo with main>: run third party go repo (mockery, regctl) Research go doc <package>: Show index of given standard lib package go doc <package> <identifier>: Show only identifier with its docstring Tracing GODEBUG=gctrace=1: garbage collector debug info a la gc 2 @0.856s 0%: 0.023+0.16+0.011 ms clock, 0.37+0/0.42/0+0.18 ms cpu, 120->120->67 MB, 122 MB goal, 0 MB stacks, 0 MB globals, 16 P Testing -test.<test flag> is used for running tests directly so go can distinguish flags for the program from the ones for testing -test.failfast: fail on first failed test -test.run="<pattern>": only run matching tests -test.skip="<pattern>": skip matching tests (run all other) t.Run("testname", func(t *testing.T){}): tests can be nested t.Cleanup(func(){}): procedural function (no input/output) acting like…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.