mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-06 17:37:09 +00:00
* add chart_source * generate chart to fake file * switching to V1 of cert-manager make exec time longer
31 lines
558 B
Go
31 lines
558 B
Go
package utils
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
)
|
|
|
|
// From https://github.com/rakyll/statik/blob/master/statik.go#L313
|
|
// FprintZipData converts zip binary contents to a string literal.
|
|
func FprintZipData(dest *bytes.Buffer, zipData []byte) {
|
|
for _, b := range zipData {
|
|
if b == '\n' {
|
|
dest.WriteString(`\n`)
|
|
continue
|
|
}
|
|
if b == '\\' {
|
|
dest.WriteString(`\\`)
|
|
continue
|
|
}
|
|
if b == '"' {
|
|
dest.WriteString(`\"`)
|
|
continue
|
|
}
|
|
if (b >= 32 && b <= 126) || b == '\t' {
|
|
dest.WriteByte(b)
|
|
continue
|
|
}
|
|
fmt.Fprintf(dest, "\\x%02x", b)
|
|
}
|
|
}
|