Browse Source

Remove vendor directory

Vendor hasn't been used in upstream since Oct 2019.
We also don't use it when building by default.
Any vendor-specific changes have been removed already.
Achilleas Koutsou 4 năm trước cách đây
mục cha
commit
8843e1cf14
100 tập tin đã thay đổi với 0 bổ sung15022 xóa
  1. 0 3
      vendor/github.com/G-Node/git-module/.gitignore
  2. 0 18
      vendor/github.com/G-Node/git-module/.travis.yml
  3. 0 19
      vendor/github.com/G-Node/git-module/LICENSE
  4. 0 15
      vendor/github.com/G-Node/git-module/README.md
  5. 0 35
      vendor/github.com/G-Node/git-module/blob.go
  6. 0 158
      vendor/github.com/G-Node/git-module/command.go
  7. 0 309
      vendor/github.com/G-Node/git-module/commit.go
  8. 0 57
      vendor/github.com/G-Node/git-module/commit_archive.go
  9. 0 77
      vendor/github.com/G-Node/git-module/deprecated.go
  10. 0 61
      vendor/github.com/G-Node/git-module/error.go
  11. 0 74
      vendor/github.com/G-Node/git-module/git.go
  12. 0 9
      vendor/github.com/G-Node/git-module/go.mod
  13. 0 16
      vendor/github.com/G-Node/git-module/go.sum
  14. 0 111
      vendor/github.com/G-Node/git-module/hook.go
  15. 0 31
      vendor/github.com/G-Node/git-module/remote.go
  16. 0 289
      vendor/github.com/G-Node/git-module/repo.go
  17. 0 120
      vendor/github.com/G-Node/git-module/repo_branch.go
  18. 0 380
      vendor/github.com/G-Node/git-module/repo_commit.go
  19. 0 400
      vendor/github.com/G-Node/git-module/repo_diff.go
  20. 0 13
      vendor/github.com/G-Node/git-module/repo_hook.go
  21. 0 14
      vendor/github.com/G-Node/git-module/repo_object.go
  22. 0 81
      vendor/github.com/G-Node/git-module/repo_pull.go
  23. 0 209
      vendor/github.com/G-Node/git-module/repo_tag.go
  24. 0 26
      vendor/github.com/G-Node/git-module/repo_tree.go
  25. 0 93
      vendor/github.com/G-Node/git-module/sha1.go
  26. 0 48
      vendor/github.com/G-Node/git-module/signature.go
  27. 0 78
      vendor/github.com/G-Node/git-module/submodule.go
  28. 0 65
      vendor/github.com/G-Node/git-module/tag.go
  29. 0 149
      vendor/github.com/G-Node/git-module/tree.go
  30. 0 57
      vendor/github.com/G-Node/git-module/tree_blob.go
  31. 0 231
      vendor/github.com/G-Node/git-module/tree_entry.go
  32. 0 93
      vendor/github.com/G-Node/git-module/utils.go
  33. 0 35
      vendor/github.com/G-Node/libgin/LICENSE
  34. 0 56
      vendor/github.com/G-Node/libgin/libgin/annex/add.go
  35. 0 74
      vendor/github.com/G-Node/libgin/libgin/annex/file.go
  36. 0 12
      vendor/github.com/G-Node/libgin/libgin/annex/util.go
  37. 0 88
      vendor/github.com/G-Node/libgin/libgin/archive.go
  38. 0 95
      vendor/github.com/G-Node/libgin/libgin/crypto.go
  39. 0 66
      vendor/github.com/G-Node/libgin/libgin/dex.go
  40. 0 173
      vendor/github.com/G-Node/libgin/libgin/doi.go
  41. 0 368
      vendor/github.com/G-Node/libgin/libgin/gig/delta.go
  42. 0 233
      vendor/github.com/G-Node/libgin/libgin/gig/objects.go
  43. 0 382
      vendor/github.com/G-Node/libgin/libgin/gig/pack.go
  44. 0 315
      vendor/github.com/G-Node/libgin/libgin/gig/parse.go
  45. 0 246
      vendor/github.com/G-Node/libgin/libgin/gig/refs.go
  46. 0 463
      vendor/github.com/G-Node/libgin/libgin/gig/repo.go
  47. 0 71
      vendor/github.com/G-Node/libgin/libgin/gig/util.go
  48. 0 80
      vendor/github.com/G-Node/libgin/libgin/gig/walk.go
  49. 0 206
      vendor/github.com/G-Node/libgin/libgin/gig/write.go
  50. 0 8
      vendor/github.com/G-Node/libgin/libgin/libgin.go
  51. 0 24
      vendor/github.com/G-Node/libgin/libgin/util.go
  52. 0 20
      vendor/github.com/beorn7/perks/LICENSE
  53. 0 2388
      vendor/github.com/beorn7/perks/quantile/exampledata.txt
  54. 0 316
      vendor/github.com/beorn7/perks/quantile/stream.go
  55. 0 1
      vendor/github.com/boombuler/barcode/.gitignore
  56. 0 21
      vendor/github.com/boombuler/barcode/LICENSE
  57. 0 53
      vendor/github.com/boombuler/barcode/README.md
  58. 0 42
      vendor/github.com/boombuler/barcode/barcode.go
  59. 0 1
      vendor/github.com/boombuler/barcode/go.mod
  60. 0 66
      vendor/github.com/boombuler/barcode/qr/alphanumeric.go
  61. 0 23
      vendor/github.com/boombuler/barcode/qr/automatic.go
  62. 0 59
      vendor/github.com/boombuler/barcode/qr/blocks.go
  63. 0 416
      vendor/github.com/boombuler/barcode/qr/encoder.go
  64. 0 29
      vendor/github.com/boombuler/barcode/qr/errorcorrection.go
  65. 0 56
      vendor/github.com/boombuler/barcode/qr/numeric.go
  66. 0 166
      vendor/github.com/boombuler/barcode/qr/qrcode.go
  67. 0 27
      vendor/github.com/boombuler/barcode/qr/unicode.go
  68. 0 310
      vendor/github.com/boombuler/barcode/qr/versioninfo.go
  69. 0 134
      vendor/github.com/boombuler/barcode/scaledbarcode.go
  70. 0 57
      vendor/github.com/boombuler/barcode/utils/base1dcode.go
  71. 0 119
      vendor/github.com/boombuler/barcode/utils/bitlist.go
  72. 0 65
      vendor/github.com/boombuler/barcode/utils/galoisfield.go
  73. 0 103
      vendor/github.com/boombuler/barcode/utils/gfpoly.go
  74. 0 44
      vendor/github.com/boombuler/barcode/utils/reedsolomon.go
  75. 0 19
      vendor/github.com/boombuler/barcode/utils/runeint.go
  76. 0 202
      vendor/github.com/bradfitz/gomemcache/LICENSE
  77. 0 687
      vendor/github.com/bradfitz/gomemcache/memcache/memcache.go
  78. 0 129
      vendor/github.com/bradfitz/gomemcache/memcache/selector.go
  79. 0 8
      vendor/github.com/cespare/xxhash/v2/.travis.yml
  80. 0 22
      vendor/github.com/cespare/xxhash/v2/LICENSE.txt
  81. 0 55
      vendor/github.com/cespare/xxhash/v2/README.md
  82. 0 3
      vendor/github.com/cespare/xxhash/v2/go.mod
  83. 0 0
      vendor/github.com/cespare/xxhash/v2/go.sum
  84. 0 236
      vendor/github.com/cespare/xxhash/v2/xxhash.go
  85. 0 13
      vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go
  86. 0 215
      vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
  87. 0 76
      vendor/github.com/cespare/xxhash/v2/xxhash_other.go
  88. 0 15
      vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
  89. 0 46
      vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
  90. 0 21
      vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md
  91. 0 14
      vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go
  92. 0 345
      vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go
  93. 0 27
      vendor/github.com/denisenkom/go-mssqldb/LICENSE.txt
  94. 0 289
      vendor/github.com/denisenkom/go-mssqldb/README.md
  95. 0 50
      vendor/github.com/denisenkom/go-mssqldb/appveyor.yml
  96. 0 262
      vendor/github.com/denisenkom/go-mssqldb/buf.go
  97. 0 583
      vendor/github.com/denisenkom/go-mssqldb/bulkcopy.go
  98. 0 93
      vendor/github.com/denisenkom/go-mssqldb/bulkcopy_sql.go
  99. 0 456
      vendor/github.com/denisenkom/go-mssqldb/conn_str.go
  100. 0 306
      vendor/github.com/denisenkom/go-mssqldb/convert.go

+ 0 - 3
vendor/github.com/G-Node/git-module/.gitignore

@@ -1,3 +0,0 @@
-.idea
-*.sublime-project
-*.sublime-workspace

+ 0 - 18
vendor/github.com/G-Node/git-module/.travis.yml

@@ -1,18 +0,0 @@
-sudo: false
-language: go
-go:
-  - 1.4.x
-  - 1.5.x
-  - 1.6.x
-  - 1.7.x
-  - 1.8.x
-  - 1.9.x
-  - 1.10.x
-  - 1.11.x
-  - 1.12.x
-  - 1.13.x
-
-script: 
-  - go get golang.org/x/tools/cmd/cover
-  - go get github.com/smartystreets/goconvey
-  - go test -v -cover -race

+ 0 - 19
vendor/github.com/G-Node/git-module/LICENSE

@@ -1,19 +0,0 @@
-Copyright (c) 2015 All Gogs Contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.

+ 0 - 15
vendor/github.com/G-Node/git-module/README.md

@@ -1,15 +0,0 @@
-# Git Module 
-
-[![Build Status](https://img.shields.io/travis/gogs/git-module/master.svg?style=for-the-badge&logo=travis)](https://travis-ci.org/gogs/git-module) [![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?style=for-the-badge&logo=sourcegraph)](https://sourcegraph.com/github.com/gogs/git-module)
-
-Package git-module is a Go module for Git access through shell commands.
-
-## Limitations
-
-- Go version must be at least **1.4**.
-- Git version must be no less than **1.8.3**.
-- For Windows users, try use as new a version as possible.
-
-## License
-
-This project is under the MIT License. See the [LICENSE](LICENSE) file for the full license text.

+ 0 - 35
vendor/github.com/G-Node/git-module/blob.go

@@ -1,35 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"bytes"
-	"io"
-)
-
-// Blob represents a Git object.
-type Blob struct {
-	repo *Repository
-	*TreeEntry
-}
-
-// Data gets content of blob all at once and wrap it as io.Reader.
-// This can be very slow and memory consuming for huge content.
-func (b *Blob) Data() (io.Reader, error) {
-	stdout := new(bytes.Buffer)
-	stderr := new(bytes.Buffer)
-
-	// Preallocate memory to save ~50% memory usage on big files.
-	stdout.Grow(int(b.Size() + 2048))
-
-	if err := b.DataPipeline(stdout, stderr); err != nil {
-		return nil, concatenateError(err, stderr.String())
-	}
-	return stdout, nil
-}
-
-func (b *Blob) DataPipeline(stdout, stderr io.Writer) error {
-	return NewCommand("show", b.ID.String()).RunInDirPipeline(b.repo.Path, stdout, stderr)
-}

+ 0 - 158
vendor/github.com/G-Node/git-module/command.go

@@ -1,158 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"bytes"
-	"fmt"
-	"io"
-	"os"
-	"os/exec"
-	"strings"
-	"time"
-)
-
-// Command represents a command with its subcommands or arguments.
-type Command struct {
-	name string
-	args []string
-	envs []string
-}
-
-func (c *Command) String() string {
-	if len(c.args) == 0 {
-		return c.name
-	}
-	return fmt.Sprintf("%s %s", c.name, strings.Join(c.args, " "))
-}
-
-// NewCommand creates and returns a new Git Command based on given command and arguments.
-func NewCommand(args ...string) *Command {
-	return &Command{
-		name: "git",
-		args: args,
-	}
-}
-
-// NewCommand creates and returns a new Git Command based on given command and arguments.
-func NewACommand(args ...string) *Command {
-	return &Command{
-		name: "git-annex",
-		args: args,
-	}
-}
-
-// AddArguments adds new argument(s) to the command.
-func (c *Command) AddArguments(args ...string) *Command {
-	c.args = append(c.args, args...)
-	return c
-}
-
-// AddEnvs adds new environment variables to the command.
-func (c *Command) AddEnvs(envs ...string) *Command {
-	c.envs = append(c.envs, envs...)
-	return c
-}
-
-const DEFAULT_TIMEOUT = 60 * time.Second
-
-// RunInDirTimeoutPipeline executes the command in given directory with given timeout,
-// it pipes stdout and stderr to given io.Writer.
-func (c *Command) RunInDirTimeoutPipeline(timeout time.Duration, dir string, stdout, stderr io.Writer) error {
-	if timeout == -1 {
-		timeout = DEFAULT_TIMEOUT
-	}
-
-	if len(dir) == 0 {
-		log(c.String())
-	} else {
-		log("%s: %v", dir, c)
-	}
-
-	cmd := exec.Command(c.name, c.args...)
-	if c.envs != nil {
-		cmd.Env = append(os.Environ(), c.envs...)
-	}
-	cmd.Dir = dir
-	cmd.Stdout = stdout
-	cmd.Stderr = stderr
-	if err := cmd.Start(); err != nil {
-		return err
-	}
-
-	done := make(chan error)
-	go func() {
-		done <- cmd.Wait()
-	}()
-
-	var err error
-	select {
-	case <-time.After(timeout):
-		if cmd.Process != nil && cmd.ProcessState != nil && !cmd.ProcessState.Exited() {
-			if err := cmd.Process.Kill(); err != nil {
-				return fmt.Errorf("fail to kill process: %v", err)
-			}
-		}
-
-		<-done
-		return ErrExecTimeout{timeout}
-	case err = <-done:
-	}
-
-	return err
-}
-
-// RunInDirTimeout executes the command in given directory with given timeout,
-// and returns stdout in []byte and error (combined with stderr).
-func (c *Command) RunInDirTimeout(timeout time.Duration, dir string) ([]byte, error) {
-	stdout := new(bytes.Buffer)
-	stderr := new(bytes.Buffer)
-	if err := c.RunInDirTimeoutPipeline(timeout, dir, stdout, stderr); err != nil {
-		return nil, concatenateError(err, stderr.String())
-	}
-
-	if stdout.Len() > 0 {
-		log("stdout:\n%s", stdout.Bytes()[:1024])
-	}
-	return stdout.Bytes(), nil
-}
-
-// RunInDirPipeline executes the command in given directory,
-// it pipes stdout and stderr to given io.Writer.
-func (c *Command) RunInDirPipeline(dir string, stdout, stderr io.Writer) error {
-	return c.RunInDirTimeoutPipeline(-1, dir, stdout, stderr)
-}
-
-// RunInDirBytes executes the command in given directory
-// and returns stdout in []byte and error (combined with stderr).
-func (c *Command) RunInDirBytes(dir string) ([]byte, error) {
-	return c.RunInDirTimeout(-1, dir)
-}
-
-// RunInDir executes the command in given directory
-// and returns stdout in string and error (combined with stderr).
-func (c *Command) RunInDir(dir string) (string, error) {
-	stdout, err := c.RunInDirTimeout(-1, dir)
-	if err != nil {
-		return "", err
-	}
-	return string(stdout), nil
-}
-
-// RunTimeout executes the command in defualt working directory with given timeout,
-// and returns stdout in string and error (combined with stderr).
-func (c *Command) RunTimeout(timeout time.Duration) (string, error) {
-	stdout, err := c.RunInDirTimeout(timeout, "")
-	if err != nil {
-		return "", err
-	}
-	return string(stdout), nil
-}
-
-// Run executes the command in defualt working directory
-// and returns stdout in string and error (combined with stderr).
-func (c *Command) Run() (string, error) {
-	return c.RunTimeout(-1)
-}

+ 0 - 309
vendor/github.com/G-Node/git-module/commit.go

@@ -1,309 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"bufio"
-	"bytes"
-	"container/list"
-	"fmt"
-	"io"
-	"net/http"
-	"strconv"
-	"strings"
-)
-
-// Commit represents a git commit.
-type Commit struct {
-	Tree
-	ID            sha1 // The ID of this commit object
-	Author        *Signature
-	Committer     *Signature
-	CommitMessage string
-
-	parents        []sha1 // SHA1 strings
-	submoduleCache *objectCache
-}
-
-// Message returns the commit message. Same as retrieving CommitMessage directly.
-func (c *Commit) Message() string {
-	return c.CommitMessage
-}
-
-// Summary returns first line of commit message.
-func (c *Commit) Summary() string {
-	return strings.Split(c.CommitMessage, "\n")[0]
-}
-
-// ParentID returns oid of n-th parent (0-based index).
-// It returns nil if no such parent exists.
-func (c *Commit) ParentID(n int) (sha1, error) {
-	if n >= len(c.parents) {
-		return sha1{}, ErrNotExist{"", ""}
-	}
-	return c.parents[n], nil
-}
-
-// Parent returns n-th parent (0-based index) of the commit.
-func (c *Commit) Parent(n int) (*Commit, error) {
-	id, err := c.ParentID(n)
-	if err != nil {
-		return nil, err
-	}
-	parent, err := c.repo.getCommit(id)
-	if err != nil {
-		return nil, err
-	}
-	return parent, nil
-}
-
-// ParentCount returns number of parents of the commit.
-// 0 if this is the root commit,  otherwise 1,2, etc.
-func (c *Commit) ParentCount() int {
-	return len(c.parents)
-}
-
-func isImageFile(data []byte) (string, bool) {
-	contentType := http.DetectContentType(data)
-	if strings.Index(contentType, "image/") != -1 {
-		return contentType, true
-	}
-	return contentType, false
-}
-
-func (c *Commit) IsImageFile(name string) bool {
-	blob, err := c.GetBlobByPath(name)
-	if err != nil {
-		return false
-	}
-
-	dataRc, err := blob.Data()
-	if err != nil {
-		return false
-	}
-	buf := make([]byte, 1024)
-	n, _ := dataRc.Read(buf)
-	buf = buf[:n]
-	_, isImage := isImageFile(buf)
-	return isImage
-}
-
-// GetCommitByPath return the commit of relative path object.
-func (c *Commit) GetCommitByPath(relpath string) (*Commit, error) {
-	return c.repo.getCommitByPathWithID(c.ID, relpath)
-}
-
-// AddChanges marks local changes to be ready for commit.
-func AddChanges(repoPath string, all bool, files ...string) error {
-	cmd := NewCommand("add")
-	if all {
-		cmd.AddArguments("--all")
-	}
-	_, err := cmd.AddArguments(files...).RunInDir(repoPath)
-	return err
-}
-
-type CommitChangesOptions struct {
-	Committer *Signature
-	Author    *Signature
-	Message   string
-}
-
-// CommitChanges commits local changes with given committer, author and message.
-// If author is nil, it will be the same as committer.
-func CommitChanges(repoPath string, opts CommitChangesOptions) error {
-	cmd := NewCommand()
-	if opts.Committer != nil {
-		cmd.AddEnvs("GIT_COMMITTER_NAME="+opts.Committer.Name, "GIT_COMMITTER_EMAIL="+opts.Committer.Email)
-	}
-	cmd.AddArguments("commit")
-
-	if opts.Author == nil {
-		opts.Author = opts.Committer
-	}
-	if opts.Author != nil {
-		cmd.AddArguments(fmt.Sprintf("--author='%s <%s>'", opts.Author.Name, opts.Author.Email))
-	}
-	cmd.AddArguments("-m", opts.Message)
-
-	_, err := cmd.RunInDir(repoPath)
-	// No stderr but exit status 1 means nothing to commit.
-	if err != nil && err.Error() == "exit status 1" {
-		return nil
-	}
-	return err
-}
-
-func commitsCount(repoPath, revision, relpath string) (int64, error) {
-	var cmd *Command
-	cmd = NewCommand("rev-list", "--count").AddArguments(revision)
-	if len(relpath) > 0 {
-		cmd.AddArguments("--", relpath)
-	}
-
-	stdout, err := cmd.RunInDir(repoPath)
-	if err != nil {
-		return 0, err
-	}
-
-	return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
-}
-
-func (c *Commit) CommitsCount() (int64, error) {
-	return CommitsCount(c.repo.Path, c.ID.String())
-}
-
-func (c *Commit) CommitsByRangeSize(page, size int) (*list.List, error) {
-	return c.repo.CommitsByRangeSize(c.ID.String(), page, size)
-}
-
-func (c *Commit) CommitsByRange(page int) (*list.List, error) {
-	return c.repo.CommitsByRange(c.ID.String(), page)
-}
-
-func (c *Commit) CommitsBefore() (*list.List, error) {
-	return c.repo.getCommitsBefore(c.ID)
-}
-
-func (c *Commit) CommitsBeforeLimit(num int) (*list.List, error) {
-	return c.repo.getCommitsBeforeLimit(c.ID, num)
-}
-
-func (c *Commit) CommitsBeforeUntil(commitID string) (*list.List, error) {
-	endCommit, err := c.repo.GetCommit(commitID)
-	if err != nil {
-		return nil, err
-	}
-	return c.repo.CommitsBetween(c, endCommit)
-}
-
-func (c *Commit) SearchCommits(keyword string) (*list.List, error) {
-	return c.repo.searchCommits(c.ID, keyword)
-}
-
-func (c *Commit) GetFilesChangedSinceCommit(pastCommit string) ([]string, error) {
-	return c.repo.getFilesChanged(pastCommit, c.ID.String())
-}
-
-func (c *Commit) GetSubModules() (*objectCache, error) {
-	if c.submoduleCache != nil {
-		return c.submoduleCache, nil
-	}
-
-	entry, err := c.GetTreeEntryByPath(".gitmodules")
-	if err != nil {
-		return nil, err
-	}
-	rd, err := entry.Blob().Data()
-	if err != nil {
-		return nil, err
-	}
-
-	scanner := bufio.NewScanner(rd)
-	c.submoduleCache = newObjectCache()
-	var ismodule bool
-	var path string
-	for scanner.Scan() {
-		if strings.HasPrefix(scanner.Text(), "[submodule") {
-			ismodule = true
-			continue
-		}
-		if ismodule {
-			fields := strings.Split(scanner.Text(), "=")
-			k := strings.TrimSpace(fields[0])
-			if k == "path" {
-				path = strings.TrimSpace(fields[1])
-			} else if k == "url" {
-				c.submoduleCache.Set(path, &SubModule{path, strings.TrimSpace(fields[1])})
-				ismodule = false
-			}
-		}
-	}
-
-	return c.submoduleCache, nil
-}
-
-func (c *Commit) GetSubModule(entryname string) (*SubModule, error) {
-	modules, err := c.GetSubModules()
-	if err != nil {
-		return nil, err
-	}
-
-	module, has := modules.Get(entryname)
-	if has {
-		return module.(*SubModule), nil
-	}
-	return nil, nil
-}
-
-// CommitFileStatus represents status of files in a commit.
-type CommitFileStatus struct {
-	Added    []string
-	Removed  []string
-	Modified []string
-}
-
-func NewCommitFileStatus() *CommitFileStatus {
-	return &CommitFileStatus{
-		[]string{}, []string{}, []string{},
-	}
-}
-
-// GetCommitFileStatus returns file status of commit in given repository.
-func GetCommitFileStatus(repoPath, commitID string) (*CommitFileStatus, error) {
-	stdout, w := io.Pipe()
-	done := make(chan struct{})
-	fileStatus := NewCommitFileStatus()
-	go func() {
-		scanner := bufio.NewScanner(stdout)
-		for scanner.Scan() {
-			fields := strings.Fields(scanner.Text())
-			if len(fields) < 2 {
-				continue
-			}
-
-			switch fields[0][0] {
-			case 'A':
-				fileStatus.Added = append(fileStatus.Added, fields[1])
-			case 'D':
-				fileStatus.Removed = append(fileStatus.Removed, fields[1])
-			case 'M':
-				fileStatus.Modified = append(fileStatus.Modified, fields[1])
-			}
-		}
-		done <- struct{}{}
-	}()
-
-	stderr := new(bytes.Buffer)
-	err := NewCommand("show", "--name-status", "--pretty=format:''", commitID).RunInDirPipeline(repoPath, w, stderr)
-	w.Close() // Close writer to exit parsing goroutine
-	if err != nil {
-		return nil, concatenateError(err, stderr.String())
-	}
-
-	<-done
-	return fileStatus, nil
-}
-
-// FileStatus returns file status of commit.
-func (c *Commit) FileStatus() (*CommitFileStatus, error) {
-	return GetCommitFileStatus(c.repo.Path, c.ID.String())
-}
-
-// GetFullCommitID returns full length (40) of commit ID by given short SHA in a repository.
-func GetFullCommitID(repoPath, shortID string) (string, error) {
-	if len(shortID) >= 40 {
-		return shortID, nil
-	}
-
-	commitID, err := NewCommand("rev-parse", shortID).RunInDir(repoPath)
-	if err != nil {
-		if strings.Contains(err.Error(), "exit status 128") {
-			return "", ErrNotExist{shortID, ""}
-		}
-		return "", err
-	}
-	return strings.TrimSpace(commitID), nil
-}

+ 0 - 57
vendor/github.com/G-Node/git-module/commit_archive.go

@@ -1,57 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"fmt"
-	"os"
-	"path/filepath"
-	"strings"
-
-	"github.com/G-Node/libgin/libgin"
-)
-
-type ArchiveType int
-
-const (
-	ArchiveZip ArchiveType = iota + 1
-	ArchiveTarGz
-	ArchiveGIN
-)
-
-func (c *Commit) CreateArchive(target string, archiveType ArchiveType, cloneL string) error {
-	var format string
-	switch archiveType {
-	case ArchiveZip:
-		format = "zip"
-	case ArchiveTarGz:
-		format = "tar.gz"
-	case ArchiveGIN:
-		// tmppath := setting.Repository.Upload.TempPath // Circular module dependency
-		tmppath := "/data/tmp/uploads" // live config location
-		to := filepath.Join(tmppath, "archives", filepath.Base(strings.TrimSuffix(c.repo.Path, ".git")))
-		defer os.RemoveAll(to)
-		_, err := NewCommand("clone", c.repo.Path, to).RunTimeout(-1)
-		if err != nil {
-			return err
-		}
-		_, err = NewCommand("remote", "set-url", "origin", cloneL).RunInDirTimeout(-1, to)
-		if err != nil {
-			return err
-		}
-		fp, err := os.Create(target)
-		defer fp.Close()
-		if err != nil {
-			return err
-		}
-		err = libgin.MakeZip(fp, to)
-		return err
-	default:
-		return fmt.Errorf("unknown format: %v", archiveType)
-	}
-
-	_, err := NewCommand("archive", "--prefix="+filepath.Base(strings.TrimSuffix(c.repo.Path, ".git"))+"/", "--format="+format, "-o", target, c.ID.String()).RunInDir(c.repo.Path)
-	return err
-}

+ 0 - 77
vendor/github.com/G-Node/git-module/deprecated.go

@@ -1,77 +0,0 @@
-// Copyright 2019 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-const (
-	// DEPRECATED: use ArchiveZip instead
-	ZIP = ArchiveZip
-	// DEPRECATED: use ArchiveTarGz instead
-	TARGZ = ArchiveTarGz
-)
-
-// DEPRECATED: use BranchPrefix instead
-const BRANCH_PREFIX = BranchPrefix
-
-// DEPRECATED: use RemotePrefix instead
-const REMOTE_PREFIX = RemotePrefix
-
-const (
-	// DEPRECATED: use DiffLinePlain instead
-	DIFF_LINE_PLAIN = DiffLinePlain
-	// DEPRECATED: use DiffLineAdd instead
-	DIFF_LINE_ADD = DiffLineAdd
-	// DEPRECATED: use DiffLineDel instead
-	DIFF_LINE_DEL = DiffLineDel
-	// DEPRECATED: use DiffLineSection instead
-	DIFF_LINE_SECTION = DiffLineSection
-)
-
-const (
-	// DEPRECATED: use DiffFileAdd instead
-	DIFF_FILE_ADD = DiffFileAdd
-	// DEPRECATED: use DiffFileChange instead
-	DIFF_FILE_CHANGE = DiffFileChange
-	// DEPRECATED: use DiffFileDel instead
-	DIFF_FILE_DEL = DiffFileDel
-	// DEPRECATED: use DiffFileRename instead
-	DIFF_FILE_RENAME = DiffFileRename
-)
-
-const (
-	// DEPRECATED: use RawDiffNormal instead
-	RAW_DIFF_NORMAL = RawDiffNormal
-	// DEPRECATED: use RawDiffPatch instead
-	RAW_DIFF_PATCH = RawDiffPatch
-)
-
-const (
-	// DEPRECATED: use ObjectCommit instead
-	OBJECT_COMMIT = ObjectCommit
-	// DEPRECATED: use ObjectTree instead
-	OBJECT_TREE = ObjectTree
-	// DEPRECATED: use ObjectBlob instead
-	OBJECT_BLOB = ObjectBlob
-	// DEPRECATED: use ObjectTag instead
-	OBJECT_TAG = ObjectTag
-)
-
-// DEPRECATED: use TagPrefix instead
-const TAG_PREFIX = TagPrefix
-
-// DEPRECATED: use EmptySHA instead
-const EMPTY_SHA = EmptySHA
-
-const (
-	// DEPRECATED: use EntryBlob instead
-	ENTRY_MODE_BLOB = EntryBlob
-	// DEPRECATED: use EntryExec instead
-	ENTRY_MODE_EXEC = EntryExec
-	// DEPRECATED: use EntrySymlink instead
-	ENTRY_MODE_SYMLINK = EntrySymlink
-	// DEPRECATED: use EntryCommit instead
-	ENTRY_MODE_COMMIT = EntryCommit
-	// DEPRECATED: use EntryTree instead
-	ENTRY_MODE_TREE = EntryTree
-)

+ 0 - 61
vendor/github.com/G-Node/git-module/error.go

@@ -1,61 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"fmt"
-	"time"
-)
-
-type ErrExecTimeout struct {
-	Duration time.Duration
-}
-
-func IsErrExecTimeout(err error) bool {
-	_, ok := err.(ErrExecTimeout)
-	return ok
-}
-
-func (err ErrExecTimeout) Error() string {
-	return fmt.Sprintf("execution timeout [duration: %v]", err.Duration)
-}
-
-type ErrNotExist struct {
-	ID      string
-	RelPath string
-}
-
-func IsErrNotExist(err error) bool {
-	_, ok := err.(ErrNotExist)
-	return ok
-}
-
-func (err ErrNotExist) Error() string {
-	return fmt.Sprintf("object does not exist [id: %s, rel_path: %s]", err.ID, err.RelPath)
-}
-
-type ErrUnsupportedVersion struct {
-	Required string
-}
-
-func IsErrUnsupportedVersion(err error) bool {
-	_, ok := err.(ErrUnsupportedVersion)
-	return ok
-}
-
-func (err ErrUnsupportedVersion) Error() string {
-	return fmt.Sprintf("Operation requires higher version [required: %s]", err.Required)
-}
-
-type ErrNoMergeBase struct{}
-
-func IsErrNoMergeBase(err error) bool {
-	_, ok := err.(ErrNoMergeBase)
-	return ok
-}
-
-func (err ErrNoMergeBase) Error() string {
-	return "no merge based found"
-}

+ 0 - 74
vendor/github.com/G-Node/git-module/git.go

@@ -1,74 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"fmt"
-	"strings"
-	"time"
-)
-
-var (
-	// Debug enables verbose logging on everything.
-	// This should be false in case Gogs starts in SSH mode.
-	Debug  = false
-	Prefix = "[git-module] "
-)
-
-func log(format string, args ...interface{}) {
-	if !Debug {
-		return
-	}
-
-	fmt.Print(Prefix)
-	if len(args) == 0 {
-		fmt.Println(format)
-	} else {
-		fmt.Printf(format+"\n", args...)
-	}
-}
-
-var gitVersion string
-
-// Version returns current Git version from shell.
-func BinVersion() (string, error) {
-	if len(gitVersion) > 0 {
-		return gitVersion, nil
-	}
-
-	stdout, err := NewCommand("version").Run()
-	if err != nil {
-		return "", err
-	}
-
-	fields := strings.Fields(stdout)
-	if len(fields) < 3 {
-		return "", fmt.Errorf("not enough output: %s", stdout)
-	}
-
-	// Handle special case on Windows.
-	i := strings.Index(fields[2], "windows")
-	if i >= 1 {
-		gitVersion = fields[2][:i-1]
-		return gitVersion, nil
-	}
-
-	gitVersion = fields[2]
-	return gitVersion, nil
-}
-
-func init() {
-	BinVersion()
-}
-
-// Fsck verifies the connectivity and validity of the objects in the database
-func Fsck(repoPath string, timeout time.Duration, args ...string) error {
-	// Make sure timeout makes sense.
-	if timeout <= 0 {
-		timeout = -1
-	}
-	_, err := NewCommand("fsck").AddArguments(args...).RunInDirTimeout(timeout, repoPath)
-	return err
-}

+ 0 - 9
vendor/github.com/G-Node/git-module/go.mod

@@ -1,9 +0,0 @@
-module github.com/G-Node/git-module
-
-go 1.12
-
-require (
-	github.com/G-Node/libgin v0.3.0
-	github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2
-	github.com/smartystreets/goconvey v1.6.4
-)

+ 0 - 16
vendor/github.com/G-Node/git-module/go.sum

@@ -1,16 +0,0 @@
-github.com/G-Node/gig v0.0.0-20171025133355-6d784b40b534/go.mod h1:H+82VbQUp9AzlbEiZl3bri3mlPlN2q6CxlIh0CyJWnc=
-github.com/G-Node/git-module v0.8.4-0.20191218161021-3fd4d7aaf932/go.mod h1:VYqGwMiaOacy+pch//bmTW0HnfVxZA6VnFSvzOOwpX0=
-github.com/G-Node/libgin v0.0.0-20191216094436-47f8aadc0067/go.mod h1:2yLXQnNbwjH8mslxnzU8Kb+d7c2Zqo8DIgR6Pgp7lCg=
-github.com/G-Node/libgin v0.3.0/go.mod h1:VjulCBq7k/kgf4Eabk2f4w9SDNowWhLnK+yZvy5Nppk=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
-github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
-github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo=
-github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
-github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=

+ 0 - 111
vendor/github.com/G-Node/git-module/hook.go

@@ -1,111 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"errors"
-	"io/ioutil"
-	"os"
-	"path"
-	"strings"
-)
-
-var (
-	// Direcotry of hook and sample files. Can be changed to "custom_hooks" for very purpose.
-	HookDir       = "hooks"
-	HookSampleDir = HookDir
-	// HookNames is a list of Git server hooks' name that are supported.
-	HookNames = []string{
-		"pre-receive",
-		"update",
-		"post-receive",
-	}
-)
-
-var (
-	ErrNotValidHook = errors.New("not a valid Git hook")
-)
-
-// IsValidHookName returns true if given name is a valid Git hook.
-func IsValidHookName(name string) bool {
-	for _, hn := range HookNames {
-		if hn == name {
-			return true
-		}
-	}
-	return false
-}
-
-// Hook represents a Git hook.
-type Hook struct {
-	name     string
-	IsActive bool   // Indicates whether repository has this hook.
-	Content  string // Content of hook if it's active.
-	Sample   string // Sample content from Git.
-	path     string // Hook file path.
-}
-
-// GetHook returns a Git hook by given name and repository.
-func GetHook(repoPath, name string) (*Hook, error) {
-	if !IsValidHookName(name) {
-		return nil, ErrNotValidHook
-	}
-	h := &Hook{
-		name: name,
-		path: path.Join(repoPath, HookDir, name),
-	}
-	if isFile(h.path) {
-		data, err := ioutil.ReadFile(h.path)
-		if err != nil {
-			return nil, err
-		}
-		h.IsActive = true
-		h.Content = string(data)
-		return h, nil
-	}
-
-	// Check sample file
-	samplePath := path.Join(repoPath, HookSampleDir, h.name) + ".sample"
-	if isFile(samplePath) {
-		data, err := ioutil.ReadFile(samplePath)
-		if err != nil {
-			return nil, err
-		}
-		h.Sample = string(data)
-	}
-	return h, nil
-}
-
-func (h *Hook) Name() string {
-	return h.name
-}
-
-// Update updates content hook file.
-func (h *Hook) Update() error {
-	if len(strings.TrimSpace(h.Content)) == 0 {
-		if isExist(h.path) {
-			return os.Remove(h.path)
-		}
-		return nil
-	}
-	os.MkdirAll(path.Dir(h.path), os.ModePerm)
-	return ioutil.WriteFile(h.path, []byte(strings.Replace(h.Content, "\r", "", -1)), os.ModePerm)
-}
-
-// ListHooks returns a list of Git hooks of given repository.
-func ListHooks(repoPath string) (_ []*Hook, err error) {
-	if !isDir(path.Join(repoPath, "hooks")) {
-		return nil, errors.New("hooks path does not exist")
-	}
-
-	hooks := make([]*Hook, len(HookNames))
-	for i, name := range HookNames {
-		hooks[i], err = GetHook(repoPath, name)
-		if err != nil {
-			return nil, err
-		}
-	}
-	return hooks, nil
-}

+ 0 - 31
vendor/github.com/G-Node/git-module/remote.go

@@ -1,31 +0,0 @@
-// Copyright 2019 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import "strings"
-
-// RemoveRemote removes a remote from given repository path if exists.
-func RemoveRemote(repoPath, remote string) error {
-	_, err := NewCommand("remote", "rm", remote).RunInDir(repoPath)
-	if err != nil && !strings.Contains(err.Error(), "fatal: No such remote") {
-		return err
-	}
-	return nil
-}
-
-// AddRemoteOptions contains options to add a remote address.
-type AddRemoteOptions struct {
-	Mirror bool
-}
-
-// AddRemote adds a new remote
-func AddRemote(repoPath, remote, addr string, opts AddRemoteOptions) error {
-	cmd := NewCommand("remote", "add", remote)
-	if opts.Mirror {
-		cmd.AddArguments("--mirror")
-	}
-	_, err := cmd.AddArguments(addr).RunInDir(repoPath)
-	return err
-}

+ 0 - 289
vendor/github.com/G-Node/git-module/repo.go

@@ -1,289 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"bytes"
-	"container/list"
-	"errors"
-	"os"
-	"path"
-	"path/filepath"
-	"strconv"
-	"strings"
-	"time"
-)
-
-// Repository represents a Git repository.
-type Repository struct {
-	Path string
-
-	commitCache *objectCache
-	tagCache    *objectCache
-}
-
-const prettyLogFormat = `--pretty=format:%H`
-
-func (repo *Repository) parsePrettyFormatLogToList(logs []byte) (*list.List, error) {
-	l := list.New()
-	if len(logs) == 0 {
-		return l, nil
-	}
-
-	parts := bytes.Split(logs, []byte{'\n'})
-
-	for _, commitId := range parts {
-		commit, err := repo.GetCommit(string(commitId))
-		if err != nil {
-			return nil, err
-		}
-		l.PushBack(commit)
-	}
-
-	return l, nil
-}
-
-type NetworkOptions struct {
-	URL     string
-	Timeout time.Duration
-}
-
-// IsRepoURLAccessible checks if given repository URL is accessible.
-func IsRepoURLAccessible(opts NetworkOptions) bool {
-	cmd := NewCommand("ls-remote", "-q", "-h", opts.URL, "HEAD")
-	if opts.Timeout <= 0 {
-		opts.Timeout = -1
-	}
-	_, err := cmd.RunTimeout(opts.Timeout)
-	if err != nil {
-		return false
-	}
-	return true
-}
-
-// InitRepository initializes a new Git repository.
-func InitRepository(repoPath string, bare bool) error {
-	os.MkdirAll(repoPath, os.ModePerm)
-
-	cmd := NewCommand("init")
-	if bare {
-		cmd.AddArguments("--bare")
-	}
-	_, err := cmd.RunInDir(repoPath)
-	return err
-}
-
-// OpenRepository opens the repository at the given path.
-func OpenRepository(repoPath string) (*Repository, error) {
-	repoPath, err := filepath.Abs(repoPath)
-	if err != nil {
-		return nil, err
-	} else if !isDir(repoPath) {
-		return nil, errors.New("no such file or directory")
-	}
-
-	return &Repository{
-		Path:        repoPath,
-		commitCache: newObjectCache(),
-		tagCache:    newObjectCache(),
-	}, nil
-}
-
-type CloneRepoOptions struct {
-	Mirror  bool
-	Bare    bool
-	Quiet   bool
-	Branch  string
-	Timeout time.Duration
-}
-
-// Clone clones original repository to target path.
-func Clone(from, to string, opts CloneRepoOptions) (err error) {
-	toDir := path.Dir(to)
-	if err = os.MkdirAll(toDir, os.ModePerm); err != nil {
-		return err
-	}
-
-	cmd := NewCommand("clone")
-	if opts.Mirror {
-		cmd.AddArguments("--mirror")
-	}
-	if opts.Bare {
-		cmd.AddArguments("--bare")
-	}
-	if opts.Quiet {
-		cmd.AddArguments("--quiet")
-	}
-	if len(opts.Branch) > 0 {
-		cmd.AddArguments("-b", opts.Branch)
-	}
-	cmd.AddArguments(from, to)
-
-	if opts.Timeout <= 0 {
-		opts.Timeout = -1
-	}
-	_, err = cmd.RunTimeout(opts.Timeout)
-	return err
-}
-
-type FetchRemoteOptions struct {
-	Prune   bool
-	Timeout time.Duration
-}
-
-// Fetch fetches changes from remotes without merging.
-func Fetch(repoPath string, opts FetchRemoteOptions) error {
-	cmd := NewCommand("fetch")
-	if opts.Prune {
-		cmd.AddArguments("--prune")
-	}
-
-	if opts.Timeout <= 0 {
-		opts.Timeout = -1
-	}
-	_, err := cmd.RunInDirTimeout(opts.Timeout, repoPath)
-	return err
-}
-
-type PullRemoteOptions struct {
-	All     bool
-	Rebase  bool
-	Remote  string
-	Branch  string
-	Timeout time.Duration
-}
-
-// Pull pulls changes from remotes.
-func Pull(repoPath string, opts PullRemoteOptions) error {
-	cmd := NewCommand("pull")
-	if opts.Rebase {
-		cmd.AddArguments("--rebase")
-	}
-	if opts.All {
-		cmd.AddArguments("--all")
-	} else {
-		cmd.AddArguments(opts.Remote)
-		cmd.AddArguments(opts.Branch)
-	}
-
-	if opts.Timeout <= 0 {
-		opts.Timeout = -1
-	}
-	_, err := cmd.RunInDirTimeout(opts.Timeout, repoPath)
-	return err
-}
-
-// PushWithEnvs pushs local commits to given remote branch with given environment variables.
-func PushWithEnvs(repoPath, remote, branch string, envs []string) error {
-	_, err := NewCommand("push", remote, branch).AddEnvs(envs...).RunInDir(repoPath)
-	return err
-}
-
-// Push pushs local commits to given remote branch.
-func Push(repoPath, remote, branch string) error {
-	return PushWithEnvs(repoPath, remote, branch, nil)
-}
-
-type CheckoutOptions struct {
-	Branch    string
-	OldBranch string
-	Timeout   time.Duration
-}
-
-// Checkout checkouts a branch
-func Checkout(repoPath string, opts CheckoutOptions) error {
-	cmd := NewCommand("checkout")
-	if len(opts.OldBranch) > 0 {
-		cmd.AddArguments("-b")
-	}
-
-	cmd.AddArguments(opts.Branch)
-
-	if len(opts.OldBranch) > 0 {
-		cmd.AddArguments(opts.OldBranch)
-	}
-	if opts.Timeout <= 0 {
-		opts.Timeout = -1
-	}
-	_, err := cmd.RunInDirTimeout(opts.Timeout, repoPath)
-	return err
-}
-
-// ResetHEAD resets HEAD to given revision or head of branch.
-func ResetHEAD(repoPath string, hard bool, revision string) error {
-	cmd := NewCommand("reset")
-	if hard {
-		cmd.AddArguments("--hard")
-	}
-	_, err := cmd.AddArguments(revision).RunInDir(repoPath)
-	return err
-}
-
-// MoveFile moves a file to another file or directory.
-func MoveFile(repoPath, oldTreeName, newTreeName string) error {
-	_, err := NewCommand("mv").AddArguments(oldTreeName, newTreeName).RunInDir(repoPath)
-	return err
-}
-
-// CountObject represents disk usage report of Git repository.
-type CountObject struct {
-	Count         int64
-	Size          int64
-	InPack        int64
-	Packs         int64
-	SizePack      int64
-	PrunePackable int64
-	Garbage       int64
-	SizeGarbage   int64
-}
-
-const (
-	statCount         = "count: "
-	statSize          = "size: "
-	statInPack        = "in-pack: "
-	statPacks         = "packs: "
-	statSizePack      = "size-pack: "
-	statPrunePackable = "prune-packable: "
-	statGarbage       = "garbage: "
-	statSizeGarbage   = "size-garbage: "
-)
-
-func strToInt64(s string) int64 {
-	i, _ := strconv.ParseInt(s, 10, 64)
-	return i
-}
-
-// GetRepoSize returns disk usage report of repository in given path.
-func GetRepoSize(repoPath string) (*CountObject, error) {
-	cmd := NewCommand("count-objects", "-v")
-	stdout, err := cmd.RunInDir(repoPath)
-	if err != nil {
-		return nil, err
-	}
-
-	countObject := new(CountObject)
-	for _, line := range strings.Split(stdout, "\n") {
-		switch {
-		case strings.HasPrefix(line, statCount):
-			countObject.Count = strToInt64(line[7:])
-		case strings.HasPrefix(line, statSize):
-			countObject.Size = strToInt64(line[6:]) * 1024
-		case strings.HasPrefix(line, statInPack):
-			countObject.InPack = strToInt64(line[9:])
-		case strings.HasPrefix(line, statPacks):
-			countObject.Packs = strToInt64(line[7:])
-		case strings.HasPrefix(line, statSizePack):
-			countObject.SizePack = strToInt64(line[11:]) * 1024
-		case strings.HasPrefix(line, statPrunePackable):
-			countObject.PrunePackable = strToInt64(line[16:])
-		case strings.HasPrefix(line, statGarbage):
-			countObject.Garbage = strToInt64(line[9:])
-		case strings.HasPrefix(line, statSizeGarbage):
-			countObject.SizeGarbage = strToInt64(line[14:]) * 1024
-		}
-	}
-
-	return countObject, nil
-}

+ 0 - 120
vendor/github.com/G-Node/git-module/repo_branch.go

@@ -1,120 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"fmt"
-	"strings"
-)
-
-const BranchPrefix = "refs/heads/"
-
-// IsReferenceExist returns true if given reference exists in the repository.
-func IsReferenceExist(repoPath, name string) bool {
-	_, err := NewCommand("show-ref", "--verify", name).RunInDir(repoPath)
-	return err == nil
-}
-
-// IsBranchExist returns true if given branch exists in the repository.
-func IsBranchExist(repoPath, name string) bool {
-	return IsReferenceExist(repoPath, BranchPrefix+name)
-}
-
-func (repo *Repository) IsBranchExist(name string) bool {
-	return IsBranchExist(repo.Path, name)
-}
-
-// Branch represents a Git branch.
-type Branch struct {
-	Name string
-	Path string
-}
-
-// GetHEADBranch returns corresponding branch of HEAD.
-func (repo *Repository) GetHEADBranch() (*Branch, error) {
-	stdout, err := NewCommand("symbolic-ref", "HEAD").RunInDir(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	stdout = strings.TrimSpace(stdout)
-
-	if !strings.HasPrefix(stdout, BranchPrefix) {
-		return nil, fmt.Errorf("invalid HEAD branch: %v", stdout)
-	}
-
-	return &Branch{
-		Name: stdout[len(BranchPrefix):],
-		Path: stdout,
-	}, nil
-}
-
-// SetDefaultBranch sets default branch of repository.
-func (repo *Repository) SetDefaultBranch(name string) error {
-	_, err := NewCommand("symbolic-ref", "HEAD", BranchPrefix+name).RunInDir(repo.Path)
-	return err
-}
-
-// GetBranches returns all branches of the repository.
-func (repo *Repository) GetBranches() ([]string, error) {
-	stdout, err := NewCommand("show-ref", "--heads").RunInDir(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-
-	infos := strings.Split(stdout, "\n")
-	branches := make([]string, len(infos)-1)
-	for i, info := range infos[:len(infos)-1] {
-		fields := strings.Fields(info)
-		if len(fields) != 2 {
-			continue // NOTE: I should believe git will not give me wrong string.
-		}
-		branches[i] = strings.TrimPrefix(fields[1], BranchPrefix)
-	}
-	return branches, nil
-}
-
-// Option(s) for delete branch
-type DeleteBranchOptions struct {
-	Force bool
-}
-
-// DeleteBranch deletes a branch from given repository path.
-func DeleteBranch(repoPath, name string, opts DeleteBranchOptions) error {
-	cmd := NewCommand("branch")
-
-	if opts.Force {
-		cmd.AddArguments("-D")
-	} else {
-		cmd.AddArguments("-d")
-	}
-
-	cmd.AddArguments(name)
-	_, err := cmd.RunInDir(repoPath)
-
-	return err
-}
-
-// DeleteBranch deletes a branch from repository.
-func (repo *Repository) DeleteBranch(name string, opts DeleteBranchOptions) error {
-	return DeleteBranch(repo.Path, name, opts)
-}
-
-// AddRemote adds a new remote to repository.
-func (repo *Repository) AddRemote(name, url string, fetch bool) error {
-	cmd := NewCommand("remote", "add")
-	if fetch {
-		cmd.AddArguments("-f")
-	}
-	cmd.AddArguments(name, url)
-
-	_, err := cmd.RunInDir(repo.Path)
-	return err
-}
-
-// RemoveRemote removes a remote from repository.
-func (repo *Repository) RemoveRemote(name string) error {
-	_, err := NewCommand("remote", "remove", name).RunInDir(repo.Path)
-	return err
-}

+ 0 - 380
vendor/github.com/G-Node/git-module/repo_commit.go

@@ -1,380 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"bytes"
-	"container/list"
-	"fmt"
-	"strconv"
-	"strings"
-	"time"
-)
-
-const RemotePrefix = "refs/remotes/"
-
-// getRefCommitID returns the last commit ID string of given reference (branch or tag).
-func (repo *Repository) getRefCommitID(name string) (string, error) {
-	stdout, err := NewCommand("show-ref", "--verify", name).RunInDir(repo.Path)
-	if err != nil {
-		if strings.Contains(err.Error(), "not a valid ref") {
-			return "", ErrNotExist{name, ""}
-		}
-		return "", err
-	}
-	return strings.Split(stdout, " ")[0], nil
-}
-
-// GetBranchCommitID returns last commit ID string of given branch.
-func (repo *Repository) GetBranchCommitID(name string) (string, error) {
-	return repo.getRefCommitID(BranchPrefix + name)
-}
-
-// GetTagCommitID returns last commit ID string of given tag.
-func (repo *Repository) GetTagCommitID(name string) (string, error) {
-	return repo.getRefCommitID(TagPrefix + name)
-}
-
-// GetRemoteBranchCommitID returns last commit ID string of given remote branch.
-func (repo *Repository) GetRemoteBranchCommitID(name string) (string, error) {
-	return repo.getRefCommitID(RemotePrefix + name)
-}
-
-// parseCommitData parses commit information from the (uncompressed) raw
-// data from the commit object.
-// \n\n separate headers from message
-func parseCommitData(data []byte) (*Commit, error) {
-	commit := new(Commit)
-	commit.parents = make([]sha1, 0, 1)
-	// we now have the contents of the commit object. Let's investigate...
-	nextline := 0
-l:
-	for {
-		eol := bytes.IndexByte(data[nextline:], '\n')
-		switch {
-		case eol > 0:
-			line := data[nextline : nextline+eol]
-			spacepos := bytes.IndexByte(line, ' ')
-			reftype := line[:spacepos]
-			switch string(reftype) {
-			case "tree", "object":
-				id, err := NewIDFromString(string(line[spacepos+1:]))
-				if err != nil {
-					return nil, err
-				}
-				commit.Tree.ID = id
-			case "parent":
-				// A commit can have one or more parents
-				oid, err := NewIDFromString(string(line[spacepos+1:]))
-				if err != nil {
-					return nil, err
-				}
-				commit.parents = append(commit.parents, oid)
-			case "author", "tagger":
-				sig, err := newSignatureFromCommitline(line[spacepos+1:])
-				if err != nil {
-					return nil, err
-				}
-				commit.Author = sig
-			case "committer":
-				sig, err := newSignatureFromCommitline(line[spacepos+1:])
-				if err != nil {
-					return nil, err
-				}
-				commit.Committer = sig
-			}
-			nextline += eol + 1
-		case eol == 0:
-			commit.CommitMessage = string(data[nextline+1:])
-			break l
-		default:
-			break l
-		}
-	}
-	return commit, nil
-}
-
-func (repo *Repository) getCommit(id sha1) (*Commit, error) {
-	c, ok := repo.commitCache.Get(id.String())
-	if ok {
-		log("Hit cache: %s", id)
-		return c.(*Commit), nil
-	}
-
-	data, err := NewCommand("cat-file", "commit", id.String()).RunInDirBytes(repo.Path)
-	if err != nil {
-		if strings.Contains(err.Error(), "exit status 128") {
-			return nil, ErrNotExist{id.String(), ""}
-		}
-		return nil, err
-	}
-
-	commit, err := parseCommitData(data)
-	if err != nil {
-		return nil, err
-	}
-	commit.repo = repo
-	commit.ID = id
-
-	repo.commitCache.Set(id.String(), commit)
-	return commit, nil
-}
-
-// GetCommit returns commit object of by ID string.
-func (repo *Repository) GetCommit(commitID string) (*Commit, error) {
-	var err error
-	commitID, err = GetFullCommitID(repo.Path, commitID)
-	if err != nil {
-		return nil, err
-	}
-	id, err := NewIDFromString(commitID)
-	if err != nil {
-		return nil, err
-	}
-
-	return repo.getCommit(id)
-}
-
-// GetBranchCommit returns the last commit of given branch.
-func (repo *Repository) GetBranchCommit(name string) (*Commit, error) {
-	commitID, err := repo.GetBranchCommitID(name)
-	if err != nil {
-		return nil, err
-	}
-	return repo.GetCommit(commitID)
-}
-
-// GetTagCommit returns the commit of given tag.
-func (repo *Repository) GetTagCommit(name string) (*Commit, error) {
-	commitID, err := repo.GetTagCommitID(name)
-	if err != nil {
-		return nil, err
-	}
-	return repo.GetCommit(commitID)
-}
-
-// GetRemoteBranchCommit returns the last commit of given remote branch.
-func (repo *Repository) GetRemoteBranchCommit(name string) (*Commit, error) {
-	commitID, err := repo.GetRemoteBranchCommitID(name)
-	if err != nil {
-		return nil, err
-	}
-	return repo.GetCommit(commitID)
-}
-
-func (repo *Repository) getCommitByPathWithID(id sha1, relpath string) (*Commit, error) {
-	// File name starts with ':' must be escaped.
-	if relpath[0] == ':' {
-		relpath = `\` + relpath
-	}
-
-	stdout, err := NewCommand("log", "-1", prettyLogFormat, id.String(), "--", relpath).RunInDir(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-
-	id, err = NewIDFromString(stdout)
-	if err != nil {
-		return nil, err
-	}
-
-	return repo.getCommit(id)
-}
-
-// GetCommitByPath returns the last commit of relative path.
-func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) {
-	stdout, err := NewCommand("log", "-1", prettyLogFormat, "--", relpath).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-
-	commits, err := repo.parsePrettyFormatLogToList(stdout)
-	if err != nil {
-		return nil, err
-	}
-	return commits.Front().Value.(*Commit), nil
-}
-
-func (repo *Repository) CommitsByRangeSize(revision string, page, size int) (*list.List, error) {
-	stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*size),
-		"--max-count="+strconv.Itoa(size), prettyLogFormat).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	return repo.parsePrettyFormatLogToList(stdout)
-}
-
-var DefaultCommitsPageSize = 30
-
-func (repo *Repository) CommitsByRange(revision string, page int) (*list.List, error) {
-	return repo.CommitsByRangeSize(revision, page, DefaultCommitsPageSize)
-}
-
-func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, error) {
-	stdout, err := NewCommand("log", id.String(), "-100", "-i", "--grep="+keyword, prettyLogFormat).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	return repo.parsePrettyFormatLogToList(stdout)
-}
-
-func (repo *Repository) getFilesChanged(id1 string, id2 string) ([]string, error) {
-	stdout, err := NewCommand("diff", "--name-only", id1, id2).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	return strings.Split(string(stdout), "\n"), nil
-}
-
-func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) {
-	return commitsCount(repo.Path, revision, file)
-}
-
-func (repo *Repository) CommitsByFileAndRangeSize(revision, file string, page, size int) (*list.List, error) {
-	stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*size),
-		"--max-count="+strconv.Itoa(size), prettyLogFormat, "--", file).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	return repo.parsePrettyFormatLogToList(stdout)
-}
-
-func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) {
-	return repo.CommitsByFileAndRangeSize(revision, file, page, DefaultCommitsPageSize)
-}
-
-func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (int, error) {
-	stdout, err := NewCommand("diff", "--name-only", startCommitID+"..."+endCommitID).RunInDir(repo.Path)
-	if err != nil {
-		return 0, err
-	}
-	return len(strings.Split(stdout, "\n")) - 1, nil
-}
-
-// CommitsBetween returns a list that contains commits between [last, before).
-func (repo *Repository) CommitsBetween(last *Commit, before *Commit) (*list.List, error) {
-	stdout, err := NewCommand("rev-list", before.ID.String()+"..."+last.ID.String()).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	return repo.parsePrettyFormatLogToList(bytes.TrimSpace(stdout))
-}
-
-func (repo *Repository) CommitsBetweenIDs(last, before string) (*list.List, error) {
-	lastCommit, err := repo.GetCommit(last)
-	if err != nil {
-		return nil, err
-	}
-	beforeCommit, err := repo.GetCommit(before)
-	if err != nil {
-		return nil, err
-	}
-	return repo.CommitsBetween(lastCommit, beforeCommit)
-}
-
-func (repo *Repository) CommitsCountBetween(start, end string) (int64, error) {
-	return commitsCount(repo.Path, start+"..."+end, "")
-}
-
-// The limit is depth, not total number of returned commits.
-func (repo *Repository) commitsBefore(l *list.List, parent *list.Element, id sha1, current, limit int) error {
-	// Reach the limit
-	if limit > 0 && current > limit {
-		return nil
-	}
-
-	commit, err := repo.getCommit(id)
-	if err != nil {
-		return fmt.Errorf("getCommit: %v", err)
-	}
-
-	var e *list.Element
-	if parent == nil {
-		e = l.PushBack(commit)
-	} else {
-		var in = parent
-		for {
-			if in == nil {
-				break
-			} else if in.Value.(*Commit).ID.Equal(commit.ID) {
-				return nil
-			} else if in.Next() == nil {
-				break
-			}
-
-			if in.Value.(*Commit).Committer.When.Equal(commit.Committer.When) {
-				break
-			}
-
-			if in.Value.(*Commit).Committer.When.After(commit.Committer.When) &&
-				in.Next().Value.(*Commit).Committer.When.Before(commit.Committer.When) {
-				break
-			}
-
-			in = in.Next()
-		}
-
-		e = l.InsertAfter(commit, in)
-	}
-
-	pr := parent
-	if commit.ParentCount() > 1 {
-		pr = e
-	}
-
-	for i := 0; i < commit.ParentCount(); i++ {
-		id, err := commit.ParentID(i)
-		if err != nil {
-			return err
-		}
-		err = repo.commitsBefore(l, pr, id, current+1, limit)
-		if err != nil {
-			return err
-		}
-	}
-
-	return nil
-}
-
-func (repo *Repository) getCommitsBefore(id sha1) (*list.List, error) {
-	l := list.New()
-	return l, repo.commitsBefore(l, nil, id, 1, 0)
-}
-
-func (repo *Repository) getCommitsBeforeLimit(id sha1, num int) (*list.List, error) {
-	l := list.New()
-	return l, repo.commitsBefore(l, nil, id, 1, num)
-}
-
-// CommitsAfterDate returns a list of commits which committed after given date.
-// The format of date should be in RFC3339.
-func (repo *Repository) CommitsAfterDate(date string) (*list.List, error) {
-	stdout, err := NewCommand("log", prettyLogFormat, "--since="+date).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-
-	return repo.parsePrettyFormatLogToList(stdout)
-}
-
-// CommitsCount returns number of total commits of until given revision.
-func CommitsCount(repoPath, revision string) (int64, error) {
-	return commitsCount(repoPath, revision, "")
-}
-
-// GetLatestCommitDate returns the date of latest commit of repository.
-// If branch is empty, it returns the latest commit across all branches.
-func GetLatestCommitDate(repoPath, branch string) (time.Time, error) {
-	cmd := NewCommand("for-each-ref", "--count=1", "--sort=-committerdate", "--format=%(committerdate:iso8601)")
-	if len(branch) > 0 {
-		cmd.AddArguments("refs/heads/" + branch)
-	}
-	stdout, err := cmd.RunInDir(repoPath)
-	if err != nil {
-		return time.Time{}, err
-	}
-
-	return time.Parse("2006-01-02 15:04:05 -0700", strings.TrimSpace(stdout))
-}

+ 0 - 400
vendor/github.com/G-Node/git-module/repo_diff.go

@@ -1,400 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"bufio"
-	"bytes"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"strconv"
-	"strings"
-	"time"
-)
-
-// DiffLineType represents the type of a line in diff.
-type DiffLineType uint8
-
-const (
-	DiffLinePlain DiffLineType = iota + 1
-	DiffLineAdd
-	DiffLineDel
-	DiffLineSection
-)
-
-// DiffFileType represents the file status in diff.
-type DiffFileType uint8
-
-const (
-	DiffFileAdd DiffFileType = iota + 1
-	DiffFileChange
-	DiffFileDel
-	DiffFileRename
-)
-
-// DiffLine represents a line in diff.
-type DiffLine struct {
-	LeftIdx  int
-	RightIdx int
-	Type     DiffLineType
-	Content  string
-}
-
-func (d *DiffLine) GetType() int {
-	return int(d.Type)
-}
-
-// DiffSection represents a section in diff.
-type DiffSection struct {
-	Name  string
-	Lines []*DiffLine
-}
-
-// Line returns a specific line by type (add or del) and file line number from a section.
-func (diffSection *DiffSection) Line(lineType DiffLineType, idx int) *DiffLine {
-	var (
-		difference    = 0
-		addCount      = 0
-		delCount      = 0
-		matchDiffLine *DiffLine
-	)
-
-LOOP:
-	for _, diffLine := range diffSection.Lines {
-		switch diffLine.Type {
-		case DiffLineAdd:
-			addCount++
-		case DiffLineDel:
-			delCount++
-		default:
-			if matchDiffLine != nil {
-				break LOOP
-			}
-			difference = diffLine.RightIdx - diffLine.LeftIdx
-			addCount = 0
-			delCount = 0
-		}
-
-		switch lineType {
-		case DiffLineDel:
-			if diffLine.RightIdx == 0 && diffLine.LeftIdx == idx-difference {
-				matchDiffLine = diffLine
-			}
-		case DiffLineAdd:
-			if diffLine.LeftIdx == 0 && diffLine.RightIdx == idx+difference {
-				matchDiffLine = diffLine
-			}
-		}
-	}
-
-	if addCount == delCount {
-		return matchDiffLine
-	}
-	return nil
-}
-
-// DiffFile represents a file in diff.
-type DiffFile struct {
-	Name               string
-	OldName            string
-	Index              string // 40-byte SHA, Changed/New: new SHA; Deleted: old SHA
-	Addition, Deletion int
-	Type               DiffFileType
-	IsCreated          bool
-	IsDeleted          bool
-	IsBin              bool
-	IsRenamed          bool
-	IsSubmodule        bool
-	Sections           []*DiffSection
-	IsIncomplete       bool
-}
-
-func (diffFile *DiffFile) GetType() int {
-	return int(diffFile.Type)
-}
-
-func (diffFile *DiffFile) NumSections() int {
-	return len(diffFile.Sections)
-}
-
-// Diff contains all information of a specific diff output.
-type Diff struct {
-	TotalAddition, TotalDeletion int
-	Files                        []*DiffFile
-	IsIncomplete                 bool
-}
-
-func (diff *Diff) NumFiles() int {
-	return len(diff.Files)
-}
-
-const _DIFF_HEAD = "diff --git "
-
-// ParsePatch takes a reader and parses everything it receives in diff format.
-func ParsePatch(done chan<- error, maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) *Diff {
-	var (
-		diff = &Diff{Files: make([]*DiffFile, 0)}
-
-		curFile    *DiffFile
-		curSection = &DiffSection{
-			Lines: make([]*DiffLine, 0, 10),
-		}
-
-		leftLine, rightLine int
-		lineCount           int
-		curFileLinesCount   int
-	)
-	input := bufio.NewReader(reader)
-	isEOF := false
-	for !isEOF {
-		// TODO: would input.ReadBytes be more memory-efficient?
-		line, err := input.ReadString('\n')
-		if err != nil {
-			if err == io.EOF {
-				isEOF = true
-			} else {
-				done <- fmt.Errorf("ReadString: %v", err)
-				return nil
-			}
-		}
-
-		if len(line) > 0 && line[len(line)-1] == '\n' {
-			// Remove line break.
-			line = line[:len(line)-1]
-		}
-
-		if strings.HasPrefix(line, "+++ ") || strings.HasPrefix(line, "--- ") || len(line) == 0 {
-			continue
-		}
-
-		curFileLinesCount++
-		lineCount++
-
-		// Diff data too large, we only show the first about maxlines lines
-		if curFileLinesCount >= maxLines || len(line) >= maxLineCharacteres {
-			curFile.IsIncomplete = true
-		}
-
-		switch {
-		case line[0] == ' ':
-			diffLine := &DiffLine{Type: DiffLinePlain, Content: line, LeftIdx: leftLine, RightIdx: rightLine}
-			leftLine++
-			rightLine++
-			curSection.Lines = append(curSection.Lines, diffLine)
-			continue
-		case line[0] == '@':
-			curSection = &DiffSection{}
-			curFile.Sections = append(curFile.Sections, curSection)
-			ss := strings.Split(line, "@@")
-			diffLine := &DiffLine{Type: DiffLineSection, Content: line}
-			curSection.Lines = append(curSection.Lines, diffLine)
-
-			// Parse line number.
-			ranges := strings.Split(ss[1][1:], " ")
-			leftLine, _ = strconv.Atoi(strings.Split(ranges[0], ",")[0][1:])
-			if len(ranges) > 1 {
-				rightLine, _ = strconv.Atoi(strings.Split(ranges[1], ",")[0])
-			} else {
-				rightLine = leftLine
-			}
-			continue
-		case line[0] == '+':
-			curFile.Addition++
-			diff.TotalAddition++
-			diffLine := &DiffLine{Type: DiffLineAdd, Content: line, RightIdx: rightLine}
-			rightLine++
-			curSection.Lines = append(curSection.Lines, diffLine)
-			continue
-		case line[0] == '-':
-			curFile.Deletion++
-			diff.TotalDeletion++
-			diffLine := &DiffLine{Type: DiffLineDel, Content: line, LeftIdx: leftLine}
-			if leftLine > 0 {
-				leftLine++
-			}
-			curSection.Lines = append(curSection.Lines, diffLine)
-		case strings.HasPrefix(line, "Binary"):
-			curFile.IsBin = true
-			continue
-		}
-
-		// Get new file.
-		if strings.HasPrefix(line, _DIFF_HEAD) {
-			middle := -1
-
-			// Note: In case file name is surrounded by double quotes (it happens only in git-shell).
-			// e.g. diff --git "a/xxx" "b/xxx"
-			hasQuote := line[len(_DIFF_HEAD)] == '"'
-			if hasQuote {
-				middle = strings.Index(line, ` "b/`)
-			} else {
-				middle = strings.Index(line, " b/")
-			}
-
-			beg := len(_DIFF_HEAD)
-			a := line[beg+2 : middle]
-			b := line[middle+3:]
-			if hasQuote {
-				a = string(UnescapeChars([]byte(a[1 : len(a)-1])))
-				b = string(UnescapeChars([]byte(b[1 : len(b)-1])))
-			}
-
-			curFile = &DiffFile{
-				Name:     a,
-				Type:     DiffFileChange,
-				Sections: make([]*DiffSection, 0, 10),
-			}
-			diff.Files = append(diff.Files, curFile)
-			if len(diff.Files) >= maxFiles {
-				diff.IsIncomplete = true
-				io.Copy(ioutil.Discard, reader)
-				break
-			}
-			curFileLinesCount = 0
-
-			// Check file diff type and submodule.
-		CHECK_TYPE:
-			for {
-				line, err := input.ReadString('\n')
-				if err != nil {
-					if err == io.EOF {
-						isEOF = true
-					} else {
-						done <- fmt.Errorf("ReadString: %v", err)
-						return nil
-					}
-				}
-
-				switch {
-				case strings.HasPrefix(line, "new file"):
-					curFile.Type = DiffFileAdd
-					curFile.IsCreated = true
-					curFile.IsSubmodule = strings.HasSuffix(line, " 160000\n")
-				case strings.HasPrefix(line, "deleted"):
-					curFile.Type = DiffFileDel
-					curFile.IsDeleted = true
-					curFile.IsSubmodule = strings.HasSuffix(line, " 160000\n")
-				case strings.HasPrefix(line, "index"):
-					if curFile.IsDeleted {
-						curFile.Index = line[6:46]
-					} else if len(line) >= 88 {
-						curFile.Index = line[49:88]
-					} else {
-						curFile.Index = curFile.Name
-					}
-					break CHECK_TYPE
-				case strings.HasPrefix(line, "similarity index 100%"):
-					curFile.Type = DiffFileRename
-					curFile.IsRenamed = true
-					curFile.OldName = curFile.Name
-					curFile.Name = b
-					curFile.Index = b
-					break CHECK_TYPE
-				case strings.HasPrefix(line, "old mode"):
-					break CHECK_TYPE
-				}
-			}
-		}
-	}
-
-	done <- nil
-	return diff
-}
-
-// GetDiffRange returns a parsed diff object between given commits.
-func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacteres, maxFiles int) (*Diff, error) {
-	repo, err := OpenRepository(repoPath)
-	if err != nil {
-		return nil, err
-	}
-
-	commit, err := repo.GetCommit(afterCommitID)
-	if err != nil {
-		return nil, err
-	}
-
-	cmd := NewCommand()
-	if len(beforeCommitID) == 0 {
-		// First commit of repository
-		if commit.ParentCount() == 0 {
-			cmd.AddArguments("show", "--full-index", afterCommitID)
-		} else {
-			c, _ := commit.Parent(0)
-			cmd.AddArguments("diff", "--full-index", "-M", c.ID.String(), afterCommitID)
-		}
-	} else {
-		cmd.AddArguments("diff", "--full-index", "-M", beforeCommitID, afterCommitID)
-	}
-
-	stdout, w := io.Pipe()
-	done := make(chan error)
-	var diff *Diff
-	go func() {
-		diff = ParsePatch(done, maxLines, maxLineCharacteres, maxFiles, stdout)
-	}()
-
-	stderr := new(bytes.Buffer)
-	err = cmd.RunInDirTimeoutPipeline(2*time.Minute, repoPath, w, stderr)
-	w.Close() // Close writer to exit parsing goroutine
-	if err != nil {
-		return nil, concatenateError(err, stderr.String())
-	}
-
-	return diff, <-done
-}
-
-// RawDiffType represents the type of raw diff format.
-type RawDiffType string
-
-const (
-	RawDiffNormal RawDiffType = "diff"
-	RawDiffPatch  RawDiffType = "patch"
-)
-
-// GetRawDiff dumps diff results of repository in given commit ID to io.Writer.
-func GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Writer) error {
-	repo, err := OpenRepository(repoPath)
-	if err != nil {
-		return fmt.Errorf("OpenRepository: %v", err)
-	}
-
-	commit, err := repo.GetCommit(commitID)
-	if err != nil {
-		return err
-	}
-
-	cmd := NewCommand()
-	switch diffType {
-	case RawDiffNormal:
-		if commit.ParentCount() == 0 {
-			cmd.AddArguments("show", commitID)
-		} else {
-			c, _ := commit.Parent(0)
-			cmd.AddArguments("diff", "-M", c.ID.String(), commitID)
-		}
-	case RawDiffPatch:
-		if commit.ParentCount() == 0 {
-			cmd.AddArguments("format-patch", "--no-signature", "--stdout", "--root", commitID)
-		} else {
-			c, _ := commit.Parent(0)
-			query := fmt.Sprintf("%s...%s", commitID, c.ID.String())
-			cmd.AddArguments("format-patch", "--no-signature", "--stdout", query)
-		}
-	default:
-		return fmt.Errorf("invalid diffType: %s", diffType)
-	}
-
-	stderr := new(bytes.Buffer)
-	if err = cmd.RunInDirPipeline(repoPath, writer, stderr); err != nil {
-		return concatenateError(err, stderr.String())
-	}
-	return nil
-}
-
-// GetDiffCommit returns a parsed diff object of given commit.
-func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacteres, maxFiles int) (*Diff, error) {
-	return GetDiffRange(repoPath, "", commitID, maxLines, maxLineCharacteres, maxFiles)
-}

+ 0 - 13
vendor/github.com/G-Node/git-module/repo_hook.go

@@ -1,13 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-func (repo *Repository) GetHook(name string) (*Hook, error) {
-	return GetHook(repo.Path, name)
-}
-
-func (repo *Repository) Hooks() ([]*Hook, error) {
-	return ListHooks(repo.Path)
-}

+ 0 - 14
vendor/github.com/G-Node/git-module/repo_object.go

@@ -1,14 +0,0 @@
-// Copyright 2014 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-type ObjectType string
-
-const (
-	ObjectCommit ObjectType = "commit"
-	ObjectTree   ObjectType = "tree"
-	ObjectBlob   ObjectType = "blob"
-	ObjectTag    ObjectType = "tag"
-)

+ 0 - 81
vendor/github.com/G-Node/git-module/repo_pull.go

@@ -1,81 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"container/list"
-	"fmt"
-	"strconv"
-	"strings"
-	"time"
-)
-
-// PullRequestInfo represents needed information for a pull request.
-type PullRequestInfo struct {
-	MergeBase string
-	Commits   *list.List
-	NumFiles  int
-}
-
-// GetMergeBase checks and returns merge base of two branches.
-func (repo *Repository) GetMergeBase(base, head string) (string, error) {
-	stdout, err := NewCommand("merge-base", base, head).RunInDir(repo.Path)
-	if err != nil {
-		if strings.Contains(err.Error(), "exit status 1") {
-			return "", ErrNoMergeBase{}
-		}
-		return "", err
-	}
-	return strings.TrimSpace(stdout), nil
-}
-
-// GetPullRequestInfo generates and returns pull request information
-// between base and head branches of repositories.
-func (repo *Repository) GetPullRequestInfo(basePath, baseBranch, headBranch string) (_ *PullRequestInfo, err error) {
-	var remoteBranch string
-
-	// We don't need a temporary remote for same repository.
-	if repo.Path != basePath {
-		// Add a temporary remote
-		tmpRemote := strconv.FormatInt(time.Now().UnixNano(), 10)
-		if err = repo.AddRemote(tmpRemote, basePath, true); err != nil {
-			return nil, fmt.Errorf("AddRemote: %v", err)
-		}
-		defer repo.RemoveRemote(tmpRemote)
-
-		remoteBranch = "remotes/" + tmpRemote + "/" + baseBranch
-	} else {
-		remoteBranch = baseBranch
-	}
-
-	prInfo := new(PullRequestInfo)
-	prInfo.MergeBase, err = repo.GetMergeBase(remoteBranch, headBranch)
-	if err != nil {
-		return nil, err
-	}
-
-	logs, err := NewCommand("log", prInfo.MergeBase+"..."+headBranch, prettyLogFormat).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	prInfo.Commits, err = repo.parsePrettyFormatLogToList(logs)
-	if err != nil {
-		return nil, fmt.Errorf("parsePrettyFormatLogToList: %v", err)
-	}
-
-	// Count number of changed files.
-	stdout, err := NewCommand("diff", "--name-only", remoteBranch+"..."+headBranch).RunInDir(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	prInfo.NumFiles = len(strings.Split(stdout, "\n")) - 1
-
-	return prInfo, nil
-}
-
-// GetPatch generates and returns patch data between given revisions.
-func (repo *Repository) GetPatch(base, head string) ([]byte, error) {
-	return NewCommand("diff", "-p", "--binary", base, head).RunInDirBytes(repo.Path)
-}

+ 0 - 209
vendor/github.com/G-Node/git-module/repo_tag.go

@@ -1,209 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"fmt"
-	"strings"
-
-	goversion "github.com/mcuadros/go-version"
-)
-
-const TagPrefix = "refs/tags/"
-
-// IsTagExist returns true if given tag exists in the repository.
-func IsTagExist(repoPath, name string) bool {
-	return IsReferenceExist(repoPath, TagPrefix+name)
-}
-
-func (repo *Repository) IsTagExist(name string) bool {
-	return IsTagExist(repo.Path, name)
-}
-
-func (repo *Repository) CreateTag(name, revision string) error {
-	_, err := NewCommand("tag", name, revision).RunInDir(repo.Path)
-	return err
-}
-
-func (repo *Repository) getTag(id sha1) (*Tag, error) {
-	t, ok := repo.tagCache.Get(id.String())
-	if ok {
-		log("Hit cache: %s", id)
-		return t.(*Tag), nil
-	}
-
-	// Get tag type
-	tp, err := NewCommand("cat-file", "-t", id.String()).RunInDir(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	tp = strings.TrimSpace(tp)
-
-	// Tag is a commit.
-	if ObjectType(tp) == ObjectCommit {
-		tag := &Tag{
-			ID:     id,
-			Object: id,
-			Type:   string(ObjectCommit),
-			repo:   repo,
-		}
-
-		repo.tagCache.Set(id.String(), tag)
-		return tag, nil
-	}
-
-	// Tag with message.
-	data, err := NewCommand("cat-file", "-p", id.String()).RunInDirBytes(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-
-	tag, err := parseTagData(data)
-	if err != nil {
-		return nil, err
-	}
-
-	tag.ID = id
-	tag.repo = repo
-
-	repo.tagCache.Set(id.String(), tag)
-	return tag, nil
-}
-
-// GetTag returns a Git tag by given name.
-func (repo *Repository) GetTag(name string) (*Tag, error) {
-	stdout, err := NewCommand("show-ref", "--tags", name).RunInDir(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-
-	id, err := NewIDFromString(strings.Split(stdout, " ")[0])
-	if err != nil {
-		return nil, err
-	}
-
-	tag, err := repo.getTag(id)
-	if err != nil {
-		return nil, err
-	}
-	tag.Name = name
-	return tag, nil
-}
-
-// GetTags returns all tags of the repository.
-func (repo *Repository) GetTags() ([]string, error) {
-	cmd := NewCommand("tag", "-l")
-	if goversion.Compare(gitVersion, "2.4.9", ">=") {
-		cmd.AddArguments("--sort=-creatordate")
-	}
-
-	stdout, err := cmd.RunInDir(repo.Path)
-	if err != nil {
-		return nil, err
-	}
-
-	tags := strings.Split(stdout, "\n")
-	tags = tags[:len(tags)-1]
-
-	if goversion.Compare(gitVersion, "2.4.9", "<") {
-		goversion.Sort(tags)
-
-		// Reverse order
-		for i := 0; i < len(tags)/2; i++ {
-			j := len(tags) - i - 1
-			tags[i], tags[j] = tags[j], tags[i]
-		}
-	}
-
-	return tags, nil
-}
-
-type TagsResult struct {
-	// Indicates whether results include the latest tag.
-	HasLatest bool
-	// If results do not include the latest tag, a indicator 'after' to go back.
-	PreviousAfter string
-	// Indicates whether results include the oldest tag.
-	ReachEnd bool
-	// List of returned tags.
-	Tags []string
-}
-
-// GetTagsAfter returns list of tags 'after' (exlusive) given tag.
-func (repo *Repository) GetTagsAfter(after string, limit int) (*TagsResult, error) {
-	allTags, err := repo.GetTags()
-	if err != nil {
-		return nil, fmt.Errorf("GetTags: %v", err)
-	}
-
-	if limit < 0 {
-		limit = 0
-	}
-
-	numAllTags := len(allTags)
-	if len(after) == 0 && limit == 0 {
-		return &TagsResult{
-			HasLatest: true,
-			ReachEnd:  true,
-			Tags:      allTags,
-		}, nil
-	} else if len(after) == 0 && limit > 0 {
-		endIdx := limit
-		if limit >= numAllTags {
-			endIdx = numAllTags
-		}
-		return &TagsResult{
-			HasLatest: true,
-			ReachEnd:  limit >= numAllTags,
-			Tags:      allTags[:endIdx],
-		}, nil
-	}
-
-	previousAfter := ""
-	hasMatch := false
-	tags := make([]string, 0, len(allTags))
-	for i := range allTags {
-		if hasMatch {
-			tags = allTags[i:]
-			break
-		}
-		if allTags[i] == after {
-			hasMatch = true
-			if limit > 0 && i-limit >= 0 {
-				previousAfter = allTags[i-limit]
-			}
-			continue
-		}
-	}
-
-	if !hasMatch {
-		tags = allTags
-	}
-
-	// If all tags after match is equal to the limit, it reaches the oldest tag as well.
-	if limit == 0 || len(tags) <= limit {
-		return &TagsResult{
-			HasLatest:     !hasMatch,
-			PreviousAfter: previousAfter,
-			ReachEnd:      true,
-			Tags:          tags,
-		}, nil
-	}
-	return &TagsResult{
-		HasLatest:     !hasMatch,
-		PreviousAfter: previousAfter,
-		Tags:          tags[:limit],
-	}, nil
-}
-
-// DeleteTag deletes a tag from the repository
-func (repo *Repository) DeleteTag(name string) error {
-	cmd := NewCommand("tag", "-d")
-
-	cmd.AddArguments(name)
-	_, err := cmd.RunInDir(repo.Path)
-
-	return err
-}

+ 0 - 26
vendor/github.com/G-Node/git-module/repo_tree.go

@@ -1,26 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-func (repo *Repository) getTree(id sha1) (*Tree, error) {
-	treePath := filepathFromSHA1(repo.Path, id.String())
-	if isFile(treePath) {
-		_, err := NewCommand("ls-tree", id.String()).RunInDir(repo.Path)
-		if err != nil {
-			return nil, ErrNotExist{id.String(), ""}
-		}
-	}
-
-	return NewTree(repo, id), nil
-}
-
-// Find the tree object in the repository.
-func (repo *Repository) GetTree(idStr string) (*Tree, error) {
-	id, err := NewIDFromString(idStr)
-	if err != nil {
-		return nil, err
-	}
-	return repo.getTree(id)
-}

+ 0 - 93
vendor/github.com/G-Node/git-module/sha1.go

@@ -1,93 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"encoding/hex"
-	"fmt"
-	"strings"
-)
-
-const EmptySHA = "0000000000000000000000000000000000000000"
-
-type sha1 [20]byte
-
-// Equal returns true if s has the same sha1 as caller.
-// Support 40-length-string, []byte, sha1.
-func (id sha1) Equal(s2 interface{}) bool {
-	switch v := s2.(type) {
-	case string:
-		if len(v) != 40 {
-			return false
-		}
-		return v == id.String()
-	case []byte:
-		if len(v) != 20 {
-			return false
-		}
-		for i, v := range v {
-			if id[i] != v {
-				return false
-			}
-		}
-	case sha1:
-		for i, v := range v {
-			if id[i] != v {
-				return false
-			}
-		}
-	default:
-		return false
-	}
-	return true
-}
-
-// String returns string (hex) representation of the Oid.
-func (s sha1) String() string {
-	result := make([]byte, 0, 40)
-	hexvalues := []byte("0123456789abcdef")
-	for i := 0; i < 20; i++ {
-		result = append(result, hexvalues[s[i]>>4])
-		result = append(result, hexvalues[s[i]&0xf])
-	}
-	return string(result)
-}
-
-// MustID always creates a new sha1 from a [20]byte array with no validation of input.
-func MustID(b []byte) sha1 {
-	var id sha1
-	for i := 0; i < 20; i++ {
-		id[i] = b[i]
-	}
-	return id
-}
-
-// NewID creates a new sha1 from a [20]byte array.
-func NewID(b []byte) (sha1, error) {
-	if len(b) != 20 {
-		return sha1{}, fmt.Errorf("Length must be 20: %v", b)
-	}
-	return MustID(b), nil
-}
-
-// MustIDFromString always creates a new sha from a ID with no validation of input.
-func MustIDFromString(s string) sha1 {
-	b, _ := hex.DecodeString(s)
-	return MustID(b)
-}
-
-// NewIDFromString creates a new sha1 from a ID string of length 40.
-func NewIDFromString(s string) (sha1, error) {
-	var id sha1
-	s = strings.TrimSpace(s)
-	if len(s) != 40 {
-		return id, fmt.Errorf("Length must be 40: %s", s)
-	}
-	b, err := hex.DecodeString(s)
-	if err != nil {
-		return id, err
-	}
-	return NewID(b)
-}

+ 0 - 48
vendor/github.com/G-Node/git-module/signature.go

@@ -1,48 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"bytes"
-	"strconv"
-	"time"
-)
-
-// Signature represents the Author or Committer information.
-type Signature struct {
-	Email string
-	Name  string
-	When  time.Time
-}
-
-// Helper to get a signature from the commit line, which looks like these:
-//     author Patrick Gundlach <gundlach@speedata.de> 1378823654 +0200
-//     author Patrick Gundlach <gundlach@speedata.de> Thu, 07 Apr 2005 22:13:13 +0200
-// but without the "author " at the beginning (this method should)
-// be used for author and committer.
-//
-// FIXME: include timezone for timestamp!
-func newSignatureFromCommitline(line []byte) (_ *Signature, err error) {
-	sig := new(Signature)
-	emailStart := bytes.IndexByte(line, '<')
-	sig.Name = string(line[:emailStart-1])
-	emailEnd := bytes.IndexByte(line, '>')
-	sig.Email = string(line[emailStart+1 : emailEnd])
-
-	// Check date format.
-	firstChar := line[emailEnd+2]
-	if firstChar >= 48 && firstChar <= 57 {
-		timestop := bytes.IndexByte(line[emailEnd+2:], ' ')
-		timestring := string(line[emailEnd+2 : emailEnd+2+timestop])
-		seconds, _ := strconv.ParseInt(timestring, 10, 64)
-		sig.When = time.Unix(seconds, 0)
-	} else {
-		sig.When, err = time.Parse("Mon Jan _2 15:04:05 2006 -0700", string(line[emailEnd+2:]))
-		if err != nil {
-			return nil, err
-		}
-	}
-	return sig, nil
-}

+ 0 - 78
vendor/github.com/G-Node/git-module/submodule.go

@@ -1,78 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import "strings"
-
-type SubModule struct {
-	Name string
-	URL  string
-}
-
-// SubModuleFile represents a file with submodule type.
-type SubModuleFile struct {
-	*Commit
-
-	refURL string
-	refID  string
-}
-
-func NewSubModuleFile(c *Commit, refURL, refID string) *SubModuleFile {
-	return &SubModuleFile{
-		Commit: c,
-		refURL: refURL,
-		refID:  refID,
-	}
-}
-
-// RefURL guesses and returns reference URL.
-func (sf *SubModuleFile) RefURL(urlPrefix string, parentPath string) string {
-	if sf.refURL == "" {
-		return ""
-	}
-
-	url := strings.TrimSuffix(sf.refURL, ".git")
-
-	// git://xxx/user/repo
-	if strings.HasPrefix(url, "git://") {
-		return "http://" + strings.TrimPrefix(url, "git://")
-	}
-
-	// http[s]://xxx/user/repo
-	if strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") {
-		return url
-	}
-
-	// Relative url prefix check (according to git submodule documentation)
-	if strings.HasPrefix(url, "./") || strings.HasPrefix(url, "../") {
-		// ...construct and return correct submodule url here...
-		idx := strings.Index(parentPath, "/src/")
-		if idx == -1 {
-			return url
-		}
-		return strings.TrimSuffix(urlPrefix, "/") + parentPath[:idx] + "/" + url
-	}
-
-	// sysuser@xxx:user/repo
-	i := strings.Index(url, "@")
-	j := strings.LastIndex(url, ":")
-
-	// Only process when i < j because git+ssh://git@git.forwardbias.in/npploader.git
-	if i > -1 && j > -1 && i < j {
-		// fix problem with reverse proxy works only with local server
-		if strings.Contains(urlPrefix, url[i+1:j]) {
-			return urlPrefix + url[j+1:]
-		} else {
-			return "http://" + url[i+1:j] + "/" + url[j+1:]
-		}
-	}
-
-	return url
-}
-
-// RefID returns reference ID.
-func (sf *SubModuleFile) RefID() string {
-	return sf.refID
-}

+ 0 - 65
vendor/github.com/G-Node/git-module/tag.go

@@ -1,65 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import "bytes"
-
-// Tag represents a Git tag.
-type Tag struct {
-	Name    string
-	ID      sha1
-	repo    *Repository
-	Object  sha1 // The id of this commit object
-	Type    string
-	Tagger  *Signature
-	Message string
-}
-
-func (tag *Tag) Commit() (*Commit, error) {
-	return tag.repo.getCommit(tag.Object)
-}
-
-// Parse commit information from the (uncompressed) raw
-// data from the commit object.
-// \n\n separate headers from message
-func parseTagData(data []byte) (*Tag, error) {
-	tag := new(Tag)
-	// we now have the contents of the commit object. Let's investigate...
-	nextline := 0
-l:
-	for {
-		eol := bytes.IndexByte(data[nextline:], '\n')
-		switch {
-		case eol > 0:
-			line := data[nextline : nextline+eol]
-			spacepos := bytes.IndexByte(line, ' ')
-			reftype := line[:spacepos]
-			switch string(reftype) {
-			case "object":
-				id, err := NewIDFromString(string(line[spacepos+1:]))
-				if err != nil {
-					return nil, err
-				}
-				tag.Object = id
-			case "type":
-				// A commit can have one or more parents
-				tag.Type = string(line[spacepos+1:])
-			case "tagger":
-				sig, err := newSignatureFromCommitline(line[spacepos+1:])
-				if err != nil {
-					return nil, err
-				}
-				tag.Tagger = sig
-			}
-			nextline += eol + 1
-		case eol == 0:
-			tag.Message = string(data[nextline+1:])
-			break l
-		default:
-			break l
-		}
-	}
-	return tag, nil
-}

+ 0 - 149
vendor/github.com/G-Node/git-module/tree.go

@@ -1,149 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"bytes"
-	"fmt"
-	"strings"
-)
-
-// Tree represents a flat directory listing.
-type Tree struct {
-	ID   sha1
-	repo *Repository
-
-	// parent tree
-	ptree *Tree
-
-	entries       Entries
-	entriesParsed bool
-}
-
-func NewTree(repo *Repository, id sha1) *Tree {
-	return &Tree{
-		ID:   id,
-		repo: repo,
-	}
-}
-
-// Predefine []byte variables to avoid runtime allocations.
-var (
-	escapedSlash = []byte(`\\`)
-	regularSlash = []byte(`\`)
-	escapedTab   = []byte(`\t`)
-	regularTab   = []byte("\t")
-)
-
-// UnescapeChars reverses escaped characters.
-func UnescapeChars(in []byte) []byte {
-	// LEGACY [Go 1.7]: use more expressive bytes.ContainsAny
-	if bytes.IndexAny(in, "\\\t") == -1 {
-		return in
-	}
-
-	out := bytes.Replace(in, escapedSlash, regularSlash, -1)
-	out = bytes.Replace(out, escapedTab, regularTab, -1)
-	return out
-}
-
-// parseTreeData parses tree information from the (uncompressed) raw
-// data from the tree object.
-func parseTreeData(tree *Tree, data []byte) ([]*TreeEntry, error) {
-	entries := make([]*TreeEntry, 0, 10)
-	l := len(data)
-	pos := 0
-	for pos < l {
-		entry := new(TreeEntry)
-		entry.ptree = tree
-		step := 6
-		switch string(data[pos : pos+step]) {
-		case "100644", "100664":
-			entry.mode = EntryBlob
-			entry.Type = ObjectBlob
-		case "100755":
-			entry.mode = EntryExec
-			entry.Type = ObjectBlob
-		case "120000":
-			entry.mode = EntrySymlink
-			entry.Type = ObjectBlob
-		case "160000":
-			entry.mode = EntryCommit
-			entry.Type = ObjectCommit
-
-			step = 8
-		case "040000":
-			entry.mode = EntryTree
-			entry.Type = ObjectTree
-		default:
-			return nil, fmt.Errorf("unknown type: %v", string(data[pos:pos+step]))
-		}
-		pos += step + 6 // Skip string type of entry type.
-
-		step = 40
-		id, err := NewIDFromString(string(data[pos : pos+step]))
-		if err != nil {
-			return nil, err
-		}
-		entry.ID = id
-		pos += step + 1 // Skip half of sha1.
-
-		step = bytes.IndexByte(data[pos:], '\n')
-
-		// In case entry name is surrounded by double quotes(it happens only in git-shell).
-		if data[pos] == '"' {
-			entry.name = string(UnescapeChars(data[pos+1 : pos+step-1]))
-		} else {
-			entry.name = string(data[pos : pos+step])
-		}
-
-		pos += step + 1
-		entries = append(entries, entry)
-	}
-	return entries, nil
-}
-
-func (t *Tree) SubTree(rpath string) (*Tree, error) {
-	if len(rpath) == 0 {
-		return t, nil
-	}
-
-	paths := strings.Split(rpath, "/")
-	var (
-		err error
-		g   = t
-		p   = t
-		te  *TreeEntry
-	)
-	for _, name := range paths {
-		te, err = p.GetTreeEntryByPath(name)
-		if err != nil {
-			return nil, err
-		}
-
-		g, err = t.repo.getTree(te.ID)
-		if err != nil {
-			return nil, err
-		}
-		g.ptree = p
-		p = g
-	}
-	return g, nil
-}
-
-// ListEntries returns all entries of current tree.
-func (t *Tree) ListEntries() (Entries, error) {
-	if t.entriesParsed {
-		return t.entries, nil
-	}
-	t.entriesParsed = true
-
-	stdout, err := NewCommand("ls-tree", t.ID.String()).RunInDirBytes(t.repo.Path)
-	if err != nil {
-		return nil, err
-	}
-	t.entries, err = parseTreeData(t, stdout)
-	return t.entries, err
-}

+ 0 - 57
vendor/github.com/G-Node/git-module/tree_blob.go

@@ -1,57 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"path"
-	"strings"
-)
-
-func (t *Tree) GetTreeEntryByPath(relpath string) (*TreeEntry, error) {
-	if len(relpath) == 0 {
-		return &TreeEntry{
-			ID:   t.ID,
-			Type: ObjectTree,
-			mode: EntryTree,
-		}, nil
-	}
-
-	relpath = path.Clean(relpath)
-	parts := strings.Split(relpath, "/")
-	var err error
-	tree := t
-	for i, name := range parts {
-		if i == len(parts)-1 {
-			entries, err := tree.ListEntries()
-			if err != nil {
-				return nil, err
-			}
-			for _, v := range entries {
-				if v.name == name {
-					return v, nil
-				}
-			}
-		} else {
-			tree, err = tree.SubTree(name)
-			if err != nil {
-				return nil, err
-			}
-		}
-	}
-	return nil, ErrNotExist{"", relpath}
-}
-
-func (t *Tree) GetBlobByPath(relpath string) (*Blob, error) {
-	entry, err := t.GetTreeEntryByPath(relpath)
-	if err != nil {
-		return nil, err
-	}
-
-	if !entry.IsDir() {
-		return entry.Blob(), nil
-	}
-
-	return nil, ErrNotExist{"", relpath}
-}

+ 0 - 231
vendor/github.com/G-Node/git-module/tree_entry.go

@@ -1,231 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"fmt"
-	"path"
-	"path/filepath"
-	"runtime"
-	"sort"
-	"strconv"
-	"strings"
-)
-
-type EntryMode int
-
-// There are only a few file modes in Git. They look like unix file modes, but they can only be
-// one of these.
-const (
-	EntryBlob    EntryMode = 0100644
-	EntryExec    EntryMode = 0100755
-	EntrySymlink EntryMode = 0120000
-	EntryCommit  EntryMode = 0160000
-	EntryTree    EntryMode = 0040000
-)
-
-type TreeEntry struct {
-	ID   sha1
-	Type ObjectType
-
-	mode EntryMode
-	name string
-
-	ptree *Tree
-
-	commited bool
-
-	size  int64
-	sized bool
-}
-
-func (te *TreeEntry) SetSize(size int64) {
-	te.size = size
-	te.sized = true
-}
-
-func (te *TreeEntry) Name() string {
-	return te.name
-}
-
-func (te *TreeEntry) Size() int64 {
-	if te.IsDir() {
-		return 0
-	} else if te.sized {
-		return te.size
-	}
-
-	stdout, err := NewCommand("cat-file", "-s", te.ID.String()).RunInDir(te.ptree.repo.Path)
-	if err != nil {
-		return 0
-	}
-
-	te.sized = true
-	te.size, _ = strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
-	return te.size
-}
-
-func (te *TreeEntry) IsSubModule() bool {
-	return te.mode == EntryCommit
-}
-
-func (te *TreeEntry) IsDir() bool {
-	return te.mode == EntryTree
-}
-
-func (te *TreeEntry) IsLink() bool {
-	return te.mode == EntrySymlink
-}
-
-func (te *TreeEntry) Blob() *Blob {
-	return &Blob{
-		repo:      te.ptree.repo,
-		TreeEntry: te,
-	}
-}
-
-type Entries []*TreeEntry
-
-var sorter = []func(t1, t2 *TreeEntry) bool{
-	func(t1, t2 *TreeEntry) bool {
-		return (t1.IsDir() || t1.IsSubModule()) && !t2.IsDir() && !t2.IsSubModule()
-	},
-	func(t1, t2 *TreeEntry) bool {
-		return t1.name < t2.name
-	},
-}
-
-func (tes Entries) Len() int      { return len(tes) }
-func (tes Entries) Swap(i, j int) { tes[i], tes[j] = tes[j], tes[i] }
-func (tes Entries) Less(i, j int) bool {
-	t1, t2 := tes[i], tes[j]
-	var k int
-	for k = 0; k < len(sorter)-1; k++ {
-		sort := sorter[k]
-		switch {
-		case sort(t1, t2):
-			return true
-		case sort(t2, t1):
-			return false
-		}
-	}
-	return sorter[k](t1, t2)
-}
-
-func (tes Entries) Sort() {
-	sort.Sort(tes)
-}
-
-var defaultConcurrency = runtime.NumCPU()
-
-type commitInfo struct {
-	entryName string
-	infos     []interface{}
-	err       error
-}
-
-// GetCommitsInfo takes advantages of concurrency to speed up getting information
-// of all commits that are corresponding to these entries. This method will automatically
-// choose the right number of goroutine (concurrency) to use related of the host CPU.
-func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interface{}, error) {
-	return tes.GetCommitsInfoWithCustomConcurrency(commit, treePath, 0)
-}
-
-// GetCommitsInfoWithCustomConcurrency takes advantages of concurrency to speed up getting information
-// of all commits that are corresponding to these entries. If the given maxConcurrency is negative or
-// equal to zero:  the right number of goroutine (concurrency) to use will be choosen related of the
-// host CPU.
-func (tes Entries) GetCommitsInfoWithCustomConcurrency(commit *Commit, treePath string, maxConcurrency int) ([][]interface{}, error) {
-	if len(tes) == 0 {
-		return nil, nil
-	}
-
-	if maxConcurrency <= 0 {
-		maxConcurrency = defaultConcurrency
-	}
-
-	// Length of taskChan determines how many goroutines (subprocesses) can run at the same time.
-	// The length of revChan should be same as taskChan so goroutines whoever finished job can
-	// exit as early as possible, only store data inside channel.
-	taskChan := make(chan bool, maxConcurrency)
-	revChan := make(chan commitInfo, maxConcurrency)
-	doneChan := make(chan error)
-
-	// Receive loop will exit when it collects same number of data pieces as tree entries.
-	// It notifies doneChan before exits or notify early with possible error.
-	infoMap := make(map[string][]interface{}, len(tes))
-	go func() {
-		i := 0
-		for info := range revChan {
-			if info.err != nil {
-				doneChan <- info.err
-				return
-			}
-
-			infoMap[info.entryName] = info.infos
-			i++
-			if i == len(tes) {
-				break
-			}
-		}
-		doneChan <- nil
-	}()
-
-	for i := range tes {
-		// When taskChan is idle (or has empty slots), put operation will not block.
-		// However when taskChan is full, code will block and wait any running goroutines to finish.
-		taskChan <- true
-
-		if tes[i].Type != ObjectCommit {
-			go func(i int) {
-				cinfo := commitInfo{entryName: tes[i].Name()}
-				c, err := commit.GetCommitByPath(filepath.Join(treePath, tes[i].Name()))
-				if err != nil {
-					cinfo.err = fmt.Errorf("GetCommitByPath (%s/%s): %v", treePath, tes[i].Name(), err)
-				} else {
-					cinfo.infos = []interface{}{tes[i], c}
-				}
-				revChan <- cinfo
-				<-taskChan // Clear one slot from taskChan to allow new goroutines to start.
-			}(i)
-			continue
-		}
-
-		// Handle submodule
-		go func(i int) {
-			cinfo := commitInfo{entryName: tes[i].Name()}
-			sm, err := commit.GetSubModule(path.Join(treePath, tes[i].Name()))
-			if err != nil && !IsErrNotExist(err) {
-				cinfo.err = fmt.Errorf("GetSubModule (%s/%s): %v", treePath, tes[i].Name(), err)
-				revChan <- cinfo
-				return
-			}
-
-			smURL := ""
-			if sm != nil {
-				smURL = sm.URL
-			}
-
-			c, err := commit.GetCommitByPath(filepath.Join(treePath, tes[i].Name()))
-			if err != nil {
-				cinfo.err = fmt.Errorf("GetCommitByPath (%s/%s): %v", treePath, tes[i].Name(), err)
-			} else {
-				cinfo.infos = []interface{}{tes[i], NewSubModuleFile(c, smURL, tes[i].ID.String())}
-			}
-			revChan <- cinfo
-			<-taskChan
-		}(i)
-	}
-
-	if err := <-doneChan; err != nil {
-		return nil, err
-	}
-
-	commitsInfo := make([][]interface{}, len(tes))
-	for i := 0; i < len(tes); i++ {
-		commitsInfo[i] = infoMap[tes[i].Name()]
-	}
-	return commitsInfo, nil
-}

+ 0 - 93
vendor/github.com/G-Node/git-module/utils.go

@@ -1,93 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git
-
-import (
-	"fmt"
-	"os"
-	"path/filepath"
-	"strings"
-	"sync"
-)
-
-// objectCache provides thread-safe cache opeations.
-type objectCache struct {
-	lock  sync.RWMutex
-	cache map[string]interface{}
-}
-
-func newObjectCache() *objectCache {
-	return &objectCache{
-		cache: make(map[string]interface{}, 10),
-	}
-}
-
-func (oc *objectCache) Set(id string, obj interface{}) {
-	oc.lock.Lock()
-	defer oc.lock.Unlock()
-
-	oc.cache[id] = obj
-}
-
-func (oc *objectCache) Get(id string) (interface{}, bool) {
-	oc.lock.RLock()
-	defer oc.lock.RUnlock()
-
-	obj, has := oc.cache[id]
-	return obj, has
-}
-
-// isDir returns true if given path is a directory,
-// or returns false when it's a file or does not exist.
-func isDir(dir string) bool {
-	f, e := os.Stat(dir)
-	if e != nil {
-		return false
-	}
-	return f.IsDir()
-}
-
-// isFile returns true if given path is a file,
-// or returns false when it's a directory or does not exist.
-func isFile(filePath string) bool {
-	f, e := os.Stat(filePath)
-	if e != nil {
-		return false
-	}
-	return !f.IsDir()
-}
-
-// isExist checks whether a file or directory exists.
-// It returns false when the file or directory does not exist.
-func isExist(path string) bool {
-	_, err := os.Stat(path)
-	return err == nil || os.IsExist(err)
-}
-
-func concatenateError(err error, stderr string) error {
-	if len(stderr) == 0 {
-		return err
-	}
-	return fmt.Errorf("%v - %s", err, stderr)
-}
-
-// If the object is stored in its own file (i.e not in a pack file),
-// this function returns the full path to the object file.
-// It does not test if the file exists.
-func filepathFromSHA1(rootdir, sha1 string) string {
-	return filepath.Join(rootdir, "objects", sha1[:2], sha1[2:])
-}
-
-func RefEndName(refStr string) string {
-	if strings.HasPrefix(refStr, BranchPrefix) {
-		return refStr[len(BranchPrefix):]
-	}
-
-	if strings.HasPrefix(refStr, TagPrefix) {
-		return refStr[len(TagPrefix):]
-	}
-
-	return refStr
-}

+ 0 - 35
vendor/github.com/G-Node/libgin/LICENSE

@@ -1,35 +0,0 @@
-BSD 3-Clause License
-
-Copyright (c) 2019, German Neuroinformatics Node
-                    Achilleas Koutsou <koutsou@bio.lmu.de>
-                    Michael Sonntag <sonntag@bio.lmu.de>
-                    Christian Garbers
-                    Christian Kellner <kellner@bio.lmu.de>
-                    Adrian Stoewer
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-
-* Neither the name of the copyright holder nor the names of its
-  contributors may be used to endorse or promote products derived from
-  this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 56
vendor/github.com/G-Node/libgin/libgin/annex/add.go

@@ -1,56 +0,0 @@
-package annex
-
-import (
-	"fmt"
-
-	git "github.com/G-Node/git-module"
-)
-
-const (
-	BYTE     = 1.0
-	KILOBYTE = 1024 * BYTE
-	MEGABYTE = 1024 * KILOBYTE
-	GIGABYTE = 1024 * MEGABYTE
-	TERABYTE = 1024 * GIGABYTE
-)
-
-func Init(dir string, args ...string) (string, error) {
-	cmd := git.NewACommand("init")
-	return cmd.AddArguments(args...).RunInDir(dir)
-}
-
-func Uninit(dir string, args ...string) (string, error) {
-	cmd := git.NewACommand("uninit")
-	return cmd.AddArguments(args...).RunInDir(dir)
-}
-
-func Worm(dir string) (string, error) {
-	cmd := git.NewCommand("config", "annex.backends", "WORM")
-	return cmd.RunInDir(dir)
-}
-
-func MD5(dir string) (string, error) {
-	cmd := git.NewCommand("config", "annex.backends", "MD5")
-	return cmd.RunInDir(dir)
-}
-
-func ASync(dir string, args ...string) (string, error) {
-	cmd := git.NewACommand("sync")
-	return cmd.AddArguments(args...).RunInDir(dir)
-}
-
-func Add(dir string, args ...string) (string, error) {
-	cmd := git.NewACommand("add")
-	cmd.AddArguments(args...)
-	return cmd.RunInDir(dir)
-}
-
-func SetAddUnlocked(dir string) (string, error) {
-	cmd := git.NewCommand("config", "annex.addunlocked", "true")
-	return cmd.RunInDir(dir)
-}
-
-func SetAnnexSizeFilter(dir string, size int64) (string, error) {
-	cmd := git.NewCommand("config", "annex.largefiles", fmt.Sprintf("largerthan=%d", size))
-	return cmd.RunInDir(dir)
-}

+ 0 - 74
vendor/github.com/G-Node/libgin/libgin/annex/file.go

@@ -1,74 +0,0 @@
-package annex
-
-import (
-	"fmt"
-	"io"
-	"os"
-	"path/filepath"
-	"regexp"
-	"strings"
-)
-
-var (
-	secPar    = regexp.MustCompile(`(\.\.)`)
-	aFPattern = regexp.MustCompile(`[\\\/]annex[\\\/](.+)`)
-)
-
-type AFile struct {
-	Filepath  string
-	OFilename string
-	Info      os.FileInfo
-}
-
-type AnnexFileNotFound struct {
-	error
-}
-
-func NewAFile(annexpath, repopath, Ofilename string, APFileC []byte) (*AFile, error) {
-	nAF := &AFile{OFilename: Ofilename}
-	matches := aFPattern.FindStringSubmatch(string(APFileC))
-	if matches != nil && len(matches) > 1 {
-		filepath := strings.Replace(matches[1], "\\", "/", 0)
-		filepath = fmt.Sprintf("%s/annex/%s", repopath, filepath)
-		if !secPar.MatchString(filepath) {
-			info, err := os.Stat(filepath)
-			if err == nil {
-				nAF.Filepath = filepath
-				nAF.Info = info
-				return nAF, nil
-			}
-		}
-	}
-	pathParts := strings.SplitAfter(string(APFileC), string(os.PathSeparator))
-	filename := strings.TrimSpace(pathParts[len(pathParts)-1])
-	// lets find the annex file
-	filepath.Walk(filepath.Join(annexpath, repopath), func(path string, info os.FileInfo, err error) error {
-		if err != nil {
-			return filepath.SkipDir
-		}
-		if info.IsDir() {
-			return nil
-		} else if info.Name() == filename {
-			nAF.Filepath = path
-			nAF.Info = info
-			return io.EOF
-		}
-		return nil
-	})
-	if nAF.Filepath != "" {
-		return nAF, nil
-	} else {
-		return nil, AnnexFileNotFound{error: fmt.Errorf("Could not find File: %s anywhere below: %s", filename,
-			filepath.Join(annexpath, repopath))}
-	}
-
-}
-
-func (af *AFile) Open() (*os.File, error) {
-	fp, err := os.Open(af.Filepath)
-	if err != nil {
-		return nil, err
-	}
-	return fp, nil
-
-}

+ 0 - 12
vendor/github.com/G-Node/libgin/libgin/annex/util.go

@@ -1,12 +0,0 @@
-package annex
-
-import "github.com/G-Node/git-module"
-
-func isAnnexed(dir string) (bool, error) {
-	return false, nil
-}
-
-func Upgrade(dir string) (string, error) {
-	cmd := git.NewACommand("upgrade")
-	return cmd.RunInDir(dir)
-}

+ 0 - 88
vendor/github.com/G-Node/libgin/libgin/archive.go

@@ -1,88 +0,0 @@
-package libgin
-
-import (
-	"archive/zip"
-	"fmt"
-	"io"
-	"os"
-	"path/filepath"
-	"strings"
-)
-
-// MakeZip recursively writes all the files found under the provided sources to
-// the dest io.Writer in ZIP format.  Any directories listed in source are
-// archived recursively.  Empty directories are ignored.
-func MakeZip(dest io.Writer, source ...string) error {
-	// check sources
-	for _, src := range source {
-		if _, err := os.Stat(src); err != nil {
-			return fmt.Errorf("Cannot access '%s': %s", src, err.Error())
-		}
-	}
-
-	zipwriter := zip.NewWriter(dest)
-	defer zipwriter.Close()
-
-	walker := func(path string, fi os.FileInfo, err error) error {
-
-		// return on any error
-		if err != nil {
-			return err
-		}
-
-		// create a new dir/file header
-		header, err := zip.FileInfoHeader(fi)
-		if err != nil {
-			return err
-		}
-
-		// update the name to correctly reflect the desired destination when unzipping
-		// header.Name = strings.TrimPrefix(strings.Replace(file, src, "", -1), string(filepath.Separator))
-		header.Name = path
-
-		if fi.Mode().IsDir() {
-			return nil
-		}
-
-		// write the header
-		w, err := zipwriter.CreateHeader(header)
-		if err != nil {
-			return err
-		}
-
-		// Dereference symlinks
-		if fi.Mode()&os.ModeSymlink != 0 {
-			data, err := os.Readlink(path)
-			if err != nil {
-				return err
-			}
-			if _, err := io.Copy(w, strings.NewReader(data)); err != nil {
-				return err
-			}
-			return nil
-		}
-
-		// open files for zipping
-		f, err := os.Open(path)
-		defer f.Close()
-		if err != nil {
-			return err
-		}
-
-		// copy file data into zip writer
-		if _, err := io.Copy(w, f); err != nil {
-			return err
-		}
-
-		return nil
-	}
-
-	// walk path
-	for _, src := range source {
-		err := filepath.Walk(src, walker)
-		if err != nil {
-			return fmt.Errorf("Error adding %s to zip file: %s", src, err.Error())
-		}
-	}
-	return nil
-}

+ 0 - 95
vendor/github.com/G-Node/libgin/libgin/crypto.go

@@ -1,95 +0,0 @@
-package libgin
-
-import (
-	"crypto/aes"
-	"crypto/cipher"
-	"crypto/rand"
-	"encoding/base64"
-	"io"
-)
-
-// Encrypt an array of bytes with AES.
-func Encrypt(key, plaintext []byte) ([]byte, error) {
-	block, err := aes.NewCipher(key)
-	if err != nil {
-		return nil, err
-	}
-
-	// The IV needs to be unique, but not secure. Therefore it's common to
-	// include it at the beginning of the ciphertext.
-	ciphertext := make([]byte, aes.BlockSize+len(plaintext))
-	iv := ciphertext[:aes.BlockSize]
-	if _, err := io.ReadFull(rand.Reader, iv); err != nil {
-		return nil, err
-	}
-
-	stream := cipher.NewCFBEncrypter(block, iv)
-	stream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext)
-	return ciphertext, nil
-}
-
-// EncryptURLString encrypts a string using AES and returns it in URL encoded base64.
-func EncryptURLString(key []byte, plaintext string) (string, error) {
-	cipherbytes, err := Encrypt(key, []byte(plaintext))
-	if err != nil {
-		return "", err
-	}
-	// convert to URL encoded base64
-	return base64.URLEncoding.EncodeToString(cipherbytes), nil
-}
-
-// EncryptString encrypts a string using AES and returns it in base64.
-func EncryptString(key []byte, plaintext string) (string, error) {
-	cipherbytes, err := Encrypt(key, []byte(plaintext))
-	if err != nil {
-		return "", err
-	}
-	// convert to (standard) encoded base64
-	return base64.StdEncoding.EncodeToString(cipherbytes), nil
-}
-
-// Decrypt an AES encrypted array of bytes.
-func Decrypt(key, ciphertext []byte) ([]byte, error) {
-	block, err := aes.NewCipher(key)
-	if err != nil {
-		return nil, err
-	}
-
-	// The IV needs to be unique, but not secure. Therefore it's common to
-	// include it at the beginning of the ciphertext.
-	if len(ciphertext) < aes.BlockSize {
-		return nil, err
-	}
-	iv := ciphertext[:aes.BlockSize]
-	ciphertext = ciphertext[aes.BlockSize:]
-
-	stream := cipher.NewCFBDecrypter(block, iv)
-
-	// XORKeyStream can work in-place if the two arguments are the same.
-	stream.XORKeyStream(ciphertext, ciphertext)
-
-	return ciphertext, nil
-}
-
-// DecryptURLString decrypts an AES encrypted URL encoded base64 string.
-func DecryptURLString(key []byte, encstring string) (string, error) {
-	ciphertext, err := base64.URLEncoding.DecodeString(encstring)
-	if err != nil {
-		return "", err
-	}
-	plainbytes, err := Decrypt(key, ciphertext)
-	if err != nil {
-		return "", err
-	}
-	return string(plainbytes), nil
-}
-
-// DecryptString decrypts an AES encrypted base64 string.
-func DecryptString(key []byte, encstring string) (string, error) {
-	ciphertext, _ := base64.StdEncoding.DecodeString(encstring)
-	plainbytes, err := Decrypt(key, ciphertext)
-	if err != nil {
-		return "", err
-	}
-	return string(plainbytes), nil
-}

+ 0 - 66
vendor/github.com/G-Node/libgin/libgin/dex.go

@@ -1,66 +0,0 @@
-package libgin
-
-import (
-	"time"
-
-	"github.com/G-Node/libgin/libgin/gig"
-)
-
-// NOTE: TEMPORARY COPY FROM gin-dex
-
-type SearchRequest struct {
-	Keywords string
-	SType    int
-	RepoIDs  []int64
-}
-
-const (
-	SEARCH_MATCH = iota
-	SEARCH_FUZZY
-	SEARCH_WILDCARD
-	SEARCH_QUERY
-	SEARCH_SUGGEST
-)
-
-type BlobSResult struct {
-	Source    *IndexBlob  `json:"_source"`
-	Score     float64     `json:"_score"`
-	Highlight interface{} `json:"highlight"`
-}
-
-type CommitSResult struct {
-	Source    *IndexCommit `json:"_source"`
-	Score     float64      `json:"_score"`
-	Highlight interface{}  `json:"highlight"`
-}
-
-type SearchResults struct {
-	Blobs   []BlobSResult
-	Commits []CommitSResult
-}
-
-type IndexBlob struct {
-	*gig.Blob
-	GinRepoName  string
-	GinRepoId    string
-	FirstCommit  string
-	Id           int64
-	Oid          gig.SHA1
-	IndexingTime time.Time
-	Content      string
-	Path         string
-}
-
-type IndexCommit struct {
-	*gig.Commit
-	GinRepoId    string
-	Oid          gig.SHA1
-	GinRepoName  string
-	IndexingTime time.Time
-}
-
-type IndexRequest struct {
-	UserID   int64
-	RepoID   int64
-	RepoPath string
-}

+ 0 - 173
vendor/github.com/G-Node/libgin/libgin/doi.go

@@ -1,173 +0,0 @@
-package libgin
-
-import (
-	"crypto/md5"
-	"encoding/hex"
-	"fmt"
-	"log"
-	"net/http"
-	"regexp"
-	"strings"
-	"time"
-)
-
-// NOTE: TEMPORARY COPIES FROM gin-doi
-
-// UUIDMap is a map between registered repositories and their UUIDs for
-// datasets registered before the new UUID generation method was implemented.
-// This map is required because the current method of computing UUIDs differs
-// from the older method and this lookup is used to handle the old-method
-// UUIDs.
-var UUIDMap = map[string]string{
-	"INT/multielectrode_grasp":                   "f83565d148510fede8a277f660e1a419",
-	"ajkumaraswamy/HB-PAC_disinhibitory_network": "1090f803258557299d287c4d44a541b2",
-	"steffi/Kleineidam_et_al_2017":               "f53069de4c4921a3cfa8f17d55ef98bb",
-	"Churan/Morris_et_al_Frontiers_2016":         "97bc1456d3f4bca2d945357b3ec92029",
-	"fabee/efish_locking":                        "6953bbf0087ba444b2d549b759de4a06",
-}
-
-// RepoPathToUUID computes a UUID from a repository path.
-func RepoPathToUUID(URI string) string {
-	if doi, ok := UUIDMap[URI]; ok {
-		return doi
-	}
-	currMd5 := md5.Sum([]byte(URI))
-	return hex.EncodeToString(currMd5[:])
-}
-
-// DOIRequestData is used to transmit data from GIN to DOI when a registration
-// request is triggered.
-type DOIRequestData struct {
-	Username   string
-	Realname   string
-	Repository string
-	Email      string
-}
-
-// DOIRegInfo holds all the metadata and information necessary for a DOI registration request.
-type DOIRegInfo struct {
-	Missing         []string
-	DOI             string
-	UUID            string
-	FileName        string
-	FileSize        string
-	Title           string
-	Authors         []Author
-	Description     string
-	Keywords        []string
-	References      []Reference
-	Funding         []string
-	License         *License
-	ResourceType    string
-	DateTime        time.Time
-	TemplateVersion string
-}
-
-func (c *DOIRegInfo) GetType() string {
-	if c.ResourceType != "" {
-		return c.ResourceType
-	}
-	return "Dataset"
-}
-
-func (c *DOIRegInfo) GetCitation() string {
-	var authors string
-	for _, auth := range c.Authors {
-		if len(auth.FirstName) > 0 {
-			authors += fmt.Sprintf("%s %s, ", auth.LastName, string(auth.FirstName[0]))
-		} else {
-			authors += fmt.Sprintf("%s, ", auth.LastName)
-		}
-	}
-	return fmt.Sprintf("%s (%s) %s. G-Node. doi:%s", authors, c.Year(), c.Title, c.DOI)
-}
-
-func (c *DOIRegInfo) Year() string {
-	return fmt.Sprintf("%d", c.DateTime.Year())
-}
-
-func (c *DOIRegInfo) ISODate() string {
-	return c.DateTime.Format("2006-01-02")
-}
-
-type Author struct {
-	FirstName   string
-	LastName    string
-	Affiliation string
-	ID          string
-}
-
-func (c *Author) GetValidID() *NamedIdentifier {
-	if c.ID == "" {
-		return nil
-	}
-	if strings.Contains(strings.ToLower(c.ID), "orcid") {
-		// assume the orcid id is a four block number thing eg. 0000-0002-5947-9939
-		var re = regexp.MustCompile(`(\d+-\d+-\d+-\d+)`)
-		nid := string(re.Find([]byte(c.ID)))
-		return &NamedIdentifier{URI: "https://orcid.org/", Scheme: "ORCID", ID: nid}
-	}
-	return nil
-}
-func (a *Author) RenderAuthor() string {
-	auth := fmt.Sprintf("%s,%s;%s;%s", a.LastName, a.FirstName, a.Affiliation, a.ID)
-	return strings.TrimRight(auth, ";")
-}
-
-type NamedIdentifier struct {
-	URI    string
-	Scheme string
-	ID     string
-}
-
-type Reference struct {
-	Reftype  string
-	Name     string
-	Citation string
-	ID       string
-}
-
-func (ref Reference) GetURL() string {
-	idparts := strings.SplitN(ref.ID, ":", 2)
-	if len(idparts) != 2 {
-		// Malformed ID (no colon)
-		return ""
-	}
-	source := idparts[0]
-	idnum := idparts[1]
-
-	var prefix string
-	switch strings.ToLower(source) {
-	case "doi":
-		prefix = "https://doi.org/"
-	case "arxiv":
-		// https://arxiv.org/help/arxiv_identifier_for_services
-		prefix = "https://arxiv.org/abs/"
-	case "pmid":
-		// https://www.ncbi.nlm.nih.gov/books/NBK3862/#linkshelp.Retrieve_PubMed_Citations
-		prefix = "https://www.ncbi.nlm.nih.gov/pubmed/"
-	default:
-		// Return an empty string to make the reflink inactive
-		return ""
-	}
-
-	return fmt.Sprintf("%s%s", prefix, idnum)
-}
-
-type License struct {
-	Name string
-	URL  string
-}
-
-func IsRegisteredDOI(doi string) bool {
-	url := fmt.Sprintf("https://doi.org/%s", doi)
-	resp, err := http.Get(url)
-	if err != nil {
-		log.Printf("Could not query for DOI: %s at %s", doi, url)
-		return false
-	}
-	if resp.StatusCode != http.StatusNotFound {
-		return true
-	}
-	return false
-}

+ 0 - 368
vendor/github.com/G-Node/libgin/libgin/gig/delta.go

@@ -1,368 +0,0 @@
-package gig
-
-import (
-	"bytes"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"os"
-)
-
-//Delta represents a git delta representation. Either BaseRef
-//or BaseOff are valid fields, depending on its Type().
-type Delta struct {
-	gitObject
-
-	BaseRef    SHA1
-	BaseOff    int64
-	SizeSource int64
-	SizeTarget int64
-
-	pf  *PackFile
-	op  DeltaOp
-	err error
-}
-
-func readByte(r io.Reader) (byte, error) {
-	var err error
-	n := 0
-	var b [1]byte
-
-	for n != 1 && err == nil {
-		n, err = r.Read(b[:])
-	}
-
-	if n != 1 {
-		return 0, err
-	}
-
-	return b[0], nil
-}
-
-func parseDelta(obj gitObject) (*Delta, error) {
-	delta := Delta{gitObject: obj}
-
-	//all delta objects come from a PackFile and
-	//therefore git.Source is must be a *packReader
-	source := delta.source.(*packReader)
-	delta.pf = source.fd
-
-	var err error
-	if obj.otype == ObjRefDelta {
-		_, err = source.Read(delta.BaseRef[:])
-		//TODO: check n?
-
-		if err != nil {
-			return nil, err
-		}
-
-	} else {
-		off, err := readVarint(source)
-		if err != nil {
-			return nil, err
-		}
-
-		delta.BaseOff = source.start - off
-	}
-
-	err = delta.wrapSourceWithDeflate()
-	if err != nil {
-		return nil, err
-	}
-
-	delta.SizeSource, err = readVarSize(delta.source, 0)
-	if err != nil {
-		return nil, err
-	}
-
-	delta.SizeTarget, err = readVarSize(delta.source, 0)
-	if err != nil {
-		return nil, err
-	}
-
-	return &delta, nil
-}
-
-func readVarSize(r io.Reader, offset uint) (size int64, err error) {
-	size = int64(0)
-	b := byte(0x80)
-
-	// [0111 1111 ... 1111] (int64) is biggest decode-able
-	// value we get by shifting byte b = 0x7F [0111 1111]
-	// left 8*7 = 56 times; the next attempt must overflow.
-	for i := offset; b&0x80 != 0 && i < 57; i += 7 {
-		b, err = readByte(r)
-		if err != nil {
-			return 0, fmt.Errorf("git: io error: %v", err)
-		}
-
-		size |= int64(b&0x7F) << i
-	}
-
-	// means i > 56, would overflow (see above).
-	if b&0x80 != 0 {
-		return 0, fmt.Errorf("int64 overflow")
-	}
-
-	return size, nil
-}
-
-func decodeInt(r io.Reader, b byte, l uint) (size int64, err error) {
-
-	for i := uint(0); i < l; i++ {
-
-		if b&(1<<i) != 0 {
-			var d byte
-			d, err = readByte(r)
-			if err != nil {
-				return
-			}
-
-			size |= int64(d) << (i * 8)
-		}
-	}
-
-	return
-}
-
-func readVarint(r io.Reader) (int64, error) {
-	b, err := readByte(r)
-	if err != nil {
-		return 0, fmt.Errorf("git: io error: %v", err)
-	}
-
-	size := int64(b & 0x7F)
-
-	for b&0x80 != 0 {
-		b, err = readByte(r)
-		if err != nil {
-			return 0, fmt.Errorf("git: io error: %v", err)
-		}
-
-		size++
-
-		// [0000 0001 ... 0000] (int64)
-		//          ^ bit 0x38 (56)
-		// shifting by 7 will shift the bit into the
-		// sign bit of int64, i.e. we have overflow.
-		if size > (1<<0x38)-1 {
-			return 0, fmt.Errorf("int64 overflow")
-		}
-
-		size = (size << 7) + int64(b&0x7F)
-	}
-
-	return size, nil
-}
-
-//DeltaOpCode is the operation code for delta compression
-//instruction set.
-type DeltaOpCode byte
-
-//DeltaOpCode values.
-const (
-	DeltaOpInsert = 1 //insert data from the delta data into dest
-	DeltaOpCopy   = 2 //copy data from the original source into dest
-)
-
-//DeltaOp represents the delta compression operation. Offset is
-//only valid for DeltaOpCopy operations.
-type DeltaOp struct {
-	Op     DeltaOpCode
-	Size   int64
-	Offset int64
-}
-
-//Op returns the current operations
-func (d *Delta) Op() DeltaOp {
-	return d.op
-}
-
-//Err retrieves the current error state, if any
-func (d *Delta) Err() error {
-	if err := d.err; err != io.EOF {
-		return err
-	}
-	return nil
-}
-
-//NextOp reads the next DeltaOp from the delta data stream.
-//Returns false when there are no operations left or on error;
-//use Err() to decide between the two cases.
-func (d *Delta) NextOp() bool {
-
-	if d.err != nil {
-		return false
-	}
-
-	b, err := readByte(d.source)
-	if err != nil {
-		return false
-	}
-
-	if b&0x80 != 0 {
-		d.op.Op = DeltaOpCopy
-		op := b & 0x7F
-		d.op.Offset, d.err = decodeInt(d.source, op, 4)
-		if d.err != nil {
-			return false
-		}
-
-		d.op.Size, d.err = decodeInt(d.source, op>>4, 3)
-		if d.err != nil {
-			return false
-		}
-
-		if d.op.Size == 0 {
-			d.op.Size = 0x10000
-		}
-	} else if n := b; n > 0 {
-		d.op.Op = DeltaOpInsert
-		d.op.Size = int64(n)
-	} else {
-		d.err = fmt.Errorf("git: unknown delta op code")
-		return false
-	}
-
-	return true
-}
-
-//Patch applies the delta data onto r and writes the result to w.
-func (d *Delta) Patch(r io.ReadSeeker, w io.Writer) error {
-
-	for d.NextOp() {
-		op := d.Op()
-		switch op.Op {
-		case DeltaOpCopy:
-			_, err := r.Seek(op.Offset, os.SEEK_SET)
-			if err != nil {
-				return err
-			}
-
-			_, err = io.CopyN(w, r, op.Size)
-			if err != nil {
-				return err
-			}
-		case DeltaOpInsert:
-			_, err := io.CopyN(w, d.source, op.Size)
-			if err != nil {
-				return err
-			}
-		}
-	}
-
-	return d.Err()
-}
-
-//SkipOp prepares the delta stream to move to the next operation
-//without actually carrying out the delta operation. Useful for
-//printing the delta stream.
-func (d *Delta) SkipOp() {
-	op := d.Op()
-	if op.Op == DeltaOpInsert {
-		_, d.err = io.CopyN(ioutil.Discard, d.source, op.Size)
-	}
-}
-
-//WriteTo would write the object to disk in the git object
-//representation. It is not NOT IMPLEMENTED for the delta
-//object.
-func (d *Delta) WriteTo(w io.Writer) (int64, error) {
-	return 0, fmt.Errorf("WriteTo not implemented for Delta")
-}
-
-type deltaChain struct {
-	baseObj gitObject
-	baseOff int64
-
-	links []Delta
-}
-
-func (c *deltaChain) Len() int {
-	return len(c.links)
-}
-
-type objectSource interface {
-	openRawObject(id SHA1) (gitObject, error)
-}
-
-func buildDeltaChain(d *Delta, s objectSource) (*deltaChain, error) {
-	var chain deltaChain
-	var err error
-
-	for err == nil {
-
-		chain.links = append(chain.links, *d)
-
-		var obj gitObject
-		if d.otype == ObjRefDelta {
-			obj, err = s.openRawObject(d.BaseRef)
-		} else {
-			obj, err = d.pf.readRawObject(d.BaseOff)
-		}
-
-		if err != nil {
-			break
-		}
-
-		if IsStandardObject(obj.otype) {
-			chain.baseObj = obj
-			chain.baseOff = d.BaseOff
-			break
-		} else if !IsDeltaObject(obj.otype) {
-			err = fmt.Errorf("git: unexpected object type in delta chain")
-			break
-		}
-
-		d, err = parseDelta(obj)
-	}
-
-	if err != nil {
-		//cleanup
-		return nil, err
-	}
-
-	return &chain, nil
-}
-
-func (c *deltaChain) resolve() (Object, error) {
-
-	ibuf := bytes.NewBuffer(make([]byte, 0, c.baseObj.Size()))
-	n, err := io.Copy(ibuf, c.baseObj.source)
-	if err != nil {
-		return nil, err
-	}
-
-	if n != c.baseObj.Size() {
-		return nil, io.ErrUnexpectedEOF
-	}
-
-	obuf := bytes.NewBuffer(make([]byte, 0, c.baseObj.Size()))
-
-	for i := len(c.links); i > 0; i-- {
-		lk := c.links[i-1]
-
-		if lk.SizeTarget > int64(^uint(0)>>1) {
-			return nil, fmt.Errorf("git: target to large for delta unpatching")
-		}
-
-		obuf.Grow(int(lk.SizeTarget))
-		obuf.Truncate(0)
-
-		err = lk.Patch(bytes.NewReader(ibuf.Bytes()), obuf)
-
-		if err != nil {
-			return nil, err
-		}
-
-		if lk.SizeTarget != int64(obuf.Len()) {
-			return nil, fmt.Errorf("git: size mismatch while patching delta object")
-		}
-
-		obuf, ibuf = ibuf, obuf
-	}
-
-	//ibuf is holding the data
-	obj := gitObject{c.baseObj.otype, int64(ibuf.Len()), ioutil.NopCloser(ibuf)}
-	return parseObject(obj)
-}

+ 0 - 233
vendor/github.com/G-Node/libgin/libgin/gig/objects.go

@@ -1,233 +0,0 @@
-package gig
-
-import (
-	"encoding/hex"
-	"fmt"
-	"io"
-	"os"
-	"strings"
-	"time"
-)
-
-//SHA1 is the object identifying checksum of
-// the object data
-type SHA1 [20]byte
-
-func (oid SHA1) String() string {
-	return hex.EncodeToString(oid[:])
-}
-
-//ParseSHA1 expects a string with a hex encoded sha1.
-//It will trim the string of newline and space before
-//parsing.
-func ParseSHA1(input string) (sha SHA1, err error) {
-	data, err := hex.DecodeString(strings.Trim(input, " \n"))
-	if err != nil {
-		return
-	} else if len(data) != 20 {
-		err = fmt.Errorf("git: sha1 must be 20 bytes")
-		return
-	}
-
-	copy(sha[:], data)
-	return
-}
-
-//Signature is a combination of who (Name, Email) and when (Date, Offset).
-//Used by Commit, Tag to link an action (committer, author, tagger, ...)
-//with a person in a point in time.
-type Signature struct {
-	Name   string
-	Email  string
-	Date   time.Time
-	Offset *time.Location
-}
-
-func (s Signature) String() string {
-	return fmt.Sprintf("%s <%s> %d %s", s.Name, s.Email, s.Date.Unix(), s.Offset)
-}
-
-//ObjectType is to the git object type
-type ObjectType byte
-
-//The defined bits match the ones used in
-//the git pack file format.
-const (
-	_         = iota
-	ObjCommit = ObjectType(iota)
-	ObjTree
-	ObjBlob
-	ObjTag
-
-	ObjOFSDelta = ObjectType(0x6)
-	ObjRefDelta = ObjectType(0x7)
-)
-
-//ParseObjectType takes a string and converts it
-//to the corresponding ObjectType or error if
-//the string doesn't match any type.
-func ParseObjectType(s string) (ObjectType, error) {
-	s = strings.Trim(s, "\n ")
-	switch s {
-	case "commit":
-		return ObjCommit, nil
-	case "tree":
-		return ObjTree, nil
-	case "blob":
-		return ObjBlob, nil
-	case "tag":
-		return ObjTag, nil
-	}
-
-	return ObjectType(0), fmt.Errorf("git: unknown object: %q", s)
-}
-
-func (ot ObjectType) String() string {
-	switch ot {
-	case ObjCommit:
-		return "commit"
-	case ObjTree:
-		return "tree"
-	case ObjBlob:
-		return "blob"
-	case ObjTag:
-		return "tag"
-	case ObjOFSDelta:
-		return "delta-ofs"
-	case ObjRefDelta:
-		return "delta-ref"
-	}
-	return "unknown"
-}
-
-//IsStandardObject checks if an object is
-//one of the four common objects such as
-//commit, tree, blob, tag.
-func IsStandardObject(ot ObjectType) bool {
-	return ot > 0 && ot < 5
-}
-
-//IsDeltaObject checks if an object is a
-//delta object, i.e. OFSDelta or RefDelta
-func IsDeltaObject(ot ObjectType) bool {
-	return ot == ObjOFSDelta || ot == ObjRefDelta
-}
-
-//Object represents a git object. It has
-//information common to all git objects,
-//like their type and their size. Also,
-//all git objects should be closed via
-//Close().
-type Object interface {
-	Type() ObjectType
-	Size() int64
-
-	io.WriterTo
-	io.Closer
-}
-
-type gitObject struct {
-	otype ObjectType
-	size  int64
-
-	source io.ReadCloser
-}
-
-func (o *gitObject) Type() ObjectType {
-	return o.otype
-}
-
-func (o *gitObject) Size() int64 {
-	return o.size
-}
-
-func (o *gitObject) Close() error {
-	if o.source == nil {
-		return nil
-	}
-	return o.source.Close()
-}
-
-//Commit represents one git commit.
-type Commit struct {
-	gitObject
-
-	Tree      SHA1
-	Parent    []SHA1
-	Author    Signature
-	Committer Signature
-	Message   string
-	GPGSig    string
-}
-
-//Date returns the commit timestamps (with the correct location).
-func (c *Commit) Date() time.Time {
-	return c.Committer.Date.In(c.Committer.Offset)
-}
-
-//Tree represents the git tree object.
-type Tree struct {
-	gitObject
-
-	entry *TreeEntry
-	err   error
-}
-
-//TreeEntry holds information about a single
-//entry in the git Tree object.
-type TreeEntry struct {
-	Mode os.FileMode
-	Type ObjectType
-	ID   SHA1
-	Name string
-}
-
-//Next advances the pointer to the next TreeEntry
-//within the Tree object. Returns false if it was
-//pointing to the last element (EOF condition), or
-//if there was an error while advacing. Use Err()
-//to resolve between the to conditions.
-func (tree *Tree) Next() bool {
-	tree.entry, tree.err = parseTreeEntry(tree.source)
-	return tree.err == nil
-}
-
-//Err returns the last error non-EOF error encountered.
-func (tree *Tree) Err() error {
-	if err := tree.err; err != nil && err != io.EOF {
-		return err
-	}
-
-	return nil
-}
-
-//Entry returns the current TreeEntry.
-func (tree *Tree) Entry() *TreeEntry {
-	return tree.entry
-}
-
-//Blob represents a git blob object.
-type Blob struct {
-	gitObject
-}
-
-func (b *Blob) Read(data []byte) (n int, err error) {
-	n, err = b.source.Read(data)
-	return
-}
-
-func MakeAnnexBlob(fp *os.File, size int64) *Blob {
-	return &Blob{gitObject{otype: ObjBlob, size: size, source: fp}}
-}
-
-//Tag represents a git tag object.
-type Tag struct {
-	gitObject
-
-	Object  SHA1
-	ObjType ObjectType
-	Tag     string
-	Tagger  Signature
-	Message string
-	GPGSig  string
-}

+ 0 - 382
vendor/github.com/G-Node/libgin/libgin/gig/pack.go

@@ -1,382 +0,0 @@
-package gig
-
-import (
-	"bytes"
-	"encoding/binary"
-	"fmt"
-	"os"
-	"strings"
-)
-
-// Resources:
-//  https://github.com/git/git/blob/master/Documentation/technical/pack-format.txt
-//  http://schacon.github.io/gitbook/7_the_packfile.html
-
-//PackHeader stores version and number of objects in the packfile
-// all data is in network-byte order (big-endian)
-type PackHeader struct {
-	Sig     [4]byte
-	Version uint32
-	Objects uint32
-}
-
-//FanOut table where the "N-th entry of this table records the
-// number of objects in the corresponding pack, the first
-// byte of whose object name is less than or equal to N.
-type FanOut [256]uint32
-
-//Bounds returns the how many objects whose first byte
-//has a value of b-1 (in s) and b (returned in e)
-//are contained in the fanout table
-func (fo FanOut) Bounds(b byte) (s, e int) {
-	e = int(fo[b])
-	if b > 0 {
-		s = int(fo[b-1])
-	}
-	return
-}
-
-//PackIndex represents the git pack file
-//index. It is the main object to use for
-//opening objects contained in packfiles
-//vai OpenObject
-type PackIndex struct {
-	*os.File
-
-	Version uint32
-	FO      FanOut
-
-	shaBase int64
-}
-
-//PackFile is git pack file with the actual
-//data in it. It should normally not be used
-//directly.
-type PackFile struct {
-	*os.File
-
-	Version  uint32
-	ObjCount uint32
-}
-
-//PackIndexOpen opens the git pack file with the given
-//path. The ".idx" if missing will be appended.
-func PackIndexOpen(path string) (*PackIndex, error) {
-
-	if !strings.HasSuffix(path, ".idx") {
-		path += ".idx"
-	}
-
-	fd, err := os.Open(path)
-
-	if err != nil {
-		return nil, fmt.Errorf("git: could not read pack index: %v", err)
-	}
-
-	idx := &PackIndex{File: fd, Version: 1}
-
-	var peek [4]byte
-	err = binary.Read(fd, binary.BigEndian, &peek)
-	if err != nil {
-		fd.Close()
-		return nil, fmt.Errorf("git: could not read pack index: %v", err)
-	}
-
-	if bytes.Equal(peek[:], []byte("\377tOc")) {
-		binary.Read(fd, binary.BigEndian, &idx.Version)
-	}
-
-	if idx.Version == 1 {
-		_, err = idx.Seek(0, 0)
-		if err != nil {
-			fd.Close()
-			return nil, fmt.Errorf("git: io error: %v", err)
-		}
-	} else if idx.Version > 2 {
-		fd.Close()
-		return nil, fmt.Errorf("git: unsupported pack index version: %d", idx.Version)
-	}
-
-	err = binary.Read(idx, binary.BigEndian, &idx.FO)
-	if err != nil {
-		idx.Close()
-		return nil, fmt.Errorf("git: io error: %v", err)
-	}
-
-	idx.shaBase = int64((idx.Version-1)*8) + int64(binary.Size(idx.FO))
-
-	return idx, nil
-}
-
-//ReadSHA1 reads the SHA1 stared at position pos (in the FanOut table).
-func (pi *PackIndex) ReadSHA1(chksum *SHA1, pos int) error {
-	if version := pi.Version; version != 2 {
-		return fmt.Errorf("git: v%d version support incomplete", version)
-	}
-
-	start := pi.shaBase
-	_, err := pi.ReadAt(chksum[0:20], start+int64(pos)*int64(20))
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-//ReadOffset returns the offset in the pack file of the object
-//at position pos in the FanOut table.
-func (pi *PackIndex) ReadOffset(pos int) (int64, error) {
-	if version := pi.Version; version != 2 {
-		return -1, fmt.Errorf("git: v%d version incomplete", version)
-	}
-
-	//header[2*4] + FanOut[256*4] + n * (sha1[20]+crc[4])
-	start := int64(2*4+256*4) + int64(pi.FO[255]*24) + int64(pos*4)
-
-	var offset uint32
-
-	_, err := pi.Seek(start, 0)
-	if err != nil {
-		return -1, fmt.Errorf("git: io error: %v", err)
-	}
-
-	err = binary.Read(pi, binary.BigEndian, &offset)
-	if err != nil {
-		return -1, err
-	}
-
-	//see if msb is set, if so this is an
-	// offset into the 64b_offset table
-	if val := uint32(1<<31) & offset; val != 0 {
-		return -1, fmt.Errorf("git: > 31 bit offests not implemented. Meh")
-	}
-
-	return int64(offset), nil
-}
-
-func (pi *PackIndex) findSHA1(target SHA1) (int, error) {
-
-	//s, e and midpoint are one-based indices,
-	//where s is the index before interval and
-	//e is the index of the last element in it
-	//-> search interval is: (s | 1, 2, ... e]
-	s, e := pi.FO.Bounds(target[0])
-
-	//invariant: object is, if present, in the interval, (s, e]
-	for s < e {
-		midpoint := s + (e-s+1)/2
-
-		var sha SHA1
-		err := pi.ReadSHA1(&sha, midpoint-1)
-		if err != nil {
-			return 0, fmt.Errorf("git: io error: %v", err)
-		}
-
-		switch bytes.Compare(target[:], sha[:]) {
-		case -1: // target < sha1, new interval (s, m-1]
-			e = midpoint - 1
-		case +1: //taget > sha1, new interval (m, e]
-			s = midpoint
-		default:
-			return midpoint - 1, nil
-		}
-	}
-
-	return 0, fmt.Errorf("git: sha1 not found in index")
-}
-
-//FindOffset tries to find  object with the id target and if
-//if found returns the offset of the object in the pack file.
-//Returns an error that can be detected by os.IsNotExist if
-//the object could not be found.
-func (pi *PackIndex) FindOffset(target SHA1) (int64, error) {
-
-	pos, err := pi.findSHA1(target)
-	if err != nil {
-		return 0, err
-	}
-
-	off, err := pi.ReadOffset(pos)
-	if err != nil {
-		return 0, err
-	}
-
-	return off, nil
-}
-
-//OpenPackFile opens the corresponding pack file.
-func (pi *PackIndex) OpenPackFile() (*PackFile, error) {
-	f := pi.Name()
-	pf, err := OpenPackFile(f[:len(f)-4] + ".pack")
-	if err != nil {
-		return nil, err
-	}
-
-	return pf, nil
-}
-
-//OpenObject will try to find the object with the given id
-//in it is index and then reach out to its corresponding
-//pack file to open the actual git Object.
-//If the object cannot be found it will return an error
-//the can be detected via os.IsNotExist()
-//Delta objects will returned as such and not be resolved.
-func (pi *PackIndex) OpenObject(id SHA1) (Object, error) {
-
-	off, err := pi.FindOffset(id)
-
-	if err != nil {
-		return nil, err
-	}
-
-	pf, err := pi.OpenPackFile()
-	if err != nil {
-		return nil, err
-	}
-
-	obj, err := pf.readRawObject(off)
-
-	if err != nil {
-		return nil, err
-	}
-
-	if IsStandardObject(obj.otype) {
-		return parseObject(obj)
-	}
-
-	if !IsDeltaObject(obj.otype) {
-		return nil, fmt.Errorf("git: unsupported object")
-	}
-
-	//This is a delta object
-	delta, err := parseDelta(obj)
-
-	return delta, err
-}
-
-//OpenPackFile opens the git pack file at the given path
-//It will check the pack file header and version.
-//Currently only version 2 is supported.
-//NB: This is low-level API and should most likely
-//not be used directly.
-func OpenPackFile(path string) (*PackFile, error) {
-	osfd, err := os.Open(path)
-
-	if err != nil {
-		return nil, err
-	}
-
-	var header PackHeader
-	err = binary.Read(osfd, binary.BigEndian, &header)
-	if err != nil {
-		return nil, fmt.Errorf("git: could not read header: %v", err)
-	}
-
-	if string(header.Sig[:]) != "PACK" {
-		return nil, fmt.Errorf("git: packfile signature error")
-	}
-
-	if header.Version != 2 {
-		return nil, fmt.Errorf("git: unsupported packfile version")
-	}
-
-	fd := &PackFile{File: osfd,
-		Version:          header.Version,
-		ObjCount:         header.Objects}
-
-	return fd, nil
-}
-
-func (pf *PackFile) readRawObject(offset int64) (gitObject, error) {
-	r := newPackReader(pf, offset)
-
-	b, err := r.ReadByte()
-	if err != nil {
-		return gitObject{}, fmt.Errorf("git: io error: %v", err)
-	}
-
-	//object header format:
-	//[mxxx tttt] (byte)
-	//      tttt -> type [4 bit]
-	otype := ObjectType((b & 0x70) >> 4)
-
-	//  xxx      -> size [3 bit]
-	size := int64(b & 0xF)
-
-	// m         -> 1, if size > 2^3 (n-byte encoding)
-	if b&0x80 != 0 {
-		s, err := readVarSize(r, 4)
-		if err != nil {
-			return gitObject{}, err
-		}
-
-		size += s
-	}
-	obj := gitObject{otype, size, r}
-
-	if IsStandardObject(otype) {
-		err = obj.wrapSourceWithDeflate()
-		if err != nil {
-			return gitObject{}, err
-		}
-	}
-
-	return obj, nil
-}
-
-//OpenObject reads the git object header at offset and
-//then parses the data as the corresponding object type.
-func (pf *PackFile) OpenObject(offset int64) (Object, error) {
-
-	obj, err := pf.readRawObject(offset)
-
-	if err != nil {
-		return nil, err
-	}
-
-	switch obj.otype {
-	case ObjCommit:
-		return parseCommit(obj)
-	case ObjTree:
-		return parseTree(obj)
-	case ObjBlob:
-		return parseBlob(obj)
-	case ObjTag:
-		return parseTag(obj)
-
-	case ObjOFSDelta:
-		fallthrough
-	case ObjRefDelta:
-		return parseDelta(obj)
-
-	default:
-		return nil, fmt.Errorf("git: unknown object type")
-	}
-}
-
-type packReader struct {
-	fd    *PackFile
-	start int64
-	off   int64
-}
-
-func newPackReader(fd *PackFile, offset int64) *packReader {
-	return &packReader{fd: fd, start: offset, off: offset}
-}
-
-func (p *packReader) Read(d []byte) (n int, err error) {
-	n, err = p.fd.ReadAt(d, p.off)
-	p.off += int64(n)
-	return
-}
-
-func (p *packReader) ReadByte() (c byte, err error) {
-	var b [1]byte
-	_, err = p.Read(b[:])
-	c = b[0]
-	return
-}
-
-func (p *packReader) Close() (err error) {
-	return //noop
-}

+ 0 - 315
vendor/github.com/G-Node/libgin/libgin/gig/parse.go

@@ -1,315 +0,0 @@
-package gig
-
-import (
-	"bufio"
-	"bytes"
-	"compress/zlib"
-	"fmt"
-	"io"
-	"io/ioutil"
-
-	"os"
-	"strconv"
-	"strings"
-	"time"
-)
-
-func parseSignature(line string) (Signature, error) {
-	//Format: "<name> <email> <unix timestamp> <time zone offset>"
-	//i.e. "A U Thor <author@example.com> 1462210432 +0200"
-
-	u := Signature{}
-
-	//<name>
-	start := strings.Index(line, " <")
-	if start == -1 {
-		return u, fmt.Errorf("invalid signature format")
-	}
-	u.Name = line[:start]
-
-	//<email>
-	end := strings.Index(line, "> ")
-	if end == -1 {
-		return u, fmt.Errorf("invalid signature format")
-	}
-	u.Email = line[start+2: end]
-
-	//<unix timestamp>
-	tstr, off := split2(line[end+2:], " ")
-	i, err := strconv.ParseInt(tstr, 10, 64)
-
-	if err != nil || len(off) != 5 {
-		return u, fmt.Errorf("invalid signature time format")
-	}
-	u.Date = time.Unix(i, 0)
-
-	//<time zone offset>
-	h, herr := strconv.Atoi(off[1:3])
-	m, merr := strconv.Atoi(off[3:])
-
-	if herr != nil || merr != nil {
-		return u, fmt.Errorf("invalid signature offset format")
-	}
-
-	o := (h*60 + m) * 60
-
-	if off[0] == '-' {
-		o *= -1
-	}
-
-	u.Offset = time.FixedZone(off, o)
-
-	return u, nil
-}
-
-func parseCommitGPGSig(r *bufio.Reader, w *bytes.Buffer) error {
-	for {
-		l, err := r.ReadString('\n')
-		if err != nil {
-			return nil
-		} else if l[0] == ' ' {
-			_, err = w.WriteString(fmt.Sprintf("\n%s", strings.Trim(l, " \n")))
-			if err != nil {
-				return err
-			}
-			continue
-		} else if l[0] == '\n' {
-			return r.UnreadByte()
-		}
-
-		return fmt.Errorf("Unexpected end of gpg signature")
-	}
-}
-
-func parseTagGPGSig(r *bufio.Reader, w *bytes.Buffer) error {
-	//!Tag signatures do not have trailing whitespaces
-	for {
-		l, err := r.ReadString('\n')
-		if err != nil {
-			return nil
-		}
-		_, err = w.WriteString(fmt.Sprintf("\n%s", strings.Trim(l, " \n")))
-		if err != nil {
-			return err
-		}
-		if !strings.Contains(l, "-----END PGP SIGNATURE-----") {
-			continue
-		} else {
-			return nil
-		}
-	}
-}
-
-func openRawObject(path string) (gitObject, error) {
-	fd, err := os.Open(path)
-	if err != nil {
-		return gitObject{}, err
-	}
-
-	// we wrap the zlib reader below, so it will be
-	// propery closed
-	r, err := zlib.NewReader(fd)
-	if err != nil {
-		return gitObject{}, fmt.Errorf("git: could not create zlib reader: %v", err)
-	}
-
-	// general object format is
-	// [type][space][length {ASCII}][\0]
-
-	line, err := readUntilNul(r)
-	if err != nil {
-		return gitObject{}, err
-	}
-
-	tstr, lstr := split2(line, " ")
-	size, err := strconv.ParseInt(lstr, 10, 64)
-
-	if err != nil {
-		return gitObject{}, fmt.Errorf("git: object parse error: %v", err)
-	}
-
-	otype, err := ParseObjectType(tstr)
-	if err != nil {
-		return gitObject{}, err
-	}
-
-	obj := gitObject{otype, size, r}
-	obj.wrapSource(r)
-
-	return obj, nil
-}
-
-func parseObject(obj gitObject) (Object, error) {
-	switch obj.otype {
-	case ObjCommit:
-		return parseCommit(obj)
-
-	case ObjTree:
-		return parseTree(obj)
-
-	case ObjBlob:
-		return parseBlob(obj)
-
-	case ObjTag:
-		return parseTag(obj)
-	}
-
-	obj.Close()
-	return nil, fmt.Errorf("git: unsupported object")
-}
-
-func parseCommit(obj gitObject) (*Commit, error) {
-	c := &Commit{gitObject: obj}
-
-	lr := &io.LimitedReader{R: obj.source, N: obj.size}
-	br := bufio.NewReader(lr)
-
-	var err error
-	for {
-		var l string
-		l, err = br.ReadString('\n')
-		head, tail := split2(l, " ")
-
-		switch head {
-		case "tree":
-			c.Tree, err = ParseSHA1(tail)
-		case "parent":
-			parent, err := ParseSHA1(tail)
-			if err == nil {
-				c.Parent = append(c.Parent, parent)
-			}
-		case "author":
-			c.Author, err = parseSignature(strings.Trim(tail, "\n"))
-		case "committer":
-			c.Committer, err = parseSignature(strings.Trim(tail, "\n"))
-		case "gpgsig":
-			sw := bytes.NewBufferString(strings.Trim(tail, "\n"))
-			err = parseCommitGPGSig(br, sw)
-			c.GPGSig = sw.String()
-		}
-
-		if err != nil || head == "\n" {
-			break
-		}
-	}
-
-	if err != nil && err != io.EOF {
-		return nil, err
-	}
-
-	data, err := ioutil.ReadAll(br)
-
-	if err != nil {
-		return nil, err
-	}
-
-	c.Message = string(data)
-	return c, nil
-}
-
-func parseTree(obj gitObject) (*Tree, error) {
-	tree := Tree{obj, nil, nil}
-	return &tree, nil
-}
-
-func parseTreeEntry(r io.Reader) (*TreeEntry, error) {
-	//format is: [mode{ASCII, octal}][space][name][\0][SHA1]
-	entry := &TreeEntry{}
-
-	l, err := readUntilNul(r) // read until \0
-
-	if err != nil {
-		return nil, err
-	}
-
-	mstr, name := split2(l, " ")
-	mode, err := strconv.ParseUint(mstr, 8, 32)
-	if err != nil {
-		return nil, err
-	}
-
-	//TODO: this is not correct because
-	// we need to shift the "st_mode" file
-	// info bits by 16
-	entry.Mode = os.FileMode(mode)
-
-	if entry.Mode == 040000 {
-		entry.Type = ObjTree
-	} else {
-		entry.Type = ObjBlob
-	}
-
-	entry.Name = name
-
-	n, err := r.Read(entry.ID[:])
-
-	if err != nil && err != io.EOF {
-		return nil, err
-	} else if err == io.EOF && n != 20 {
-		return nil, fmt.Errorf("git: unexpected EOF")
-	}
-
-	return entry, nil
-}
-
-func parseBlob(obj gitObject) (*Blob, error) {
-	blob := &Blob{obj}
-	return blob, nil
-}
-
-func parseTag(obj gitObject) (*Tag, error) {
-	c := &Tag{gitObject: obj}
-
-	lr := &io.LimitedReader{R: c.source, N: c.size}
-	br := bufio.NewReader(lr)
-	var mess bytes.Buffer
-
-	var err error
-	for {
-		var l string
-		l, err = br.ReadString('\n')
-		head, tail := split2(l, " ")
-
-		switch head {
-		case "object":
-			c.Object, err = ParseSHA1(tail)
-		case "type":
-			c.ObjType, err = ParseObjectType(tail)
-		case "tag":
-			c.Tag = strings.Trim(tail, "\n")
-		case "tagger":
-			c.Tagger, err = parseSignature(strings.Trim(tail, "\n"))
-		case "-----BEGIN":
-			//with signed tags (in difference to signed commits) the
-			// signatures do not start with "gpgsig" but just with
-			//"-----BEGIN PGP SIGNATURE-----"
-			//(tbd)
-			sw := bytes.NewBufferString(strings.Trim(
-				fmt.Sprintf("%s %s", head, tail),
-				"\n"))
-			err = parseTagGPGSig(br, sw)
-			c.GPGSig = sw.String()
-		default:
-			//Capture descriptions for tags here.The old way works for unsigned
-			//tags but not for signed ones.
-			// Be Aware! The message comes before the gpg signature
-			// not after as with commits
-			mess.WriteString(l)
-		}
-
-		if err != nil {
-			//For tags gpg signatures can come after the tag description
-			// which might start and also contain a single newline.
-			// therefore the ||head=="\n" part
-			// has been removed. i guess this wont break anything as err will
-			// eventually become EOF for tags and hence the loop will break
-			// (tbd)
-			break
-		}
-	}
-	if err != nil && err != io.EOF {
-		return nil, err
-	}
-	c.Message = mess.String()[1:]
-	return c, nil
-}

+ 0 - 246
vendor/github.com/G-Node/libgin/libgin/gig/refs.go

@@ -1,246 +0,0 @@
-package gig
-
-import (
-	"bufio"
-	"bytes"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"os"
-	"os/exec"
-	"path"
-	"path/filepath"
-	"strings"
-)
-
-type Ref interface {
-	Repo() *Repository
-	Name() string
-	Fullname() string
-	Namespace() string
-	Resolve() (SHA1, error)
-}
-
-type ref struct {
-	repo *Repository
-	name string
-	ns   string // #special, #branch, or the name like 'remote', 'tags'
-}
-
-func (r *ref) Name() string {
-	return r.name
-}
-
-func (r *ref) Fullname() string {
-	fullname := r.name
-	if !strings.HasPrefix(r.ns, "#") {
-		fullname = path.Join(r.ns, r.name)
-	}
-	return fullname
-}
-
-func (r *ref) Repo() *Repository {
-	return r.repo
-}
-
-func (r *ref) Namespace() string {
-	return r.ns
-}
-
-func IsBranchRef(r Ref) bool {
-	return r.Namespace() == "#branch"
-}
-
-//IDRef is a reference that points via
-//a sha1 directly to a git object
-type IDRef struct {
-	ref
-	id SHA1
-}
-
-//Resolve for IDRef returns the stored object
-//id (SHA1)
-func (r *IDRef) Resolve() (SHA1, error) {
-	return r.id, nil
-}
-
-//SymbolicRef is a reference that points
-//to another reference
-type SymbolicRef struct {
-	ref
-	Symbol string
-}
-
-//Resolve will resolve the symbolic reference into
-//an object id.
-func (r *SymbolicRef) Resolve() (SHA1, error) {
-	gdir := fmt.Sprintf("--git-dir=%s", r.repo.Path)
-
-	cmd := exec.Command("git", gdir, "rev-parse", r.Fullname())
-	body, err := cmd.Output()
-
-	if err != nil {
-		var id SHA1
-		return id, err
-	}
-
-	return ParseSHA1(string(body))
-}
-
-func parseRefName(filename string) (name, ns string, err error) {
-	comps := strings.Split(filename, "/")
-	n := len(comps)
-
-	if n < 1 || n == 2 || (n > 2 && comps[0] != "refs") {
-		err = fmt.Errorf("git: unexpected ref name: %v", filename)
-		return
-	}
-
-	if n == 1 {
-		name = comps[0]
-		ns = "#special"
-	}
-
-	// 'man gitrepository-layout' is really helpfull
-	// 'man git-check-ref-format' too
-	// [HEAD|ORIG_HEAD] -> special head
-	// [0|refs][1|<ns>][2+|name]
-	// <ns> == "heads" -> local branch"
-	switch {
-	case n == 1:
-		name = comps[0]
-		ns = "#special"
-	case comps[1] == "heads":
-		name = path.Join(comps[2:]...)
-		ns = "#branch"
-	default:
-		name = path.Join(comps[2:]...)
-		ns = comps[1]
-	}
-	return
-}
-
-func (repo *Repository) parseRef(filename string) (Ref, error) {
-
-	name, ns, err := parseRefName(filename)
-	if err != nil {
-		return nil, err
-	}
-
-	base := ref{repo, name, ns}
-
-	//now to the actual contents of the ref
-	data, err := ioutil.ReadFile(filepath.Join(repo.Path, filename))
-	if err != nil {
-		if os.IsNotExist(err) {
-			return repo.findPackedRef(base.Fullname())
-		}
-		return nil, err
-	}
-
-	b := string(data)
-	if strings.HasPrefix(b, "ref:") {
-		trimmed := strings.Trim(b[4:], " \n")
-		return &SymbolicRef{base, trimmed}, nil
-	}
-
-	id, err := ParseSHA1(b)
-	if err == nil {
-		return &IDRef{base, id}, nil
-	}
-
-	return nil, fmt.Errorf("git: unknown ref type: %q", b)
-}
-
-func (repo *Repository) listRefWithName(name string) (res []Ref) {
-	gdir := fmt.Sprintf("--git-dir=%s", repo.Path)
-	cmd := exec.Command("git", gdir, "show-ref", name)
-	body, err := cmd.Output()
-
-	if err != nil {
-		return
-	}
-
-	r := bytes.NewBuffer(body)
-
-	for {
-		var l string
-		l, err = r.ReadString('\n')
-		if err != nil {
-			break
-		}
-
-		_, name := split2(l[:len(l)-1], " ")
-		r, err := repo.parseRef(name)
-
-		if err != nil {
-			fmt.Fprintf(os.Stderr, "git: could not parse ref with name %q: %v", name, err)
-			continue
-		}
-
-		res = append(res, r)
-	}
-
-	return
-}
-
-func (repo *Repository) loadPackedRefs() ([]Ref, error) {
-
-	fd, err := os.Open(filepath.Join(repo.Path, "packed-refs"))
-	if err != nil {
-		return nil, err
-	}
-	defer fd.Close()
-
-	r := bufio.NewReader(fd)
-
-	var refs []Ref
-	for {
-		var l string
-		l, err = r.ReadString('\n')
-		if err != nil {
-			break
-		}
-
-		head, tail := split2(l, " ")
-		if tail == "" {
-			//probably a peeled id (i.e. "^SHA1")
-			//TODO: do something with it
-			continue
-		}
-
-		name, ns, err := parseRefName(tail[:len(tail)-1])
-		if err != nil {
-			//TODO: log error, panic?
-			continue
-		}
-
-		id, err := ParseSHA1(head)
-		if err != nil {
-			//TODO: same as above
-			continue
-		}
-
-		refs = append(refs, &IDRef{ref{repo, name, ns}, id})
-	}
-
-	if err != nil && err != io.EOF {
-		return nil, err
-	}
-
-	return refs, nil
-}
-
-func (repo *Repository) findPackedRef(name string) (Ref, error) {
-	refs, err := repo.loadPackedRefs()
-	if err != nil {
-		return nil, err
-	}
-
-	for _, ref := range refs {
-		if ref.Fullname() == name {
-			return ref, nil
-		}
-	}
-	return nil, fmt.Errorf("ref with name %q not found", name)
-}

+ 0 - 463
vendor/github.com/G-Node/libgin/libgin/gig/repo.go

@@ -1,463 +0,0 @@
-package gig
-
-import (
-	"bufio"
-	"bytes"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"os"
-	"os/exec"
-	"path"
-	"path/filepath"
-	"strings"
-)
-
-//Repository represents an on disk git repository.
-type Repository struct {
-	Path string
-}
-
-//InitBareRepository creates a bare git repository at path.
-func InitBareRepository(path string) (*Repository, error) {
-
-	path, err := filepath.Abs(path)
-	if err != nil {
-		return nil, fmt.Errorf("Could not determine absolute path: %v", err)
-	}
-
-	cmd := exec.Command("git", "init", "--bare", path)
-	err = cmd.Run()
-
-	if err != nil {
-		return nil, err
-	}
-
-	return &Repository{Path: path}, nil
-}
-
-//IsBareRepository checks if path is a bare git repository.
-func IsBareRepository(path string) bool {
-
-	cmd := exec.Command("git", fmt.Sprintf("--git-dir=%s", path), "rev-parse", "--is-bare-repository")
-	body, err := cmd.Output()
-
-	if err != nil {
-		return false
-	}
-
-	status := strings.Trim(string(body), "\n ")
-	return status == "true"
-}
-
-//OpenRepository opens the repository at path. Currently
-//verifies that it is a (bare) repository and returns an
-//error if the check fails.
-func OpenRepository(path string) (*Repository, error) {
-
-	path, err := filepath.Abs(path)
-	if err != nil {
-		return nil, fmt.Errorf("git: could not determine absolute path")
-	}
-
-	if !IsBareRepository(path) {
-		return nil, fmt.Errorf("git: not a bare repository")
-	}
-
-	return &Repository{Path: path}, nil
-}
-
-//DiscoverRepository returns the git repository that contains the
-//current working directory, or and error if the current working
-//dir does not lie inside one.
-func DiscoverRepository() (*Repository, error) {
-	cmd := exec.Command("git", "rev-parse", "--git-dir")
-	data, err := cmd.Output()
-	if err != nil {
-		return nil, err
-	}
-
-	path := strings.Trim(string(data), "\n ")
-	return &Repository{Path: path}, nil
-}
-
-//ReadDescription returns the contents of the description file.
-func (repo *Repository) ReadDescription() string {
-	path := filepath.Join(repo.Path, "description")
-
-	dat, err := ioutil.ReadFile(path)
-	if err != nil {
-		return ""
-	}
-
-	return string(dat)
-}
-
-//WriteDescription writes the contents of the description file.
-func (repo *Repository) WriteDescription(description string) error {
-	path := filepath.Join(repo.Path, "description")
-
-	// not atomic, fine for now
-	return ioutil.WriteFile(path, []byte(description), 0666)
-}
-
-// DeleteCollaborator removes a collaborator file from the repositories sharing folder.
-func (repo *Repository) DeleteCollaborator(username string) error {
-	filePath := filepath.Join(repo.Path, "gin", "sharing", username)
-
-	return os.Remove(filePath)
-}
-
-//OpenObject returns the git object for a give id (SHA1).
-func (repo *Repository) OpenObject(id SHA1) (Object, error) {
-	obj, err := repo.openRawObject(id)
-
-	if err != nil {
-		return nil, err
-	}
-
-	if IsStandardObject(obj.otype) {
-		return parseObject(obj)
-	}
-
-	//not a standard object, *must* be a delta object,
-	// we know of no other types
-	if !IsDeltaObject(obj.otype) {
-		return nil, fmt.Errorf("git: unsupported object")
-	}
-
-	delta, err := parseDelta(obj)
-	if err != nil {
-		return nil, err
-	}
-
-	chain, err := buildDeltaChain(delta, repo)
-
-	if err != nil {
-		return nil, err
-	}
-
-	//TODO: check depth, and especially expected memory usage
-	// beofre actually patching it
-
-	return chain.resolve()
-}
-
-func (repo *Repository) openRawObject(id SHA1) (gitObject, error) {
-	idstr := id.String()
-	opath := filepath.Join(repo.Path, "objects", idstr[:2], idstr[2:])
-
-	obj, err := openRawObject(opath)
-
-	if err == nil {
-		return obj, nil
-	} else if err != nil && !os.IsNotExist(err) {
-		return obj, err
-	}
-
-	indicies := repo.loadPackIndices()
-
-	for _, f := range indicies {
-
-		idx, err := PackIndexOpen(f)
-		if err != nil {
-			continue
-		}
-
-		//TODO: we should leave index files open,
-		defer idx.Close()
-
-		off, err := idx.FindOffset(id)
-
-		if err != nil {
-			continue
-		}
-
-		pf, err := idx.OpenPackFile()
-		if err != nil {
-			return gitObject{}, err
-		}
-
-		obj, err := pf.readRawObject(off)
-
-		if err != nil {
-			return gitObject{}, err
-		}
-
-		return obj, nil
-	}
-
-	// from inspecting the os.isNotExist source it
-	// seems that if we have "not found" in the message
-	// os.IsNotExist() report true, which is what we want
-	return gitObject{}, fmt.Errorf("git: object not found")
-}
-
-func (repo *Repository) loadPackIndices() []string {
-	target := filepath.Join(repo.Path, "objects", "pack", "*.idx")
-	files, err := filepath.Glob(target)
-
-	if err != nil {
-		panic(err)
-	}
-
-	return files
-}
-
-//OpenRef returns the Ref with the given name or an error
-//if either no maching could be found or in case the match
-//was not unique.
-func (repo *Repository) OpenRef(name string) (Ref, error) {
-
-	if name == "HEAD" {
-		return repo.parseRef("HEAD")
-	}
-
-	matches := repo.listRefWithName(name)
-
-	//first search in local heads
-	var locals []Ref
-	for _, v := range matches {
-		if IsBranchRef(v) {
-			if name == v.Fullname() {
-				return v, nil
-			}
-			locals = append(locals, v)
-		}
-	}
-
-	// if we find a single local match
-	// we return it directly
-	if len(locals) == 1 {
-		return locals[0], nil
-	}
-
-	switch len(matches) {
-	case 0:
-		return nil, fmt.Errorf("git: ref matching %q not found", name)
-	case 1:
-		return matches[0], nil
-	}
-	return nil, fmt.Errorf("git: ambiguous ref name, multiple matches")
-}
-
-//Readlink returns the destination of a symbilc link blob object
-func (repo *Repository) Readlink(id SHA1) (string, error) {
-
-	b, err := repo.OpenObject(id)
-	if err != nil {
-		return "", err
-	}
-
-	if b.Type() != ObjBlob {
-		return "", fmt.Errorf("id must point to a blob")
-	}
-
-	blob := b.(*Blob)
-
-	//TODO: check size and don't read unreasonable large blobs
-	data, err := ioutil.ReadAll(blob)
-
-	if err != nil {
-		return "", err
-	}
-
-	return string(data), nil
-}
-
-//ObjectForPath will resolve the path to an object
-//for the file tree starting in the node root.
-//The root object can be either a Commit, Tree or Tag.
-func (repo *Repository) ObjectForPath(root Object, pathstr string) (Object, error) {
-
-	var node Object
-	var err error
-
-	switch o := root.(type) {
-	case *Tree:
-		node = root
-	case *Commit:
-		node, err = repo.OpenObject(o.Tree)
-	case *Tag:
-		node, err = repo.OpenObject(o.Object)
-	default:
-		return nil, fmt.Errorf("unsupported root object type")
-	}
-
-	if err != nil {
-		return nil, fmt.Errorf("could not root tree object: %v", err)
-	}
-
-	cleaned := path.Clean(strings.Trim(pathstr, " /"))
-	comps := strings.Split(cleaned, "/")
-
-	var i int
-	for i = 0; i < len(comps); i++ {
-
-		tree, ok := node.(*Tree)
-		if !ok {
-			cwd := strings.Join(comps[:i+1], "/")
-			err := &os.PathError{
-				Op:   "convert git.Object to git.Tree",
-				Path: cwd,
-				Err:  fmt.Errorf("expected tree object, got %s", node.Type()),
-			}
-			return nil, err
-		}
-
-		//Since we call path.Clean(), this should really
-		//only happen at the root, but it is safe to
-		//have here anyway
-		if comps[i] == "." || comps[i] == "/" {
-			continue
-		}
-
-		var id *SHA1
-		for tree.Next() {
-			entry := tree.Entry()
-			if entry.Name == comps[i] {
-				id = &entry.ID
-				break
-			}
-		}
-
-		if err = tree.Err(); err != nil {
-			cwd := strings.Join(comps[:i+1], "/")
-			return nil, &os.PathError{
-				Op:   "find object",
-				Path: cwd,
-				Err:  err}
-		} else if id == nil {
-			cwd := strings.Join(comps[:i+1], "/")
-			return nil, &os.PathError{
-				Op:   "find object",
-				Path: cwd,
-				Err:  os.ErrNotExist}
-		}
-
-		node, err = repo.OpenObject(*id)
-		if err != nil {
-			cwd := strings.Join(comps[:i+1], "/")
-			return nil, &os.PathError{
-				Op:   "open object",
-				Path: cwd,
-				Err:  err,
-			}
-		}
-	}
-
-	return node, nil
-}
-
-// usefmt is the option string used by CommitsForRef to return a formatted git commit log.
-const usefmt = `--pretty=format:
-Commit:=%H%n
-Committer:=%cn%n
-Author:=%an%n
-Date-iso:=%ai%n
-Date-rel:=%ar%n
-Subject:=%s%n
-Changes:=`
-
-// CommitSummary represents a subset of information from a git commit.
-type CommitSummary struct {
-	Commit       string
-	Committer    string
-	Author       string
-	DateIso      string
-	DateRelative string
-	Subject      string
-	Changes      []string
-}
-
-// CommitsForRef executes a custom git log command for the specified ref of the
-// associated git repository and returns the resulting byte array.
-func (repo *Repository) CommitsForRef(ref string) ([]CommitSummary, error) {
-
-	raw, err := commitsForRef(repo.Path, ref, usefmt)
-	if err != nil {
-		return nil, err
-	}
-
-	sep := ":="
-	var comList []CommitSummary
-	r := bytes.NewReader(raw)
-	br := bufio.NewReader(r)
-
-	var changesFlag bool
-	for {
-		// Consume line until newline character
-		l, err := br.ReadString('\n')
-
-		if strings.Contains(l, sep) {
-			splitList := strings.SplitN(l, sep, 2)
-
-			key := splitList[0]
-			val := splitList[1]
-			switch key {
-			case "Commit":
-				// reset non key line flags
-				changesFlag = false
-				newCommit := CommitSummary{Commit: val}
-				comList = append(comList, newCommit)
-			case "Committer":
-				comList[len(comList)-1].Committer = val
-			case "Author":
-				comList[len(comList)-1].Author = val
-			case "Date-iso":
-				comList[len(comList)-1].DateIso = val
-			case "Date-rel":
-				comList[len(comList)-1].DateRelative = val
-			case "Subject":
-				comList[len(comList)-1].Subject = val
-			case "Changes":
-				// Setting changes flag so we know, that the next lines are probably file change notification lines.
-				changesFlag = true
-			default:
-				fmt.Printf("[W] commits: unexpected key %q, value %q\n", key, strings.Trim(val, "\n"))
-			}
-		} else if changesFlag && strings.Contains(l, "\t") {
-			comList[len(comList)-1].Changes = append(comList[len(comList)-1].Changes, l)
-		}
-
-		// Breaks at the latest when EOF err is raised
-		if err != nil {
-			break
-		}
-	}
-	if err != io.EOF && err != nil {
-		return nil, err
-	}
-
-	return comList, nil
-}
-
-// commitsForRef executes a custom git log command for the specified ref of the
-// given git repository with the specified log format string and returns the resulting byte array.
-// Function is kept private to force handling of the []byte inside the package.
-func commitsForRef(repoPath, ref, usefmt string) ([]byte, error) {
-	gdir := fmt.Sprintf("--git-dir=%s", repoPath)
-
-	cmd := exec.Command("git", gdir, "log", ref, usefmt, "--name-status")
-	body, err := cmd.Output()
-	if err != nil {
-		return nil, fmt.Errorf("failed running git log: %s\n", err.Error())
-	}
-	return body, nil
-}
-
-// BranchExists runs the "git branch <branchname> --list" command.
-// It will return an error, if the command fails, true, if the result is not empty and false otherwise.
-func (repo *Repository) BranchExists(branch string) (bool, error) {
-	gdir := fmt.Sprintf("--git-dir=%s", repo.Path)
-
-	cmd := exec.Command("git", gdir, "branch", branch, "--list")
-	body, err := cmd.Output()
-	if err != nil {
-		return false, err
-	} else if len(body) == 0 {
-		return false, nil
-	}
-
-	return true, nil
-}

+ 0 - 71
vendor/github.com/G-Node/libgin/libgin/gig/util.go

@@ -1,71 +0,0 @@
-package gig
-
-import (
-	"io"
-	"bytes"
-	"strings"
-	"compress/zlib"
-)
-
-func readUntilNul(r io.Reader) (string, error) {
-	buf := bytes.NewBuffer(make([]byte, 0))
-	for {
-		var b [1]byte
-		_, err := r.Read(b[:])
-		if err != nil {
-			return "", err
-		} else if b[0] == 0 {
-			break
-		}
-		buf.WriteByte(b[0])
-	}
-
-	return buf.String(), nil
-}
-
-func split2(s, sep string) (head, tail string) {
-	comps := strings.SplitN(s, sep, 2)
-	head = comps[0]
-	if len(comps) > 1 {
-		tail = comps[1]
-	}
-	return
-}
-
-type zlibReadCloser struct {
-	io.LimitedReader     //R of io.LimitedReader is the zlib reader
-	source io.ReadCloser //the underlying source
-}
-
-func (r *zlibReadCloser) Close() error {
-	var e1, e2 error
-
-	// this shouldn't fail ever actually, since the wrapped
-	//  object should have been an io.ReadCloser
-	if rc, ok := r.LimitedReader.R.(io.Closer); ok {
-		e1 = rc.Close()
-	}
-
-	e2 = r.source.Close()
-
-	if e1 == nil && e2 == nil {
-		return nil
-	} else if e2 != nil {
-		return e2
-	}
-	return e1
-}
-
-func (o *gitObject) wrapSourceWithDeflate() error {
-	r, err := zlib.NewReader(o.source)
-	if err != nil {
-		return err
-	}
-
-	o.source = &zlibReadCloser{io.LimitedReader{R: r, N: o.size}, o.source}
-	return nil
-}
-
-func (o *gitObject) wrapSource(rc io.ReadCloser) {
-	o.source = &zlibReadCloser{io.LimitedReader{R: rc, N: o.size}, o.source}
-}

+ 0 - 80
vendor/github.com/G-Node/libgin/libgin/gig/walk.go

@@ -1,80 +0,0 @@
-package gig
-
-import "fmt"
-
-func (repo *Repository) WalkRef(refname string, goOn func(SHA1) bool) (map[SHA1]*Commit, error) {
-	head, err := repo.OpenRef(refname)
-	if err != nil {
-		return nil, err
-	}
-
-	HId, err := head.Resolve()
-	if err != nil {
-		return nil, err
-	}
-
-	commits := make(map[SHA1]*Commit)
-	repo.walkCommitTree(commits, HId, goOn)
-	return commits, nil
-}
-
-func (repo *Repository) walkCommitTree(commits map[SHA1]*Commit, commitId SHA1,
-	goOn func(SHA1) bool) error {
-	commit, err := repo.OpenObject(commitId)
-	commit.Close()
-	if err != nil {
-		return err
-	}
-
-	if _, ok := commits[commitId]; !ok && goOn(commitId) {
-		commits[commitId] = commit.(*Commit)
-		for _, parent := range commit.(*Commit).Parent {
-			repo.walkCommitTree(commits, parent, goOn)
-		}
-		return nil
-	} else {
-		return nil
-	}
-}
-
-func (repo *Repository) GetBlobsForCommit(commit *Commit, blobs map[SHA1]*Blob) error {
-	treeOb, err := repo.OpenObject(commit.Tree)
-	if err != nil {
-		return err
-	}
-	defer treeOb.Close()
-
-	tree, ok := treeOb.(*Tree)
-	if !ok {
-		return fmt.Errorf("Could not assert a tree")
-	}
-
-	err = repo.GetBlobsForTree(tree, blobs)
-	return err
-}
-
-func (repo *Repository) GetBlobsForTree(tree *Tree, blobs map[SHA1]*Blob) error {
-	for tree.Next() {
-		trEntry := tree.Entry()
-		switch trEntry.Type {
-		case ObjBlob:
-			if blobOb, err := repo.OpenObject(trEntry.ID); err != nil {
-				return err
-			} else {
-				blobs[trEntry.ID] = blobOb.(*Blob)
-				blobOb.Close()
-			}
-		case ObjTree:
-			if treeOb, err := repo.OpenObject(trEntry.ID); err != nil {
-				return err
-			} else {
-				if err = repo.GetBlobsForTree(treeOb.(*Tree), blobs); err != nil {
-					treeOb.Close()
-					return err
-				}
-
-			}
-		}
-	}
-	return tree.Err()
-}

+ 0 - 206
vendor/github.com/G-Node/libgin/libgin/gig/write.go

@@ -1,206 +0,0 @@
-package gig
-
-import (
-	"bufio"
-	"fmt"
-	"io"
-	"strings"
-)
-
-func writeHeader(o Object, w *bufio.Writer) (n int64, err error) {
-
-	x, err := w.WriteString(o.Type().String())
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	x, err = w.WriteString(" ")
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	x, err = w.WriteString(fmt.Sprintf("%d", o.Size()))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	err = w.WriteByte(0)
-	if err != nil {
-		return n, err
-	}
-
-	return n + 1, nil
-}
-
-//WriteTo writes the commit object to the writer in the on-disk format
-//i.e. as it would be stored in the git objects dir (although uncompressed).
-func (c *Commit) WriteTo(writer io.Writer) (int64, error) {
-	w := bufio.NewWriter(writer)
-
-	n, err := writeHeader(c, w)
-	if err != nil {
-		return n, err
-	}
-
-	x, err := w.WriteString(fmt.Sprintf("tree %s\n", c.Tree))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	for _, p := range c.Parent {
-		x, err = w.WriteString(fmt.Sprintf("parent %s\n", p))
-		n += int64(x)
-		if err != nil {
-			return n, err
-		}
-	}
-
-	x, err = w.WriteString(fmt.Sprintf("author %s\n", c.Author))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	x, err = w.WriteString(fmt.Sprintf("committer %s\n", c.Committer))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	if c.GPGSig != "" {
-		s := strings.Replace(c.GPGSig, "\n", "\n ", -1)
-		x, err = w.WriteString(fmt.Sprintf("gpgsig %s\n", s))
-		n += int64(x)
-		if err != nil {
-			return n, err
-		}
-
-	}
-
-	x, err = w.WriteString(fmt.Sprintf("\n%s", c.Message))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	err = w.Flush()
-	return n, err
-}
-
-//WriteTo writes the tree object to the writer in the on-disk format
-//i.e. as it would be stored in the git objects dir (although uncompressed).
-func (t *Tree) WriteTo(writer io.Writer) (int64, error) {
-
-	w := bufio.NewWriter(writer)
-
-	n, err := writeHeader(t, w)
-	if err != nil {
-		return n, err
-	}
-
-	for t.Next() {
-		//format is: [mode{ASCII, octal}][space][name][\0][SHA1]
-		entry := t.Entry()
-		line := fmt.Sprintf("%o %s", entry.Mode, entry.Name)
-		x, err := w.WriteString(line)
-		n += int64(x)
-		if err != nil {
-			return n, err
-		}
-
-		err = w.WriteByte(0)
-		if err != nil {
-			return n, err
-		}
-		n++
-
-		x, err = w.Write(entry.ID[:])
-		n += int64(x)
-		if err != nil {
-			return n, err
-		}
-	}
-
-	if err = t.Err(); err != nil {
-		return n, err
-	}
-
-	err = w.Flush()
-	return n, err
-}
-
-//WriteTo writes the blob object to the writer in the on-disk format
-//i.e. as it would be stored in the git objects dir (although uncompressed).
-func (b *Blob) WriteTo(writer io.Writer) (int64, error) {
-	w := bufio.NewWriter(writer)
-
-	n, err := writeHeader(b, w)
-	if err != nil {
-		return n, err
-	}
-
-	x, err := io.Copy(w, b.source)
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	err = w.Flush()
-	return n, err
-}
-
-//WriteTo writes the tag object to the writer in the on-disk format
-//i.e. as it would be stored in the git objects dir (although uncompressed).
-func (t *Tag) WriteTo(writer io.Writer) (int64, error) {
-	w := bufio.NewWriter(writer)
-
-	n, err := writeHeader(t, w)
-	if err != nil {
-		return n, err
-	}
-
-	x, err := w.WriteString(fmt.Sprintf("object %s\n", t.Object))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	x, err = w.WriteString(fmt.Sprintf("type %s\n", t.ObjType))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	x, err = w.WriteString(fmt.Sprintf("tag %s\n", t.Tag))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	x, err = w.WriteString(fmt.Sprintf("tagger %s\n\n", t.Tagger))
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-
-	x, err = w.WriteString(t.Message)
-	n += int64(x)
-	if err != nil {
-		return n, err
-	}
-	if t.GPGSig != "" {
-		x, err = w.WriteString(fmt.Sprintf("%s\n", t.GPGSig))
-		n += int64(x)
-		if err != nil {
-			return n, err
-		}
-
-	}
-
-	err = w.Flush()
-	return n, err
-}

+ 0 - 8
vendor/github.com/G-Node/libgin/libgin/libgin.go

@@ -1,8 +0,0 @@
-/*
-Package libgin provides functionality shared between the G-Node GIN services.
-These include:
-- GIN Web: The G-Node/GOGS fork (https://github.com/G-Node/gogs)
-- GIN DOI: The DOI registration service (https://github.com/G-Node/gin-doi)
-- GIN DEX: The indexing service for GIN (https://github.com/G-Node/gin-dex)
-*/
-package libgin

+ 0 - 24
vendor/github.com/G-Node/libgin/libgin/util.go

@@ -1,24 +0,0 @@
-package libgin
-
-// Common utilities for the GIN services
-
-import (
-	"os"
-)
-
-// ReadConfDefault returns the value of a configuration env variable.
-// If the variable is not set, the default is returned.
-func ReadConfDefault(key, defval string) string {
-	value, ok := os.LookupEnv(key)
-	if !ok {
-		return defval
-	}
-	return value
-}
-
-// ReadConf returns the value of a configuration env variable.
-// If the variable is not set, an empty string is returned (ignores any errors).
-func ReadConf(key string) string {
-	value, _ := os.LookupEnv(key)
-	return value
-}

+ 0 - 20
vendor/github.com/beorn7/perks/LICENSE

@@ -1,20 +0,0 @@
-Copyright (C) 2013 Blake Mizerany
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 0 - 2388
vendor/github.com/beorn7/perks/quantile/exampledata.txt

@@ -1,2388 +0,0 @@
-8
-5
-26
-12
-5
-235
-13
-6
-28
-30
-3
-3
-3
-3
-5
-2
-33
-7
-2
-4
-7
-12
-14
-5
-8
-3
-10
-4
-5
-3
-6
-6
-209
-20
-3
-10
-14
-3
-4
-6
-8
-5
-11
-7
-3
-2
-3
-3
-212
-5
-222
-4
-10
-10
-5
-6
-3
-8
-3
-10
-254
-220
-2
-3
-5
-24
-5
-4
-222
-7
-3
-3
-223
-8
-15
-12
-14
-14
-3
-2
-2
-3
-13
-3
-11
-4
-4
-6
-5
-7
-13
-5
-3
-5
-2
-5
-3
-5
-2
-7
-15
-17
-14
-3
-6
-6
-3
-17
-5
-4
-7
-6
-4
-4
-8
-6
-8
-3
-9
-3
-6
-3
-4
-5
-3
-3
-660
-4
-6
-10
-3
-6
-3
-2
-5
-13
-2
-4
-4
-10
-4
-8
-4
-3
-7
-9
-9
-3
-10
-37
-3
-13
-4
-12
-3
-6
-10
-8
-5
-21
-2
-3
-8
-3
-2
-3
-3
-4
-12
-2
-4
-8
-8
-4
-3
-2
-20
-1
-6
-32
-2
-11
-6
-18
-3
-8
-11
-3
-212
-3
-4
-2
-6
-7
-12
-11
-3
-2
-16
-10
-6
-4
-6
-3
-2
-7
-3
-2
-2
-2
-2
-5
-6
-4
-3
-10
-3
-4
-6
-5
-3
-4
-4
-5
-6
-4
-3
-4
-4
-5
-7
-5
-5
-3
-2
-7
-2
-4
-12
-4
-5
-6
-2
-4
-4
-8
-4
-15
-13
-7
-16
-5
-3
-23
-5
-5
-7
-3
-2
-9
-8
-7
-5
-8
-11
-4
-10
-76
-4
-47
-4
-3
-2
-7
-4
-2
-3
-37
-10
-4
-2
-20
-5
-4
-4
-10
-10
-4
-3
-7
-23
-240
-7
-13
-5
-5
-3
-3
-2
-5
-4
-2
-8
-7
-19
-2
-23
-8
-7
-2
-5
-3
-8
-3
-8
-13
-5
-5
-5
-2
-3
-23
-4
-9
-8
-4
-3
-3
-5
-220
-2
-3
-4
-6
-14
-3
-53
-6
-2
-5
-18
-6
-3
-219
-6
-5
-2
-5
-3
-6
-5
-15
-4
-3
-17
-3
-2
-4
-7
-2
-3
-3
-4
-4
-3
-2
-664
-6
-3
-23
-5
-5
-16
-5
-8
-2
-4
-2
-24
-12
-3
-2
-3
-5
-8
-3
-5
-4
-3
-14
-3
-5
-8
-2
-3
-7
-9
-4
-2
-3
-6
-8
-4
-3
-4
-6
-5
-3
-3
-6
-3
-19
-4
-4
-6
-3
-6
-3
-5
-22
-5
-4
-4
-3
-8
-11
-4
-9
-7
-6
-13
-4
-4
-4
-6
-17
-9
-3
-3
-3
-4
-3
-221
-5
-11
-3
-4
-2
-12
-6
-3
-5
-7
-5
-7
-4
-9
-7
-14
-37
-19
-217
-16
-3
-5
-2
-2
-7
-19
-7
-6
-7
-4
-24
-5
-11
-4
-7
-7
-9
-13
-3
-4
-3
-6
-28
-4
-4
-5
-5
-2
-5
-6
-4
-4
-6
-10
-5
-4
-3
-2
-3
-3
-6
-5
-5
-4
-3
-2
-3
-7
-4
-6
-18
-16
-8
-16
-4
-5
-8
-6
-9
-13
-1545
-6
-215
-6
-5
-6
-3
-45
-31
-5
-2
-2
-4
-3
-3
-2
-5
-4
-3
-5
-7
-7
-4
-5
-8
-5
-4
-749
-2
-31
-9
-11
-2
-11
-5
-4
-4
-7
-9
-11
-4
-5
-4
-7
-3
-4
-6
-2
-15
-3
-4
-3
-4
-3
-5
-2
-13
-5
-5
-3
-3
-23
-4
-4
-5
-7
-4
-13
-2
-4
-3
-4
-2
-6
-2
-7
-3
-5
-5
-3
-29
-5
-4
-4
-3
-10
-2
-3
-79
-16
-6
-6
-7
-7
-3
-5
-5
-7
-4
-3
-7
-9
-5
-6
-5
-9
-6
-3
-6
-4
-17
-2
-10
-9
-3
-6
-2
-3
-21
-22
-5
-11
-4
-2
-17
-2
-224
-2
-14
-3
-4
-4
-2
-4
-4
-4
-4
-5
-3
-4
-4
-10
-2
-6
-3
-3
-5
-7
-2
-7
-5
-6
-3
-218
-2
-2
-5
-2
-6
-3
-5
-222
-14
-6
-33
-3
-2
-5
-3
-3
-3
-9
-5
-3
-3
-2
-7
-4
-3
-4
-3
-5
-6
-5
-26
-4
-13
-9
-7
-3
-221
-3
-3
-4
-4
-4
-4
-2
-18
-5
-3
-7
-9
-6
-8
-3
-10
-3
-11
-9
-5
-4
-17
-5
-5
-6
-6
-3
-2
-4
-12
-17
-6
-7
-218
-4
-2
-4
-10
-3
-5
-15
-3
-9
-4
-3
-3
-6
-29
-3
-3
-4
-5
-5
-3
-8
-5
-6
-6
-7
-5
-3
-5
-3
-29
-2
-31
-5
-15
-24
-16
-5
-207
-4
-3
-3
-2
-15
-4
-4
-13
-5
-5
-4
-6
-10
-2
-7
-8
-4
-6
-20
-5
-3
-4
-3
-12
-12
-5
-17
-7
-3
-3
-3
-6
-10
-3
-5
-25
-80
-4
-9
-3
-2
-11
-3
-3
-2
-3
-8
-7
-5
-5
-19
-5
-3
-3
-12
-11
-2
-6
-5
-5
-5
-3
-3
-3
-4
-209
-14
-3
-2
-5
-19
-4
-4
-3
-4
-14
-5
-6
-4
-13
-9
-7
-4
-7
-10
-2
-9
-5
-7
-2
-8
-4
-6
-5
-5
-222
-8
-7
-12
-5
-216
-3
-4
-4
-6
-3
-14
-8
-7
-13
-4
-3
-3
-3
-3
-17
-5
-4
-3
-33
-6
-6
-33
-7
-5
-3
-8
-7
-5
-2
-9
-4
-2
-233
-24
-7
-4
-8
-10
-3
-4
-15
-2
-16
-3
-3
-13
-12
-7
-5
-4
-207
-4
-2
-4
-27
-15
-2
-5
-2
-25
-6
-5
-5
-6
-13
-6
-18
-6
-4
-12
-225
-10
-7
-5
-2
-2
-11
-4
-14
-21
-8
-10
-3
-5
-4
-232
-2
-5
-5
-3
-7
-17
-11
-6
-6
-23
-4
-6
-3
-5
-4
-2
-17
-3
-6
-5
-8
-3
-2
-2
-14
-9
-4
-4
-2
-5
-5
-3
-7
-6
-12
-6
-10
-3
-6
-2
-2
-19
-5
-4
-4
-9
-2
-4
-13
-3
-5
-6
-3
-6
-5
-4
-9
-6
-3
-5
-7
-3
-6
-6
-4
-3
-10
-6
-3
-221
-3
-5
-3
-6
-4
-8
-5
-3
-6
-4
-4
-2
-54
-5
-6
-11
-3
-3
-4
-4
-4
-3
-7
-3
-11
-11
-7
-10
-6
-13
-223
-213
-15
-231
-7
-3
-7
-228
-2
-3
-4
-4
-5
-6
-7
-4
-13
-3
-4
-5
-3
-6
-4
-6
-7
-2
-4
-3
-4
-3
-3
-6
-3
-7
-3
-5
-18
-5
-6
-8
-10
-3
-3
-3
-2
-4
-2
-4
-4
-5
-6
-6
-4
-10
-13
-3
-12
-5
-12
-16
-8
-4
-19
-11
-2
-4
-5
-6
-8
-5
-6
-4
-18
-10
-4
-2
-216
-6
-6
-6
-2
-4
-12
-8
-3
-11
-5
-6
-14
-5
-3
-13
-4
-5
-4
-5
-3
-28
-6
-3
-7
-219
-3
-9
-7
-3
-10
-6
-3
-4
-19
-5
-7
-11
-6
-15
-19
-4
-13
-11
-3
-7
-5
-10
-2
-8
-11
-2
-6
-4
-6
-24
-6
-3
-3
-3
-3
-6
-18
-4
-11
-4
-2
-5
-10
-8
-3
-9
-5
-3
-4
-5
-6
-2
-5
-7
-4
-4
-14
-6
-4
-4
-5
-5
-7
-2
-4
-3
-7
-3
-3
-6
-4
-5
-4
-4
-4
-3
-3
-3
-3
-8
-14
-2
-3
-5
-3
-2
-4
-5
-3
-7
-3
-3
-18
-3
-4
-4
-5
-7
-3
-3
-3
-13
-5
-4
-8
-211
-5
-5
-3
-5
-2
-5
-4
-2
-655
-6
-3
-5
-11
-2
-5
-3
-12
-9
-15
-11
-5
-12
-217
-2
-6
-17
-3
-3
-207
-5
-5
-4
-5
-9
-3
-2
-8
-5
-4
-3
-2
-5
-12
-4
-14
-5
-4
-2
-13
-5
-8
-4
-225
-4
-3
-4
-5
-4
-3
-3
-6
-23
-9
-2
-6
-7
-233
-4
-4
-6
-18
-3
-4
-6
-3
-4
-4
-2
-3
-7
-4
-13
-227
-4
-3
-5
-4
-2
-12
-9
-17
-3
-7
-14
-6
-4
-5
-21
-4
-8
-9
-2
-9
-25
-16
-3
-6
-4
-7
-8
-5
-2
-3
-5
-4
-3
-3
-5
-3
-3
-3
-2
-3
-19
-2
-4
-3
-4
-2
-3
-4
-4
-2
-4
-3
-3
-3
-2
-6
-3
-17
-5
-6
-4
-3
-13
-5
-3
-3
-3
-4
-9
-4
-2
-14
-12
-4
-5
-24
-4
-3
-37
-12
-11
-21
-3
-4
-3
-13
-4
-2
-3
-15
-4
-11
-4
-4
-3
-8
-3
-4
-4
-12
-8
-5
-3
-3
-4
-2
-220
-3
-5
-223
-3
-3
-3
-10
-3
-15
-4
-241
-9
-7
-3
-6
-6
-23
-4
-13
-7
-3
-4
-7
-4
-9
-3
-3
-4
-10
-5
-5
-1
-5
-24
-2
-4
-5
-5
-6
-14
-3
-8
-2
-3
-5
-13
-13
-3
-5
-2
-3
-15
-3
-4
-2
-10
-4
-4
-4
-5
-5
-3
-5
-3
-4
-7
-4
-27
-3
-6
-4
-15
-3
-5
-6
-6
-5
-4
-8
-3
-9
-2
-6
-3
-4
-3
-7
-4
-18
-3
-11
-3
-3
-8
-9
-7
-24
-3
-219
-7
-10
-4
-5
-9
-12
-2
-5
-4
-4
-4
-3
-3
-19
-5
-8
-16
-8
-6
-22
-3
-23
-3
-242
-9
-4
-3
-3
-5
-7
-3
-3
-5
-8
-3
-7
-5
-14
-8
-10
-3
-4
-3
-7
-4
-6
-7
-4
-10
-4
-3
-11
-3
-7
-10
-3
-13
-6
-8
-12
-10
-5
-7
-9
-3
-4
-7
-7
-10
-8
-30
-9
-19
-4
-3
-19
-15
-4
-13
-3
-215
-223
-4
-7
-4
-8
-17
-16
-3
-7
-6
-5
-5
-4
-12
-3
-7
-4
-4
-13
-4
-5
-2
-5
-6
-5
-6
-6
-7
-10
-18
-23
-9
-3
-3
-6
-5
-2
-4
-2
-7
-3
-3
-2
-5
-5
-14
-10
-224
-6
-3
-4
-3
-7
-5
-9
-3
-6
-4
-2
-5
-11
-4
-3
-3
-2
-8
-4
-7
-4
-10
-7
-3
-3
-18
-18
-17
-3
-3
-3
-4
-5
-3
-3
-4
-12
-7
-3
-11
-13
-5
-4
-7
-13
-5
-4
-11
-3
-12
-3
-6
-4
-4
-21
-4
-6
-9
-5
-3
-10
-8
-4
-6
-4
-4
-6
-5
-4
-8
-6
-4
-6
-4
-4
-5
-9
-6
-3
-4
-2
-9
-3
-18
-2
-4
-3
-13
-3
-6
-6
-8
-7
-9
-3
-2
-16
-3
-4
-6
-3
-2
-33
-22
-14
-4
-9
-12
-4
-5
-6
-3
-23
-9
-4
-3
-5
-5
-3
-4
-5
-3
-5
-3
-10
-4
-5
-5
-8
-4
-4
-6
-8
-5
-4
-3
-4
-6
-3
-3
-3
-5
-9
-12
-6
-5
-9
-3
-5
-3
-2
-2
-2
-18
-3
-2
-21
-2
-5
-4
-6
-4
-5
-10
-3
-9
-3
-2
-10
-7
-3
-6
-6
-4
-4
-8
-12
-7
-3
-7
-3
-3
-9
-3
-4
-5
-4
-4
-5
-5
-10
-15
-4
-4
-14
-6
-227
-3
-14
-5
-216
-22
-5
-4
-2
-2
-6
-3
-4
-2
-9
-9
-4
-3
-28
-13
-11
-4
-5
-3
-3
-2
-3
-3
-5
-3
-4
-3
-5
-23
-26
-3
-4
-5
-6
-4
-6
-3
-5
-5
-3
-4
-3
-2
-2
-2
-7
-14
-3
-6
-7
-17
-2
-2
-15
-14
-16
-4
-6
-7
-13
-6
-4
-5
-6
-16
-3
-3
-28
-3
-6
-15
-3
-9
-2
-4
-6
-3
-3
-22
-4
-12
-6
-7
-2
-5
-4
-10
-3
-16
-6
-9
-2
-5
-12
-7
-5
-5
-5
-5
-2
-11
-9
-17
-4
-3
-11
-7
-3
-5
-15
-4
-3
-4
-211
-8
-7
-5
-4
-7
-6
-7
-6
-3
-6
-5
-6
-5
-3
-4
-4
-26
-4
-6
-10
-4
-4
-3
-2
-3
-3
-4
-5
-9
-3
-9
-4
-4
-5
-5
-8
-2
-4
-2
-3
-8
-4
-11
-19
-5
-8
-6
-3
-5
-6
-12
-3
-2
-4
-16
-12
-3
-4
-4
-8
-6
-5
-6
-6
-219
-8
-222
-6
-16
-3
-13
-19
-5
-4
-3
-11
-6
-10
-4
-7
-7
-12
-5
-3
-3
-5
-6
-10
-3
-8
-2
-5
-4
-7
-2
-4
-4
-2
-12
-9
-6
-4
-2
-40
-2
-4
-10
-4
-223
-4
-2
-20
-6
-7
-24
-5
-4
-5
-2
-20
-16
-6
-5
-13
-2
-3
-3
-19
-3
-2
-4
-5
-6
-7
-11
-12
-5
-6
-7
-7
-3
-5
-3
-5
-3
-14
-3
-4
-4
-2
-11
-1
-7
-3
-9
-6
-11
-12
-5
-8
-6
-221
-4
-2
-12
-4
-3
-15
-4
-5
-226
-7
-218
-7
-5
-4
-5
-18
-4
-5
-9
-4
-4
-2
-9
-18
-18
-9
-5
-6
-6
-3
-3
-7
-3
-5
-4
-4
-4
-12
-3
-6
-31
-5
-4
-7
-3
-6
-5
-6
-5
-11
-2
-2
-11
-11
-6
-7
-5
-8
-7
-10
-5
-23
-7
-4
-3
-5
-34
-2
-5
-23
-7
-3
-6
-8
-4
-4
-4
-2
-5
-3
-8
-5
-4
-8
-25
-2
-3
-17
-8
-3
-4
-8
-7
-3
-15
-6
-5
-7
-21
-9
-5
-6
-6
-5
-3
-2
-3
-10
-3
-6
-3
-14
-7
-4
-4
-8
-7
-8
-2
-6
-12
-4
-213
-6
-5
-21
-8
-2
-5
-23
-3
-11
-2
-3
-6
-25
-2
-3
-6
-7
-6
-6
-4
-4
-6
-3
-17
-9
-7
-6
-4
-3
-10
-7
-2
-3
-3
-3
-11
-8
-3
-7
-6
-4
-14
-36
-3
-4
-3
-3
-22
-13
-21
-4
-2
-7
-4
-4
-17
-15
-3
-7
-11
-2
-4
-7
-6
-209
-6
-3
-2
-2
-24
-4
-9
-4
-3
-3
-3
-29
-2
-2
-4
-3
-3
-5
-4
-6
-3
-3
-2
-4

+ 0 - 316
vendor/github.com/beorn7/perks/quantile/stream.go

@@ -1,316 +0,0 @@
-// Package quantile computes approximate quantiles over an unbounded data
-// stream within low memory and CPU bounds.
-//
-// A small amount of accuracy is traded to achieve the above properties.
-//
-// Multiple streams can be merged before calling Query to generate a single set
-// of results. This is meaningful when the streams represent the same type of
-// data. See Merge and Samples.
-//
-// For more detailed information about the algorithm used, see:
-//
-// Effective Computation of Biased Quantiles over Data Streams
-//
-// http://www.cs.rutgers.edu/~muthu/bquant.pdf
-package quantile
-
-import (
-	"math"
-	"sort"
-)
-
-// Sample holds an observed value and meta information for compression. JSON
-// tags have been added for convenience.
-type Sample struct {
-	Value float64 `json:",string"`
-	Width float64 `json:",string"`
-	Delta float64 `json:",string"`
-}
-
-// Samples represents a slice of samples. It implements sort.Interface.
-type Samples []Sample
-
-func (a Samples) Len() int           { return len(a) }
-func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value }
-func (a Samples) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
-
-type invariant func(s *stream, r float64) float64
-
-// NewLowBiased returns an initialized Stream for low-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the lower ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within (1±Epsilon)*Quantile.
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewLowBiased(epsilon float64) *Stream {
-	ƒ := func(s *stream, r float64) float64 {
-		return 2 * epsilon * r
-	}
-	return newStream(ƒ)
-}
-
-// NewHighBiased returns an initialized Stream for high-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the higher ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewHighBiased(epsilon float64) *Stream {
-	ƒ := func(s *stream, r float64) float64 {
-		return 2 * epsilon * (s.n - r)
-	}
-	return newStream(ƒ)
-}
-
-// NewTargeted returns an initialized Stream concerned with a particular set of
-// quantile values that are supplied a priori. Knowing these a priori reduces
-// space and computation time. The targets map maps the desired quantiles to
-// their absolute errors, i.e. the true quantile of a value returned by a query
-// is guaranteed to be within (Quantile±Epsilon).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties.
-func NewTargeted(targetMap map[float64]float64) *Stream {
-	// Convert map to slice to avoid slow iterations on a map.
-	// ƒ is called on the hot path, so converting the map to a slice
-	// beforehand results in significant CPU savings.
-	targets := targetMapToSlice(targetMap)
-
-	ƒ := func(s *stream, r float64) float64 {
-		var m = math.MaxFloat64
-		var f float64
-		for _, t := range targets {
-			if t.quantile*s.n <= r {
-				f = (2 * t.epsilon * r) / t.quantile
-			} else {
-				f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile)
-			}
-			if f < m {
-				m = f
-			}
-		}
-		return m
-	}
-	return newStream(ƒ)
-}
-
-type target struct {
-	quantile float64
-	epsilon  float64
-}
-
-func targetMapToSlice(targetMap map[float64]float64) []target {
-	targets := make([]target, 0, len(targetMap))
-
-	for quantile, epsilon := range targetMap {
-		t := target{
-			quantile: quantile,
-			epsilon:  epsilon,
-		}
-		targets = append(targets, t)
-	}
-
-	return targets
-}
-
-// Stream computes quantiles for a stream of float64s. It is not thread-safe by
-// design. Take care when using across multiple goroutines.
-type Stream struct {
-	*stream
-	b      Samples
-	sorted bool
-}
-
-func newStream(ƒ invariant) *Stream {
-	x := &stream{ƒ: ƒ}
-	return &Stream{x, make(Samples, 0, 500), true}
-}
-
-// Insert inserts v into the stream.
-func (s *Stream) Insert(v float64) {
-	s.insert(Sample{Value: v, Width: 1})
-}
-
-func (s *Stream) insert(sample Sample) {
-	s.b = append(s.b, sample)
-	s.sorted = false
-	if len(s.b) == cap(s.b) {
-		s.flush()
-	}
-}
-
-// Query returns the computed qth percentiles value. If s was created with
-// NewTargeted, and q is not in the set of quantiles provided a priori, Query
-// will return an unspecified result.
-func (s *Stream) Query(q float64) float64 {
-	if !s.flushed() {
-		// Fast path when there hasn't been enough data for a flush;
-		// this also yields better accuracy for small sets of data.
-		l := len(s.b)
-		if l == 0 {
-			return 0
-		}
-		i := int(math.Ceil(float64(l) * q))
-		if i > 0 {
-			i -= 1
-		}
-		s.maybeSort()
-		return s.b[i].Value
-	}
-	s.flush()
-	return s.stream.query(q)
-}
-
-// Merge merges samples into the underlying streams samples. This is handy when
-// merging multiple streams from separate threads, database shards, etc.
-//
-// ATTENTION: This method is broken and does not yield correct results. The
-// underlying algorithm is not capable of merging streams correctly.
-func (s *Stream) Merge(samples Samples) {
-	sort.Sort(samples)
-	s.stream.merge(samples)
-}
-
-// Reset reinitializes and clears the list reusing the samples buffer memory.
-func (s *Stream) Reset() {
-	s.stream.reset()
-	s.b = s.b[:0]
-}
-
-// Samples returns stream samples held by s.
-func (s *Stream) Samples() Samples {
-	if !s.flushed() {
-		return s.b
-	}
-	s.flush()
-	return s.stream.samples()
-}
-
-// Count returns the total number of samples observed in the stream
-// since initialization.
-func (s *Stream) Count() int {
-	return len(s.b) + s.stream.count()
-}
-
-func (s *Stream) flush() {
-	s.maybeSort()
-	s.stream.merge(s.b)
-	s.b = s.b[:0]
-}
-
-func (s *Stream) maybeSort() {
-	if !s.sorted {
-		s.sorted = true
-		sort.Sort(s.b)
-	}
-}
-
-func (s *Stream) flushed() bool {
-	return len(s.stream.l) > 0
-}
-
-type stream struct {
-	n float64
-	l []Sample
-	ƒ invariant
-}
-
-func (s *stream) reset() {
-	s.l = s.l[:0]
-	s.n = 0
-}
-
-func (s *stream) insert(v float64) {
-	s.merge(Samples{{v, 1, 0}})
-}
-
-func (s *stream) merge(samples Samples) {
-	// TODO(beorn7): This tries to merge not only individual samples, but
-	// whole summaries. The paper doesn't mention merging summaries at
-	// all. Unittests show that the merging is inaccurate. Find out how to
-	// do merges properly.
-	var r float64
-	i := 0
-	for _, sample := range samples {
-		for ; i < len(s.l); i++ {
-			c := s.l[i]
-			if c.Value > sample.Value {
-				// Insert at position i.
-				s.l = append(s.l, Sample{})
-				copy(s.l[i+1:], s.l[i:])
-				s.l[i] = Sample{
-					sample.Value,
-					sample.Width,
-					math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1),
-					// TODO(beorn7): How to calculate delta correctly?
-				}
-				i++
-				goto inserted
-			}
-			r += c.Width
-		}
-		s.l = append(s.l, Sample{sample.Value, sample.Width, 0})
-		i++
-	inserted:
-		s.n += sample.Width
-		r += sample.Width
-	}
-	s.compress()
-}
-
-func (s *stream) count() int {
-	return int(s.n)
-}
-
-func (s *stream) query(q float64) float64 {
-	t := math.Ceil(q * s.n)
-	t += math.Ceil(s.ƒ(s, t) / 2)
-	p := s.l[0]
-	var r float64
-	for _, c := range s.l[1:] {
-		r += p.Width
-		if r+c.Width+c.Delta > t {
-			return p.Value
-		}
-		p = c
-	}
-	return p.Value
-}
-
-func (s *stream) compress() {
-	if len(s.l) < 2 {
-		return
-	}
-	x := s.l[len(s.l)-1]
-	xi := len(s.l) - 1
-	r := s.n - 1 - x.Width
-
-	for i := len(s.l) - 2; i >= 0; i-- {
-		c := s.l[i]
-		if c.Width+x.Width+x.Delta <= s.ƒ(s, r) {
-			x.Width += c.Width
-			s.l[xi] = x
-			// Remove element at i.
-			copy(s.l[i:], s.l[i+1:])
-			s.l = s.l[:len(s.l)-1]
-			xi -= 1
-		} else {
-			x = c
-			xi = i
-		}
-		r -= c.Width
-	}
-}
-
-func (s *stream) samples() Samples {
-	samples := make(Samples, len(s.l))
-	copy(samples, s.l)
-	return samples
-}

+ 0 - 1
vendor/github.com/boombuler/barcode/.gitignore

@@ -1 +0,0 @@
-.vscode/

+ 0 - 21
vendor/github.com/boombuler/barcode/LICENSE

@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Florian Sundermann
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 53
vendor/github.com/boombuler/barcode/README.md

@@ -1,53 +0,0 @@
-[![Join the chat at https://gitter.im/golang-barcode/Lobby](https://badges.gitter.im/golang-barcode/Lobby.svg)](https://gitter.im/golang-barcode/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-## Introduction ##
-
-This is a package for GO which can be used to create different types of barcodes.
-
-## Supported Barcode Types ##
-* 2 of 5
-* Aztec Code
-* Codabar
-* Code 128
-* Code 39
-* Code 93
-* Datamatrix
-* EAN 13
-* EAN 8
-* PDF 417
-* QR Code
-
-## Example ##
-
-This is a simple example on how to create a QR-Code and write it to a png-file
-```go
-package main
-
-import (
-	"image/png"
-	"os"
-
-	"github.com/boombuler/barcode"
-	"github.com/boombuler/barcode/qr"
-)
-
-func main() {
-	// Create the barcode
-	qrCode, _ := qr.Encode("Hello World", qr.M, qr.Auto)
-
-	// Scale the barcode to 200x200 pixels
-	qrCode, _ = barcode.Scale(qrCode, 200, 200)
-
-	// create the output file
-	file, _ := os.Create("qrcode.png")
-	defer file.Close()
-
-	// encode the barcode as png
-	png.Encode(file, qrCode)
-}
-```
-
-## Documentation ##
-See [GoDoc](https://godoc.org/github.com/boombuler/barcode)
-
-To create a barcode use the Encode function from one of the subpackages.

+ 0 - 42
vendor/github.com/boombuler/barcode/barcode.go

@@ -1,42 +0,0 @@
-package barcode
-
-import "image"
-
-const (
-	TypeAztec           = "Aztec"
-	TypeCodabar         = "Codabar"
-	TypeCode128         = "Code 128"
-	TypeCode39          = "Code 39"
-	TypeCode93          = "Code 93"
-	TypeDataMatrix      = "DataMatrix"
-	TypeEAN8            = "EAN 8"
-	TypeEAN13           = "EAN 13"
-	TypePDF             = "PDF417"
-	TypeQR              = "QR Code"
-	Type2of5            = "2 of 5"
-	Type2of5Interleaved = "2 of 5 (interleaved)"
-)
-
-// Contains some meta information about a barcode
-type Metadata struct {
-	// the name of the barcode kind
-	CodeKind string
-	// contains 1 for 1D barcodes or 2 for 2D barcodes
-	Dimensions byte
-}
-
-// a rendered and encoded barcode
-type Barcode interface {
-	image.Image
-	// returns some meta information about the barcode
-	Metadata() Metadata
-	// the data that was encoded in this barcode
-	Content() string
-}
-
-// Additional interface that some barcodes might implement to provide
-// the value of its checksum.
-type BarcodeIntCS interface {
-	Barcode
-	CheckSum() int
-}

+ 0 - 1
vendor/github.com/boombuler/barcode/go.mod

@@ -1 +0,0 @@
-module github.com/boombuler/barcode

+ 0 - 66
vendor/github.com/boombuler/barcode/qr/alphanumeric.go

@@ -1,66 +0,0 @@
-package qr
-
-import (
-	"errors"
-	"fmt"
-	"strings"
-
-	"github.com/boombuler/barcode/utils"
-)
-
-const charSet string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"
-
-func stringToAlphaIdx(content string) <-chan int {
-	result := make(chan int)
-	go func() {
-		for _, r := range content {
-			idx := strings.IndexRune(charSet, r)
-			result <- idx
-			if idx < 0 {
-				break
-			}
-		}
-		close(result)
-	}()
-
-	return result
-}
-
-func encodeAlphaNumeric(content string, ecl ErrorCorrectionLevel) (*utils.BitList, *versionInfo, error) {
-
-	contentLenIsOdd := len(content)%2 == 1
-	contentBitCount := (len(content) / 2) * 11
-	if contentLenIsOdd {
-		contentBitCount += 6
-	}
-	vi := findSmallestVersionInfo(ecl, alphaNumericMode, contentBitCount)
-	if vi == nil {
-		return nil, nil, errors.New("To much data to encode")
-	}
-
-	res := new(utils.BitList)
-	res.AddBits(int(alphaNumericMode), 4)
-	res.AddBits(len(content), vi.charCountBits(alphaNumericMode))
-
-	encoder := stringToAlphaIdx(content)
-
-	for idx := 0; idx < len(content)/2; idx++ {
-		c1 := <-encoder
-		c2 := <-encoder
-		if c1 < 0 || c2 < 0 {
-			return nil, nil, fmt.Errorf("\"%s\" can not be encoded as %s", content, AlphaNumeric)
-		}
-		res.AddBits(c1*45+c2, 11)
-	}
-	if contentLenIsOdd {
-		c := <-encoder
-		if c < 0 {
-			return nil, nil, fmt.Errorf("\"%s\" can not be encoded as %s", content, AlphaNumeric)
-		}
-		res.AddBits(c, 6)
-	}
-
-	addPaddingAndTerminator(res, vi)
-
-	return res, vi, nil
-}

+ 0 - 23
vendor/github.com/boombuler/barcode/qr/automatic.go

@@ -1,23 +0,0 @@
-package qr
-
-import (
-	"fmt"
-
-	"github.com/boombuler/barcode/utils"
-)
-
-func encodeAuto(content string, ecl ErrorCorrectionLevel) (*utils.BitList, *versionInfo, error) {
-	bits, vi, _ := Numeric.getEncoder()(content, ecl)
-	if bits != nil && vi != nil {
-		return bits, vi, nil
-	}
-	bits, vi, _ = AlphaNumeric.getEncoder()(content, ecl)
-	if bits != nil && vi != nil {
-		return bits, vi, nil
-	}
-	bits, vi, _ = Unicode.getEncoder()(content, ecl)
-	if bits != nil && vi != nil {
-		return bits, vi, nil
-	}
-	return nil, nil, fmt.Errorf("No encoding found to encode \"%s\"", content)
-}

+ 0 - 59
vendor/github.com/boombuler/barcode/qr/blocks.go

@@ -1,59 +0,0 @@
-package qr
-
-type block struct {
-	data []byte
-	ecc  []byte
-}
-type blockList []*block
-
-func splitToBlocks(data <-chan byte, vi *versionInfo) blockList {
-	result := make(blockList, vi.NumberOfBlocksInGroup1+vi.NumberOfBlocksInGroup2)
-
-	for b := 0; b < int(vi.NumberOfBlocksInGroup1); b++ {
-		blk := new(block)
-		blk.data = make([]byte, vi.DataCodeWordsPerBlockInGroup1)
-		for cw := 0; cw < int(vi.DataCodeWordsPerBlockInGroup1); cw++ {
-			blk.data[cw] = <-data
-		}
-		blk.ecc = ec.calcECC(blk.data, vi.ErrorCorrectionCodewordsPerBlock)
-		result[b] = blk
-	}
-
-	for b := 0; b < int(vi.NumberOfBlocksInGroup2); b++ {
-		blk := new(block)
-		blk.data = make([]byte, vi.DataCodeWordsPerBlockInGroup2)
-		for cw := 0; cw < int(vi.DataCodeWordsPerBlockInGroup2); cw++ {
-			blk.data[cw] = <-data
-		}
-		blk.ecc = ec.calcECC(blk.data, vi.ErrorCorrectionCodewordsPerBlock)
-		result[int(vi.NumberOfBlocksInGroup1)+b] = blk
-	}
-
-	return result
-}
-
-func (bl blockList) interleave(vi *versionInfo) []byte {
-	var maxCodewordCount int
-	if vi.DataCodeWordsPerBlockInGroup1 > vi.DataCodeWordsPerBlockInGroup2 {
-		maxCodewordCount = int(vi.DataCodeWordsPerBlockInGroup1)
-	} else {
-		maxCodewordCount = int(vi.DataCodeWordsPerBlockInGroup2)
-	}
-	resultLen := (vi.DataCodeWordsPerBlockInGroup1+vi.ErrorCorrectionCodewordsPerBlock)*vi.NumberOfBlocksInGroup1 +
-		(vi.DataCodeWordsPerBlockInGroup2+vi.ErrorCorrectionCodewordsPerBlock)*vi.NumberOfBlocksInGroup2
-
-	result := make([]byte, 0, resultLen)
-	for i := 0; i < maxCodewordCount; i++ {
-		for b := 0; b < len(bl); b++ {
-			if len(bl[b].data) > i {
-				result = append(result, bl[b].data[i])
-			}
-		}
-	}
-	for i := 0; i < int(vi.ErrorCorrectionCodewordsPerBlock); i++ {
-		for b := 0; b < len(bl); b++ {
-			result = append(result, bl[b].ecc[i])
-		}
-	}
-	return result
-}

+ 0 - 416
vendor/github.com/boombuler/barcode/qr/encoder.go

@@ -1,416 +0,0 @@
-// Package qr can be used to create QR barcodes.
-package qr
-
-import (
-	"image"
-
-	"github.com/boombuler/barcode"
-	"github.com/boombuler/barcode/utils"
-)
-
-type encodeFn func(content string, eccLevel ErrorCorrectionLevel) (*utils.BitList, *versionInfo, error)
-
-// Encoding mode for QR Codes.
-type Encoding byte
-
-const (
-	// Auto will choose ths best matching encoding
-	Auto Encoding = iota
-	// Numeric encoding only encodes numbers [0-9]
-	Numeric
-	// AlphaNumeric encoding only encodes uppercase letters, numbers and  [Space], $, %, *, +, -, ., /, :
-	AlphaNumeric
-	// Unicode encoding encodes the string as utf-8
-	Unicode
-	// only for testing purpose
-	unknownEncoding
-)
-
-func (e Encoding) getEncoder() encodeFn {
-	switch e {
-	case Auto:
-		return encodeAuto
-	case Numeric:
-		return encodeNumeric
-	case AlphaNumeric:
-		return encodeAlphaNumeric
-	case Unicode:
-		return encodeUnicode
-	}
-	return nil
-}
-
-func (e Encoding) String() string {
-	switch e {
-	case Auto:
-		return "Auto"
-	case Numeric:
-		return "Numeric"
-	case AlphaNumeric:
-		return "AlphaNumeric"
-	case Unicode:
-		return "Unicode"
-	}
-	return ""
-}
-
-// Encode returns a QR barcode with the given content, error correction level and uses the given encoding
-func Encode(content string, level ErrorCorrectionLevel, mode Encoding) (barcode.Barcode, error) {
-	bits, vi, err := mode.getEncoder()(content, level)
-	if err != nil {
-		return nil, err
-	}
-
-	blocks := splitToBlocks(bits.IterateBytes(), vi)
-	data := blocks.interleave(vi)
-	result := render(data, vi)
-	result.content = content
-	return result, nil
-}
-
-func render(data []byte, vi *versionInfo) *qrcode {
-	dim := vi.modulWidth()
-	results := make([]*qrcode, 8)
-	for i := 0; i < 8; i++ {
-		results[i] = newBarcode(dim)
-	}
-
-	occupied := newBarcode(dim)
-
-	setAll := func(x int, y int, val bool) {
-		occupied.Set(x, y, true)
-		for i := 0; i < 8; i++ {
-			results[i].Set(x, y, val)
-		}
-	}
-
-	drawFinderPatterns(vi, setAll)
-	drawAlignmentPatterns(occupied, vi, setAll)
-
-	//Timing Pattern:
-	var i int
-	for i = 0; i < dim; i++ {
-		if !occupied.Get(i, 6) {
-			setAll(i, 6, i%2 == 0)
-		}
-		if !occupied.Get(6, i) {
-			setAll(6, i, i%2 == 0)
-		}
-	}
-	// Dark Module
-	setAll(8, dim-8, true)
-
-	drawVersionInfo(vi, setAll)
-	drawFormatInfo(vi, -1, occupied.Set)
-	for i := 0; i < 8; i++ {
-		drawFormatInfo(vi, i, results[i].Set)
-	}
-
-	// Write the data
-	var curBitNo int
-
-	for pos := range iterateModules(occupied) {
-		var curBit bool
-		if curBitNo < len(data)*8 {
-			curBit = ((data[curBitNo/8] >> uint(7-(curBitNo%8))) & 1) == 1
-		} else {
-			curBit = false
-		}
-
-		for i := 0; i < 8; i++ {
-			setMasked(pos.X, pos.Y, curBit, i, results[i].Set)
-		}
-		curBitNo++
-	}
-
-	lowestPenalty := ^uint(0)
-	lowestPenaltyIdx := -1
-	for i := 0; i < 8; i++ {
-		p := results[i].calcPenalty()
-		if p < lowestPenalty {
-			lowestPenalty = p
-			lowestPenaltyIdx = i
-		}
-	}
-	return results[lowestPenaltyIdx]
-}
-
-func setMasked(x, y int, val bool, mask int, set func(int, int, bool)) {
-	switch mask {
-	case 0:
-		val = val != (((y + x) % 2) == 0)
-		break
-	case 1:
-		val = val != ((y % 2) == 0)
-		break
-	case 2:
-		val = val != ((x % 3) == 0)
-		break
-	case 3:
-		val = val != (((y + x) % 3) == 0)
-		break
-	case 4:
-		val = val != (((y/2 + x/3) % 2) == 0)
-		break
-	case 5:
-		val = val != (((y*x)%2)+((y*x)%3) == 0)
-		break
-	case 6:
-		val = val != ((((y*x)%2)+((y*x)%3))%2 == 0)
-		break
-	case 7:
-		val = val != ((((y+x)%2)+((y*x)%3))%2 == 0)
-	}
-	set(x, y, val)
-}
-
-func iterateModules(occupied *qrcode) <-chan image.Point {
-	result := make(chan image.Point)
-	allPoints := make(chan image.Point)
-	go func() {
-		curX := occupied.dimension - 1
-		curY := occupied.dimension - 1
-		isUpward := true
-
-		for true {
-			if isUpward {
-				allPoints <- image.Pt(curX, curY)
-				allPoints <- image.Pt(curX-1, curY)
-				curY--
-				if curY < 0 {
-					curY = 0
-					curX -= 2
-					if curX == 6 {
-						curX--
-					}
-					if curX < 0 {
-						break
-					}
-					isUpward = false
-				}
-			} else {
-				allPoints <- image.Pt(curX, curY)
-				allPoints <- image.Pt(curX-1, curY)
-				curY++
-				if curY >= occupied.dimension {
-					curY = occupied.dimension - 1
-					curX -= 2
-					if curX == 6 {
-						curX--
-					}
-					isUpward = true
-					if curX < 0 {
-						break
-					}
-				}
-			}
-		}
-
-		close(allPoints)
-	}()
-	go func() {
-		for pt := range allPoints {
-			if !occupied.Get(pt.X, pt.Y) {
-				result <- pt
-			}
-		}
-		close(result)
-	}()
-	return result
-}
-
-func drawFinderPatterns(vi *versionInfo, set func(int, int, bool)) {
-	dim := vi.modulWidth()
-	drawPattern := func(xoff int, yoff int) {
-		for x := -1; x < 8; x++ {
-			for y := -1; y < 8; y++ {
-				val := (x == 0 || x == 6 || y == 0 || y == 6 || (x > 1 && x < 5 && y > 1 && y < 5)) && (x <= 6 && y <= 6 && x >= 0 && y >= 0)
-
-				if x+xoff >= 0 && x+xoff < dim && y+yoff >= 0 && y+yoff < dim {
-					set(x+xoff, y+yoff, val)
-				}
-			}
-		}
-	}
-	drawPattern(0, 0)
-	drawPattern(0, dim-7)
-	drawPattern(dim-7, 0)
-}
-
-func drawAlignmentPatterns(occupied *qrcode, vi *versionInfo, set func(int, int, bool)) {
-	drawPattern := func(xoff int, yoff int) {
-		for x := -2; x <= 2; x++ {
-			for y := -2; y <= 2; y++ {
-				val := x == -2 || x == 2 || y == -2 || y == 2 || (x == 0 && y == 0)
-				set(x+xoff, y+yoff, val)
-			}
-		}
-	}
-	positions := vi.alignmentPatternPlacements()
-
-	for _, x := range positions {
-		for _, y := range positions {
-			if occupied.Get(x, y) {
-				continue
-			}
-			drawPattern(x, y)
-		}
-	}
-}
-
-var formatInfos = map[ErrorCorrectionLevel]map[int][]bool{
-	L: {
-		0: []bool{true, true, true, false, true, true, true, true, true, false, false, false, true, false, false},
-		1: []bool{true, true, true, false, false, true, false, true, true, true, true, false, false, true, true},
-		2: []bool{true, true, true, true, true, false, true, true, false, true, false, true, false, true, false},
-		3: []bool{true, true, true, true, false, false, false, true, false, false, true, true, true, false, true},
-		4: []bool{true, true, false, false, true, true, false, false, false, true, false, true, true, true, true},
-		5: []bool{true, true, false, false, false, true, true, false, false, false, true, true, false, false, false},
-		6: []bool{true, true, false, true, true, false, false, false, true, false, false, false, false, false, true},
-		7: []bool{true, true, false, true, false, false, true, false, true, true, true, false, true, true, false},
-	},
-	M: {
-		0: []bool{true, false, true, false, true, false, false, false, false, false, true, false, false, true, false},
-		1: []bool{true, false, true, false, false, false, true, false, false, true, false, false, true, false, true},
-		2: []bool{true, false, true, true, true, true, false, false, true, true, true, true, true, false, false},
-		3: []bool{true, false, true, true, false, true, true, false, true, false, false, true, false, true, true},
-		4: []bool{true, false, false, false, true, false, true, true, true, true, true, true, false, false, true},
-		5: []bool{true, false, false, false, false, false, false, true, true, false, false, true, true, true, false},
-		6: []bool{true, false, false, true, true, true, true, true, false, false, true, false, true, true, true},
-		7: []bool{true, false, false, true, false, true, false, true, false, true, false, false, false, false, false},
-	},
-	Q: {
-		0: []bool{false, true, true, false, true, false, true, false, true, false, true, true, true, true, true},
-		1: []bool{false, true, true, false, false, false, false, false, true, true, false, true, false, false, false},
-		2: []bool{false, true, true, true, true, true, true, false, false, true, true, false, false, false, true},
-		3: []bool{false, true, true, true, false, true, false, false, false, false, false, false, true, true, false},
-		4: []bool{false, true, false, false, true, false, false, true, false, true, true, false, true, false, false},
-		5: []bool{false, true, false, false, false, false, true, true, false, false, false, false, false, true, true},
-		6: []bool{false, true, false, true, true, true, false, true, true, false, true, true, false, true, false},
-		7: []bool{false, true, false, true, false, true, true, true, true, true, false, true, true, false, true},
-	},
-	H: {
-		0: []bool{false, false, true, false, true, true, false, true, false, false, false, true, false, false, true},
-		1: []bool{false, false, true, false, false, true, true, true, false, true, true, true, true, true, false},
-		2: []bool{false, false, true, true, true, false, false, true, true, true, false, false, true, true, true},
-		3: []bool{false, false, true, true, false, false, true, true, true, false, true, false, false, false, false},
-		4: []bool{false, false, false, false, true, true, true, false, true, true, false, false, false, true, false},
-		5: []bool{false, false, false, false, false, true, false, false, true, false, true, false, true, false, true},
-		6: []bool{false, false, false, true, true, false, true, false, false, false, false, true, true, false, false},
-		7: []bool{false, false, false, true, false, false, false, false, false, true, true, true, false, true, true},
-	},
-}
-
-func drawFormatInfo(vi *versionInfo, usedMask int, set func(int, int, bool)) {
-	var formatInfo []bool
-
-	if usedMask == -1 {
-		formatInfo = []bool{true, true, true, true, true, true, true, true, true, true, true, true, true, true, true} // Set all to true cause -1 --> occupied mask.
-	} else {
-		formatInfo = formatInfos[vi.Level][usedMask]
-	}
-
-	if len(formatInfo) == 15 {
-		dim := vi.modulWidth()
-		set(0, 8, formatInfo[0])
-		set(1, 8, formatInfo[1])
-		set(2, 8, formatInfo[2])
-		set(3, 8, formatInfo[3])
-		set(4, 8, formatInfo[4])
-		set(5, 8, formatInfo[5])
-		set(7, 8, formatInfo[6])
-		set(8, 8, formatInfo[7])
-		set(8, 7, formatInfo[8])
-		set(8, 5, formatInfo[9])
-		set(8, 4, formatInfo[10])
-		set(8, 3, formatInfo[11])
-		set(8, 2, formatInfo[12])
-		set(8, 1, formatInfo[13])
-		set(8, 0, formatInfo[14])
-
-		set(8, dim-1, formatInfo[0])
-		set(8, dim-2, formatInfo[1])
-		set(8, dim-3, formatInfo[2])
-		set(8, dim-4, formatInfo[3])
-		set(8, dim-5, formatInfo[4])
-		set(8, dim-6, formatInfo[5])
-		set(8, dim-7, formatInfo[6])
-		set(dim-8, 8, formatInfo[7])
-		set(dim-7, 8, formatInfo[8])
-		set(dim-6, 8, formatInfo[9])
-		set(dim-5, 8, formatInfo[10])
-		set(dim-4, 8, formatInfo[11])
-		set(dim-3, 8, formatInfo[12])
-		set(dim-2, 8, formatInfo[13])
-		set(dim-1, 8, formatInfo[14])
-	}
-}
-
-var versionInfoBitsByVersion = map[byte][]bool{
-	7:  []bool{false, false, false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false},
-	8:  []bool{false, false, true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false},
-	9:  []bool{false, false, true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true},
-	10: []bool{false, false, true, false, true, false, false, true, false, false, true, true, false, true, false, false, true, true},
-	11: []bool{false, false, true, false, true, true, true, false, true, true, true, true, true, true, false, true, true, false},
-	12: []bool{false, false, true, true, false, false, false, true, true, true, false, true, true, false, false, false, true, false},
-	13: []bool{false, false, true, true, false, true, true, false, false, false, false, true, false, false, false, true, true, true},
-	14: []bool{false, false, true, true, true, false, false, true, true, false, false, false, false, false, true, true, false, true},
-	15: []bool{false, false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false, false},
-	16: []bool{false, true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false, false},
-	17: []bool{false, true, false, false, false, true, false, true, false, false, false, true, false, true, true, true, false, true},
-	18: []bool{false, true, false, false, true, false, true, false, true, false, false, false, false, true, false, true, true, true},
-	19: []bool{false, true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true, false},
-	20: []bool{false, true, false, true, false, false, true, false, false, true, true, false, true, false, false, true, true, false},
-	21: []bool{false, true, false, true, false, true, false, true, true, false, true, false, false, false, false, false, true, true},
-	22: []bool{false, true, false, true, true, false, true, false, false, false, true, true, false, false, true, false, false, true},
-	23: []bool{false, true, false, true, true, true, false, true, true, true, true, true, true, false, true, true, false, false},
-	24: []bool{false, true, true, false, false, false, true, true, true, false, true, true, false, false, false, true, false, false},
-	25: []bool{false, true, true, false, false, true, false, false, false, true, true, true, true, false, false, false, false, true},
-	26: []bool{false, true, true, false, true, false, true, true, true, true, true, false, true, false, true, false, true, true},
-	27: []bool{false, true, true, false, true, true, false, false, false, false, true, false, false, false, true, true, true, false},
-	28: []bool{false, true, true, true, false, false, true, true, false, false, false, false, false, true, true, false, true, false},
-	29: []bool{false, true, true, true, false, true, false, false, true, true, false, false, true, true, true, true, true, true},
-	30: []bool{false, true, true, true, true, false, true, true, false, true, false, true, true, true, false, true, false, true},
-	31: []bool{false, true, true, true, true, true, false, false, true, false, false, true, false, true, false, false, false, false},
-	32: []bool{true, false, false, false, false, false, true, false, false, true, true, true, false, true, false, true, false, true},
-	33: []bool{true, false, false, false, false, true, false, true, true, false, true, true, true, true, false, false, false, false},
-	34: []bool{true, false, false, false, true, false, true, false, false, false, true, false, true, true, true, false, true, false},
-	35: []bool{true, false, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true},
-	36: []bool{true, false, false, true, false, false, true, false, true, true, false, false, false, false, true, false, true, true},
-	37: []bool{true, false, false, true, false, true, false, true, false, false, false, false, true, false, true, true, true, false},
-	38: []bool{true, false, false, true, true, false, true, false, true, false, false, true, true, false, false, true, false, false},
-	39: []bool{true, false, false, true, true, true, false, true, false, true, false, true, false, false, false, false, false, true},
-	40: []bool{true, false, true, false, false, false, true, true, false, false, false, true, true, false, true, false, false, true},
-}
-
-func drawVersionInfo(vi *versionInfo, set func(int, int, bool)) {
-	versionInfoBits, ok := versionInfoBitsByVersion[vi.Version]
-
-	if ok && len(versionInfoBits) > 0 {
-		for i := 0; i < len(versionInfoBits); i++ {
-			x := (vi.modulWidth() - 11) + i%3
-			y := i / 3
-			set(x, y, versionInfoBits[len(versionInfoBits)-i-1])
-			set(y, x, versionInfoBits[len(versionInfoBits)-i-1])
-		}
-	}
-
-}
-
-func addPaddingAndTerminator(bl *utils.BitList, vi *versionInfo) {
-	for i := 0; i < 4 && bl.Len() < vi.totalDataBytes()*8; i++ {
-		bl.AddBit(false)
-	}
-
-	for bl.Len()%8 != 0 {
-		bl.AddBit(false)
-	}
-
-	for i := 0; bl.Len() < vi.totalDataBytes()*8; i++ {
-		if i%2 == 0 {
-			bl.AddByte(236)
-		} else {
-			bl.AddByte(17)
-		}
-	}
-}

+ 0 - 29
vendor/github.com/boombuler/barcode/qr/errorcorrection.go

@@ -1,29 +0,0 @@
-package qr
-
-import (
-	"github.com/boombuler/barcode/utils"
-)
-
-type errorCorrection struct {
-	rs *utils.ReedSolomonEncoder
-}
-
-var ec = newErrorCorrection()
-
-func newErrorCorrection() *errorCorrection {
-	fld := utils.NewGaloisField(285, 256, 0)
-	return &errorCorrection{utils.NewReedSolomonEncoder(fld)}
-}
-
-func (ec *errorCorrection) calcECC(data []byte, eccCount byte) []byte {
-	dataInts := make([]int, len(data))
-	for i := 0; i < len(data); i++ {
-		dataInts[i] = int(data[i])
-	}
-	res := ec.rs.Encode(dataInts, int(eccCount))
-	result := make([]byte, len(res))
-	for i := 0; i < len(res); i++ {
-		result[i] = byte(res[i])
-	}
-	return result
-}

+ 0 - 56
vendor/github.com/boombuler/barcode/qr/numeric.go

@@ -1,56 +0,0 @@
-package qr
-
-import (
-	"errors"
-	"fmt"
-	"strconv"
-
-	"github.com/boombuler/barcode/utils"
-)
-
-func encodeNumeric(content string, ecl ErrorCorrectionLevel) (*utils.BitList, *versionInfo, error) {
-	contentBitCount := (len(content) / 3) * 10
-	switch len(content) % 3 {
-	case 1:
-		contentBitCount += 4
-	case 2:
-		contentBitCount += 7
-	}
-	vi := findSmallestVersionInfo(ecl, numericMode, contentBitCount)
-	if vi == nil {
-		return nil, nil, errors.New("To much data to encode")
-	}
-	res := new(utils.BitList)
-	res.AddBits(int(numericMode), 4)
-	res.AddBits(len(content), vi.charCountBits(numericMode))
-
-	for pos := 0; pos < len(content); pos += 3 {
-		var curStr string
-		if pos+3 <= len(content) {
-			curStr = content[pos : pos+3]
-		} else {
-			curStr = content[pos:]
-		}
-
-		i, err := strconv.Atoi(curStr)
-		if err != nil || i < 0 {
-			return nil, nil, fmt.Errorf("\"%s\" can not be encoded as %s", content, Numeric)
-		}
-		var bitCnt byte
-		switch len(curStr) % 3 {
-		case 0:
-			bitCnt = 10
-		case 1:
-			bitCnt = 4
-			break
-		case 2:
-			bitCnt = 7
-			break
-		}
-
-		res.AddBits(i, bitCnt)
-	}
-
-	addPaddingAndTerminator(res, vi)
-	return res, vi, nil
-}

+ 0 - 166
vendor/github.com/boombuler/barcode/qr/qrcode.go

@@ -1,166 +0,0 @@
-package qr
-
-import (
-	"image"
-	"image/color"
-	"math"
-
-	"github.com/boombuler/barcode"
-	"github.com/boombuler/barcode/utils"
-)
-
-type qrcode struct {
-	dimension int
-	data      *utils.BitList
-	content   string
-}
-
-func (qr *qrcode) Content() string {
-	return qr.content
-}
-
-func (qr *qrcode) Metadata() barcode.Metadata {
-	return barcode.Metadata{barcode.TypeQR, 2}
-}
-
-func (qr *qrcode) ColorModel() color.Model {
-	return color.Gray16Model
-}
-
-func (qr *qrcode) Bounds() image.Rectangle {
-	return image.Rect(0, 0, qr.dimension, qr.dimension)
-}
-
-func (qr *qrcode) At(x, y int) color.Color {
-	if qr.Get(x, y) {
-		return color.Black
-	}
-	return color.White
-}
-
-func (qr *qrcode) Get(x, y int) bool {
-	return qr.data.GetBit(x*qr.dimension + y)
-}
-
-func (qr *qrcode) Set(x, y int, val bool) {
-	qr.data.SetBit(x*qr.dimension+y, val)
-}
-
-func (qr *qrcode) calcPenalty() uint {
-	return qr.calcPenaltyRule1() + qr.calcPenaltyRule2() + qr.calcPenaltyRule3() + qr.calcPenaltyRule4()
-}
-
-func (qr *qrcode) calcPenaltyRule1() uint {
-	var result uint
-	for x := 0; x < qr.dimension; x++ {
-		checkForX := false
-		var cntX uint
-		checkForY := false
-		var cntY uint
-
-		for y := 0; y < qr.dimension; y++ {
-			if qr.Get(x, y) == checkForX {
-				cntX++
-			} else {
-				checkForX = !checkForX
-				if cntX >= 5 {
-					result += cntX - 2
-				}
-				cntX = 1
-			}
-
-			if qr.Get(y, x) == checkForY {
-				cntY++
-			} else {
-				checkForY = !checkForY
-				if cntY >= 5 {
-					result += cntY - 2
-				}
-				cntY = 1
-			}
-		}
-
-		if cntX >= 5 {
-			result += cntX - 2
-		}
-		if cntY >= 5 {
-			result += cntY - 2
-		}
-	}
-
-	return result
-}
-
-func (qr *qrcode) calcPenaltyRule2() uint {
-	var result uint
-	for x := 0; x < qr.dimension-1; x++ {
-		for y := 0; y < qr.dimension-1; y++ {
-			check := qr.Get(x, y)
-			if qr.Get(x, y+1) == check && qr.Get(x+1, y) == check && qr.Get(x+1, y+1) == check {
-				result += 3
-			}
-		}
-	}
-	return result
-}
-
-func (qr *qrcode) calcPenaltyRule3() uint {
-	pattern1 := []bool{true, false, true, true, true, false, true, false, false, false, false}
-	pattern2 := []bool{false, false, false, false, true, false, true, true, true, false, true}
-
-	var result uint
-	for x := 0; x <= qr.dimension-len(pattern1); x++ {
-		for y := 0; y < qr.dimension; y++ {
-			pattern1XFound := true
-			pattern2XFound := true
-			pattern1YFound := true
-			pattern2YFound := true
-
-			for i := 0; i < len(pattern1); i++ {
-				iv := qr.Get(x+i, y)
-				if iv != pattern1[i] {
-					pattern1XFound = false
-				}
-				if iv != pattern2[i] {
-					pattern2XFound = false
-				}
-				iv = qr.Get(y, x+i)
-				if iv != pattern1[i] {
-					pattern1YFound = false
-				}
-				if iv != pattern2[i] {
-					pattern2YFound = false
-				}
-			}
-			if pattern1XFound || pattern2XFound {
-				result += 40
-			}
-			if pattern1YFound || pattern2YFound {
-				result += 40
-			}
-		}
-	}
-
-	return result
-}
-
-func (qr *qrcode) calcPenaltyRule4() uint {
-	totalNum := qr.data.Len()
-	trueCnt := 0
-	for i := 0; i < totalNum; i++ {
-		if qr.data.GetBit(i) {
-			trueCnt++
-		}
-	}
-	percDark := float64(trueCnt) * 100 / float64(totalNum)
-	floor := math.Abs(math.Floor(percDark/5) - 10)
-	ceil := math.Abs(math.Ceil(percDark/5) - 10)
-	return uint(math.Min(floor, ceil) * 10)
-}
-
-func newBarcode(dim int) *qrcode {
-	res := new(qrcode)
-	res.dimension = dim
-	res.data = utils.NewBitList(dim * dim)
-	return res
-}

+ 0 - 27
vendor/github.com/boombuler/barcode/qr/unicode.go

@@ -1,27 +0,0 @@
-package qr
-
-import (
-	"errors"
-
-	"github.com/boombuler/barcode/utils"
-)
-
-func encodeUnicode(content string, ecl ErrorCorrectionLevel) (*utils.BitList, *versionInfo, error) {
-	data := []byte(content)
-
-	vi := findSmallestVersionInfo(ecl, byteMode, len(data)*8)
-	if vi == nil {
-		return nil, nil, errors.New("To much data to encode")
-	}
-
-	// It's not correct to add the unicode bytes to the result directly but most readers can't handle the
-	// required ECI header...
-	res := new(utils.BitList)
-	res.AddBits(int(byteMode), 4)
-	res.AddBits(len(content), vi.charCountBits(byteMode))
-	for _, b := range data {
-		res.AddByte(b)
-	}
-	addPaddingAndTerminator(res, vi)
-	return res, vi, nil
-}

+ 0 - 310
vendor/github.com/boombuler/barcode/qr/versioninfo.go

@@ -1,310 +0,0 @@
-package qr
-
-import "math"
-
-// ErrorCorrectionLevel indicates the amount of "backup data" stored in the QR code
-type ErrorCorrectionLevel byte
-
-const (
-	// L recovers 7% of data
-	L ErrorCorrectionLevel = iota
-	// M recovers 15% of data
-	M
-	// Q recovers 25% of data
-	Q
-	// H recovers 30% of data
-	H
-)
-
-func (ecl ErrorCorrectionLevel) String() string {
-	switch ecl {
-	case L:
-		return "L"
-	case M:
-		return "M"
-	case Q:
-		return "Q"
-	case H:
-		return "H"
-	}
-	return "unknown"
-}
-
-type encodingMode byte
-
-const (
-	numericMode      encodingMode = 1
-	alphaNumericMode encodingMode = 2
-	byteMode         encodingMode = 4
-	kanjiMode        encodingMode = 8
-)
-
-type versionInfo struct {
-	Version                          byte
-	Level                            ErrorCorrectionLevel
-	ErrorCorrectionCodewordsPerBlock byte
-	NumberOfBlocksInGroup1           byte
-	DataCodeWordsPerBlockInGroup1    byte
-	NumberOfBlocksInGroup2           byte
-	DataCodeWordsPerBlockInGroup2    byte
-}
-
-var versionInfos = []*versionInfo{
-	&versionInfo{1, L, 7, 1, 19, 0, 0},
-	&versionInfo{1, M, 10, 1, 16, 0, 0},
-	&versionInfo{1, Q, 13, 1, 13, 0, 0},
-	&versionInfo{1, H, 17, 1, 9, 0, 0},
-	&versionInfo{2, L, 10, 1, 34, 0, 0},
-	&versionInfo{2, M, 16, 1, 28, 0, 0},
-	&versionInfo{2, Q, 22, 1, 22, 0, 0},
-	&versionInfo{2, H, 28, 1, 16, 0, 0},
-	&versionInfo{3, L, 15, 1, 55, 0, 0},
-	&versionInfo{3, M, 26, 1, 44, 0, 0},
-	&versionInfo{3, Q, 18, 2, 17, 0, 0},
-	&versionInfo{3, H, 22, 2, 13, 0, 0},
-	&versionInfo{4, L, 20, 1, 80, 0, 0},
-	&versionInfo{4, M, 18, 2, 32, 0, 0},
-	&versionInfo{4, Q, 26, 2, 24, 0, 0},
-	&versionInfo{4, H, 16, 4, 9, 0, 0},
-	&versionInfo{5, L, 26, 1, 108, 0, 0},
-	&versionInfo{5, M, 24, 2, 43, 0, 0},
-	&versionInfo{5, Q, 18, 2, 15, 2, 16},
-	&versionInfo{5, H, 22, 2, 11, 2, 12},
-	&versionInfo{6, L, 18, 2, 68, 0, 0},
-	&versionInfo{6, M, 16, 4, 27, 0, 0},
-	&versionInfo{6, Q, 24, 4, 19, 0, 0},
-	&versionInfo{6, H, 28, 4, 15, 0, 0},
-	&versionInfo{7, L, 20, 2, 78, 0, 0},
-	&versionInfo{7, M, 18, 4, 31, 0, 0},
-	&versionInfo{7, Q, 18, 2, 14, 4, 15},
-	&versionInfo{7, H, 26, 4, 13, 1, 14},
-	&versionInfo{8, L, 24, 2, 97, 0, 0},
-	&versionInfo{8, M, 22, 2, 38, 2, 39},
-	&versionInfo{8, Q, 22, 4, 18, 2, 19},
-	&versionInfo{8, H, 26, 4, 14, 2, 15},
-	&versionInfo{9, L, 30, 2, 116, 0, 0},
-	&versionInfo{9, M, 22, 3, 36, 2, 37},
-	&versionInfo{9, Q, 20, 4, 16, 4, 17},
-	&versionInfo{9, H, 24, 4, 12, 4, 13},
-	&versionInfo{10, L, 18, 2, 68, 2, 69},
-	&versionInfo{10, M, 26, 4, 43, 1, 44},
-	&versionInfo{10, Q, 24, 6, 19, 2, 20},
-	&versionInfo{10, H, 28, 6, 15, 2, 16},
-	&versionInfo{11, L, 20, 4, 81, 0, 0},
-	&versionInfo{11, M, 30, 1, 50, 4, 51},
-	&versionInfo{11, Q, 28, 4, 22, 4, 23},
-	&versionInfo{11, H, 24, 3, 12, 8, 13},
-	&versionInfo{12, L, 24, 2, 92, 2, 93},
-	&versionInfo{12, M, 22, 6, 36, 2, 37},
-	&versionInfo{12, Q, 26, 4, 20, 6, 21},
-	&versionInfo{12, H, 28, 7, 14, 4, 15},
-	&versionInfo{13, L, 26, 4, 107, 0, 0},
-	&versionInfo{13, M, 22, 8, 37, 1, 38},
-	&versionInfo{13, Q, 24, 8, 20, 4, 21},
-	&versionInfo{13, H, 22, 12, 11, 4, 12},
-	&versionInfo{14, L, 30, 3, 115, 1, 116},
-	&versionInfo{14, M, 24, 4, 40, 5, 41},
-	&versionInfo{14, Q, 20, 11, 16, 5, 17},
-	&versionInfo{14, H, 24, 11, 12, 5, 13},
-	&versionInfo{15, L, 22, 5, 87, 1, 88},
-	&versionInfo{15, M, 24, 5, 41, 5, 42},
-	&versionInfo{15, Q, 30, 5, 24, 7, 25},
-	&versionInfo{15, H, 24, 11, 12, 7, 13},
-	&versionInfo{16, L, 24, 5, 98, 1, 99},
-	&versionInfo{16, M, 28, 7, 45, 3, 46},
-	&versionInfo{16, Q, 24, 15, 19, 2, 20},
-	&versionInfo{16, H, 30, 3, 15, 13, 16},
-	&versionInfo{17, L, 28, 1, 107, 5, 108},
-	&versionInfo{17, M, 28, 10, 46, 1, 47},
-	&versionInfo{17, Q, 28, 1, 22, 15, 23},
-	&versionInfo{17, H, 28, 2, 14, 17, 15},
-	&versionInfo{18, L, 30, 5, 120, 1, 121},
-	&versionInfo{18, M, 26, 9, 43, 4, 44},
-	&versionInfo{18, Q, 28, 17, 22, 1, 23},
-	&versionInfo{18, H, 28, 2, 14, 19, 15},
-	&versionInfo{19, L, 28, 3, 113, 4, 114},
-	&versionInfo{19, M, 26, 3, 44, 11, 45},
-	&versionInfo{19, Q, 26, 17, 21, 4, 22},
-	&versionInfo{19, H, 26, 9, 13, 16, 14},
-	&versionInfo{20, L, 28, 3, 107, 5, 108},
-	&versionInfo{20, M, 26, 3, 41, 13, 42},
-	&versionInfo{20, Q, 30, 15, 24, 5, 25},
-	&versionInfo{20, H, 28, 15, 15, 10, 16},
-	&versionInfo{21, L, 28, 4, 116, 4, 117},
-	&versionInfo{21, M, 26, 17, 42, 0, 0},
-	&versionInfo{21, Q, 28, 17, 22, 6, 23},
-	&versionInfo{21, H, 30, 19, 16, 6, 17},
-	&versionInfo{22, L, 28, 2, 111, 7, 112},
-	&versionInfo{22, M, 28, 17, 46, 0, 0},
-	&versionInfo{22, Q, 30, 7, 24, 16, 25},
-	&versionInfo{22, H, 24, 34, 13, 0, 0},
-	&versionInfo{23, L, 30, 4, 121, 5, 122},
-	&versionInfo{23, M, 28, 4, 47, 14, 48},
-	&versionInfo{23, Q, 30, 11, 24, 14, 25},
-	&versionInfo{23, H, 30, 16, 15, 14, 16},
-	&versionInfo{24, L, 30, 6, 117, 4, 118},
-	&versionInfo{24, M, 28, 6, 45, 14, 46},
-	&versionInfo{24, Q, 30, 11, 24, 16, 25},
-	&versionInfo{24, H, 30, 30, 16, 2, 17},
-	&versionInfo{25, L, 26, 8, 106, 4, 107},
-	&versionInfo{25, M, 28, 8, 47, 13, 48},
-	&versionInfo{25, Q, 30, 7, 24, 22, 25},
-	&versionInfo{25, H, 30, 22, 15, 13, 16},
-	&versionInfo{26, L, 28, 10, 114, 2, 115},
-	&versionInfo{26, M, 28, 19, 46, 4, 47},
-	&versionInfo{26, Q, 28, 28, 22, 6, 23},
-	&versionInfo{26, H, 30, 33, 16, 4, 17},
-	&versionInfo{27, L, 30, 8, 122, 4, 123},
-	&versionInfo{27, M, 28, 22, 45, 3, 46},
-	&versionInfo{27, Q, 30, 8, 23, 26, 24},
-	&versionInfo{27, H, 30, 12, 15, 28, 16},
-	&versionInfo{28, L, 30, 3, 117, 10, 118},
-	&versionInfo{28, M, 28, 3, 45, 23, 46},
-	&versionInfo{28, Q, 30, 4, 24, 31, 25},
-	&versionInfo{28, H, 30, 11, 15, 31, 16},
-	&versionInfo{29, L, 30, 7, 116, 7, 117},
-	&versionInfo{29, M, 28, 21, 45, 7, 46},
-	&versionInfo{29, Q, 30, 1, 23, 37, 24},
-	&versionInfo{29, H, 30, 19, 15, 26, 16},
-	&versionInfo{30, L, 30, 5, 115, 10, 116},
-	&versionInfo{30, M, 28, 19, 47, 10, 48},
-	&versionInfo{30, Q, 30, 15, 24, 25, 25},
-	&versionInfo{30, H, 30, 23, 15, 25, 16},
-	&versionInfo{31, L, 30, 13, 115, 3, 116},
-	&versionInfo{31, M, 28, 2, 46, 29, 47},
-	&versionInfo{31, Q, 30, 42, 24, 1, 25},
-	&versionInfo{31, H, 30, 23, 15, 28, 16},
-	&versionInfo{32, L, 30, 17, 115, 0, 0},
-	&versionInfo{32, M, 28, 10, 46, 23, 47},
-	&versionInfo{32, Q, 30, 10, 24, 35, 25},
-	&versionInfo{32, H, 30, 19, 15, 35, 16},
-	&versionInfo{33, L, 30, 17, 115, 1, 116},
-	&versionInfo{33, M, 28, 14, 46, 21, 47},
-	&versionInfo{33, Q, 30, 29, 24, 19, 25},
-	&versionInfo{33, H, 30, 11, 15, 46, 16},
-	&versionInfo{34, L, 30, 13, 115, 6, 116},
-	&versionInfo{34, M, 28, 14, 46, 23, 47},
-	&versionInfo{34, Q, 30, 44, 24, 7, 25},
-	&versionInfo{34, H, 30, 59, 16, 1, 17},
-	&versionInfo{35, L, 30, 12, 121, 7, 122},
-	&versionInfo{35, M, 28, 12, 47, 26, 48},
-	&versionInfo{35, Q, 30, 39, 24, 14, 25},
-	&versionInfo{35, H, 30, 22, 15, 41, 16},
-	&versionInfo{36, L, 30, 6, 121, 14, 122},
-	&versionInfo{36, M, 28, 6, 47, 34, 48},
-	&versionInfo{36, Q, 30, 46, 24, 10, 25},
-	&versionInfo{36, H, 30, 2, 15, 64, 16},
-	&versionInfo{37, L, 30, 17, 122, 4, 123},
-	&versionInfo{37, M, 28, 29, 46, 14, 47},
-	&versionInfo{37, Q, 30, 49, 24, 10, 25},
-	&versionInfo{37, H, 30, 24, 15, 46, 16},
-	&versionInfo{38, L, 30, 4, 122, 18, 123},
-	&versionInfo{38, M, 28, 13, 46, 32, 47},
-	&versionInfo{38, Q, 30, 48, 24, 14, 25},
-	&versionInfo{38, H, 30, 42, 15, 32, 16},
-	&versionInfo{39, L, 30, 20, 117, 4, 118},
-	&versionInfo{39, M, 28, 40, 47, 7, 48},
-	&versionInfo{39, Q, 30, 43, 24, 22, 25},
-	&versionInfo{39, H, 30, 10, 15, 67, 16},
-	&versionInfo{40, L, 30, 19, 118, 6, 119},
-	&versionInfo{40, M, 28, 18, 47, 31, 48},
-	&versionInfo{40, Q, 30, 34, 24, 34, 25},
-	&versionInfo{40, H, 30, 20, 15, 61, 16},
-}
-
-func (vi *versionInfo) totalDataBytes() int {
-	g1Data := int(vi.NumberOfBlocksInGroup1) * int(vi.DataCodeWordsPerBlockInGroup1)
-	g2Data := int(vi.NumberOfBlocksInGroup2) * int(vi.DataCodeWordsPerBlockInGroup2)
-	return (g1Data + g2Data)
-}
-
-func (vi *versionInfo) charCountBits(m encodingMode) byte {
-	switch m {
-	case numericMode:
-		if vi.Version < 10 {
-			return 10
-		} else if vi.Version < 27 {
-			return 12
-		}
-		return 14
-
-	case alphaNumericMode:
-		if vi.Version < 10 {
-			return 9
-		} else if vi.Version < 27 {
-			return 11
-		}
-		return 13
-
-	case byteMode:
-		if vi.Version < 10 {
-			return 8
-		}
-		return 16
-
-	case kanjiMode:
-		if vi.Version < 10 {
-			return 8
-		} else if vi.Version < 27 {
-			return 10
-		}
-		return 12
-	default:
-		return 0
-	}
-}
-
-func (vi *versionInfo) modulWidth() int {
-	return ((int(vi.Version) - 1) * 4) + 21
-}
-
-func (vi *versionInfo) alignmentPatternPlacements() []int {
-	if vi.Version == 1 {
-		return make([]int, 0)
-	}
-
-	first := 6
-	last := vi.modulWidth() - 7
-	space := float64(last - first)
-	count := int(math.Ceil(space/28)) + 1
-
-	result := make([]int, count)
-	result[0] = first
-	result[len(result)-1] = last
-	if count > 2 {
-		step := int(math.Ceil(float64(last-first) / float64(count-1)))
-		if step%2 == 1 {
-			frac := float64(last-first) / float64(count-1)
-			_, x := math.Modf(frac)
-			if x >= 0.5 {
-				frac = math.Ceil(frac)
-			} else {
-				frac = math.Floor(frac)
-			}
-
-			if int(frac)%2 == 0 {
-				step--
-			} else {
-				step++
-			}
-		}
-
-		for i := 1; i <= count-2; i++ {
-			result[i] = last - (step * (count - 1 - i))
-		}
-	}
-
-	return result
-}
-
-func findSmallestVersionInfo(ecl ErrorCorrectionLevel, mode encodingMode, dataBits int) *versionInfo {
-	dataBits = dataBits + 4 // mode indicator
-	for _, vi := range versionInfos {
-		if vi.Level == ecl {
-			if (vi.totalDataBytes() * 8) >= (dataBits + int(vi.charCountBits(mode))) {
-				return vi
-			}
-		}
-	}
-	return nil
-}

+ 0 - 134
vendor/github.com/boombuler/barcode/scaledbarcode.go

@@ -1,134 +0,0 @@
-package barcode
-
-import (
-	"errors"
-	"fmt"
-	"image"
-	"image/color"
-	"math"
-)
-
-type wrapFunc func(x, y int) color.Color
-
-type scaledBarcode struct {
-	wrapped     Barcode
-	wrapperFunc wrapFunc
-	rect        image.Rectangle
-}
-
-type intCSscaledBC struct {
-	scaledBarcode
-}
-
-func (bc *scaledBarcode) Content() string {
-	return bc.wrapped.Content()
-}
-
-func (bc *scaledBarcode) Metadata() Metadata {
-	return bc.wrapped.Metadata()
-}
-
-func (bc *scaledBarcode) ColorModel() color.Model {
-	return bc.wrapped.ColorModel()
-}
-
-func (bc *scaledBarcode) Bounds() image.Rectangle {
-	return bc.rect
-}
-
-func (bc *scaledBarcode) At(x, y int) color.Color {
-	return bc.wrapperFunc(x, y)
-}
-
-func (bc *intCSscaledBC) CheckSum() int {
-	if cs, ok := bc.wrapped.(BarcodeIntCS); ok {
-		return cs.CheckSum()
-	}
-	return 0
-}
-
-// Scale returns a resized barcode with the given width and height.
-func Scale(bc Barcode, width, height int) (Barcode, error) {
-	switch bc.Metadata().Dimensions {
-	case 1:
-		return scale1DCode(bc, width, height)
-	case 2:
-		return scale2DCode(bc, width, height)
-	}
-
-	return nil, errors.New("unsupported barcode format")
-}
-
-func newScaledBC(wrapped Barcode, wrapperFunc wrapFunc, rect image.Rectangle) Barcode {
-	result := &scaledBarcode{
-		wrapped:     wrapped,
-		wrapperFunc: wrapperFunc,
-		rect:        rect,
-	}
-
-	if _, ok := wrapped.(BarcodeIntCS); ok {
-		return &intCSscaledBC{*result}
-	}
-	return result
-}
-
-func scale2DCode(bc Barcode, width, height int) (Barcode, error) {
-	orgBounds := bc.Bounds()
-	orgWidth := orgBounds.Max.X - orgBounds.Min.X
-	orgHeight := orgBounds.Max.Y - orgBounds.Min.Y
-
-	factor := int(math.Min(float64(width)/float64(orgWidth), float64(height)/float64(orgHeight)))
-	if factor <= 0 {
-		return nil, fmt.Errorf("can not scale barcode to an image smaller than %dx%d", orgWidth, orgHeight)
-	}
-
-	offsetX := (width - (orgWidth * factor)) / 2
-	offsetY := (height - (orgHeight * factor)) / 2
-
-	wrap := func(x, y int) color.Color {
-		if x < offsetX || y < offsetY {
-			return color.White
-		}
-		x = (x - offsetX) / factor
-		y = (y - offsetY) / factor
-		if x >= orgWidth || y >= orgHeight {
-			return color.White
-		}
-		return bc.At(x, y)
-	}
-
-	return newScaledBC(
-		bc,
-		wrap,
-		image.Rect(0, 0, width, height),
-	), nil
-}
-
-func scale1DCode(bc Barcode, width, height int) (Barcode, error) {
-	orgBounds := bc.Bounds()
-	orgWidth := orgBounds.Max.X - orgBounds.Min.X
-	factor := int(float64(width) / float64(orgWidth))
-
-	if factor <= 0 {
-		return nil, fmt.Errorf("can not scale barcode to an image smaller than %dx1", orgWidth)
-	}
-	offsetX := (width - (orgWidth * factor)) / 2
-
-	wrap := func(x, y int) color.Color {
-		if x < offsetX {
-			return color.White
-		}
-		x = (x - offsetX) / factor
-
-		if x >= orgWidth {
-			return color.White
-		}
-		return bc.At(x, 0)
-	}
-
-	return newScaledBC(
-		bc,
-		wrap,
-		image.Rect(0, 0, width, height),
-	), nil
-}

+ 0 - 57
vendor/github.com/boombuler/barcode/utils/base1dcode.go

@@ -1,57 +0,0 @@
-// Package utils contain some utilities which are needed to create barcodes
-package utils
-
-import (
-	"image"
-	"image/color"
-
-	"github.com/boombuler/barcode"
-)
-
-type base1DCode struct {
-	*BitList
-	kind    string
-	content string
-}
-
-type base1DCodeIntCS struct {
-	base1DCode
-	checksum int
-}
-
-func (c *base1DCode) Content() string {
-	return c.content
-}
-
-func (c *base1DCode) Metadata() barcode.Metadata {
-	return barcode.Metadata{c.kind, 1}
-}
-
-func (c *base1DCode) ColorModel() color.Model {
-	return color.Gray16Model
-}
-
-func (c *base1DCode) Bounds() image.Rectangle {
-	return image.Rect(0, 0, c.Len(), 1)
-}
-
-func (c *base1DCode) At(x, y int) color.Color {
-	if c.GetBit(x) {
-		return color.Black
-	}
-	return color.White
-}
-
-func (c *base1DCodeIntCS) CheckSum() int {
-	return c.checksum
-}
-
-// New1DCodeIntCheckSum creates a new 1D barcode where the bars are represented by the bits in the bars BitList
-func New1DCodeIntCheckSum(codeKind, content string, bars *BitList, checksum int) barcode.BarcodeIntCS {
-	return &base1DCodeIntCS{base1DCode{bars, codeKind, content}, checksum}
-}
-
-// New1DCode creates a new 1D barcode where the bars are represented by the bits in the bars BitList
-func New1DCode(codeKind, content string, bars *BitList) barcode.Barcode {
-	return &base1DCode{bars, codeKind, content}
-}

+ 0 - 119
vendor/github.com/boombuler/barcode/utils/bitlist.go

@@ -1,119 +0,0 @@
-package utils
-
-// BitList is a list that contains bits
-type BitList struct {
-	count int
-	data  []int32
-}
-
-// NewBitList returns a new BitList with the given length
-// all bits are initialize with false
-func NewBitList(capacity int) *BitList {
-	bl := new(BitList)
-	bl.count = capacity
-	x := 0
-	if capacity%32 != 0 {
-		x = 1
-	}
-	bl.data = make([]int32, capacity/32+x)
-	return bl
-}
-
-// Len returns the number of contained bits
-func (bl *BitList) Len() int {
-	return bl.count
-}
-
-func (bl *BitList) grow() {
-	growBy := len(bl.data)
-	if growBy < 128 {
-		growBy = 128
-	} else if growBy >= 1024 {
-		growBy = 1024
-	}
-
-	nd := make([]int32, len(bl.data)+growBy)
-	copy(nd, bl.data)
-	bl.data = nd
-}
-
-// AddBit appends the given bits to the end of the list
-func (bl *BitList) AddBit(bits ...bool) {
-	for _, bit := range bits {
-		itmIndex := bl.count / 32
-		for itmIndex >= len(bl.data) {
-			bl.grow()
-		}
-		bl.SetBit(bl.count, bit)
-		bl.count++
-	}
-}
-
-// SetBit sets the bit at the given index to the given value
-func (bl *BitList) SetBit(index int, value bool) {
-	itmIndex := index / 32
-	itmBitShift := 31 - (index % 32)
-	if value {
-		bl.data[itmIndex] = bl.data[itmIndex] | 1<<uint(itmBitShift)
-	} else {
-		bl.data[itmIndex] = bl.data[itmIndex] & ^(1 << uint(itmBitShift))
-	}
-}
-
-// GetBit returns the bit at the given index
-func (bl *BitList) GetBit(index int) bool {
-	itmIndex := index / 32
-	itmBitShift := 31 - (index % 32)
-	return ((bl.data[itmIndex] >> uint(itmBitShift)) & 1) == 1
-}
-
-// AddByte appends all 8 bits of the given byte to the end of the list
-func (bl *BitList) AddByte(b byte) {
-	for i := 7; i >= 0; i-- {
-		bl.AddBit(((b >> uint(i)) & 1) == 1)
-	}
-}
-
-// AddBits appends the last (LSB) 'count' bits of 'b' the the end of the list
-func (bl *BitList) AddBits(b int, count byte) {
-	for i := int(count) - 1; i >= 0; i-- {
-		bl.AddBit(((b >> uint(i)) & 1) == 1)
-	}
-}
-
-// GetBytes returns all bits of the BitList as a []byte
-func (bl *BitList) GetBytes() []byte {
-	len := bl.count >> 3
-	if (bl.count % 8) != 0 {
-		len++
-	}
-	result := make([]byte, len)
-	for i := 0; i < len; i++ {
-		shift := (3 - (i % 4)) * 8
-		result[i] = (byte)((bl.data[i/4] >> uint(shift)) & 0xFF)
-	}
-	return result
-}
-
-// IterateBytes iterates through all bytes contained in the BitList
-func (bl *BitList) IterateBytes() <-chan byte {
-	res := make(chan byte)
-
-	go func() {
-		c := bl.count
-		shift := 24
-		i := 0
-		for c > 0 {
-			res <- byte((bl.data[i] >> uint(shift)) & 0xFF)
-			shift -= 8
-			if shift < 0 {
-				shift = 24
-				i++
-			}
-			c -= 8
-		}
-		close(res)
-	}()
-
-	return res
-}

+ 0 - 65
vendor/github.com/boombuler/barcode/utils/galoisfield.go

@@ -1,65 +0,0 @@
-package utils
-
-// GaloisField encapsulates galois field arithmetics
-type GaloisField struct {
-	Size    int
-	Base    int
-	ALogTbl []int
-	LogTbl  []int
-}
-
-// NewGaloisField creates a new galois field
-func NewGaloisField(pp, fieldSize, b int) *GaloisField {
-	result := new(GaloisField)
-
-	result.Size = fieldSize
-	result.Base = b
-	result.ALogTbl = make([]int, fieldSize)
-	result.LogTbl = make([]int, fieldSize)
-
-	x := 1
-	for i := 0; i < fieldSize; i++ {
-		result.ALogTbl[i] = x
-		x = x * 2
-		if x >= fieldSize {
-			x = (x ^ pp) & (fieldSize - 1)
-		}
-	}
-
-	for i := 0; i < fieldSize; i++ {
-		result.LogTbl[result.ALogTbl[i]] = int(i)
-	}
-
-	return result
-}
-
-func (gf *GaloisField) Zero() *GFPoly {
-	return NewGFPoly(gf, []int{0})
-}
-
-// AddOrSub add or substract two numbers
-func (gf *GaloisField) AddOrSub(a, b int) int {
-	return a ^ b
-}
-
-// Multiply multiplys two numbers
-func (gf *GaloisField) Multiply(a, b int) int {
-	if a == 0 || b == 0 {
-		return 0
-	}
-	return gf.ALogTbl[(gf.LogTbl[a]+gf.LogTbl[b])%(gf.Size-1)]
-}
-
-// Divide divides two numbers
-func (gf *GaloisField) Divide(a, b int) int {
-	if b == 0 {
-		panic("divide by zero")
-	} else if a == 0 {
-		return 0
-	}
-	return gf.ALogTbl[(gf.LogTbl[a]-gf.LogTbl[b])%(gf.Size-1)]
-}
-
-func (gf *GaloisField) Invers(num int) int {
-	return gf.ALogTbl[(gf.Size-1)-gf.LogTbl[num]]
-}

+ 0 - 103
vendor/github.com/boombuler/barcode/utils/gfpoly.go

@@ -1,103 +0,0 @@
-package utils
-
-type GFPoly struct {
-	gf           *GaloisField
-	Coefficients []int
-}
-
-func (gp *GFPoly) Degree() int {
-	return len(gp.Coefficients) - 1
-}
-
-func (gp *GFPoly) Zero() bool {
-	return gp.Coefficients[0] == 0
-}
-
-// GetCoefficient returns the coefficient of x ^ degree
-func (gp *GFPoly) GetCoefficient(degree int) int {
-	return gp.Coefficients[gp.Degree()-degree]
-}
-
-func (gp *GFPoly) AddOrSubstract(other *GFPoly) *GFPoly {
-	if gp.Zero() {
-		return other
-	} else if other.Zero() {
-		return gp
-	}
-	smallCoeff := gp.Coefficients
-	largeCoeff := other.Coefficients
-	if len(smallCoeff) > len(largeCoeff) {
-		largeCoeff, smallCoeff = smallCoeff, largeCoeff
-	}
-	sumDiff := make([]int, len(largeCoeff))
-	lenDiff := len(largeCoeff) - len(smallCoeff)
-	copy(sumDiff, largeCoeff[:lenDiff])
-	for i := lenDiff; i < len(largeCoeff); i++ {
-		sumDiff[i] = int(gp.gf.AddOrSub(int(smallCoeff[i-lenDiff]), int(largeCoeff[i])))
-	}
-	return NewGFPoly(gp.gf, sumDiff)
-}
-
-func (gp *GFPoly) MultByMonominal(degree int, coeff int) *GFPoly {
-	if coeff == 0 {
-		return gp.gf.Zero()
-	}
-	size := len(gp.Coefficients)
-	result := make([]int, size+degree)
-	for i := 0; i < size; i++ {
-		result[i] = int(gp.gf.Multiply(int(gp.Coefficients[i]), int(coeff)))
-	}
-	return NewGFPoly(gp.gf, result)
-}
-
-func (gp *GFPoly) Multiply(other *GFPoly) *GFPoly {
-	if gp.Zero() || other.Zero() {
-		return gp.gf.Zero()
-	}
-	aCoeff := gp.Coefficients
-	aLen := len(aCoeff)
-	bCoeff := other.Coefficients
-	bLen := len(bCoeff)
-	product := make([]int, aLen+bLen-1)
-	for i := 0; i < aLen; i++ {
-		ac := int(aCoeff[i])
-		for j := 0; j < bLen; j++ {
-			bc := int(bCoeff[j])
-			product[i+j] = int(gp.gf.AddOrSub(int(product[i+j]), gp.gf.Multiply(ac, bc)))
-		}
-	}
-	return NewGFPoly(gp.gf, product)
-}
-
-func (gp *GFPoly) Divide(other *GFPoly) (quotient *GFPoly, remainder *GFPoly) {
-	quotient = gp.gf.Zero()
-	remainder = gp
-	fld := gp.gf
-	denomLeadTerm := other.GetCoefficient(other.Degree())
-	inversDenomLeadTerm := fld.Invers(int(denomLeadTerm))
-	for remainder.Degree() >= other.Degree() && !remainder.Zero() {
-		degreeDiff := remainder.Degree() - other.Degree()
-		scale := int(fld.Multiply(int(remainder.GetCoefficient(remainder.Degree())), inversDenomLeadTerm))
-		term := other.MultByMonominal(degreeDiff, scale)
-		itQuot := NewMonominalPoly(fld, degreeDiff, scale)
-		quotient = quotient.AddOrSubstract(itQuot)
-		remainder = remainder.AddOrSubstract(term)
-	}
-	return
-}
-
-func NewMonominalPoly(field *GaloisField, degree int, coeff int) *GFPoly {
-	if coeff == 0 {
-		return field.Zero()
-	}
-	result := make([]int, degree+1)
-	result[0] = coeff
-	return NewGFPoly(field, result)
-}
-
-func NewGFPoly(field *GaloisField, coefficients []int) *GFPoly {
-	for len(coefficients) > 1 && coefficients[0] == 0 {
-		coefficients = coefficients[1:]
-	}
-	return &GFPoly{field, coefficients}
-}

+ 0 - 44
vendor/github.com/boombuler/barcode/utils/reedsolomon.go

@@ -1,44 +0,0 @@
-package utils
-
-import (
-	"sync"
-)
-
-type ReedSolomonEncoder struct {
-	gf        *GaloisField
-	polynomes []*GFPoly
-	m         *sync.Mutex
-}
-
-func NewReedSolomonEncoder(gf *GaloisField) *ReedSolomonEncoder {
-	return &ReedSolomonEncoder{
-		gf, []*GFPoly{NewGFPoly(gf, []int{1})}, new(sync.Mutex),
-	}
-}
-
-func (rs *ReedSolomonEncoder) getPolynomial(degree int) *GFPoly {
-	rs.m.Lock()
-	defer rs.m.Unlock()
-
-	if degree >= len(rs.polynomes) {
-		last := rs.polynomes[len(rs.polynomes)-1]
-		for d := len(rs.polynomes); d <= degree; d++ {
-			next := last.Multiply(NewGFPoly(rs.gf, []int{1, rs.gf.ALogTbl[d-1+rs.gf.Base]}))
-			rs.polynomes = append(rs.polynomes, next)
-			last = next
-		}
-	}
-	return rs.polynomes[degree]
-}
-
-func (rs *ReedSolomonEncoder) Encode(data []int, eccCount int) []int {
-	generator := rs.getPolynomial(eccCount)
-	info := NewGFPoly(rs.gf, data)
-	info = info.MultByMonominal(eccCount, 1)
-	_, remainder := info.Divide(generator)
-
-	result := make([]int, eccCount)
-	numZero := int(eccCount) - len(remainder.Coefficients)
-	copy(result[numZero:], remainder.Coefficients)
-	return result
-}

+ 0 - 19
vendor/github.com/boombuler/barcode/utils/runeint.go

@@ -1,19 +0,0 @@
-package utils
-
-// RuneToInt converts a rune between '0' and '9' to an integer between 0 and 9
-// If the rune is outside of this range -1 is returned.
-func RuneToInt(r rune) int {
-	if r >= '0' && r <= '9' {
-		return int(r - '0')
-	}
-	return -1
-}
-
-// IntToRune converts a digit 0 - 9 to the rune '0' - '9'. If the given int is outside
-// of this range 'F' is returned!
-func IntToRune(i int) rune {
-	if i >= 0 && i <= 9 {
-		return rune(i + '0')
-	}
-	return 'F'
-}

+ 0 - 202
vendor/github.com/bradfitz/gomemcache/LICENSE

@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.

+ 0 - 687
vendor/github.com/bradfitz/gomemcache/memcache/memcache.go

@@ -1,687 +0,0 @@
-/*
-Copyright 2011 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.
-*/
-
-// Package memcache provides a client for the memcached cache server.
-package memcache
-
-import (
-	"bufio"
-	"bytes"
-	"errors"
-	"fmt"
-	"io"
-	"net"
-
-	"strconv"
-	"strings"
-	"sync"
-	"time"
-)
-
-// Similar to:
-// https://godoc.org/google.golang.org/appengine/memcache
-
-var (
-	// ErrCacheMiss means that a Get failed because the item wasn't present.
-	ErrCacheMiss = errors.New("memcache: cache miss")
-
-	// ErrCASConflict means that a CompareAndSwap call failed due to the
-	// cached value being modified between the Get and the CompareAndSwap.
-	// If the cached value was simply evicted rather than replaced,
-	// ErrNotStored will be returned instead.
-	ErrCASConflict = errors.New("memcache: compare-and-swap conflict")
-
-	// ErrNotStored means that a conditional write operation (i.e. Add or
-	// CompareAndSwap) failed because the condition was not satisfied.
-	ErrNotStored = errors.New("memcache: item not stored")
-
-	// ErrServer means that a server error occurred.
-	ErrServerError = errors.New("memcache: server error")
-
-	// ErrNoStats means that no statistics were available.
-	ErrNoStats = errors.New("memcache: no statistics available")
-
-	// ErrMalformedKey is returned when an invalid key is used.
-	// Keys must be at maximum 250 bytes long and not
-	// contain whitespace or control characters.
-	ErrMalformedKey = errors.New("malformed: key is too long or contains invalid characters")
-
-	// ErrNoServers is returned when no servers are configured or available.
-	ErrNoServers = errors.New("memcache: no servers configured or available")
-)
-
-const (
-	// DefaultTimeout is the default socket read/write timeout.
-	DefaultTimeout = 100 * time.Millisecond
-
-	// DefaultMaxIdleConns is the default maximum number of idle connections
-	// kept for any single address.
-	DefaultMaxIdleConns = 2
-)
-
-const buffered = 8 // arbitrary buffered channel size, for readability
-
-// resumableError returns true if err is only a protocol-level cache error.
-// This is used to determine whether or not a server connection should
-// be re-used or not. If an error occurs, by default we don't reuse the
-// connection, unless it was just a cache error.
-func resumableError(err error) bool {
-	switch err {
-	case ErrCacheMiss, ErrCASConflict, ErrNotStored, ErrMalformedKey:
-		return true
-	}
-	return false
-}
-
-func legalKey(key string) bool {
-	if len(key) > 250 {
-		return false
-	}
-	for i := 0; i < len(key); i++ {
-		if key[i] <= ' ' || key[i] == 0x7f {
-			return false
-		}
-	}
-	return true
-}
-
-var (
-	crlf            = []byte("\r\n")
-	space           = []byte(" ")
-	resultOK        = []byte("OK\r\n")
-	resultStored    = []byte("STORED\r\n")
-	resultNotStored = []byte("NOT_STORED\r\n")
-	resultExists    = []byte("EXISTS\r\n")
-	resultNotFound  = []byte("NOT_FOUND\r\n")
-	resultDeleted   = []byte("DELETED\r\n")
-	resultEnd       = []byte("END\r\n")
-	resultOk        = []byte("OK\r\n")
-	resultTouched   = []byte("TOUCHED\r\n")
-
-	resultClientErrorPrefix = []byte("CLIENT_ERROR ")
-)
-
-// New returns a memcache client using the provided server(s)
-// with equal weight. If a server is listed multiple times,
-// it gets a proportional amount of weight.
-func New(server ...string) *Client {
-	ss := new(ServerList)
-	ss.SetServers(server...)
-	return NewFromSelector(ss)
-}
-
-// NewFromSelector returns a new Client using the provided ServerSelector.
-func NewFromSelector(ss ServerSelector) *Client {
-	return &Client{selector: ss}
-}
-
-// Client is a memcache client.
-// It is safe for unlocked use by multiple concurrent goroutines.
-type Client struct {
-	// Timeout specifies the socket read/write timeout.
-	// If zero, DefaultTimeout is used.
-	Timeout time.Duration
-
-	// MaxIdleConns specifies the maximum number of idle connections that will
-	// be maintained per address. If less than one, DefaultMaxIdleConns will be
-	// used.
-	//
-	// Consider your expected traffic rates and latency carefully. This should
-	// be set to a number higher than your peak parallel requests.
-	MaxIdleConns int
-
-	selector ServerSelector
-
-	lk       sync.Mutex
-	freeconn map[string][]*conn
-}
-
-// Item is an item to be got or stored in a memcached server.
-type Item struct {
-	// Key is the Item's key (250 bytes maximum).
-	Key string
-
-	// Value is the Item's value.
-	Value []byte
-
-	// Flags are server-opaque flags whose semantics are entirely
-	// up to the app.
-	Flags uint32
-
-	// Expiration is the cache expiration time, in seconds: either a relative
-	// time from now (up to 1 month), or an absolute Unix epoch time.
-	// Zero means the Item has no expiration time.
-	Expiration int32
-
-	// Compare and swap ID.
-	casid uint64
-}
-
-// conn is a connection to a server.
-type conn struct {
-	nc   net.Conn
-	rw   *bufio.ReadWriter
-	addr net.Addr
-	c    *Client
-}
-
-// release returns this connection back to the client's free pool
-func (cn *conn) release() {
-	cn.c.putFreeConn(cn.addr, cn)
-}
-
-func (cn *conn) extendDeadline() {
-	cn.nc.SetDeadline(time.Now().Add(cn.c.netTimeout()))
-}
-
-// condRelease releases this connection if the error pointed to by err
-// is nil (not an error) or is only a protocol level error (e.g. a
-// cache miss).  The purpose is to not recycle TCP connections that
-// are bad.
-func (cn *conn) condRelease(err *error) {
-	if *err == nil || resumableError(*err) {
-		cn.release()
-	} else {
-		cn.nc.Close()
-	}
-}
-
-func (c *Client) putFreeConn(addr net.Addr, cn *conn) {
-	c.lk.Lock()
-	defer c.lk.Unlock()
-	if c.freeconn == nil {
-		c.freeconn = make(map[string][]*conn)
-	}
-	freelist := c.freeconn[addr.String()]
-	if len(freelist) >= c.maxIdleConns() {
-		cn.nc.Close()
-		return
-	}
-	c.freeconn[addr.String()] = append(freelist, cn)
-}
-
-func (c *Client) getFreeConn(addr net.Addr) (cn *conn, ok bool) {
-	c.lk.Lock()
-	defer c.lk.Unlock()
-	if c.freeconn == nil {
-		return nil, false
-	}
-	freelist, ok := c.freeconn[addr.String()]
-	if !ok || len(freelist) == 0 {
-		return nil, false
-	}
-	cn = freelist[len(freelist)-1]
-	c.freeconn[addr.String()] = freelist[:len(freelist)-1]
-	return cn, true
-}
-
-func (c *Client) netTimeout() time.Duration {
-	if c.Timeout != 0 {
-		return c.Timeout
-	}
-	return DefaultTimeout
-}
-
-func (c *Client) maxIdleConns() int {
-	if c.MaxIdleConns > 0 {
-		return c.MaxIdleConns
-	}
-	return DefaultMaxIdleConns
-}
-
-// ConnectTimeoutError is the error type used when it takes
-// too long to connect to the desired host. This level of
-// detail can generally be ignored.
-type ConnectTimeoutError struct {
-	Addr net.Addr
-}
-
-func (cte *ConnectTimeoutError) Error() string {
-	return "memcache: connect timeout to " + cte.Addr.String()
-}
-
-func (c *Client) dial(addr net.Addr) (net.Conn, error) {
-	type connError struct {
-		cn  net.Conn
-		err error
-	}
-
-	nc, err := net.DialTimeout(addr.Network(), addr.String(), c.netTimeout())
-	if err == nil {
-		return nc, nil
-	}
-
-	if ne, ok := err.(net.Error); ok && ne.Timeout() {
-		return nil, &ConnectTimeoutError{addr}
-	}
-
-	return nil, err
-}
-
-func (c *Client) getConn(addr net.Addr) (*conn, error) {
-	cn, ok := c.getFreeConn(addr)
-	if ok {
-		cn.extendDeadline()
-		return cn, nil
-	}
-	nc, err := c.dial(addr)
-	if err != nil {
-		return nil, err
-	}
-	cn = &conn{
-		nc:   nc,
-		addr: addr,
-		rw:   bufio.NewReadWriter(bufio.NewReader(nc), bufio.NewWriter(nc)),
-		c:    c,
-	}
-	cn.extendDeadline()
-	return cn, nil
-}
-
-func (c *Client) onItem(item *Item, fn func(*Client, *bufio.ReadWriter, *Item) error) error {
-	addr, err := c.selector.PickServer(item.Key)
-	if err != nil {
-		return err
-	}
-	cn, err := c.getConn(addr)
-	if err != nil {
-		return err
-	}
-	defer cn.condRelease(&err)
-	if err = fn(c, cn.rw, item); err != nil {
-		return err
-	}
-	return nil
-}
-
-func (c *Client) FlushAll() error {
-	return c.selector.Each(c.flushAllFromAddr)
-}
-
-// Get gets the item for the given key. ErrCacheMiss is returned for a
-// memcache cache miss. The key must be at most 250 bytes in length.
-func (c *Client) Get(key string) (item *Item, err error) {
-	err = c.withKeyAddr(key, func(addr net.Addr) error {
-		return c.getFromAddr(addr, []string{key}, func(it *Item) { item = it })
-	})
-	if err == nil && item == nil {
-		err = ErrCacheMiss
-	}
-	return
-}
-
-// Touch updates the expiry for the given key. The seconds parameter is either
-// a Unix timestamp or, if seconds is less than 1 month, the number of seconds
-// into the future at which time the item will expire. Zero means the item has
-// no expiration time. ErrCacheMiss is returned if the key is not in the cache.
-// The key must be at most 250 bytes in length.
-func (c *Client) Touch(key string, seconds int32) (err error) {
-	return c.withKeyAddr(key, func(addr net.Addr) error {
-		return c.touchFromAddr(addr, []string{key}, seconds)
-	})
-}
-
-func (c *Client) withKeyAddr(key string, fn func(net.Addr) error) (err error) {
-	if !legalKey(key) {
-		return ErrMalformedKey
-	}
-	addr, err := c.selector.PickServer(key)
-	if err != nil {
-		return err
-	}
-	return fn(addr)
-}
-
-func (c *Client) withAddrRw(addr net.Addr, fn func(*bufio.ReadWriter) error) (err error) {
-	cn, err := c.getConn(addr)
-	if err != nil {
-		return err
-	}
-	defer cn.condRelease(&err)
-	return fn(cn.rw)
-}
-
-func (c *Client) withKeyRw(key string, fn func(*bufio.ReadWriter) error) error {
-	return c.withKeyAddr(key, func(addr net.Addr) error {
-		return c.withAddrRw(addr, fn)
-	})
-}
-
-func (c *Client) getFromAddr(addr net.Addr, keys []string, cb func(*Item)) error {
-	return c.withAddrRw(addr, func(rw *bufio.ReadWriter) error {
-		if _, err := fmt.Fprintf(rw, "gets %s\r\n", strings.Join(keys, " ")); err != nil {
-			return err
-		}
-		if err := rw.Flush(); err != nil {
-			return err
-		}
-		if err := parseGetResponse(rw.Reader, cb); err != nil {
-			return err
-		}
-		return nil
-	})
-}
-
-// flushAllFromAddr send the flush_all command to the given addr
-func (c *Client) flushAllFromAddr(addr net.Addr) error {
-	return c.withAddrRw(addr, func(rw *bufio.ReadWriter) error {
-		if _, err := fmt.Fprintf(rw, "flush_all\r\n"); err != nil {
-			return err
-		}
-		if err := rw.Flush(); err != nil {
-			return err
-		}
-		line, err := rw.ReadSlice('\n')
-		if err != nil {
-			return err
-		}
-		switch {
-		case bytes.Equal(line, resultOk):
-			break
-		default:
-			return fmt.Errorf("memcache: unexpected response line from flush_all: %q", string(line))
-		}
-		return nil
-	})
-}
-
-func (c *Client) touchFromAddr(addr net.Addr, keys []string, expiration int32) error {
-	return c.withAddrRw(addr, func(rw *bufio.ReadWriter) error {
-		for _, key := range keys {
-			if _, err := fmt.Fprintf(rw, "touch %s %d\r\n", key, expiration); err != nil {
-				return err
-			}
-			if err := rw.Flush(); err != nil {
-				return err
-			}
-			line, err := rw.ReadSlice('\n')
-			if err != nil {
-				return err
-			}
-			switch {
-			case bytes.Equal(line, resultTouched):
-				break
-			case bytes.Equal(line, resultNotFound):
-				return ErrCacheMiss
-			default:
-				return fmt.Errorf("memcache: unexpected response line from touch: %q", string(line))
-			}
-		}
-		return nil
-	})
-}
-
-// GetMulti is a batch version of Get. The returned map from keys to
-// items may have fewer elements than the input slice, due to memcache
-// cache misses. Each key must be at most 250 bytes in length.
-// If no error is returned, the returned map will also be non-nil.
-func (c *Client) GetMulti(keys []string) (map[string]*Item, error) {
-	var lk sync.Mutex
-	m := make(map[string]*Item)
-	addItemToMap := func(it *Item) {
-		lk.Lock()
-		defer lk.Unlock()
-		m[it.Key] = it
-	}
-
-	keyMap := make(map[net.Addr][]string)
-	for _, key := range keys {
-		if !legalKey(key) {
-			return nil, ErrMalformedKey
-		}
-		addr, err := c.selector.PickServer(key)
-		if err != nil {
-			return nil, err
-		}
-		keyMap[addr] = append(keyMap[addr], key)
-	}
-
-	ch := make(chan error, buffered)
-	for addr, keys := range keyMap {
-		go func(addr net.Addr, keys []string) {
-			ch <- c.getFromAddr(addr, keys, addItemToMap)
-		}(addr, keys)
-	}
-
-	var err error
-	for _ = range keyMap {
-		if ge := <-ch; ge != nil {
-			err = ge
-		}
-	}
-	return m, err
-}
-
-// parseGetResponse reads a GET response from r and calls cb for each
-// read and allocated Item
-func parseGetResponse(r *bufio.Reader, cb func(*Item)) error {
-	for {
-		line, err := r.ReadSlice('\n')
-		if err != nil {
-			return err
-		}
-		if bytes.Equal(line, resultEnd) {
-			return nil
-		}
-		it := new(Item)
-		size, err := scanGetResponseLine(line, it)
-		if err != nil {
-			return err
-		}
-		it.Value = make([]byte, size+2)
-		_, err = io.ReadFull(r, it.Value)
-		if err != nil {
-			it.Value = nil
-			return err
-		}
-		if !bytes.HasSuffix(it.Value, crlf) {
-			it.Value = nil
-			return fmt.Errorf("memcache: corrupt get result read")
-		}
-		it.Value = it.Value[:size]
-		cb(it)
-	}
-}
-
-// scanGetResponseLine populates it and returns the declared size of the item.
-// It does not read the bytes of the item.
-func scanGetResponseLine(line []byte, it *Item) (size int, err error) {
-	pattern := "VALUE %s %d %d %d\r\n"
-	dest := []interface{}{&it.Key, &it.Flags, &size, &it.casid}
-	if bytes.Count(line, space) == 3 {
-		pattern = "VALUE %s %d %d\r\n"
-		dest = dest[:3]
-	}
-	n, err := fmt.Sscanf(string(line), pattern, dest...)
-	if err != nil || n != len(dest) {
-		return -1, fmt.Errorf("memcache: unexpected line in get response: %q", line)
-	}
-	return size, nil
-}
-
-// Set writes the given item, unconditionally.
-func (c *Client) Set(item *Item) error {
-	return c.onItem(item, (*Client).set)
-}
-
-func (c *Client) set(rw *bufio.ReadWriter, item *Item) error {
-	return c.populateOne(rw, "set", item)
-}
-
-// Add writes the given item, if no value already exists for its
-// key. ErrNotStored is returned if that condition is not met.
-func (c *Client) Add(item *Item) error {
-	return c.onItem(item, (*Client).add)
-}
-
-func (c *Client) add(rw *bufio.ReadWriter, item *Item) error {
-	return c.populateOne(rw, "add", item)
-}
-
-// Replace writes the given item, but only if the server *does*
-// already hold data for this key
-func (c *Client) Replace(item *Item) error {
-	return c.onItem(item, (*Client).replace)
-}
-
-func (c *Client) replace(rw *bufio.ReadWriter, item *Item) error {
-	return c.populateOne(rw, "replace", item)
-}
-
-// CompareAndSwap writes the given item that was previously returned
-// by Get, if the value was neither modified or evicted between the
-// Get and the CompareAndSwap calls. The item's Key should not change
-// between calls but all other item fields may differ. ErrCASConflict
-// is returned if the value was modified in between the
-// calls. ErrNotStored is returned if the value was evicted in between
-// the calls.
-func (c *Client) CompareAndSwap(item *Item) error {
-	return c.onItem(item, (*Client).cas)
-}
-
-func (c *Client) cas(rw *bufio.ReadWriter, item *Item) error {
-	return c.populateOne(rw, "cas", item)
-}
-
-func (c *Client) populateOne(rw *bufio.ReadWriter, verb string, item *Item) error {
-	if !legalKey(item.Key) {
-		return ErrMalformedKey
-	}
-	var err error
-	if verb == "cas" {
-		_, err = fmt.Fprintf(rw, "%s %s %d %d %d %d\r\n",
-			verb, item.Key, item.Flags, item.Expiration, len(item.Value), item.casid)
-	} else {
-		_, err = fmt.Fprintf(rw, "%s %s %d %d %d\r\n",
-			verb, item.Key, item.Flags, item.Expiration, len(item.Value))
-	}
-	if err != nil {
-		return err
-	}
-	if _, err = rw.Write(item.Value); err != nil {
-		return err
-	}
-	if _, err := rw.Write(crlf); err != nil {
-		return err
-	}
-	if err := rw.Flush(); err != nil {
-		return err
-	}
-	line, err := rw.ReadSlice('\n')
-	if err != nil {
-		return err
-	}
-	switch {
-	case bytes.Equal(line, resultStored):
-		return nil
-	case bytes.Equal(line, resultNotStored):
-		return ErrNotStored
-	case bytes.Equal(line, resultExists):
-		return ErrCASConflict
-	case bytes.Equal(line, resultNotFound):
-		return ErrCacheMiss
-	}
-	return fmt.Errorf("memcache: unexpected response line from %q: %q", verb, string(line))
-}
-
-func writeReadLine(rw *bufio.ReadWriter, format string, args ...interface{}) ([]byte, error) {
-	_, err := fmt.Fprintf(rw, format, args...)
-	if err != nil {
-		return nil, err
-	}
-	if err := rw.Flush(); err != nil {
-		return nil, err
-	}
-	line, err := rw.ReadSlice('\n')
-	return line, err
-}
-
-func writeExpectf(rw *bufio.ReadWriter, expect []byte, format string, args ...interface{}) error {
-	line, err := writeReadLine(rw, format, args...)
-	if err != nil {
-		return err
-	}
-	switch {
-	case bytes.Equal(line, resultOK):
-		return nil
-	case bytes.Equal(line, expect):
-		return nil
-	case bytes.Equal(line, resultNotStored):
-		return ErrNotStored
-	case bytes.Equal(line, resultExists):
-		return ErrCASConflict
-	case bytes.Equal(line, resultNotFound):
-		return ErrCacheMiss
-	}
-	return fmt.Errorf("memcache: unexpected response line: %q", string(line))
-}
-
-// Delete deletes the item with the provided key. The error ErrCacheMiss is
-// returned if the item didn't already exist in the cache.
-func (c *Client) Delete(key string) error {
-	return c.withKeyRw(key, func(rw *bufio.ReadWriter) error {
-		return writeExpectf(rw, resultDeleted, "delete %s\r\n", key)
-	})
-}
-
-// DeleteAll deletes all items in the cache.
-func (c *Client) DeleteAll() error {
-	return c.withKeyRw("", func(rw *bufio.ReadWriter) error {
-		return writeExpectf(rw, resultDeleted, "flush_all\r\n")
-	})
-}
-
-// Increment atomically increments key by delta. The return value is
-// the new value after being incremented or an error. If the value
-// didn't exist in memcached the error is ErrCacheMiss. The value in
-// memcached must be an decimal number, or an error will be returned.
-// On 64-bit overflow, the new value wraps around.
-func (c *Client) Increment(key string, delta uint64) (newValue uint64, err error) {
-	return c.incrDecr("incr", key, delta)
-}
-
-// Decrement atomically decrements key by delta. The return value is
-// the new value after being decremented or an error. If the value
-// didn't exist in memcached the error is ErrCacheMiss. The value in
-// memcached must be an decimal number, or an error will be returned.
-// On underflow, the new value is capped at zero and does not wrap
-// around.
-func (c *Client) Decrement(key string, delta uint64) (newValue uint64, err error) {
-	return c.incrDecr("decr", key, delta)
-}
-
-func (c *Client) incrDecr(verb, key string, delta uint64) (uint64, error) {
-	var val uint64
-	err := c.withKeyRw(key, func(rw *bufio.ReadWriter) error {
-		line, err := writeReadLine(rw, "%s %s %d\r\n", verb, key, delta)
-		if err != nil {
-			return err
-		}
-		switch {
-		case bytes.Equal(line, resultNotFound):
-			return ErrCacheMiss
-		case bytes.HasPrefix(line, resultClientErrorPrefix):
-			errMsg := line[len(resultClientErrorPrefix) : len(line)-2]
-			return errors.New("memcache: client error: " + string(errMsg))
-		}
-		val, err = strconv.ParseUint(string(line[:len(line)-2]), 10, 64)
-		if err != nil {
-			return err
-		}
-		return nil
-	})
-	return val, err
-}

+ 0 - 129
vendor/github.com/bradfitz/gomemcache/memcache/selector.go

@@ -1,129 +0,0 @@
-/*
-Copyright 2011 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.
-*/
-
-package memcache
-
-import (
-	"hash/crc32"
-	"net"
-	"strings"
-	"sync"
-)
-
-// ServerSelector is the interface that selects a memcache server
-// as a function of the item's key.
-//
-// All ServerSelector implementations must be safe for concurrent use
-// by multiple goroutines.
-type ServerSelector interface {
-	// PickServer returns the server address that a given item
-	// should be shared onto.
-	PickServer(key string) (net.Addr, error)
-	Each(func(net.Addr) error) error
-}
-
-// ServerList is a simple ServerSelector. Its zero value is usable.
-type ServerList struct {
-	mu    sync.RWMutex
-	addrs []net.Addr
-}
-
-// staticAddr caches the Network() and String() values from any net.Addr.
-type staticAddr struct {
-	ntw, str string
-}
-
-func newStaticAddr(a net.Addr) net.Addr {
-	return &staticAddr{
-		ntw: a.Network(),
-		str: a.String(),
-	}
-}
-
-func (s *staticAddr) Network() string { return s.ntw }
-func (s *staticAddr) String() string  { return s.str }
-
-// SetServers changes a ServerList's set of servers at runtime and is
-// safe for concurrent use by multiple goroutines.
-//
-// Each server is given equal weight. A server is given more weight
-// if it's listed multiple times.
-//
-// SetServers returns an error if any of the server names fail to
-// resolve. No attempt is made to connect to the server. If any error
-// is returned, no changes are made to the ServerList.
-func (ss *ServerList) SetServers(servers ...string) error {
-	naddr := make([]net.Addr, len(servers))
-	for i, server := range servers {
-		if strings.Contains(server, "/") {
-			addr, err := net.ResolveUnixAddr("unix", server)
-			if err != nil {
-				return err
-			}
-			naddr[i] = newStaticAddr(addr)
-		} else {
-			tcpaddr, err := net.ResolveTCPAddr("tcp", server)
-			if err != nil {
-				return err
-			}
-			naddr[i] = newStaticAddr(tcpaddr)
-		}
-	}
-
-	ss.mu.Lock()
-	defer ss.mu.Unlock()
-	ss.addrs = naddr
-	return nil
-}
-
-// Each iterates over each server calling the given function
-func (ss *ServerList) Each(f func(net.Addr) error) error {
-	ss.mu.RLock()
-	defer ss.mu.RUnlock()
-	for _, a := range ss.addrs {
-		if err := f(a); nil != err {
-			return err
-		}
-	}
-	return nil
-}
-
-// keyBufPool returns []byte buffers for use by PickServer's call to
-// crc32.ChecksumIEEE to avoid allocations. (but doesn't avoid the
-// copies, which at least are bounded in size and small)
-var keyBufPool = sync.Pool{
-	New: func() interface{} {
-		b := make([]byte, 256)
-		return &b
-	},
-}
-
-func (ss *ServerList) PickServer(key string) (net.Addr, error) {
-	ss.mu.RLock()
-	defer ss.mu.RUnlock()
-	if len(ss.addrs) == 0 {
-		return nil, ErrNoServers
-	}
-	if len(ss.addrs) == 1 {
-		return ss.addrs[0], nil
-	}
-	bufp := keyBufPool.Get().(*[]byte)
-	n := copy(*bufp, key)
-	cs := crc32.ChecksumIEEE((*bufp)[:n])
-	keyBufPool.Put(bufp)
-
-	return ss.addrs[cs%uint32(len(ss.addrs))], nil
-}

+ 0 - 8
vendor/github.com/cespare/xxhash/v2/.travis.yml

@@ -1,8 +0,0 @@
-language: go
-go:
-  - "1.x"
-  - master
-env:
-  - TAGS=""
-  - TAGS="-tags purego"
-script: go test $TAGS -v ./...

+ 0 - 22
vendor/github.com/cespare/xxhash/v2/LICENSE.txt

@@ -1,22 +0,0 @@
-Copyright (c) 2016 Caleb Spare
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 0 - 55
vendor/github.com/cespare/xxhash/v2/README.md

@@ -1,55 +0,0 @@
-# xxhash
-
-[![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash)
-[![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash)
-
-xxhash is a Go implementation of the 64-bit
-[xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a
-high-quality hashing algorithm that is much faster than anything in the Go
-standard library.
-
-This package provides a straightforward API:
-
-```
-func Sum64(b []byte) uint64
-func Sum64String(s string) uint64
-type Digest struct{ ... }
-    func New() *Digest
-```
-
-The `Digest` type implements hash.Hash64. Its key methods are:
-
-```
-func (*Digest) Write([]byte) (int, error)
-func (*Digest) WriteString(string) (int, error)
-func (*Digest) Sum64() uint64
-```
-
-This implementation provides a fast pure-Go implementation and an even faster
-assembly implementation for amd64.
-
-## Benchmarks
-
-Here are some quick benchmarks comparing the pure-Go and assembly
-implementations of Sum64.
-
-| input size | purego | asm |
-| --- | --- | --- |
-| 5 B   |  979.66 MB/s |  1291.17 MB/s  |
-| 100 B | 7475.26 MB/s | 7973.40 MB/s  |
-| 4 KB  | 17573.46 MB/s | 17602.65 MB/s |
-| 10 MB | 17131.46 MB/s | 17142.16 MB/s |
-
-These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using
-the following commands under Go 1.11.2:
-
-```
-$ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes'
-$ go test -benchtime 10s -bench '/xxhash,direct,bytes'
-```
-
-## Projects using this package
-
-- [InfluxDB](https://github.com/influxdata/influxdb)
-- [Prometheus](https://github.com/prometheus/prometheus)
-- [FreeCache](https://github.com/coocood/freecache)

+ 0 - 3
vendor/github.com/cespare/xxhash/v2/go.mod

@@ -1,3 +0,0 @@
-module github.com/cespare/xxhash/v2
-
-go 1.13

+ 0 - 0
vendor/github.com/cespare/xxhash/v2/go.sum


+ 0 - 236
vendor/github.com/cespare/xxhash/v2/xxhash.go

@@ -1,236 +0,0 @@
-// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described
-// at http://cyan4973.github.io/xxHash/.
-package xxhash
-
-import (
-	"encoding/binary"
-	"errors"
-	"math/bits"
-)
-
-const (
-	prime1 uint64 = 11400714785074694791
-	prime2 uint64 = 14029467366897019727
-	prime3 uint64 = 1609587929392839161
-	prime4 uint64 = 9650029242287828579
-	prime5 uint64 = 2870177450012600261
-)
-
-// NOTE(caleb): I'm using both consts and vars of the primes. Using consts where
-// possible in the Go code is worth a small (but measurable) performance boost
-// by avoiding some MOVQs. Vars are needed for the asm and also are useful for
-// convenience in the Go code in a few places where we need to intentionally
-// avoid constant arithmetic (e.g., v1 := prime1 + prime2 fails because the
-// result overflows a uint64).
-var (
-	prime1v = prime1
-	prime2v = prime2
-	prime3v = prime3
-	prime4v = prime4
-	prime5v = prime5
-)
-
-// Digest implements hash.Hash64.
-type Digest struct {
-	v1    uint64
-	v2    uint64
-	v3    uint64
-	v4    uint64
-	total uint64
-	mem   [32]byte
-	n     int // how much of mem is used
-}
-
-// New creates a new Digest that computes the 64-bit xxHash algorithm.
-func New() *Digest {
-	var d Digest
-	d.Reset()
-	return &d
-}
-
-// Reset clears the Digest's state so that it can be reused.
-func (d *Digest) Reset() {
-	d.v1 = prime1v + prime2
-	d.v2 = prime2
-	d.v3 = 0
-	d.v4 = -prime1v
-	d.total = 0
-	d.n = 0
-}
-
-// Size always returns 8 bytes.
-func (d *Digest) Size() int { return 8 }
-
-// BlockSize always returns 32 bytes.
-func (d *Digest) BlockSize() int { return 32 }
-
-// Write adds more data to d. It always returns len(b), nil.
-func (d *Digest) Write(b []byte) (n int, err error) {
-	n = len(b)
-	d.total += uint64(n)
-
-	if d.n+n < 32 {
-		// This new data doesn't even fill the current block.
-		copy(d.mem[d.n:], b)
-		d.n += n
-		return
-	}
-
-	if d.n > 0 {
-		// Finish off the partial block.
-		copy(d.mem[d.n:], b)
-		d.v1 = round(d.v1, u64(d.mem[0:8]))
-		d.v2 = round(d.v2, u64(d.mem[8:16]))
-		d.v3 = round(d.v3, u64(d.mem[16:24]))
-		d.v4 = round(d.v4, u64(d.mem[24:32]))
-		b = b[32-d.n:]
-		d.n = 0
-	}
-
-	if len(b) >= 32 {
-		// One or more full blocks left.
-		nw := writeBlocks(d, b)
-		b = b[nw:]
-	}
-
-	// Store any remaining partial block.
-	copy(d.mem[:], b)
-	d.n = len(b)
-
-	return
-}
-
-// Sum appends the current hash to b and returns the resulting slice.
-func (d *Digest) Sum(b []byte) []byte {
-	s := d.Sum64()
-	return append(
-		b,
-		byte(s>>56),
-		byte(s>>48),
-		byte(s>>40),
-		byte(s>>32),
-		byte(s>>24),
-		byte(s>>16),
-		byte(s>>8),
-		byte(s),
-	)
-}
-
-// Sum64 returns the current hash.
-func (d *Digest) Sum64() uint64 {
-	var h uint64
-
-	if d.total >= 32 {
-		v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
-		h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
-		h = mergeRound(h, v1)
-		h = mergeRound(h, v2)
-		h = mergeRound(h, v3)
-		h = mergeRound(h, v4)
-	} else {
-		h = d.v3 + prime5
-	}
-
-	h += d.total
-
-	i, end := 0, d.n
-	for ; i+8 <= end; i += 8 {
-		k1 := round(0, u64(d.mem[i:i+8]))
-		h ^= k1
-		h = rol27(h)*prime1 + prime4
-	}
-	if i+4 <= end {
-		h ^= uint64(u32(d.mem[i:i+4])) * prime1
-		h = rol23(h)*prime2 + prime3
-		i += 4
-	}
-	for i < end {
-		h ^= uint64(d.mem[i]) * prime5
-		h = rol11(h) * prime1
-		i++
-	}
-
-	h ^= h >> 33
-	h *= prime2
-	h ^= h >> 29
-	h *= prime3
-	h ^= h >> 32
-
-	return h
-}
-
-const (
-	magic         = "xxh\x06"
-	marshaledSize = len(magic) + 8*5 + 32
-)
-
-// MarshalBinary implements the encoding.BinaryMarshaler interface.
-func (d *Digest) MarshalBinary() ([]byte, error) {
-	b := make([]byte, 0, marshaledSize)
-	b = append(b, magic...)
-	b = appendUint64(b, d.v1)
-	b = appendUint64(b, d.v2)
-	b = appendUint64(b, d.v3)
-	b = appendUint64(b, d.v4)
-	b = appendUint64(b, d.total)
-	b = append(b, d.mem[:d.n]...)
-	b = b[:len(b)+len(d.mem)-d.n]
-	return b, nil
-}
-
-// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
-func (d *Digest) UnmarshalBinary(b []byte) error {
-	if len(b) < len(magic) || string(b[:len(magic)]) != magic {
-		return errors.New("xxhash: invalid hash state identifier")
-	}
-	if len(b) != marshaledSize {
-		return errors.New("xxhash: invalid hash state size")
-	}
-	b = b[len(magic):]
-	b, d.v1 = consumeUint64(b)
-	b, d.v2 = consumeUint64(b)
-	b, d.v3 = consumeUint64(b)
-	b, d.v4 = consumeUint64(b)
-	b, d.total = consumeUint64(b)
-	copy(d.mem[:], b)
-	b = b[len(d.mem):]
-	d.n = int(d.total % uint64(len(d.mem)))
-	return nil
-}
-
-func appendUint64(b []byte, x uint64) []byte {
-	var a [8]byte
-	binary.LittleEndian.PutUint64(a[:], x)
-	return append(b, a[:]...)
-}
-
-func consumeUint64(b []byte) ([]byte, uint64) {
-	x := u64(b)
-	return b[8:], x
-}
-
-func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) }
-func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) }
-
-func round(acc, input uint64) uint64 {
-	acc += input * prime2
-	acc = rol31(acc)
-	acc *= prime1
-	return acc
-}
-
-func mergeRound(acc, val uint64) uint64 {
-	val = round(0, val)
-	acc ^= val
-	acc = acc*prime1 + prime4
-	return acc
-}
-
-func rol1(x uint64) uint64  { return bits.RotateLeft64(x, 1) }
-func rol7(x uint64) uint64  { return bits.RotateLeft64(x, 7) }
-func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) }
-func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) }
-func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) }
-func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) }
-func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) }
-func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) }

+ 0 - 13
vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go

@@ -1,13 +0,0 @@
-// +build !appengine
-// +build gc
-// +build !purego
-
-package xxhash
-
-// Sum64 computes the 64-bit xxHash digest of b.
-//
-//go:noescape
-func Sum64(b []byte) uint64
-
-//go:noescape
-func writeBlocks(*Digest, []byte) int

+ 0 - 215
vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s

@@ -1,215 +0,0 @@
-// +build !appengine
-// +build gc
-// +build !purego
-
-#include "textflag.h"
-
-// Register allocation:
-// AX	h
-// CX	pointer to advance through b
-// DX	n
-// BX	loop end
-// R8	v1, k1
-// R9	v2
-// R10	v3
-// R11	v4
-// R12	tmp
-// R13	prime1v
-// R14	prime2v
-// R15	prime4v
-
-// round reads from and advances the buffer pointer in CX.
-// It assumes that R13 has prime1v and R14 has prime2v.
-#define round(r) \
-	MOVQ  (CX), R12 \
-	ADDQ  $8, CX    \
-	IMULQ R14, R12  \
-	ADDQ  R12, r    \
-	ROLQ  $31, r    \
-	IMULQ R13, r
-
-// mergeRound applies a merge round on the two registers acc and val.
-// It assumes that R13 has prime1v, R14 has prime2v, and R15 has prime4v.
-#define mergeRound(acc, val) \
-	IMULQ R14, val \
-	ROLQ  $31, val \
-	IMULQ R13, val \
-	XORQ  val, acc \
-	IMULQ R13, acc \
-	ADDQ  R15, acc
-
-// func Sum64(b []byte) uint64
-TEXT ·Sum64(SB), NOSPLIT, $0-32
-	// Load fixed primes.
-	MOVQ ·prime1v(SB), R13
-	MOVQ ·prime2v(SB), R14
-	MOVQ ·prime4v(SB), R15
-
-	// Load slice.
-	MOVQ b_base+0(FP), CX
-	MOVQ b_len+8(FP), DX
-	LEAQ (CX)(DX*1), BX
-
-	// The first loop limit will be len(b)-32.
-	SUBQ $32, BX
-
-	// Check whether we have at least one block.
-	CMPQ DX, $32
-	JLT  noBlocks
-
-	// Set up initial state (v1, v2, v3, v4).
-	MOVQ R13, R8
-	ADDQ R14, R8
-	MOVQ R14, R9
-	XORQ R10, R10
-	XORQ R11, R11
-	SUBQ R13, R11
-
-	// Loop until CX > BX.
-blockLoop:
-	round(R8)
-	round(R9)
-	round(R10)
-	round(R11)
-
-	CMPQ CX, BX
-	JLE  blockLoop
-
-	MOVQ R8, AX
-	ROLQ $1, AX
-	MOVQ R9, R12
-	ROLQ $7, R12
-	ADDQ R12, AX
-	MOVQ R10, R12
-	ROLQ $12, R12
-	ADDQ R12, AX
-	MOVQ R11, R12
-	ROLQ $18, R12
-	ADDQ R12, AX
-
-	mergeRound(AX, R8)
-	mergeRound(AX, R9)
-	mergeRound(AX, R10)
-	mergeRound(AX, R11)
-
-	JMP afterBlocks
-
-noBlocks:
-	MOVQ ·prime5v(SB), AX
-
-afterBlocks:
-	ADDQ DX, AX
-
-	// Right now BX has len(b)-32, and we want to loop until CX > len(b)-8.
-	ADDQ $24, BX
-
-	CMPQ CX, BX
-	JG   fourByte
-
-wordLoop:
-	// Calculate k1.
-	MOVQ  (CX), R8
-	ADDQ  $8, CX
-	IMULQ R14, R8
-	ROLQ  $31, R8
-	IMULQ R13, R8
-
-	XORQ  R8, AX
-	ROLQ  $27, AX
-	IMULQ R13, AX
-	ADDQ  R15, AX
-
-	CMPQ CX, BX
-	JLE  wordLoop
-
-fourByte:
-	ADDQ $4, BX
-	CMPQ CX, BX
-	JG   singles
-
-	MOVL  (CX), R8
-	ADDQ  $4, CX
-	IMULQ R13, R8
-	XORQ  R8, AX
-
-	ROLQ  $23, AX
-	IMULQ R14, AX
-	ADDQ  ·prime3v(SB), AX
-
-singles:
-	ADDQ $4, BX
-	CMPQ CX, BX
-	JGE  finalize
-
-singlesLoop:
-	MOVBQZX (CX), R12
-	ADDQ    $1, CX
-	IMULQ   ·prime5v(SB), R12
-	XORQ    R12, AX
-
-	ROLQ  $11, AX
-	IMULQ R13, AX
-
-	CMPQ CX, BX
-	JL   singlesLoop
-
-finalize:
-	MOVQ  AX, R12
-	SHRQ  $33, R12
-	XORQ  R12, AX
-	IMULQ R14, AX
-	MOVQ  AX, R12
-	SHRQ  $29, R12
-	XORQ  R12, AX
-	IMULQ ·prime3v(SB), AX
-	MOVQ  AX, R12
-	SHRQ  $32, R12
-	XORQ  R12, AX
-
-	MOVQ AX, ret+24(FP)
-	RET
-
-// writeBlocks uses the same registers as above except that it uses AX to store
-// the d pointer.
-
-// func writeBlocks(d *Digest, b []byte) int
-TEXT ·writeBlocks(SB), NOSPLIT, $0-40
-	// Load fixed primes needed for round.
-	MOVQ ·prime1v(SB), R13
-	MOVQ ·prime2v(SB), R14
-
-	// Load slice.
-	MOVQ b_base+8(FP), CX
-	MOVQ b_len+16(FP), DX
-	LEAQ (CX)(DX*1), BX
-	SUBQ $32, BX
-
-	// Load vN from d.
-	MOVQ d+0(FP), AX
-	MOVQ 0(AX), R8   // v1
-	MOVQ 8(AX), R9   // v2
-	MOVQ 16(AX), R10 // v3
-	MOVQ 24(AX), R11 // v4
-
-	// We don't need to check the loop condition here; this function is
-	// always called with at least one block of data to process.
-blockLoop:
-	round(R8)
-	round(R9)
-	round(R10)
-	round(R11)
-
-	CMPQ CX, BX
-	JLE  blockLoop
-
-	// Copy vN back to d.
-	MOVQ R8, 0(AX)
-	MOVQ R9, 8(AX)
-	MOVQ R10, 16(AX)
-	MOVQ R11, 24(AX)
-
-	// The number of bytes written is CX minus the old base pointer.
-	SUBQ b_base+8(FP), CX
-	MOVQ CX, ret+32(FP)
-
-	RET

+ 0 - 76
vendor/github.com/cespare/xxhash/v2/xxhash_other.go

@@ -1,76 +0,0 @@
-// +build !amd64 appengine !gc purego
-
-package xxhash
-
-// Sum64 computes the 64-bit xxHash digest of b.
-func Sum64(b []byte) uint64 {
-	// A simpler version would be
-	//   d := New()
-	//   d.Write(b)
-	//   return d.Sum64()
-	// but this is faster, particularly for small inputs.
-
-	n := len(b)
-	var h uint64
-
-	if n >= 32 {
-		v1 := prime1v + prime2
-		v2 := prime2
-		v3 := uint64(0)
-		v4 := -prime1v
-		for len(b) >= 32 {
-			v1 = round(v1, u64(b[0:8:len(b)]))
-			v2 = round(v2, u64(b[8:16:len(b)]))
-			v3 = round(v3, u64(b[16:24:len(b)]))
-			v4 = round(v4, u64(b[24:32:len(b)]))
-			b = b[32:len(b):len(b)]
-		}
-		h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
-		h = mergeRound(h, v1)
-		h = mergeRound(h, v2)
-		h = mergeRound(h, v3)
-		h = mergeRound(h, v4)
-	} else {
-		h = prime5
-	}
-
-	h += uint64(n)
-
-	i, end := 0, len(b)
-	for ; i+8 <= end; i += 8 {
-		k1 := round(0, u64(b[i:i+8:len(b)]))
-		h ^= k1
-		h = rol27(h)*prime1 + prime4
-	}
-	if i+4 <= end {
-		h ^= uint64(u32(b[i:i+4:len(b)])) * prime1
-		h = rol23(h)*prime2 + prime3
-		i += 4
-	}
-	for ; i < end; i++ {
-		h ^= uint64(b[i]) * prime5
-		h = rol11(h) * prime1
-	}
-
-	h ^= h >> 33
-	h *= prime2
-	h ^= h >> 29
-	h *= prime3
-	h ^= h >> 32
-
-	return h
-}
-
-func writeBlocks(d *Digest, b []byte) int {
-	v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
-	n := len(b)
-	for len(b) >= 32 {
-		v1 = round(v1, u64(b[0:8:len(b)]))
-		v2 = round(v2, u64(b[8:16:len(b)]))
-		v3 = round(v3, u64(b[16:24:len(b)]))
-		v4 = round(v4, u64(b[24:32:len(b)]))
-		b = b[32:len(b):len(b)]
-	}
-	d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4
-	return n - len(b)
-}

+ 0 - 15
vendor/github.com/cespare/xxhash/v2/xxhash_safe.go

@@ -1,15 +0,0 @@
-// +build appengine
-
-// This file contains the safe implementations of otherwise unsafe-using code.
-
-package xxhash
-
-// Sum64String computes the 64-bit xxHash digest of s.
-func Sum64String(s string) uint64 {
-	return Sum64([]byte(s))
-}
-
-// WriteString adds more data to d. It always returns len(s), nil.
-func (d *Digest) WriteString(s string) (n int, err error) {
-	return d.Write([]byte(s))
-}

+ 0 - 46
vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go

@@ -1,46 +0,0 @@
-// +build !appengine
-
-// This file encapsulates usage of unsafe.
-// xxhash_safe.go contains the safe implementations.
-
-package xxhash
-
-import (
-	"reflect"
-	"unsafe"
-)
-
-// Notes:
-//
-// See https://groups.google.com/d/msg/golang-nuts/dcjzJy-bSpw/tcZYBzQqAQAJ
-// for some discussion about these unsafe conversions.
-//
-// In the future it's possible that compiler optimizations will make these
-// unsafe operations unnecessary: https://golang.org/issue/2205.
-//
-// Both of these wrapper functions still incur function call overhead since they
-// will not be inlined. We could write Go/asm copies of Sum64 and Digest.Write
-// for strings to squeeze out a bit more speed. Mid-stack inlining should
-// eventually fix this.
-
-// Sum64String computes the 64-bit xxHash digest of s.
-// It may be faster than Sum64([]byte(s)) by avoiding a copy.
-func Sum64String(s string) uint64 {
-	var b []byte
-	bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
-	bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data
-	bh.Len = len(s)
-	bh.Cap = len(s)
-	return Sum64(b)
-}
-
-// WriteString adds more data to d. It always returns len(s), nil.
-// It may be faster than Write([]byte(s)) by avoiding a copy.
-func (d *Digest) WriteString(s string) (n int, err error) {
-	var b []byte
-	bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
-	bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data
-	bh.Len = len(s)
-	bh.Cap = len(s)
-	return d.Write(b)
-}

+ 0 - 21
vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md

@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Brian Goff
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 14
vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go

@@ -1,14 +0,0 @@
-package md2man
-
-import (
-	"github.com/russross/blackfriday/v2"
-)
-
-// Render converts a markdown document into a roff formatted document.
-func Render(doc []byte) []byte {
-	renderer := NewRoffRenderer()
-
-	return blackfriday.Run(doc,
-		[]blackfriday.Option{blackfriday.WithRenderer(renderer),
-			blackfriday.WithExtensions(renderer.GetExtensions())}...)
-}

+ 0 - 345
vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go

@@ -1,345 +0,0 @@
-package md2man
-
-import (
-	"fmt"
-	"io"
-	"os"
-	"strings"
-
-	"github.com/russross/blackfriday/v2"
-)
-
-// roffRenderer implements the blackfriday.Renderer interface for creating
-// roff format (manpages) from markdown text
-type roffRenderer struct {
-	extensions   blackfriday.Extensions
-	listCounters []int
-	firstHeader  bool
-	defineTerm   bool
-	listDepth    int
-}
-
-const (
-	titleHeader      = ".TH "
-	topLevelHeader   = "\n\n.SH "
-	secondLevelHdr   = "\n.SH "
-	otherHeader      = "\n.SS "
-	crTag            = "\n"
-	emphTag          = "\\fI"
-	emphCloseTag     = "\\fP"
-	strongTag        = "\\fB"
-	strongCloseTag   = "\\fP"
-	breakTag         = "\n.br\n"
-	paraTag          = "\n.PP\n"
-	hruleTag         = "\n.ti 0\n\\l'\\n(.lu'\n"
-	linkTag          = "\n\\[la]"
-	linkCloseTag     = "\\[ra]"
-	codespanTag      = "\\fB\\fC"
-	codespanCloseTag = "\\fR"
-	codeTag          = "\n.PP\n.RS\n\n.nf\n"
-	codeCloseTag     = "\n.fi\n.RE\n"
-	quoteTag         = "\n.PP\n.RS\n"
-	quoteCloseTag    = "\n.RE\n"
-	listTag          = "\n.RS\n"
-	listCloseTag     = "\n.RE\n"
-	arglistTag       = "\n.TP\n"
-	tableStart       = "\n.TS\nallbox;\n"
-	tableEnd         = ".TE\n"
-	tableCellStart   = "T{\n"
-	tableCellEnd     = "\nT}\n"
-)
-
-// NewRoffRenderer creates a new blackfriday Renderer for generating roff documents
-// from markdown
-func NewRoffRenderer() *roffRenderer { // nolint: golint
-	var extensions blackfriday.Extensions
-
-	extensions |= blackfriday.NoIntraEmphasis
-	extensions |= blackfriday.Tables
-	extensions |= blackfriday.FencedCode
-	extensions |= blackfriday.SpaceHeadings
-	extensions |= blackfriday.Footnotes
-	extensions |= blackfriday.Titleblock
-	extensions |= blackfriday.DefinitionLists
-	return &roffRenderer{
-		extensions: extensions,
-	}
-}
-
-// GetExtensions returns the list of extensions used by this renderer implementation
-func (r *roffRenderer) GetExtensions() blackfriday.Extensions {
-	return r.extensions
-}
-
-// RenderHeader handles outputting the header at document start
-func (r *roffRenderer) RenderHeader(w io.Writer, ast *blackfriday.Node) {
-	// disable hyphenation
-	out(w, ".nh\n")
-}
-
-// RenderFooter handles outputting the footer at the document end; the roff
-// renderer has no footer information
-func (r *roffRenderer) RenderFooter(w io.Writer, ast *blackfriday.Node) {
-}
-
-// RenderNode is called for each node in a markdown document; based on the node
-// type the equivalent roff output is sent to the writer
-func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering bool) blackfriday.WalkStatus {
-
-	var walkAction = blackfriday.GoToNext
-
-	switch node.Type {
-	case blackfriday.Text:
-		r.handleText(w, node, entering)
-	case blackfriday.Softbreak:
-		out(w, crTag)
-	case blackfriday.Hardbreak:
-		out(w, breakTag)
-	case blackfriday.Emph:
-		if entering {
-			out(w, emphTag)
-		} else {
-			out(w, emphCloseTag)
-		}
-	case blackfriday.Strong:
-		if entering {
-			out(w, strongTag)
-		} else {
-			out(w, strongCloseTag)
-		}
-	case blackfriday.Link:
-		if !entering {
-			out(w, linkTag+string(node.LinkData.Destination)+linkCloseTag)
-		}
-	case blackfriday.Image:
-		// ignore images
-		walkAction = blackfriday.SkipChildren
-	case blackfriday.Code:
-		out(w, codespanTag)
-		escapeSpecialChars(w, node.Literal)
-		out(w, codespanCloseTag)
-	case blackfriday.Document:
-		break
-	case blackfriday.Paragraph:
-		// roff .PP markers break lists
-		if r.listDepth > 0 {
-			return blackfriday.GoToNext
-		}
-		if entering {
-			out(w, paraTag)
-		} else {
-			out(w, crTag)
-		}
-	case blackfriday.BlockQuote:
-		if entering {
-			out(w, quoteTag)
-		} else {
-			out(w, quoteCloseTag)
-		}
-	case blackfriday.Heading:
-		r.handleHeading(w, node, entering)
-	case blackfriday.HorizontalRule:
-		out(w, hruleTag)
-	case blackfriday.List:
-		r.handleList(w, node, entering)
-	case blackfriday.Item:
-		r.handleItem(w, node, entering)
-	case blackfriday.CodeBlock:
-		out(w, codeTag)
-		escapeSpecialChars(w, node.Literal)
-		out(w, codeCloseTag)
-	case blackfriday.Table:
-		r.handleTable(w, node, entering)
-	case blackfriday.TableCell:
-		r.handleTableCell(w, node, entering)
-	case blackfriday.TableHead:
-	case blackfriday.TableBody:
-	case blackfriday.TableRow:
-		// no action as cell entries do all the nroff formatting
-		return blackfriday.GoToNext
-	default:
-		fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String())
-	}
-	return walkAction
-}
-
-func (r *roffRenderer) handleText(w io.Writer, node *blackfriday.Node, entering bool) {
-	var (
-		start, end string
-	)
-	// handle special roff table cell text encapsulation
-	if node.Parent.Type == blackfriday.TableCell {
-		if len(node.Literal) > 30 {
-			start = tableCellStart
-			end = tableCellEnd
-		} else {
-			// end rows that aren't terminated by "tableCellEnd" with a cr if end of row
-			if node.Parent.Next == nil && !node.Parent.IsHeader {
-				end = crTag
-			}
-		}
-	}
-	out(w, start)
-	escapeSpecialChars(w, node.Literal)
-	out(w, end)
-}
-
-func (r *roffRenderer) handleHeading(w io.Writer, node *blackfriday.Node, entering bool) {
-	if entering {
-		switch node.Level {
-		case 1:
-			if !r.firstHeader {
-				out(w, titleHeader)
-				r.firstHeader = true
-				break
-			}
-			out(w, topLevelHeader)
-		case 2:
-			out(w, secondLevelHdr)
-		default:
-			out(w, otherHeader)
-		}
-	}
-}
-
-func (r *roffRenderer) handleList(w io.Writer, node *blackfriday.Node, entering bool) {
-	openTag := listTag
-	closeTag := listCloseTag
-	if node.ListFlags&blackfriday.ListTypeDefinition != 0 {
-		// tags for definition lists handled within Item node
-		openTag = ""
-		closeTag = ""
-	}
-	if entering {
-		r.listDepth++
-		if node.ListFlags&blackfriday.ListTypeOrdered != 0 {
-			r.listCounters = append(r.listCounters, 1)
-		}
-		out(w, openTag)
-	} else {
-		if node.ListFlags&blackfriday.ListTypeOrdered != 0 {
-			r.listCounters = r.listCounters[:len(r.listCounters)-1]
-		}
-		out(w, closeTag)
-		r.listDepth--
-	}
-}
-
-func (r *roffRenderer) handleItem(w io.Writer, node *blackfriday.Node, entering bool) {
-	if entering {
-		if node.ListFlags&blackfriday.ListTypeOrdered != 0 {
-			out(w, fmt.Sprintf(".IP \"%3d.\" 5\n", r.listCounters[len(r.listCounters)-1]))
-			r.listCounters[len(r.listCounters)-1]++
-		} else if node.ListFlags&blackfriday.ListTypeDefinition != 0 {
-			// state machine for handling terms and following definitions
-			// since blackfriday does not distinguish them properly, nor
-			// does it seperate them into separate lists as it should
-			if !r.defineTerm {
-				out(w, arglistTag)
-				r.defineTerm = true
-			} else {
-				r.defineTerm = false
-			}
-		} else {
-			out(w, ".IP \\(bu 2\n")
-		}
-	} else {
-		out(w, "\n")
-	}
-}
-
-func (r *roffRenderer) handleTable(w io.Writer, node *blackfriday.Node, entering bool) {
-	if entering {
-		out(w, tableStart)
-		//call walker to count cells (and rows?) so format section can be produced
-		columns := countColumns(node)
-		out(w, strings.Repeat("l ", columns)+"\n")
-		out(w, strings.Repeat("l ", columns)+".\n")
-	} else {
-		out(w, tableEnd)
-	}
-}
-
-func (r *roffRenderer) handleTableCell(w io.Writer, node *blackfriday.Node, entering bool) {
-	var (
-		start, end string
-	)
-	if node.IsHeader {
-		start = codespanTag
-		end = codespanCloseTag
-	}
-	if entering {
-		if node.Prev != nil && node.Prev.Type == blackfriday.TableCell {
-			out(w, "\t"+start)
-		} else {
-			out(w, start)
-		}
-	} else {
-		// need to carriage return if we are at the end of the header row
-		if node.IsHeader && node.Next == nil {
-			end = end + crTag
-		}
-		out(w, end)
-	}
-}
-
-// because roff format requires knowing the column count before outputting any table
-// data we need to walk a table tree and count the columns
-func countColumns(node *blackfriday.Node) int {
-	var columns int
-
-	node.Walk(func(node *blackfriday.Node, entering bool) blackfriday.WalkStatus {
-		switch node.Type {
-		case blackfriday.TableRow:
-			if !entering {
-				return blackfriday.Terminate
-			}
-		case blackfriday.TableCell:
-			if entering {
-				columns++
-			}
-		default:
-		}
-		return blackfriday.GoToNext
-	})
-	return columns
-}
-
-func out(w io.Writer, output string) {
-	io.WriteString(w, output) // nolint: errcheck
-}
-
-func needsBackslash(c byte) bool {
-	for _, r := range []byte("-_&\\~") {
-		if c == r {
-			return true
-		}
-	}
-	return false
-}
-
-func escapeSpecialChars(w io.Writer, text []byte) {
-	for i := 0; i < len(text); i++ {
-		// escape initial apostrophe or period
-		if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') {
-			out(w, "\\&")
-		}
-
-		// directly copy normal characters
-		org := i
-
-		for i < len(text) && !needsBackslash(text[i]) {
-			i++
-		}
-		if i > org {
-			w.Write(text[org:i]) // nolint: errcheck
-		}
-
-		// escape a character
-		if i >= len(text) {
-			break
-		}
-
-		w.Write([]byte{'\\', text[i]}) // nolint: errcheck
-	}
-}

+ 0 - 27
vendor/github.com/denisenkom/go-mssqldb/LICENSE.txt

@@ -1,27 +0,0 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 289
vendor/github.com/denisenkom/go-mssqldb/README.md

@@ -1,289 +0,0 @@
-# A pure Go MSSQL driver for Go's database/sql package
-
-[![GoDoc](https://godoc.org/github.com/denisenkom/go-mssqldb?status.svg)](http://godoc.org/github.com/denisenkom/go-mssqldb)
-[![Build status](https://ci.appveyor.com/api/projects/status/jrln8cs62wj9i0a2?svg=true)](https://ci.appveyor.com/project/denisenkom/go-mssqldb)
-[![codecov](https://codecov.io/gh/denisenkom/go-mssqldb/branch/master/graph/badge.svg)](https://codecov.io/gh/denisenkom/go-mssqldb)
-
-## Install
-
-Requires Go 1.8 or above.
-
-Install with `go get github.com/denisenkom/go-mssqldb` .
-
-## Connection Parameters and DSN
-
-The recommended connection string uses a URL format:
-`sqlserver://username:password@host/instance?param1=value&param2=value`
-Other supported formats are listed below.
-
-### Common parameters:
-
-* `user id` - enter the SQL Server Authentication user id or the Windows Authentication user id in the DOMAIN\User format. On Windows, if user id is empty or missing Single-Sign-On is used.
-* `password`
-* `database`
-* `connection timeout` - in seconds (default is 0 for no timeout), set to 0 for no timeout. Recommended to set to 0 and use context to manage query and connection timeouts.
-* `dial timeout` - in seconds (default is 15), set to 0 for no timeout
-* `encrypt`
-  * `disable` - Data send between client and server is not encrypted.
-  * `false` - Data sent between client and server is not encrypted beyond the login packet. (Default)
-  * `true` - Data sent between client and server is encrypted.
-* `app name` - The application name (default is go-mssqldb)
-
-### Connection parameters for ODBC and ADO style connection strings:
-
-* `server` - host or host\instance (default localhost)
-* `port` - used only when there is no instance in server (default 1433)
-
-### Less common parameters:
-
-* `keepAlive` - in seconds; 0 to disable (default is 30)
-* `failoverpartner` - host or host\instance (default is no partner). 
-* `failoverport` - used only when there is no instance in failoverpartner (default 1433)
-* `packet size` - in bytes; 512 to 32767 (default is 4096)
-  * Encrypted connections have a maximum packet size of 16383 bytes
-  * Further information on usage: https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-network-packet-size-server-configuration-option
-* `log` - logging flags (default 0/no logging, 63 for full logging)
-  *  1 log errors
-  *  2 log messages
-  *  4 log rows affected
-  *  8 trace sql statements
-  * 16 log statement parameters
-  * 32 log transaction begin/end
-* `TrustServerCertificate`
-  * false - Server certificate is checked. Default is false if encypt is specified.
-  * true - Server certificate is not checked. Default is true if encrypt is not specified. If trust server certificate is true, driver accepts any certificate presented by the server and any host name in that certificate. In this mode, TLS is susceptible to man-in-the-middle attacks. This should be used only for testing.
-* `certificate` - The file that contains the public key certificate of the CA that signed the SQL Server certificate. The specified certificate overrides the go platform specific CA certificates.
-* `hostNameInCertificate` - Specifies the Common Name (CN) in the server certificate. Default value is the server host.
-* `ServerSPN` - The kerberos SPN (Service Principal Name) for the server. Default is MSSQLSvc/host:port.
-* `Workstation ID` - The workstation name (default is the host name)
-* `ApplicationIntent` - Can be given the value `ReadOnly` to initiate a read-only connection to an Availability Group listener. The `database` must be specified when connecting with `Application Intent` set to `ReadOnly`. 
-
-### The connection string can be specified in one of three formats:
-
-
-1. URL: with `sqlserver` scheme. username and password appears before the host. Any instance appears as
-    the first segment in the path. All other options are query parameters. Examples:
-
-  * `sqlserver://username:password@host/instance?param1=value&param2=value`
-  * `sqlserver://username:password@host:port?param1=value&param2=value`
-  * `sqlserver://sa@localhost/SQLExpress?database=master&connection+timeout=30` // `SQLExpress instance.
-  * `sqlserver://sa:mypass@localhost?database=master&connection+timeout=30`     // username=sa, password=mypass.
-  * `sqlserver://sa:mypass@localhost:1234?database=master&connection+timeout=30` // port 1234 on localhost.
-  * `sqlserver://sa:my%7Bpass@somehost?connection+timeout=30` // password is "my{pass"
-
-  A string of this format can be constructed using the `URL` type in the `net/url` package.
-
-```go
-  query := url.Values{}
-  query.Add("app name", "MyAppName")
-
-  u := &url.URL{
-      Scheme:   "sqlserver",
-      User:     url.UserPassword(username, password),
-      Host:     fmt.Sprintf("%s:%d", hostname, port),
-      // Path:  instance, // if connecting to an instance instead of a port
-      RawQuery: query.Encode(),
-  }
-  db, err := sql.Open("sqlserver", u.String())
-```
-
-2. ADO: `key=value` pairs separated by `;`. Values may not contain `;`, leading and trailing whitespace is ignored.
-     Examples:
-	
-  * `server=localhost\\SQLExpress;user id=sa;database=master;app name=MyAppName`
-  * `server=localhost;user id=sa;database=master;app name=MyAppName`
-
-3. ODBC: Prefix with `odbc`, `key=value` pairs separated by `;`. Allow `;` by wrapping
-    values in `{}`. Examples:
-	
-  * `odbc:server=localhost\\SQLExpress;user id=sa;database=master;app name=MyAppName`
-  * `odbc:server=localhost;user id=sa;database=master;app name=MyAppName`
-  * `odbc:server=localhost;user id=sa;password={foo;bar}` // Value marked with `{}`, password is "foo;bar"
-  * `odbc:server=localhost;user id=sa;password={foo{bar}` // Value marked with `{}`, password is "foo{bar"
-  * `odbc:server=localhost;user id=sa;password={foobar }` // Value marked with `{}`, password is "foobar "
-  * `odbc:server=localhost;user id=sa;password=foo{bar`   // Literal `{`, password is "foo{bar"
-  * `odbc:server=localhost;user id=sa;password=foo}bar`   // Literal `}`, password is "foo}bar"
-  * `odbc:server=localhost;user id=sa;password={foo{bar}` // Literal `{`, password is "foo{bar"
-  * `odbc:server=localhost;user id=sa;password={foo}}bar}` // Escaped `} with `}}`, password is "foo}bar"
-
-## Executing Stored Procedures
-
-To run a stored procedure, set the query text to the procedure name:
-```go
-var account = "abc"
-_, err := db.ExecContext(ctx, "sp_RunMe",
-	sql.Named("ID", 123),
-	sql.Named("Account", sql.Out{Dest: &account}),
-)
-```
-
-## Reading Output Parameters from a Stored Procedure with Resultset
-
-To read output parameters from a stored procedure with resultset, make sure you read all the rows before reading the output parameters:
-```go
-sqltextcreate := `
-CREATE PROCEDURE spwithoutputandrows
-	@bitparam BIT OUTPUT
-AS BEGIN
-	SET @bitparam = 1
-	SELECT 'Row 1'
-END
-`
-var bitout int64
-rows, err := db.QueryContext(ctx, "spwithoutputandrows", sql.Named("bitparam", sql.Out{Dest: &bitout}))
-var strrow string
-for rows.Next() {
-	err = rows.Scan(&strrow)
-}
-fmt.Printf("bitparam is %d", bitout)
-```
-
-## Caveat for local temporary tables
-
-Due to protocol limitations, temporary tables will only be allocated on the connection
-as a result of executing a query with zero parameters. The following query
-will, due to the use of a parameter, execute in its own session,
-and `#mytemp` will be de-allocated right away:
-
-```go
-conn, err := pool.Conn(ctx)
-defer conn.Close()
-_, err := conn.ExecContext(ctx, "select @p1 as x into #mytemp", 1)
-// at this point #mytemp is already dropped again as the session of the ExecContext is over
-```
-
-To work around this, always explicitly create the local temporary
-table in a query without any parameters. As a special case, the driver
-will then be able to execute the query directly on the
-connection-scoped session. The following example works:
-
-```go
-conn, err := pool.Conn(ctx)
-
-// Set us up so that temp table is always cleaned up, since conn.Close()
-// merely returns conn to pool, rather than actually closing the connection.
-defer func() {
-	_, _ = conn.ExecContext(ctx, "drop table #mytemp")  // always clean up
-	conn.Close() // merely returns conn to pool
-}()
-
-
-// Since we not pass any parameters below, the query will execute on the scope of
-// the connection and succeed in creating the table.
-_, err := conn.ExecContext(ctx, "create table #mytemp ( x int )")
-
-// #mytemp is now available even if you pass parameters
-_, err := conn.ExecContext(ctx, "insert into #mytemp (x) values (@p1)", 1)
-
-```
-
-## Return Status
-
-To get the procedure return status, pass into the parameters a
-`*mssql.ReturnStatus`. For example:
-```
-var rs mssql.ReturnStatus
-_, err := db.ExecContext(ctx, "theproc", &rs)
-log.Printf("status=%d", rs)
-```
-
-or
-
-```
-var rs mssql.ReturnStatus
-_, err := db.QueryContext(ctx, "theproc", &rs)
-for rows.Next() {
-	err = rows.Scan(&val)
-}
-log.Printf("status=%d", rs)
-```
-
-Limitation: ReturnStatus cannot be retrieved using `QueryRow`.
-
-## Parameters
-
-The `sqlserver` driver uses normal MS SQL Server syntax and expects parameters in
-the sql query to be in the form of either `@Name` or `@p1` to `@pN` (ordinal position).
-
-```go
-db.QueryContext(ctx, `select * from t where ID = @ID and Name = @p2;`, sql.Named("ID", 6), "Bob")
-```
-
-### Parameter Types
-
-To pass specific types to the query parameters, say `varchar` or `date` types,
-you must convert the types to the type before passing in. The following types
-are supported:
-
- * string -> nvarchar
- * mssql.VarChar -> varchar
- * time.Time -> datetimeoffset or datetime (TDS version dependent)
- * mssql.DateTime1 -> datetime
- * mssql.DateTimeOffset -> datetimeoffset
- * "github.com/golang-sql/civil".Date -> date
- * "github.com/golang-sql/civil".DateTime -> datetime2
- * "github.com/golang-sql/civil".Time -> time
- * mssql.TVP -> Table Value Parameter (TDS version dependent)
-
-## Important Notes
-
- * [LastInsertId](https://golang.org/pkg/database/sql/#Result.LastInsertId) should
-    not be used with this driver (or SQL Server) due to how the TDS protocol
-	works. Please use the [OUTPUT Clause](https://docs.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql)
-	or add a `select ID = convert(bigint, SCOPE_IDENTITY());` to the end of your
-	query (ref [SCOPE_IDENTITY](https://docs.microsoft.com/en-us/sql/t-sql/functions/scope-identity-transact-sql)).
-	This will ensure you are getting the correct ID and will prevent a network round trip.
- * [NewConnector](https://godoc.org/github.com/denisenkom/go-mssqldb#NewConnector)
-    may be used with [OpenDB](https://golang.org/pkg/database/sql/#OpenDB).
- * [Connector.SessionInitSQL](https://godoc.org/github.com/denisenkom/go-mssqldb#Connector.SessionInitSQL)
-	may be set to set any driver specific session settings after the session
-	has been reset. If empty the session will still be reset but use the database
-	defaults in Go1.10+.
-
-## Features
-
-* Can be used with SQL Server 2005 or newer
-* Can be used with Microsoft Azure SQL Database
-* Can be used on all go supported platforms (e.g. Linux, Mac OS X and Windows)
-* Supports new date/time types: date, time, datetime2, datetimeoffset
-* Supports string parameters longer than 8000 characters
-* Supports encryption using SSL/TLS
-* Supports SQL Server and Windows Authentication
-* Supports Single-Sign-On on Windows
-* Supports connections to AlwaysOn Availability Group listeners, including re-direction to read-only replicas.
-* Supports query notifications
-
-## Tests
-
-`go test` is used for testing. A running instance of MSSQL server is required.
-Environment variables are used to pass login information.
-
-Example:
-
-    env SQLSERVER_DSN=sqlserver://user:pass@hostname/instance?database=test1 go test
-
-## Deprecated
-
-These features still exist in the driver, but they are are deprecated.
-
-### Query Parameter Token Replace (driver "mssql")
-
-If you use the driver name "mssql" (rather then "sqlserver") the SQL text
-will be loosly parsed and an attempt to extract identifiers using one of
-
-* ?
-* ?nnn
-* :nnn
-* $nnn
-
-will be used. This is not recommended with SQL Server. 
-There is at least one existing `won't fix` issue with the query parsing.
-
-Use the native "@Name" parameters instead with the "sqlserver" driver name.
-
-## Known Issues
-
-* SQL Server 2008 and 2008 R2 engine cannot handle login records when SSL encryption is not disabled.
-To fix SQL Server 2008 R2 issue, install SQL Server 2008 R2 Service Pack 2.
-To fix SQL Server 2008 issue, install Microsoft SQL Server 2008 Service Pack 3 and Cumulative update package 3 for SQL Server 2008 SP3.
-More information: http://support.microsoft.com/kb/2653857

+ 0 - 50
vendor/github.com/denisenkom/go-mssqldb/appveyor.yml

@@ -1,50 +0,0 @@
-version: 1.0.{build}
-
-os: Windows Server 2012 R2
-
-clone_folder: c:\gopath\src\github.com\denisenkom\go-mssqldb
-
-environment:
-  GOPATH: c:\gopath
-  HOST: localhost
-  SQLUSER: sa
-  SQLPASSWORD: Password12!
-  DATABASE: test  
-  GOVERSION: 111
-  matrix:
-    - GOVERSION: 18
-      SQLINSTANCE: SQL2016
-    - GOVERSION: 19
-      SQLINSTANCE: SQL2016
-    - GOVERSION: 110
-      SQLINSTANCE: SQL2016
-    - GOVERSION: 111
-      SQLINSTANCE: SQL2016
-    - SQLINSTANCE: SQL2014
-    - SQLINSTANCE: SQL2012SP1
-    - SQLINSTANCE: SQL2008R2SP2
- 
-install:
-  - set GOROOT=c:\go%GOVERSION%
-  - set PATH=%GOPATH%\bin;%GOROOT%\bin;%PATH%
-  - go version
-  - go env
-  - go get -u github.com/golang-sql/civil
-
-build_script:
-  - go build
-
-before_test:
-  # setup SQL Server 
-  - ps: | 
-      $instanceName = $env:SQLINSTANCE
-      Start-Service "MSSQL`$$instanceName"
-      Start-Service "SQLBrowser"
-  - sqlcmd -S "(local)\%SQLINSTANCE%" -Q "Use [master]; CREATE DATABASE test;"
-  - sqlcmd -S "(local)\%SQLINSTANCE%" -h -1 -Q "set nocount on; Select @@version"
-  - pip install codecov
- 
-
-test_script:
-  - go test -race -cpu 4 -coverprofile=coverage.txt -covermode=atomic
-  - codecov -f coverage.txt

+ 0 - 262
vendor/github.com/denisenkom/go-mssqldb/buf.go

@@ -1,262 +0,0 @@
-package mssql
-
-import (
-	"encoding/binary"
-	"errors"
-	"io"
-)
-
-type packetType uint8
-
-type header struct {
-	PacketType packetType
-	Status     uint8
-	Size       uint16
-	Spid       uint16
-	PacketNo   uint8
-	Pad        uint8
-}
-
-// tdsBuffer reads and writes TDS packets of data to the transport.
-// The write and read buffers are separate to make sending attn signals
-// possible without locks. Currently attn signals are only sent during
-// reads, not writes.
-type tdsBuffer struct {
-	transport io.ReadWriteCloser
-
-	packetSize int
-
-	// Write fields.
-	wbuf        []byte
-	wpos        int
-	wPacketSeq  byte
-	wPacketType packetType
-
-	// Read fields.
-	rbuf        []byte
-	rpos        int
-	rsize       int
-	final       bool
-	rPacketType packetType
-
-	// afterFirst is assigned to right after tdsBuffer is created and
-	// before the first use. It is executed after the first packet is
-	// written and then removed.
-	afterFirst func()
-}
-
-func newTdsBuffer(bufsize uint16, transport io.ReadWriteCloser) *tdsBuffer {
-	return &tdsBuffer{
-		packetSize: int(bufsize),
-		wbuf:       make([]byte, 1<<16),
-		rbuf:       make([]byte, 1<<16),
-		rpos:       8,
-		transport:  transport,
-	}
-}
-
-func (rw *tdsBuffer) ResizeBuffer(packetSize int) {
-	rw.packetSize = packetSize
-}
-
-func (w *tdsBuffer) PackageSize() int {
-	return w.packetSize
-}
-
-func (w *tdsBuffer) flush() (err error) {
-	// Write packet size.
-	w.wbuf[0] = byte(w.wPacketType)
-	binary.BigEndian.PutUint16(w.wbuf[2:], uint16(w.wpos))
-	w.wbuf[6] = w.wPacketSeq
-
-	// Write packet into underlying transport.
-	if _, err = w.transport.Write(w.wbuf[:w.wpos]); err != nil {
-		return err
-	}
-	// It is possible to create a whole new buffer after a flush.
-	// Useful for debugging. Normally reuse the buffer.
-	// w.wbuf = make([]byte, 1<<16)
-
-	// Execute afterFirst hook if it is set.
-	if w.afterFirst != nil {
-		w.afterFirst()
-		w.afterFirst = nil
-	}
-
-	w.wpos = 8
-	w.wPacketSeq++
-	return nil
-}
-
-func (w *tdsBuffer) Write(p []byte) (total int, err error) {
-	for {
-		copied := copy(w.wbuf[w.wpos:w.packetSize], p)
-		w.wpos += copied
-		total += copied
-		if copied == len(p) {
-			return
-		}
-		if err = w.flush(); err != nil {
-			return
-		}
-		p = p[copied:]
-	}
-}
-
-func (w *tdsBuffer) WriteByte(b byte) error {
-	if int(w.wpos) == len(w.wbuf) || w.wpos == w.packetSize {
-		if err := w.flush(); err != nil {
-			return err
-		}
-	}
-	w.wbuf[w.wpos] = b
-	w.wpos += 1
-	return nil
-}
-
-func (w *tdsBuffer) BeginPacket(packetType packetType, resetSession bool) {
-	status := byte(0)
-	if resetSession {
-		switch packetType {
-		// Reset session can only be set on the following packet types.
-		case packSQLBatch, packRPCRequest, packTransMgrReq:
-			status = 0x8
-		}
-	}
-	w.wbuf[1] = status // Packet is incomplete. This byte is set again in FinishPacket.
-	w.wpos = 8
-	w.wPacketSeq = 1
-	w.wPacketType = packetType
-}
-
-func (w *tdsBuffer) FinishPacket() error {
-	w.wbuf[1] |= 1 // Mark this as the last packet in the message.
-	return w.flush()
-}
-
-var headerSize = binary.Size(header{})
-
-func (r *tdsBuffer) readNextPacket() error {
-	h := header{}
-	var err error
-	err = binary.Read(r.transport, binary.BigEndian, &h)
-	if err != nil {
-		return err
-	}
-	if int(h.Size) > r.packetSize {
-		return errors.New("Invalid packet size, it is longer than buffer size")
-	}
-	if headerSize > int(h.Size) {
-		return errors.New("Invalid packet size, it is shorter than header size")
-	}
-	_, err = io.ReadFull(r.transport, r.rbuf[headerSize:h.Size])
-	if err != nil {
-		return err
-	}
-	r.rpos = headerSize
-	r.rsize = int(h.Size)
-	r.final = h.Status != 0
-	r.rPacketType = h.PacketType
-	return nil
-}
-
-func (r *tdsBuffer) BeginRead() (packetType, error) {
-	err := r.readNextPacket()
-	if err != nil {
-		return 0, err
-	}
-	return r.rPacketType, nil
-}
-
-func (r *tdsBuffer) ReadByte() (res byte, err error) {
-	if r.rpos == r.rsize {
-		if r.final {
-			return 0, io.EOF
-		}
-		err = r.readNextPacket()
-		if err != nil {
-			return 0, err
-		}
-	}
-	res = r.rbuf[r.rpos]
-	r.rpos++
-	return res, nil
-}
-
-func (r *tdsBuffer) byte() byte {
-	b, err := r.ReadByte()
-	if err != nil {
-		badStreamPanic(err)
-	}
-	return b
-}
-
-func (r *tdsBuffer) ReadFull(buf []byte) {
-	_, err := io.ReadFull(r, buf[:])
-	if err != nil {
-		badStreamPanic(err)
-	}
-}
-
-func (r *tdsBuffer) uint64() uint64 {
-	var buf [8]byte
-	r.ReadFull(buf[:])
-	return binary.LittleEndian.Uint64(buf[:])
-}
-
-func (r *tdsBuffer) int32() int32 {
-	return int32(r.uint32())
-}
-
-func (r *tdsBuffer) uint32() uint32 {
-	var buf [4]byte
-	r.ReadFull(buf[:])
-	return binary.LittleEndian.Uint32(buf[:])
-}
-
-func (r *tdsBuffer) uint16() uint16 {
-	var buf [2]byte
-	r.ReadFull(buf[:])
-	return binary.LittleEndian.Uint16(buf[:])
-}
-
-func (r *tdsBuffer) BVarChar() string {
-	return readBVarCharOrPanic(r)
-}
-
-func readBVarCharOrPanic(r io.Reader) string {
-	s, err := readBVarChar(r)
-	if err != nil {
-		badStreamPanic(err)
-	}
-	return s
-}
-
-func readUsVarCharOrPanic(r io.Reader) string {
-	s, err := readUsVarChar(r)
-	if err != nil {
-		badStreamPanic(err)
-	}
-	return s
-}
-
-func (r *tdsBuffer) UsVarChar() string {
-	return readUsVarCharOrPanic(r)
-}
-
-func (r *tdsBuffer) Read(buf []byte) (copied int, err error) {
-	copied = 0
-	err = nil
-	if r.rpos == r.rsize {
-		if r.final {
-			return 0, io.EOF
-		}
-		err = r.readNextPacket()
-		if err != nil {
-			return
-		}
-	}
-	copied = copy(buf, r.rbuf[r.rpos:r.rsize])
-	r.rpos += copied
-	return
-}

+ 0 - 583
vendor/github.com/denisenkom/go-mssqldb/bulkcopy.go

@@ -1,583 +0,0 @@
-package mssql
-
-import (
-	"bytes"
-	"context"
-	"encoding/binary"
-	"fmt"
-	"math"
-	"reflect"
-	"strings"
-	"time"
-
-	"github.com/denisenkom/go-mssqldb/internal/decimal"
-)
-
-type Bulk struct {
-	// ctx is used only for AddRow and Done methods.
-	// This could be removed if AddRow and Done accepted
-	// a ctx field as well, which is available with the
-	// database/sql call.
-	ctx context.Context
-
-	cn          *Conn
-	metadata    []columnStruct
-	bulkColumns []columnStruct
-	columnsName []string
-	tablename   string
-	numRows     int
-
-	headerSent bool
-	Options    BulkOptions
-	Debug      bool
-}
-type BulkOptions struct {
-	CheckConstraints  bool
-	FireTriggers      bool
-	KeepNulls         bool
-	KilobytesPerBatch int
-	RowsPerBatch      int
-	Order             []string
-	Tablock           bool
-}
-
-type DataValue interface{}
-
-const (
-	sqlDateFormat = "2006-01-02"
-	sqlTimeFormat = "2006-01-02 15:04:05.999999999Z07:00"
-)
-
-func (cn *Conn) CreateBulk(table string, columns []string) (_ *Bulk) {
-	b := Bulk{ctx: context.Background(), cn: cn, tablename: table, headerSent: false, columnsName: columns}
-	b.Debug = false
-	return &b
-}
-
-func (cn *Conn) CreateBulkContext(ctx context.Context, table string, columns []string) (_ *Bulk) {
-	b := Bulk{ctx: ctx, cn: cn, tablename: table, headerSent: false, columnsName: columns}
-	b.Debug = false
-	return &b
-}
-
-func (b *Bulk) sendBulkCommand(ctx context.Context) (err error) {
-	//get table columns info
-	err = b.getMetadata(ctx)
-	if err != nil {
-		return err
-	}
-
-	//match the columns
-	for _, colname := range b.columnsName {
-		var bulkCol *columnStruct
-
-		for _, m := range b.metadata {
-			if m.ColName == colname {
-				bulkCol = &m
-				break
-			}
-		}
-		if bulkCol != nil {
-
-			if bulkCol.ti.TypeId == typeUdt {
-				//send udt as binary
-				bulkCol.ti.TypeId = typeBigVarBin
-			}
-			b.bulkColumns = append(b.bulkColumns, *bulkCol)
-			b.dlogf("Adding column %s %s %#x", colname, bulkCol.ColName, bulkCol.ti.TypeId)
-		} else {
-			return fmt.Errorf("Column %s does not exist in destination table %s", colname, b.tablename)
-		}
-	}
-
-	//create the bulk command
-
-	//columns definitions
-	var col_defs bytes.Buffer
-	for i, col := range b.bulkColumns {
-		if i != 0 {
-			col_defs.WriteString(", ")
-		}
-		col_defs.WriteString("[" + col.ColName + "] " + makeDecl(col.ti))
-	}
-
-	//options
-	var with_opts []string
-
-	if b.Options.CheckConstraints {
-		with_opts = append(with_opts, "CHECK_CONSTRAINTS")
-	}
-	if b.Options.FireTriggers {
-		with_opts = append(with_opts, "FIRE_TRIGGERS")
-	}
-	if b.Options.KeepNulls {
-		with_opts = append(with_opts, "KEEP_NULLS")
-	}
-	if b.Options.KilobytesPerBatch > 0 {
-		with_opts = append(with_opts, fmt.Sprintf("KILOBYTES_PER_BATCH = %d", b.Options.KilobytesPerBatch))
-	}
-	if b.Options.RowsPerBatch > 0 {
-		with_opts = append(with_opts, fmt.Sprintf("ROWS_PER_BATCH = %d", b.Options.RowsPerBatch))
-	}
-	if len(b.Options.Order) > 0 {
-		with_opts = append(with_opts, fmt.Sprintf("ORDER(%s)", strings.Join(b.Options.Order, ",")))
-	}
-	if b.Options.Tablock {
-		with_opts = append(with_opts, "TABLOCK")
-	}
-	var with_part string
-	if len(with_opts) > 0 {
-		with_part = fmt.Sprintf("WITH (%s)", strings.Join(with_opts, ","))
-	}
-
-	query := fmt.Sprintf("INSERT BULK %s (%s) %s", b.tablename, col_defs.String(), with_part)
-
-	stmt, err := b.cn.PrepareContext(ctx, query)
-	if err != nil {
-		return fmt.Errorf("Prepare failed: %s", err.Error())
-	}
-	b.dlogf(query)
-
-	_, err = stmt.(*Stmt).ExecContext(ctx, nil)
-	if err != nil {
-		return err
-	}
-
-	b.headerSent = true
-
-	var buf = b.cn.sess.buf
-	buf.BeginPacket(packBulkLoadBCP, false)
-
-	// Send the columns metadata.
-	columnMetadata := b.createColMetadata()
-	_, err = buf.Write(columnMetadata)
-
-	return
-}
-
-// AddRow immediately writes the row to the destination table.
-// The arguments are the row values in the order they were specified.
-func (b *Bulk) AddRow(row []interface{}) (err error) {
-	if !b.headerSent {
-		err = b.sendBulkCommand(b.ctx)
-		if err != nil {
-			return
-		}
-	}
-
-	if len(row) != len(b.bulkColumns) {
-		return fmt.Errorf("Row does not have the same number of columns than the destination table %d %d",
-			len(row), len(b.bulkColumns))
-	}
-
-	bytes, err := b.makeRowData(row)
-	if err != nil {
-		return
-	}
-
-	_, err = b.cn.sess.buf.Write(bytes)
-	if err != nil {
-		return
-	}
-
-	b.numRows = b.numRows + 1
-	return
-}
-
-func (b *Bulk) makeRowData(row []interface{}) ([]byte, error) {
-	buf := new(bytes.Buffer)
-	buf.WriteByte(byte(tokenRow))
-
-	var logcol bytes.Buffer
-	for i, col := range b.bulkColumns {
-
-		if b.Debug {
-			logcol.WriteString(fmt.Sprintf(" col[%d]='%v' ", i, row[i]))
-		}
-		param, err := b.makeParam(row[i], col)
-		if err != nil {
-			return nil, fmt.Errorf("bulkcopy: %s", err.Error())
-		}
-
-		if col.ti.Writer == nil {
-			return nil, fmt.Errorf("no writer for column: %s, TypeId: %#x",
-				col.ColName, col.ti.TypeId)
-		}
-		err = col.ti.Writer(buf, param.ti, param.buffer)
-		if err != nil {
-			return nil, fmt.Errorf("bulkcopy: %s", err.Error())
-		}
-	}
-
-	b.dlogf("row[%d] %s\n", b.numRows, logcol.String())
-
-	return buf.Bytes(), nil
-}
-
-func (b *Bulk) Done() (rowcount int64, err error) {
-	if b.headerSent == false {
-		//no rows had been sent
-		return 0, nil
-	}
-	var buf = b.cn.sess.buf
-	buf.WriteByte(byte(tokenDone))
-
-	binary.Write(buf, binary.LittleEndian, uint16(doneFinal))
-	binary.Write(buf, binary.LittleEndian, uint16(0)) //     curcmd
-
-	if b.cn.sess.loginAck.TDSVersion >= verTDS72 {
-		binary.Write(buf, binary.LittleEndian, uint64(0)) //rowcount 0
-	} else {
-		binary.Write(buf, binary.LittleEndian, uint32(0)) //rowcount 0
-	}
-
-	buf.FinishPacket()
-
-	tokchan := make(chan tokenStruct, 5)
-	go processResponse(b.ctx, b.cn.sess, tokchan, nil)
-
-	var rowCount int64
-	for token := range tokchan {
-		switch token := token.(type) {
-		case doneStruct:
-			if token.Status&doneCount != 0 {
-				rowCount = int64(token.RowCount)
-			}
-			if token.isError() {
-				return 0, token.getError()
-			}
-		case error:
-			return 0, b.cn.checkBadConn(token)
-		}
-	}
-	return rowCount, nil
-}
-
-func (b *Bulk) createColMetadata() []byte {
-	buf := new(bytes.Buffer)
-	buf.WriteByte(byte(tokenColMetadata))                              // token
-	binary.Write(buf, binary.LittleEndian, uint16(len(b.bulkColumns))) // column count
-
-	for i, col := range b.bulkColumns {
-
-		if b.cn.sess.loginAck.TDSVersion >= verTDS72 {
-			binary.Write(buf, binary.LittleEndian, uint32(col.UserType)) //  usertype, always 0?
-		} else {
-			binary.Write(buf, binary.LittleEndian, uint16(col.UserType))
-		}
-		binary.Write(buf, binary.LittleEndian, uint16(col.Flags))
-
-		writeTypeInfo(buf, &b.bulkColumns[i].ti)
-
-		if col.ti.TypeId == typeNText ||
-			col.ti.TypeId == typeText ||
-			col.ti.TypeId == typeImage {
-
-			tablename_ucs2 := str2ucs2(b.tablename)
-			binary.Write(buf, binary.LittleEndian, uint16(len(tablename_ucs2)/2))
-			buf.Write(tablename_ucs2)
-		}
-		colname_ucs2 := str2ucs2(col.ColName)
-		buf.WriteByte(uint8(len(colname_ucs2) / 2))
-		buf.Write(colname_ucs2)
-	}
-
-	return buf.Bytes()
-}
-
-func (b *Bulk) getMetadata(ctx context.Context) (err error) {
-	stmt, err := b.cn.prepareContext(ctx, "SET FMTONLY ON")
-	if err != nil {
-		return
-	}
-
-	_, err = stmt.ExecContext(ctx, nil)
-	if err != nil {
-		return
-	}
-
-	// Get columns info.
-	stmt, err = b.cn.prepareContext(ctx, fmt.Sprintf("select * from %s SET FMTONLY OFF", b.tablename))
-	if err != nil {
-		return
-	}
-	rows, err := stmt.QueryContext(ctx, nil)
-	if err != nil {
-		return fmt.Errorf("get columns info failed: %v", err)
-	}
-	b.metadata = rows.(*Rows).cols
-
-	if b.Debug {
-		for _, col := range b.metadata {
-			b.dlogf("col: %s typeId: %#x size: %d scale: %d prec: %d flags: %d lcid: %#x\n",
-				col.ColName, col.ti.TypeId, col.ti.Size, col.ti.Scale, col.ti.Prec,
-				col.Flags, col.ti.Collation.LcidAndFlags)
-		}
-	}
-
-	return rows.Close()
-}
-
-func (b *Bulk) makeParam(val DataValue, col columnStruct) (res param, err error) {
-	res.ti.Size = col.ti.Size
-	res.ti.TypeId = col.ti.TypeId
-
-	if val == nil {
-		res.ti.Size = 0
-		return
-	}
-
-	switch col.ti.TypeId {
-
-	case typeInt1, typeInt2, typeInt4, typeInt8, typeIntN:
-		var intvalue int64
-
-		switch val := val.(type) {
-		case int:
-			intvalue = int64(val)
-		case int32:
-			intvalue = int64(val)
-		case int64:
-			intvalue = val
-		default:
-			err = fmt.Errorf("mssql: invalid type for int column: %T", val)
-			return
-		}
-
-		res.buffer = make([]byte, res.ti.Size)
-		if col.ti.Size == 1 {
-			res.buffer[0] = byte(intvalue)
-		} else if col.ti.Size == 2 {
-			binary.LittleEndian.PutUint16(res.buffer, uint16(intvalue))
-		} else if col.ti.Size == 4 {
-			binary.LittleEndian.PutUint32(res.buffer, uint32(intvalue))
-		} else if col.ti.Size == 8 {
-			binary.LittleEndian.PutUint64(res.buffer, uint64(intvalue))
-		}
-	case typeFlt4, typeFlt8, typeFltN:
-		var floatvalue float64
-
-		switch val := val.(type) {
-		case float32:
-			floatvalue = float64(val)
-		case float64:
-			floatvalue = val
-		case int:
-			floatvalue = float64(val)
-		case int64:
-			floatvalue = float64(val)
-		default:
-			err = fmt.Errorf("mssql: invalid type for float column: %T %s", val, val)
-			return
-		}
-
-		if col.ti.Size == 4 {
-			res.buffer = make([]byte, 4)
-			binary.LittleEndian.PutUint32(res.buffer, math.Float32bits(float32(floatvalue)))
-		} else if col.ti.Size == 8 {
-			res.buffer = make([]byte, 8)
-			binary.LittleEndian.PutUint64(res.buffer, math.Float64bits(floatvalue))
-		}
-	case typeNVarChar, typeNText, typeNChar:
-
-		switch val := val.(type) {
-		case string:
-			res.buffer = str2ucs2(val)
-		case []byte:
-			res.buffer = val
-		default:
-			err = fmt.Errorf("mssql: invalid type for nvarchar column: %T %s", val, val)
-			return
-		}
-		res.ti.Size = len(res.buffer)
-
-	case typeVarChar, typeBigVarChar, typeText, typeChar, typeBigChar:
-		switch val := val.(type) {
-		case string:
-			res.buffer = []byte(val)
-		case []byte:
-			res.buffer = val
-		default:
-			err = fmt.Errorf("mssql: invalid type for varchar column: %T %s", val, val)
-			return
-		}
-		res.ti.Size = len(res.buffer)
-
-	case typeBit, typeBitN:
-		if reflect.TypeOf(val).Kind() != reflect.Bool {
-			err = fmt.Errorf("mssql: invalid type for bit column: %T %s", val, val)
-			return
-		}
-		res.ti.TypeId = typeBitN
-		res.ti.Size = 1
-		res.buffer = make([]byte, 1)
-		if val.(bool) {
-			res.buffer[0] = 1
-		}
-	case typeDateTime2N:
-		switch val := val.(type) {
-		case time.Time:
-			res.buffer = encodeDateTime2(val, int(col.ti.Scale))
-			res.ti.Size = len(res.buffer)
-		case string:
-			var t time.Time
-			if t, err = time.Parse(sqlTimeFormat, val); err != nil {
-				return res, fmt.Errorf("bulk: unable to convert string to date: %v", err)
-			}
-			res.buffer = encodeDateTime2(t, int(col.ti.Scale))
-			res.ti.Size = len(res.buffer)
-		default:
-			err = fmt.Errorf("mssql: invalid type for datetime2 column: %T %s", val, val)
-			return
-		}
-	case typeDateTimeOffsetN:
-		switch val := val.(type) {
-		case time.Time:
-			res.buffer = encodeDateTimeOffset(val, int(col.ti.Scale))
-			res.ti.Size = len(res.buffer)
-		case string:
-			var t time.Time
-			if t, err = time.Parse(sqlTimeFormat, val); err != nil {
-				return res, fmt.Errorf("bulk: unable to convert string to date: %v", err)
-			}
-			res.buffer = encodeDateTimeOffset(t, int(col.ti.Scale))
-			res.ti.Size = len(res.buffer)
-		default:
-			err = fmt.Errorf("mssql: invalid type for datetimeoffset column: %T %s", val, val)
-			return
-		}
-	case typeDateN:
-		switch val := val.(type) {
-		case time.Time:
-			res.buffer = encodeDate(val)
-			res.ti.Size = len(res.buffer)
-		case string:
-			var t time.Time
-			if t, err = time.ParseInLocation(sqlDateFormat, val, time.UTC); err != nil {
-				return res, fmt.Errorf("bulk: unable to convert string to date: %v", err)
-			}
-			res.buffer = encodeDate(t)
-			res.ti.Size = len(res.buffer)
-		default:
-			err = fmt.Errorf("mssql: invalid type for date column: %T %s", val, val)
-			return
-		}
-	case typeDateTime, typeDateTimeN, typeDateTim4:
-		var t time.Time
-		switch val := val.(type) {
-		case time.Time:
-			t = val
-		case string:
-			if t, err = time.Parse(sqlTimeFormat, val); err != nil {
-				return res, fmt.Errorf("bulk: unable to convert string to date: %v", err)
-			}
-		default:
-			err = fmt.Errorf("mssql: invalid type for datetime column: %T %s", val, val)
-			return
-		}
-
-		if col.ti.Size == 4 {
-			res.buffer = encodeDateTim4(t)
-			res.ti.Size = len(res.buffer)
-		} else if col.ti.Size == 8 {
-			res.buffer = encodeDateTime(t)
-			res.ti.Size = len(res.buffer)
-		} else {
-			err = fmt.Errorf("mssql: invalid size of column %d", col.ti.Size)
-		}
-
-	// case typeMoney, typeMoney4, typeMoneyN:
-	case typeDecimal, typeDecimalN, typeNumeric, typeNumericN:
-		prec := col.ti.Prec
-		scale := col.ti.Scale
-		var dec decimal.Decimal
-		switch v := val.(type) {
-		case int:
-			dec = decimal.Int64ToDecimalScale(int64(v), 0)
-		case int8:
-			dec = decimal.Int64ToDecimalScale(int64(v), 0)
-		case int16:
-			dec = decimal.Int64ToDecimalScale(int64(v), 0)
-		case int32:
-			dec = decimal.Int64ToDecimalScale(int64(v), 0)
-		case int64:
-			dec = decimal.Int64ToDecimalScale(int64(v), 0)
-		case float32:
-			dec, err = decimal.Float64ToDecimalScale(float64(v), scale)
-		case float64:
-			dec, err = decimal.Float64ToDecimalScale(float64(v), scale)
-		case string:
-			dec, err = decimal.StringToDecimalScale(v, scale)
-		default:
-			return res, fmt.Errorf("unknown value for decimal: %T %#v", v, v)
-		}
-
-		if err != nil {
-			return res, err
-		}
-		dec.SetPrec(prec)
-
-		var length byte
-		switch {
-		case prec <= 9:
-			length = 4
-		case prec <= 19:
-			length = 8
-		case prec <= 28:
-			length = 12
-		default:
-			length = 16
-		}
-
-		buf := make([]byte, length+1)
-		// first byte length written by typeInfo.writer
-		res.ti.Size = int(length) + 1
-		// second byte sign
-		if !dec.IsPositive() {
-			buf[0] = 0
-		} else {
-			buf[0] = 1
-		}
-
-		ub := dec.UnscaledBytes()
-		l := len(ub)
-		if l > int(length) {
-			err = fmt.Errorf("decimal out of range: %s", dec)
-			return res, err
-		}
-		// reverse the bytes
-		for i, j := 1, l-1; j >= 0; i, j = i+1, j-1 {
-			buf[i] = ub[j]
-		}
-		res.buffer = buf
-	case typeBigVarBin, typeBigBinary:
-		switch val := val.(type) {
-		case []byte:
-			res.ti.Size = len(val)
-			res.buffer = val
-		default:
-			err = fmt.Errorf("mssql: invalid type for Binary column: %T %s", val, val)
-			return
-		}
-	case typeGuid:
-		switch val := val.(type) {
-		case []byte:
-			res.ti.Size = len(val)
-			res.buffer = val
-		default:
-			err = fmt.Errorf("mssql: invalid type for Guid column: %T %s", val, val)
-			return
-		}
-
-	default:
-		err = fmt.Errorf("mssql: type %x not implemented", col.ti.TypeId)
-	}
-	return
-
-}
-
-func (b *Bulk) dlogf(format string, v ...interface{}) {
-	if b.Debug {
-		b.cn.sess.log.Printf(format, v...)
-	}
-}

+ 0 - 93
vendor/github.com/denisenkom/go-mssqldb/bulkcopy_sql.go

@@ -1,93 +0,0 @@
-package mssql
-
-import (
-	"context"
-	"database/sql/driver"
-	"encoding/json"
-	"errors"
-)
-
-type copyin struct {
-	cn       *Conn
-	bulkcopy *Bulk
-	closed   bool
-}
-
-type serializableBulkConfig struct {
-	TableName   string
-	ColumnsName []string
-	Options     BulkOptions
-}
-
-func (d *Driver) OpenConnection(dsn string) (*Conn, error) {
-	return d.open(context.Background(), dsn)
-}
-
-func (c *Conn) prepareCopyIn(ctx context.Context, query string) (_ driver.Stmt, err error) {
-	config_json := query[11:]
-
-	bulkconfig := serializableBulkConfig{}
-	err = json.Unmarshal([]byte(config_json), &bulkconfig)
-	if err != nil {
-		return
-	}
-
-	bulkcopy := c.CreateBulkContext(ctx, bulkconfig.TableName, bulkconfig.ColumnsName)
-	bulkcopy.Options = bulkconfig.Options
-
-	ci := &copyin{
-		cn:       c,
-		bulkcopy: bulkcopy,
-	}
-
-	return ci, nil
-}
-
-func CopyIn(table string, options BulkOptions, columns ...string) string {
-	bulkconfig := &serializableBulkConfig{TableName: table, Options: options, ColumnsName: columns}
-
-	config_json, err := json.Marshal(bulkconfig)
-	if err != nil {
-		panic(err)
-	}
-
-	stmt := "INSERTBULK " + string(config_json)
-
-	return stmt
-}
-
-func (ci *copyin) NumInput() int {
-	return -1
-}
-
-func (ci *copyin) Query(v []driver.Value) (r driver.Rows, err error) {
-	panic("should never be called")
-}
-
-func (ci *copyin) Exec(v []driver.Value) (r driver.Result, err error) {
-	if ci.closed {
-		return nil, errors.New("copyin query is closed")
-	}
-
-	if len(v) == 0 {
-		rowCount, err := ci.bulkcopy.Done()
-		ci.closed = true
-		return driver.RowsAffected(rowCount), err
-	}
-
-	t := make([]interface{}, len(v))
-	for i, val := range v {
-		t[i] = val
-	}
-
-	err = ci.bulkcopy.AddRow(t)
-	if err != nil {
-		return
-	}
-
-	return driver.RowsAffected(0), nil
-}
-
-func (ci *copyin) Close() (err error) {
-	return nil
-}

+ 0 - 456
vendor/github.com/denisenkom/go-mssqldb/conn_str.go

@@ -1,456 +0,0 @@
-package mssql
-
-import (
-	"fmt"
-	"net"
-	"net/url"
-	"os"
-	"strconv"
-	"strings"
-	"time"
-	"unicode"
-)
-
-type connectParams struct {
-	logFlags                  uint64
-	port                      uint64
-	host                      string
-	instance                  string
-	database                  string
-	user                      string
-	password                  string
-	dial_timeout              time.Duration
-	conn_timeout              time.Duration
-	keepAlive                 time.Duration
-	encrypt                   bool
-	disableEncryption         bool
-	trustServerCertificate    bool
-	certificate               string
-	hostInCertificate         string
-	hostInCertificateProvided bool
-	serverSPN                 string
-	workstation               string
-	appname                   string
-	typeFlags                 uint8
-	failOverPartner           string
-	failOverPort              uint64
-	packetSize                uint16
-}
-
-func parseConnectParams(dsn string) (connectParams, error) {
-	var p connectParams
-
-	var params map[string]string
-	if strings.HasPrefix(dsn, "odbc:") {
-		parameters, err := splitConnectionStringOdbc(dsn[len("odbc:"):])
-		if err != nil {
-			return p, err
-		}
-		params = parameters
-	} else if strings.HasPrefix(dsn, "sqlserver://") {
-		parameters, err := splitConnectionStringURL(dsn)
-		if err != nil {
-			return p, err
-		}
-		params = parameters
-	} else {
-		params = splitConnectionString(dsn)
-	}
-
-	strlog, ok := params["log"]
-	if ok {
-		var err error
-		p.logFlags, err = strconv.ParseUint(strlog, 10, 64)
-		if err != nil {
-			return p, fmt.Errorf("Invalid log parameter '%s': %s", strlog, err.Error())
-		}
-	}
-	server := params["server"]
-	parts := strings.SplitN(server, `\`, 2)
-	p.host = parts[0]
-	if p.host == "." || strings.ToUpper(p.host) == "(LOCAL)" || p.host == "" {
-		p.host = "localhost"
-	}
-	if len(parts) > 1 {
-		p.instance = parts[1]
-	}
-	p.database = params["database"]
-	p.user = params["user id"]
-	p.password = params["password"]
-
-	p.port = 1433
-	strport, ok := params["port"]
-	if ok {
-		var err error
-		p.port, err = strconv.ParseUint(strport, 10, 16)
-		if err != nil {
-			f := "Invalid tcp port '%v': %v"
-			return p, fmt.Errorf(f, strport, err.Error())
-		}
-	}
-
-	// https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-network-packet-size-server-configuration-option
-	// Default packet size remains at 4096 bytes
-	p.packetSize = 4096
-	strpsize, ok := params["packet size"]
-	if ok {
-		var err error
-		psize, err := strconv.ParseUint(strpsize, 0, 16)
-		if err != nil {
-			f := "Invalid packet size '%v': %v"
-			return p, fmt.Errorf(f, strpsize, err.Error())
-		}
-
-		// Ensure packet size falls within the TDS protocol range of 512 to 32767 bytes
-		// NOTE: Encrypted connections have a maximum size of 16383 bytes.  If you request
-		// a higher packet size, the server will respond with an ENVCHANGE request to
-		// alter the packet size to 16383 bytes.
-		p.packetSize = uint16(psize)
-		if p.packetSize < 512 {
-			p.packetSize = 512
-		} else if p.packetSize > 32767 {
-			p.packetSize = 32767
-		}
-	}
-
-	// https://msdn.microsoft.com/en-us/library/dd341108.aspx
-	//
-	// Do not set a connection timeout. Use Context to manage such things.
-	// Default to zero, but still allow it to be set.
-	if strconntimeout, ok := params["connection timeout"]; ok {
-		timeout, err := strconv.ParseUint(strconntimeout, 10, 64)
-		if err != nil {
-			f := "Invalid connection timeout '%v': %v"
-			return p, fmt.Errorf(f, strconntimeout, err.Error())
-		}
-		p.conn_timeout = time.Duration(timeout) * time.Second
-	}
-	p.dial_timeout = 15 * time.Second
-	if strdialtimeout, ok := params["dial timeout"]; ok {
-		timeout, err := strconv.ParseUint(strdialtimeout, 10, 64)
-		if err != nil {
-			f := "Invalid dial timeout '%v': %v"
-			return p, fmt.Errorf(f, strdialtimeout, err.Error())
-		}
-		p.dial_timeout = time.Duration(timeout) * time.Second
-	}
-
-	// default keep alive should be 30 seconds according to spec:
-	// https://msdn.microsoft.com/en-us/library/dd341108.aspx
-	p.keepAlive = 30 * time.Second
-	if keepAlive, ok := params["keepalive"]; ok {
-		timeout, err := strconv.ParseUint(keepAlive, 10, 64)
-		if err != nil {
-			f := "Invalid keepAlive value '%s': %s"
-			return p, fmt.Errorf(f, keepAlive, err.Error())
-		}
-		p.keepAlive = time.Duration(timeout) * time.Second
-	}
-	encrypt, ok := params["encrypt"]
-	if ok {
-		if strings.EqualFold(encrypt, "DISABLE") {
-			p.disableEncryption = true
-		} else {
-			var err error
-			p.encrypt, err = strconv.ParseBool(encrypt)
-			if err != nil {
-				f := "Invalid encrypt '%s': %s"
-				return p, fmt.Errorf(f, encrypt, err.Error())
-			}
-		}
-	} else {
-		p.trustServerCertificate = true
-	}
-	trust, ok := params["trustservercertificate"]
-	if ok {
-		var err error
-		p.trustServerCertificate, err = strconv.ParseBool(trust)
-		if err != nil {
-			f := "Invalid trust server certificate '%s': %s"
-			return p, fmt.Errorf(f, trust, err.Error())
-		}
-	}
-	p.certificate = params["certificate"]
-	p.hostInCertificate, ok = params["hostnameincertificate"]
-	if ok {
-		p.hostInCertificateProvided = true
-	} else {
-		p.hostInCertificate = p.host
-		p.hostInCertificateProvided = false
-	}
-
-	serverSPN, ok := params["serverspn"]
-	if ok {
-		p.serverSPN = serverSPN
-	} else {
-		p.serverSPN = fmt.Sprintf("MSSQLSvc/%s:%d", p.host, p.port)
-	}
-
-	workstation, ok := params["workstation id"]
-	if ok {
-		p.workstation = workstation
-	} else {
-		workstation, err := os.Hostname()
-		if err == nil {
-			p.workstation = workstation
-		}
-	}
-
-	appname, ok := params["app name"]
-	if !ok {
-		appname = "go-mssqldb"
-	}
-	p.appname = appname
-
-	appintent, ok := params["applicationintent"]
-	if ok {
-		if appintent == "ReadOnly" {
-			if p.database == "" {
-				return p, fmt.Errorf("Database must be specified when ApplicationIntent is ReadOnly")
-			}
-			p.typeFlags |= fReadOnlyIntent
-		}
-	}
-
-	failOverPartner, ok := params["failoverpartner"]
-	if ok {
-		p.failOverPartner = failOverPartner
-	}
-
-	failOverPort, ok := params["failoverport"]
-	if ok {
-		var err error
-		p.failOverPort, err = strconv.ParseUint(failOverPort, 0, 16)
-		if err != nil {
-			f := "Invalid tcp port '%v': %v"
-			return p, fmt.Errorf(f, failOverPort, err.Error())
-		}
-	}
-
-	return p, nil
-}
-
-func splitConnectionString(dsn string) (res map[string]string) {
-	res = map[string]string{}
-	parts := strings.Split(dsn, ";")
-	for _, part := range parts {
-		if len(part) == 0 {
-			continue
-		}
-		lst := strings.SplitN(part, "=", 2)
-		name := strings.TrimSpace(strings.ToLower(lst[0]))
-		if len(name) == 0 {
-			continue
-		}
-		var value string = ""
-		if len(lst) > 1 {
-			value = strings.TrimSpace(lst[1])
-		}
-		res[name] = value
-	}
-	return res
-}
-
-// Splits a URL of the form sqlserver://username:password@host/instance?param1=value&param2=value
-func splitConnectionStringURL(dsn string) (map[string]string, error) {
-	res := map[string]string{}
-
-	u, err := url.Parse(dsn)
-	if err != nil {
-		return res, err
-	}
-
-	if u.Scheme != "sqlserver" {
-		return res, fmt.Errorf("scheme %s is not recognized", u.Scheme)
-	}
-
-	if u.User != nil {
-		res["user id"] = u.User.Username()
-		p, exists := u.User.Password()
-		if exists {
-			res["password"] = p
-		}
-	}
-
-	host, port, err := net.SplitHostPort(u.Host)
-	if err != nil {
-		host = u.Host
-	}
-
-	if len(u.Path) > 0 {
-		res["server"] = host + "\\" + u.Path[1:]
-	} else {
-		res["server"] = host
-	}
-
-	if len(port) > 0 {
-		res["port"] = port
-	}
-
-	query := u.Query()
-	for k, v := range query {
-		if len(v) > 1 {
-			return res, fmt.Errorf("key %s provided more than once", k)
-		}
-		res[strings.ToLower(k)] = v[0]
-	}
-
-	return res, nil
-}
-
-// Splits a URL in the ODBC format
-func splitConnectionStringOdbc(dsn string) (map[string]string, error) {
-	res := map[string]string{}
-
-	type parserState int
-	const (
-		// Before the start of a key
-		parserStateBeforeKey parserState = iota
-
-		// Inside a key
-		parserStateKey
-
-		// Beginning of a value. May be bare or braced
-		parserStateBeginValue
-
-		// Inside a bare value
-		parserStateBareValue
-
-		// Inside a braced value
-		parserStateBracedValue
-
-		// A closing brace inside a braced value.
-		// May be the end of the value or an escaped closing brace, depending on the next character
-		parserStateBracedValueClosingBrace
-
-		// After a value. Next character should be a semicolon or whitespace.
-		parserStateEndValue
-	)
-
-	var state = parserStateBeforeKey
-
-	var key string
-	var value string
-
-	for i, c := range dsn {
-		switch state {
-		case parserStateBeforeKey:
-			switch {
-			case c == '=':
-				return res, fmt.Errorf("Unexpected character = at index %d. Expected start of key or semi-colon or whitespace.", i)
-			case !unicode.IsSpace(c) && c != ';':
-				state = parserStateKey
-				key += string(c)
-			}
-
-		case parserStateKey:
-			switch c {
-			case '=':
-				key = normalizeOdbcKey(key)
-				state = parserStateBeginValue
-
-			case ';':
-				// Key without value
-				key = normalizeOdbcKey(key)
-				res[key] = value
-				key = ""
-				value = ""
-				state = parserStateBeforeKey
-
-			default:
-				key += string(c)
-			}
-
-		case parserStateBeginValue:
-			switch {
-			case c == '{':
-				state = parserStateBracedValue
-			case c == ';':
-				// Empty value
-				res[key] = value
-				key = ""
-				state = parserStateBeforeKey
-			case unicode.IsSpace(c):
-				// Ignore whitespace
-			default:
-				state = parserStateBareValue
-				value += string(c)
-			}
-
-		case parserStateBareValue:
-			if c == ';' {
-				res[key] = strings.TrimRightFunc(value, unicode.IsSpace)
-				key = ""
-				value = ""
-				state = parserStateBeforeKey
-			} else {
-				value += string(c)
-			}
-
-		case parserStateBracedValue:
-			if c == '}' {
-				state = parserStateBracedValueClosingBrace
-			} else {
-				value += string(c)
-			}
-
-		case parserStateBracedValueClosingBrace:
-			if c == '}' {
-				// Escaped closing brace
-				value += string(c)
-				state = parserStateBracedValue
-				continue
-			}
-
-			// End of braced value
-			res[key] = value
-			key = ""
-			value = ""
-
-			// This character is the first character past the end,
-			// so it needs to be parsed like the parserStateEndValue state.
-			state = parserStateEndValue
-			switch {
-			case c == ';':
-				state = parserStateBeforeKey
-			case unicode.IsSpace(c):
-				// Ignore whitespace
-			default:
-				return res, fmt.Errorf("Unexpected character %c at index %d. Expected semi-colon or whitespace.", c, i)
-			}
-
-		case parserStateEndValue:
-			switch {
-			case c == ';':
-				state = parserStateBeforeKey
-			case unicode.IsSpace(c):
-				// Ignore whitespace
-			default:
-				return res, fmt.Errorf("Unexpected character %c at index %d. Expected semi-colon or whitespace.", c, i)
-			}
-		}
-	}
-
-	switch state {
-	case parserStateBeforeKey: // Okay
-	case parserStateKey: // Unfinished key. Treat as key without value.
-		key = normalizeOdbcKey(key)
-		res[key] = value
-	case parserStateBeginValue: // Empty value
-		res[key] = value
-	case parserStateBareValue:
-		res[key] = strings.TrimRightFunc(value, unicode.IsSpace)
-	case parserStateBracedValue:
-		return res, fmt.Errorf("Unexpected end of braced value at index %d.", len(dsn))
-	case parserStateBracedValueClosingBrace: // End of braced value
-		res[key] = value
-	case parserStateEndValue: // Okay
-	}
-
-	return res, nil
-}
-
-// Normalizes the given string as an ODBC-format key
-func normalizeOdbcKey(s string) string {
-	return strings.ToLower(strings.TrimRightFunc(s, unicode.IsSpace))
-}

+ 0 - 306
vendor/github.com/denisenkom/go-mssqldb/convert.go

@@ -1,306 +0,0 @@
-package mssql
-
-import "errors"
-
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Type conversions for Scan.
-
-// This file was imported from database.sql.convert for go 1.10.3 with minor modifications to get
-// convertAssign function
-// This function is used internally by sql to convert values during call to Scan, we need same
-// logic to return values for OUTPUT parameters.
-// TODO: sql library should instead expose function defaultCheckNamedValue to be callable by drivers
-
-import (
-	"database/sql"
-	"database/sql/driver"
-	"fmt"
-	"reflect"
-	"strconv"
-	"time"
-)
-
-var errNilPtr = errors.New("destination pointer is nil") // embedded in descriptive error
-
-// convertAssign copies to dest the value in src, converting it if possible.
-// An error is returned if the copy would result in loss of information.
-// dest should be a pointer type.
-func convertAssign(dest, src interface{}) error {
-	// Common cases, without reflect.
-	switch s := src.(type) {
-	case string:
-		switch d := dest.(type) {
-		case *string:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = s
-			return nil
-		case *[]byte:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = []byte(s)
-			return nil
-		case *sql.RawBytes:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = append((*d)[:0], s...)
-			return nil
-		}
-	case []byte:
-		switch d := dest.(type) {
-		case *string:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = string(s)
-			return nil
-		case *interface{}:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = cloneBytes(s)
-			return nil
-		case *[]byte:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = cloneBytes(s)
-			return nil
-		case *sql.RawBytes:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = s
-			return nil
-		}
-	case time.Time:
-		switch d := dest.(type) {
-		case *time.Time:
-			*d = s
-			return nil
-		case *string:
-			*d = s.Format(time.RFC3339Nano)
-			return nil
-		case *[]byte:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = []byte(s.Format(time.RFC3339Nano))
-			return nil
-		case *sql.RawBytes:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = s.AppendFormat((*d)[:0], time.RFC3339Nano)
-			return nil
-		}
-	case nil:
-		switch d := dest.(type) {
-		case *interface{}:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = nil
-			return nil
-		case *[]byte:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = nil
-			return nil
-		case *sql.RawBytes:
-			if d == nil {
-				return errNilPtr
-			}
-			*d = nil
-			return nil
-		}
-	}
-
-	var sv reflect.Value
-
-	switch d := dest.(type) {
-	case *string:
-		sv = reflect.ValueOf(src)
-		switch sv.Kind() {
-		case reflect.Bool,
-			reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
-			reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
-			reflect.Float32, reflect.Float64:
-			*d = asString(src)
-			return nil
-		}
-	case *[]byte:
-		sv = reflect.ValueOf(src)
-		if b, ok := asBytes(nil, sv); ok {
-			*d = b
-			return nil
-		}
-	case *sql.RawBytes:
-		sv = reflect.ValueOf(src)
-		if b, ok := asBytes([]byte(*d)[:0], sv); ok {
-			*d = sql.RawBytes(b)
-			return nil
-		}
-	case *bool:
-		bv, err := driver.Bool.ConvertValue(src)
-		if err == nil {
-			*d = bv.(bool)
-		}
-		return err
-	case *interface{}:
-		*d = src
-		return nil
-	}
-
-	if scanner, ok := dest.(sql.Scanner); ok {
-		return scanner.Scan(src)
-	}
-
-	dpv := reflect.ValueOf(dest)
-	if dpv.Kind() != reflect.Ptr {
-		return errors.New("destination not a pointer")
-	}
-	if dpv.IsNil() {
-		return errNilPtr
-	}
-
-	if !sv.IsValid() {
-		sv = reflect.ValueOf(src)
-	}
-
-	dv := reflect.Indirect(dpv)
-	if sv.IsValid() && sv.Type().AssignableTo(dv.Type()) {
-		switch b := src.(type) {
-		case []byte:
-			dv.Set(reflect.ValueOf(cloneBytes(b)))
-		default:
-			dv.Set(sv)
-		}
-		return nil
-	}
-
-	if dv.Kind() == sv.Kind() && sv.Type().ConvertibleTo(dv.Type()) {
-		dv.Set(sv.Convert(dv.Type()))
-		return nil
-	}
-
-	// The following conversions use a string value as an intermediate representation
-	// to convert between various numeric types.
-	//
-	// This also allows scanning into user defined types such as "type Int int64".
-	// For symmetry, also check for string destination types.
-	switch dv.Kind() {
-	case reflect.Ptr:
-		if src == nil {
-			dv.Set(reflect.Zero(dv.Type()))
-			return nil
-		} else {
-			dv.Set(reflect.New(dv.Type().Elem()))
-			return convertAssign(dv.Interface(), src)
-		}
-	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-		s := asString(src)
-		i64, err := strconv.ParseInt(s, 10, dv.Type().Bits())
-		if err != nil {
-			err = strconvErr(err)
-			return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err)
-		}
-		dv.SetInt(i64)
-		return nil
-	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
-		s := asString(src)
-		u64, err := strconv.ParseUint(s, 10, dv.Type().Bits())
-		if err != nil {
-			err = strconvErr(err)
-			return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err)
-		}
-		dv.SetUint(u64)
-		return nil
-	case reflect.Float32, reflect.Float64:
-		s := asString(src)
-		f64, err := strconv.ParseFloat(s, dv.Type().Bits())
-		if err != nil {
-			err = strconvErr(err)
-			return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err)
-		}
-		dv.SetFloat(f64)
-		return nil
-	case reflect.String:
-		switch v := src.(type) {
-		case string:
-			dv.SetString(v)
-			return nil
-		case []byte:
-			dv.SetString(string(v))
-			return nil
-		}
-	}
-
-	return fmt.Errorf("unsupported Scan, storing driver.Value type %T into type %T", src, dest)
-}
-
-func strconvErr(err error) error {
-	if ne, ok := err.(*strconv.NumError); ok {
-		return ne.Err
-	}
-	return err
-}
-
-func cloneBytes(b []byte) []byte {
-	if b == nil {
-		return nil
-	} else {
-		c := make([]byte, len(b))
-		copy(c, b)
-		return c
-	}
-}
-
-func asString(src interface{}) string {
-	switch v := src.(type) {
-	case string:
-		return v
-	case []byte:
-		return string(v)
-	}
-	rv := reflect.ValueOf(src)
-	switch rv.Kind() {
-	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-		return strconv.FormatInt(rv.Int(), 10)
-	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
-		return strconv.FormatUint(rv.Uint(), 10)
-	case reflect.Float64:
-		return strconv.FormatFloat(rv.Float(), 'g', -1, 64)
-	case reflect.Float32:
-		return strconv.FormatFloat(rv.Float(), 'g', -1, 32)
-	case reflect.Bool:
-		return strconv.FormatBool(rv.Bool())
-	}
-	return fmt.Sprintf("%v", src)
-}
-
-func asBytes(buf []byte, rv reflect.Value) (b []byte, ok bool) {
-	switch rv.Kind() {
-	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-		return strconv.AppendInt(buf, rv.Int(), 10), true
-	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
-		return strconv.AppendUint(buf, rv.Uint(), 10), true
-	case reflect.Float32:
-		return strconv.AppendFloat(buf, rv.Float(), 'g', -1, 32), true
-	case reflect.Float64:
-		return strconv.AppendFloat(buf, rv.Float(), 'g', -1, 64), true
-	case reflect.Bool:
-		return strconv.AppendBool(buf, rv.Bool()), true
-	case reflect.String:
-		s := rv.String()
-		return append(buf, s...), true
-	}
-	return
-}

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác