dnssd icon indicating copy to clipboard operation
dnssd copied to clipboard

Add the Go linter runner `golangci-lint`

Open makon opened this issue 3 years ago • 1 comments

As mentioned in #26 this PR adds the Go linter runner golangci-lint.

Most of the linter issues are fixed in several commits. I splited them explicitly so it is easier to follow what the issue is and what was changed to fix it. Many changes aren't critical but are treated as some kind of a standard for golang code.

I would even recommend to enable more linter like the following, but they need a deeper understanding of the code to fix them:

  • funlen
  • gocognit
  • gocyclo
  • nestif
  • testpackage

There is still 1 issue open which doesn't seem to be intended:

probe.go:54:69: `probeService` - `delay` is unused (unparam)
func probeService(ctx context.Context, conn MDNSConn, srv *Service, delay time.Duration, probeOnce bool) (*Service, error) {

The delay param is unused because it is always reassigned with a different value. Not sure if it is safe to remove the parameter or if this is a bug. It would be great if you could give me some feedback so I can fix this or you can do it by your own.

makon avatar Feb 02 '21 21:02 makon

You can find the travis CI results here: https://travis-ci.com/github/makon/dnssd

makon avatar Feb 03 '21 07:02 makon