Skip to content
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

Fix Makefile install instructions and improve CONTRIBUTING.md #1823

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FollowTheProcess
Copy link

Closes #1820

This PR addresses the concerns raised in the linked issue above re. Makefile printing entire $PATH variable and incorrect instructions for installing golangci-lint.

I've also added a line in CONTRIBUTING.md linking to the two dev tools required.

On running linting there was a few warnings about deprecated and/or abandoned linters so I've fixed them up:

WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused. 
WARN [runner] The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.  
WARN [runner] The linter 'maligned' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.  Replaced by govet 'fieldalignment'. 
WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused. 
WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused. 
WARN [runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner.  Replaced by revive. 

I've made the suggested replacements (most were replaced by unused)

@CLAassistant
Copy link

CLAassistant commented Oct 9, 2022

CLA assistant check
All committers have signed the CLA.

@umarcor
Copy link
Contributor

umarcor commented Oct 18, 2022

@FollowTheProcess can you please rebase on top of #1785 ?

.golangci.yml Outdated
#- lll
- maligned
# - maligned
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we are running the replacement linter for this one.
According to the golangci-lint warning: "Replaced by govet 'fieldalignment'"

If I make the following modification without the PR I get an linter error, but not after the PR.

diff --git a/command.go b/command.go
index 9d5e9cf..943bb17 100644
--- a/command.go
+++ b/command.go
@@ -175,9 +175,6 @@ type Command struct {
 	// helpCommandGroupID is the group id for the helpCommand
 	helpCommandGroupID string

-	// completionCommandGroupID is the group id for the completion command
-	completionCommandGroupID string
-
 	// versionTemplate is the version template defined by user.
 	versionTemplate string

@@ -194,6 +191,8 @@ type Command struct {
 	// CompletionOptions is a set of options to control the handling of shell completion
 	CompletionOptions CompletionOptions

+	// completionCommandGroupID is the group id for the completion command
+	completionCommandGroupID string
 	// commandsAreSorted defines, if command slice are sorted or not.
 	commandsAreSorted bool
 	// commandCalledAs is the name or alias value used to call this command.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think we'd need to configure govet to do that: https://golangci-lint.run/usage/linters/#govet. I tend to just use:

  govet:
    enable-all: true

But if we've not run that before it might trigger a load of stuff

@FollowTheProcess
Copy link
Author

@FollowTheProcess can you please rebase on top of #1785 ?

Ahh sorry I didn't see there was already one addressing the linter config. If it's easier and keeps this PR cleaner I can remove the linter changes from this one?

@marckhouzam
Copy link
Collaborator

Ahh sorry I didn't see there was already one addressing the linter config. If it's easier and keeps this PR cleaner I can remove the linter changes from this one?

Yeah, if we keep the changes separate, we will be able to merge more easily. Thanks 👍

Makefile Outdated

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")
$(warning "could not find golangci-lint in PATH, run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.50.0")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern here is that the command now specifies a version of the linter to install (which would have to be kept up to date). Maybe it's better to simply point to the website which has good install docs: https://golangci-lint.run/usage/install/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern here is that the command now specifies a version of the linter to install (which would have to be kept up to date). Maybe it's better to simply point to the website which has good install docs: https://golangci-lint.run/usage/install/

Agreed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative is to use go install, as done in CI. However, that won't add it to the PATH.

@github-actions
Copy link

The Cobra project currently lacks enough contributors to adequately respond to all PRs. This bot triages issues and PRs according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied. - After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied and the PR is closed.
    You can:
  • Make a comment to remove the stale label and show your support. The 60 days reset. - If a PR has lifecycle/rotten and is closed, comment and ask maintainers if they'd be interested in reopening.

@FollowTheProcess
Copy link
Author

Please don't stale 😂 do I need to do anything to help you guys be able to merge this?

@umarcor
Copy link
Contributor

umarcor commented Dec 18, 2022

@FollowTheProcess, see #1858. You can ignore those comments. Furthermore, you might want to propose a PR to remove the stale-bot. Removing https://github.com/spf13/cobra/blob/main/.github/workflows/stale.yml should suffice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve CONTRIBUTING.md and update Makefile help message
5 participants