github.com/xingly-cn/shorturl-go@v0.0.0-20220110130535-e21de4659f74/pkg/mod/golang.org/x/sys@v0.0.0-20200323222414-85ca7c5b95cd/unix/syscall_darwin_test.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package unix_test 6 7 // stringsFromByteSlice converts a sequence of attributes to a []string. 8 // On Darwin, each entry is a NULL-terminated string. 9 func stringsFromByteSlice(buf []byte) []string { 10 var result []string 11 off := 0 12 for i, b := range buf { 13 if b == 0 { 14 result = append(result, string(buf[off:i])) 15 off = i + 1 16 } 17 } 18 return result 19 }