atc0005 / todo

A collection of TODO items not specific to any one project
MIT License
0 stars 0 forks source link

Remove gofmt and golint as separate checks, enable these linters in golangci-lint config #9

Closed atc0005 closed 1 year ago

atc0005 commented 4 years ago

While working on atc0005/check-mail#24 I encountered a vendored package that failed gofmt checks. I solved it by excluding the vendor path (as I intended) by using this workaround:

# https://stackoverflow.com/a/42510278/903870
# https://github.com/golang/go/issues/33962#issue-487227277
diff -u <(echo -n) <(gofmt -l $(find . -type f -name '*.go'| grep -v "/vendor/"))

I'll need to either update the gofmt linting call in all other projects using vendored dependencies to reflect this approach or confirm that golangci-lint already handles the gofmt functionality and that the linter is enabled.

atc0005 commented 4 years ago

I solved it by excluding the vendor path (as I intended) by using this workaround:

# https://stackoverflow.com/a/42510278/903870
# https://github.com/golang/go/issues/33962#issue-487227277
diff -u <(echo -n) <(gofmt -l $(find . -type f -name '*.go'| grep -v "/vendor/"))

That worked well enough until I tried to port the line to the project Makefile and hit a wall. I'm sure the syntax is available to do what is desired, but I haven't gotten anywhere with it thus far.

I was told that golangci-lint has gofmt linting support, and after taking a closer look evidently you just need to explicitly enable it (it's disabled by default). At this point I think I'm better off going that route instead of trying to figure out the required syntax.

In short, do away with installing/using gofmt separately and just enable the gofmt linter for golangci-lint.

atc0005 commented 4 years ago

In short, do away with installing/using gofmt separately and just enable the gofmt linter for golangci-lint.

The same for golint at this point. See https://github.com/atc0005/check-mail/issues/23#issuecomment-620498297 for additional details.

atc0005 commented 1 year ago

Long since resolved.

See https://github.com/atc0005/shared-project-resources (and dependent projects) for current workflow efforts.