go-tools
delve
go-tools | delve | |
---|---|---|
19 | 52 | |
5,910 | 22,075 | |
- | 0.6% | |
7.9 | 9.2 | |
8 days ago | 2 days ago | |
Go | Go | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
go-tools
- Ask HN: What are some interesting tools or code repos you discovered recently
-
Gopher Pythonista #1: Moving From Python To Go
Another useful tool in Go is the go vet command, which helps to identify common coding mistakes such as unreachable code or useless comparisons. In addition, external linters like staticcheck can be used to detect bugs and performance issues with ease.
-
Find project-wide unused code using Golang's LSP
For the last year or so (as of 2023) Golang has only had one active project for linting unused code, namely: unused from https://github.com/dominikh/go-tools. It works really well, but only within a package, not across packages, like within a traditional monolith. unused used to be part of another project called staticcheck, that did indeed have a flag for detecting project-wide unused code, but that is no longer supported. There are good reasons for that (see this Github discussion), mainly that it's computationally expensive.
-
Why tf golang let's you create maps with duplicated keys
To a degree, sure. It can't pick it up in general, because of the halting problem. But some trivial cases could be caught. Feel free to write such a linter, I'm sure Dominik would gladly merge it, for example.
-
Tools besides Go for a newbie
IDE: use whatever make you productive. I personally use vscode. VCS: git, as golang communities use github heavily as base for many libraries. AFAIK Linter: use staticcheck for linting as it looks like mostly used linting tool in go, supported by many also. In Vscode it will be recommended once you install go plugin. Libraries/Framework: actually the standard libraries already included many things you need, decent enough for your day-to-day development cycles(e.g. `net/http`). But here are things for extra: - Struct fields validator: validator - Http server lib: chi router , httprouter , fasthttp (for non standard http implementations, but fast) - Web Framework: echo , gin , fiber , beego , etc - Http client lib: most already covered by stdlib(net/http), so you rarely need extra lib for this, but if you really need some are: resty - CLI: cobra - Config: godotenv , viper - DB Drivers: sqlx , postgre , sqlite , mysql - nosql: redis , mongodb , elasticsearch - ORM: gorm , entgo , sqlc(codegen) - JS Transpiler: gopherjs - GUI: fyne - grpc: grpc - logging: zerolog - test: testify , gomock , dockertest - and many others you can find here
-
New linter for mixing pointer and value method receivers
Also proposal to staticcheck, will see if it goes through! https://github.com/dominikh/go-tools/issues/1337
-
this result of append is never used, except maybe in other appends (SA4010)
This is the first result for that error in google. The comment in that issue explains it. You're building two array's c_code, and c_start_date which are built and then never read or returned or otherwise used.
-
Zig, the Small Language
This really irritated me when I started working with go, but it stopped bothering me and now I even mostly like it.
The missing error checks are annoying, but if you have appropriate editor config it is hard to miss them: https://cdn.billmill.org/static/newsyctmp/warning.png
Basically writing go without `staticcheck`[1] is not recommended. If you do have it set up, it's pretty easy to avoid simple errors like that.
[1]: https://staticcheck.io/
-
Our experience upgrading from go v1.17 to v1.18 for generics
However, recently [per this issue](https://github.com/dominikh/go-tools/issues/1270) it is safe to re-enable the ones I highlighted with strikethrough above. I would be interested in tracking issues for the remainder if you have those linked somewhere.
-
What are your strategies to prevent nil pointers errors in your code base?
Unfortunately I don't know of any tools that can/do always detect it. There's this discussion for the staticcheck linter where they basically don't think it's worth false positives in order to support it a lint for it.
delve
-
The worst thing about Jenkins is that it works
At a recent job, we had slightly different containers for local dev; our backend containers (for a Go app) had Air [1] installed for live reloading, plus Delve [2] running inside the container for VS Code's debugger to connect to. We also had a frontend container for local dev, which didn't get deployed as a container, just as static files.
[1] https://github.com/cosmtrek/air
[2] https://github.com/go-delve/delve/
-
Delve v1.21.2 is out now
https://github.com/go-delve/delve/releases/tag/v1.21.2 Thanks Derek and the rest of the team for helping us to debug in a normal way!
- I do not use a debugger
-
Writing and debugging integration tests of multiple processes with Golang
My employer has a commercial solution for this but Delve does supports `rr` traces natively for this purpose, which gives a complete open-source solution (https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_replay.md).
- No support for debugging Go on OpenBSD
- Delve v1.20.2 is out now
-
Tools besides Go for a newbie
delve and related IDE integrations
-
What a good debugger can do
For time travel debugging in Go:
The Delve debugger for Go supports debugging rr traces: https://github.com/go-delve/delve/blob/master/Documentation/...
Undo (who I work for) maintain a fork that debugs our LiveRecorder recordings: https://docs.undo.io/GoDelve.html
Either rr (https://rr-project.org/) or our UDB debugger (https://undo.io/solutions/products/udb/) can do some time travel debugging of Go programs via GDB's built-in support for Go. I believe its weakness is in support for goroutines, since they don't map well onto its idea of how programs run.
-
Is there a neovim config with preconfigured debugger?
So in my case I use https://github.com/leoluz/nvim-dap-go (which itself calls out to the CLI tool https://github.com/go-delve/delve).
-
What's wrong with my GoLand debugger?
Clone https://github.com/go-delve/delve.git
What are some alternatives?
revive - 🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
air - ☁️ Live reload for Go apps
gosec - Go security checker
go-debug
golangci-lint - Fast linters Runner for Go
vim-go - Go development plugin for Vim
GNU/Emacs go-mode - Emacs mode for the Go programming language
gorequest - GoRequest -- Simplified HTTP client ( inspired by nodejs SuperAgent )
gofumpt - A stricter gofmt
go-sitemap-generator - go-sitemap-generator is the easiest way to generate Sitemaps in Go
ls-lint - An extremely fast directory and filename linter - Bring some structure to your project filesystem
gohper