spf13 / cobra

A Commander for modern Go CLI interactions
https://cobra.dev
Apache License 2.0
38.08k stars 2.85k forks source link

Improve CONTRIBUTING.md and update Makefile help message #1820

Open maxRN opened 2 years ago

maxRN commented 2 years ago

Hi 👋🏼

The CONTRIBUTING.md file doesn't mention the requirements (golangci-lint and richgo), we should add those for a smoother experience.

And while we are on that, when I tried to run make test the first time, this is what it looked like:

Makefile:5: "could not find golangci-lint in /opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/libiconv/bin:/Users/maxrn/.pyenv/shims:/Users/maxrn/.nvm/versions/node/v16.13.0/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/maxrn/.sdkman/candidates/java/current/bin:/opt/homebrew/opt/llvm/bin:/Users/maxrn/.cabal/bin:/Users/maxrn/.ghcup/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/libiconv/bin:/Users/maxrn/.nvm/versions/node/v16.13.0/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/maxrn/.cargo/bin:/opt/homebrew/opt/fzf/bin:/Users/maxrn/go/bin:/Users/maxrn/src/sonar-scanner-4.7.0.2747-macosx/bin:/Users/maxrn/.dotfiles/bin:/Users/maxrn/go/bin:/Users/maxrn/src/sonar-scanner-4.7.0.2747-macosx/bin:/Users/maxrn/.dotfiles/bin, run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh"
Makefile:9: "could not find richgo in /opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/libiconv/bin:/Users/maxrn/.pyenv/shims:/Users/maxrn/.nvm/versions/node/v16.13.0/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/maxrn/.sdkman/candidates/java/current/bin:/opt/homebrew/opt/llvm/bin:/Users/maxrn/.cabal/bin:/Users/maxrn/.ghcup/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/libiconv/bin:/Users/maxrn/.nvm/versions/node/v16.13.0/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/maxrn/.cargo/bin:/opt/homebrew/opt/fzf/bin:/Users/maxrn/go/bin:/Users/maxrn/src/sonar-scanner-4.7.0.2747-macosx/bin:/Users/maxrn/.dotfiles/bin:/Users/maxrn/go/bin:/Users/maxrn/src/sonar-scanner-4.7.0.2747-macosx/bin:/Users/maxrn/.dotfiles/bin, run: go install github.com/kyoh86/richgo@latest"
******************** downloading dependencies ********************
go get -v ./...
******************** running tests ********************
richgo test -v ./...
make: richgo: No such file or directory
make: *** [test] Error 1

We are printing the entire PATH variable which is pointless IMO. It makes it hard to parse the actual error and the help message ((warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")) is also easily glossed over. I would propose not printing the value of $PATH but just "$PATH". This makes clear the error and also helps the user see the help message more easily.

On that note, the link for installing golangci-lint is outdated. According to the documentation the recommended way for Mac is using brew and the curl command is now curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0

github-actions[bot] commented 1 year ago

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