github.com/Schaudge/grailbase@v0.0.0-20240223061707-44c758a471c0/recordio/gen-magic.go (about) 1 // Copyright 2017 GRAIL, Inc. All rights reserved. 2 // Use of this source code is governed by the Apache-2.0 3 // license that can be found in the LICENSE file. 4 5 // +build ignore 6 7 package main 8 9 import ( 10 "crypto/rand" 11 "fmt" 12 "strings" 13 ) 14 15 func main() { 16 buf := make([]byte, 8, 8) 17 _, err := rand.Read(buf) 18 if err != nil { 19 panic(err) 20 } 21 out := "[]byte{ " 22 for _, v := range buf { 23 out += fmt.Sprintf("0x%02x, ", v) 24 } 25 out = strings.TrimSuffix(out, ", ") + " }" 26 fmt.Println(out) 27 }