Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "flag"
- )
- var option = struct {
- knob uint
- }{
- knob: 4096,
- }
- func init() {
- flag.UintVar(&option.knob, "k", option.knob, "somethin' to play with")
- }
- // fragment for server main
- func main() {
- flag.Parse()
- // ...
- }
- // put in service path
- func service() {
- arr := alloc(option.knob)
- lim := len(arr) - 1
- for i := 0; i < lim; i++ {
- arr[i] = uint64(i)
- }
- copy(arr[1:], arr[:lim+1])
- }
- func alloc(size uint) []uint64 {
- return make([]uint64, size)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement