MCPcopy
hub / github.com/hashicorp/hcl / stripUTF8BOM

Function stripUTF8BOM

hclsyntax/token.go:332–337  ·  view source on GitHub ↗

stripUTF8BOM checks whether the given buffer begins with a UTF-8 byte order mark (0xEF 0xBB 0xBF) and, if so, returns a truncated slice with the same backing array but with the BOM skipped. If there is no BOM present, the given slice is returned verbatim.

(src []byte)

Source from the content-addressed store, hash-verified

330//
331// If there is no BOM present, the given slice is returned verbatim.
332func stripUTF8BOM(src []byte) []byte {
333 if bytes.HasPrefix(src, utf8BOM) {
334 return src[3:]
335 }
336 return src
337}

Callers 1

scanTokensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected