gitee.com/bomy/docker.git@v1.13.1/pkg/platform/utsname_uint8.go (about)

     1  // +build linux,arm linux,ppc64 linux,ppc64le s390x
     2  // see golang's sources src/syscall/ztypes_linux_*.go that use uint8
     3  
     4  package platform
     5  
     6  // Convert the OS/ARCH-specific utsname.Machine to string
     7  // given as an array of unsigned uint8
     8  func charsToString(ca [65]uint8) string {
     9  	s := make([]byte, len(ca))
    10  	var lens int
    11  	for ; lens < len(ca); lens++ {
    12  		if ca[lens] == 0 {
    13  			break
    14  		}
    15  		s[lens] = ca[lens]
    16  	}
    17  	return string(s[0:lens])
    18  }