switch to use go module support

versions of all dependencies remain the same, but now use `go mod` to
manage them rather than govendor.  This does result in a few extra files
being checked in, since govendor would ignore non-build files and go mod
does not.
This commit is contained in:
Will Norris 2018-09-15 07:38:09 +00:00
parent bc59afcf2a
commit 9c3cbc1733
14 changed files with 3215 additions and 831 deletions

76
vendor/github.com/google/btree/btree_mem.go generated vendored Normal file
View file

@ -0,0 +1,76 @@
// Copyright 2014 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build ignore
// This binary compares memory usage between btree and gollrb.
package main
import (
"flag"
"fmt"
"math/rand"
"runtime"
"time"
"github.com/google/btree"
"github.com/petar/GoLLRB/llrb"
)
var (
size = flag.Int("size", 1000000, "size of the tree to build")
degree = flag.Int("degree", 8, "degree of btree")
gollrb = flag.Bool("llrb", false, "use llrb instead of btree")
)
func main() {
flag.Parse()
vals := rand.Perm(*size)
var t, v interface{}
v = vals
var stats runtime.MemStats
for i := 0; i < 10; i++ {
runtime.GC()
}
fmt.Println("-------- BEFORE ----------")
runtime.ReadMemStats(&stats)
fmt.Printf("%+v\n", stats)
start := time.Now()
if *gollrb {
tr := llrb.New()
for _, v := range vals {
tr.ReplaceOrInsert(llrb.Int(v))
}
t = tr // keep it around
} else {
tr := btree.New(*degree)
for _, v := range vals {
tr.ReplaceOrInsert(btree.Int(v))
}
t = tr // keep it around
}
fmt.Printf("%v inserts in %v\n", *size, time.Since(start))
fmt.Println("-------- AFTER ----------")
runtime.ReadMemStats(&stats)
fmt.Printf("%+v\n", stats)
for i := 0; i < 10; i++ {
runtime.GC()
}
fmt.Println("-------- AFTER GC ----------")
runtime.ReadMemStats(&stats)
fmt.Printf("%+v\n", stats)
if t == v {
fmt.Println("to make sure vals and tree aren't GC'd")
}
}

View file

@ -0,0 +1,79 @@
// +build ignore
package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strings"
"github.com/rwcarlsen/goexif/exif"
"github.com/rwcarlsen/goexif/tiff"
)
func main() {
flag.Parse()
fname := flag.Arg(0)
dst, err := os.Create(fname)
if err != nil {
log.Fatal(err)
}
defer dst.Close()
dir, err := os.Open("samples")
if err != nil {
log.Fatal(err)
}
defer dir.Close()
names, err := dir.Readdirnames(0)
if err != nil {
log.Fatal(err)
}
for i, name := range names {
names[i] = filepath.Join("samples", name)
}
makeExpected(names, dst)
}
func makeExpected(files []string, w io.Writer) {
fmt.Fprintf(w, "package exif\n\n")
fmt.Fprintf(w, "var regressExpected = map[string]map[FieldName]string{\n")
for _, name := range files {
f, err := os.Open(name)
if err != nil {
continue
}
x, err := exif.Decode(f)
if err != nil {
f.Close()
continue
}
fmt.Fprintf(w, "\"%v\": map[FieldName]string{\n", filepath.Base(name))
x.Walk(&regresswalk{w})
fmt.Fprintf(w, "},\n")
f.Close()
}
fmt.Fprintf(w, "}")
}
type regresswalk struct {
wr io.Writer
}
func (w *regresswalk) Walk(name exif.FieldName, tag *tiff.Tag) error {
if strings.HasPrefix(string(name), exif.UnknownPrefix) {
fmt.Fprintf(w.wr, "\"%v\": `%v`,\n", name, tag.String())
} else {
fmt.Fprintf(w.wr, "%v: `%v`,\n", name, tag.String())
}
return nil
}