INNER CODE UNIT · Go

stringLiteral

deckhouse/deckhouse · dhctl/hack/gen_preflight_checks/main.go:107

func stringLiteral(values []ast.Expr, idx int) string {
	if idx >= len(values) {
		return ""
	}
	lit, ok := values[idx].(*ast.BasicLit)
	if !ok || lit.Kind != token.STRING {
		return ""
	}
	s, err := strconv.Unquote(lit.Value)
	if err != nil {
		return ""
	}
	return s
}

func render(names []string) string {
	var b strings.Builder
	fmt.Fprintln(&b, "// Code generated by hack/gen_preflight_checks; DO NOT EDIT.")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…