MCPcopy Create free account
hub / github.com/rilldata/rill / padLeft

Function padLeft

admin/pkg/authtoken/authtoken.go:186–194  ·  view source on GitHub ↗

padLeft pads a byte slice with zeros on the left such that its length is n. If the slice is already longer than n, it is returned as is.

(b []byte, n int)

Source from the content-addressed store, hash-verified

184// padLeft pads a byte slice with zeros on the left such that its length is n.
185// If the slice is already longer than n, it is returned as is.
186func padLeft(b []byte, n int) []byte {
187 if len(b) >= n {
188 return b
189 }
190
191 padded := make([]byte, n)
192 copy(padded[n-len(b):], b)
193 return padded
194}

Callers 1

FromStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected