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

--help broke #32

Closed
Skarlso opened this issue Jul 27, 2022 · 11 comments · Fixed by #33
Closed

--help broke #32

Skarlso opened this issue Jul 27, 2022 · 11 comments · Fixed by #33
Labels

Comments

@Skarlso
Copy link
Contributor

Skarlso commented Jul 27, 2022

For any command when I'm trying to run --help I get:

ocm add --help
ocm add — template: top:1:29: executing "top" at <.Short>: wrong type for value; expected language.Tag; got string
@Skarlso Skarlso added the kind/bugfix Bug label Jul 27, 2022
@mandelsoft
Copy link
Contributor

This must have been those golangci-lint proposals

@mandelsoft
Copy link
Contributor

. /home/d021770/dev/go/landscaper/src/github.com/open-component-model/ocm/pkg/...
WARN [linters context] structcheck is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649. 
cmds/ocm/pkg/cobrautils/funcs.go:25:17: SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)
	"title":       strings.Title,
	               ^

This is not a replacement

@mandelsoft
Copy link
Contributor

No idea how to use it. Could you fix this?

@Skarlso
Copy link
Contributor Author

Skarlso commented Jul 27, 2022

Yep, on it.

@mandelsoft
Copy link
Contributor

I think strings.Title should be replaced by cases.Title(language.English).String

@Skarlso
Copy link
Contributor Author

Skarlso commented Jul 27, 2022

That's not the cause of the broken --help though. Don't worry, I'll fix it. :)

@mandelsoft
Copy link
Contributor

mandelsoft commented Jul 27, 2022

sure, after I changed this, help worked again

@Skarlso
Copy link
Contributor Author

Skarlso commented Jul 27, 2022

What was your change? Because for me it still fails.

@Skarlso
Copy link
Contributor Author

Skarlso commented Jul 27, 2022

I might be missing something but that strings.Title is generate-docs, right? That's not part of the help generating problem.

@Skarlso
Copy link
Contributor Author

Skarlso commented Jul 27, 2022

ah you mean what you replaced here:

var templatefuncs = map[string]interface{}{
	"indent":      indent,
	"skipCommand": skipCommand,
	"soleCommand": soleCommand,
-	"title":       strings.Title,
+	"title":       cases.Title,
}

@Skarlso
Copy link
Contributor Author

Skarlso commented Jul 27, 2022

Yep, that works.

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

Successfully merging a pull request may close this issue.

3 participants