| 1 |
// compile |
| 2 |
|
| 3 |
// Copyright 2017 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
package foo |
| 8 |
|
| 9 |
import ( |
| 10 |
"encoding/binary" |
| 11 |
) |
| 12 |
|
| 13 |
type DbBuilder struct { |
| 14 |
arr []int |
| 15 |
} |
| 16 |
|
| 17 |
func (bld *DbBuilder) Finish() error { |
| 18 |
defer bld.Finish() |
| 19 |
|
| 20 |
var hash []byte |
| 21 |
for _, ixw := range bld.arr { |
| 22 |
for { |
| 23 |
if ixw != 0 { |
| 24 |
panic("ixw != 0") |
| 25 |
} |
| 26 |
ixw-- |
| 27 |
insertOne: |
| 28 |
for { |
| 29 |
for i := 0; i < 1; i++ { |
| 30 |
if binary.LittleEndian.Uint16(hash[i:]) == 0 { |
| 31 |
break insertOne |
| 32 |
} |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
return nil |
| 39 |
} |