-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update golangci configuration #1785
base: main
Are you sure you want to change the base?
Changes from all commits
fb85207
4e22048
62eecc8
fca1d61
287f2e9
c056dec
cee7f37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,19 +5,15 @@ ifeq (, $(shell which golangci-lint)) | |||||
$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh") | ||||||
endif | ||||||
|
||||||
.PHONY: fmt lint test install_deps clean | ||||||
.PHONY: lint test install_deps clean | ||||||
|
||||||
default: all | ||||||
|
||||||
all: fmt test | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I started contributing I would do But I agree that making I'm not sure what is best... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO modifying the sources and building cobra are not directly related to contributing code back to the upstream. That is, users might want to use and modify this open source tool regardless of the linting rules enforced in this repository. From this point of view, the requirement/need to use golangci-lint belongs to contributing guidelines: https://github.com/spf13/cobra/blob/main/CONTRIBUTING.md. Everyone should read the contributing guidelines before submitting a PR to a project. |
||||||
all: test | ||||||
|
||||||
fmt: | ||||||
$(info ******************** checking formatting ********************) | ||||||
@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we no longer need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the 'lint' target in the same Makefile. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah gotcha - but is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. It will check if the format is correct. That's what the current Lines 19 to 20 in a281c8b
This PR does not introduce any change in that regard. |
||||||
|
||||||
lint: | ||||||
$(info ******************** running lint tools ********************) | ||||||
golangci-lint run -v | ||||||
install_deps: | ||||||
$(info ******************** downloading dependencies ********************) | ||||||
go get -v ./... | ||||||
|
||||||
test: install_deps | ||||||
$(info ******************** running tests ********************) | ||||||
|
@@ -27,9 +23,9 @@ richtest: install_deps | |||||
$(info ******************** running tests with kyoh86/richgo ********************) | ||||||
richgo test -v ./... | ||||||
|
||||||
install_deps: | ||||||
$(info ******************** downloading dependencies ********************) | ||||||
go get -v ./... | ||||||
lint: | ||||||
$(info ******************** running lint tools ********************) | ||||||
golangci-lint run -v | ||||||
|
||||||
clean: | ||||||
rm -rf $(BIN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize our
.golangci.yml
had abunch of rules commented out. That seems weird. And makes the linter file harder to read: I don't think anyone really needs to know what rules we explicitly aren't using, that's implied by them not being in the file to begin with.Can we just remove them?