├── .travis.yml ├── LICENSE ├── README.md ├── appveyor.yml ├── cliprompt └── cliPrompt.go ├── context ├── context.go ├── context_test.go ├── copy.go ├── err.go ├── fetch.go ├── get.go ├── label.go ├── label_test.go ├── license.go ├── license_test.go ├── modify.go ├── path.go ├── remote_test.go ├── resolve.go ├── rewrite.go ├── status.go ├── sync.go ├── syslist.go ├── tags.go ├── tags_test.go ├── vendorFile.go ├── version.go └── version_test.go ├── doc ├── design.md ├── dev-guide.md ├── faq.md ├── implementation.md ├── talk_2015-09-08.slide └── whitepaper.md ├── help ├── gen-license.template ├── licenses.go ├── msg.go ├── text.go └── version.go ├── internal ├── gt │ ├── gopath.go │ └── vcs.go ├── pathos │ ├── path.go │ └── path_test.go ├── vfilepath │ ├── prefix.go │ ├── prefix_test.go │ ├── stub.go │ ├── switch.go │ └── walk.go └── vos │ ├── stub.go │ └── switch.go ├── main.go ├── migrate ├── gb.go ├── gdm.go ├── gdm_test.go ├── glide.go ├── glock.go ├── godep.go ├── migrate.go └── old.go ├── pkgspec ├── pkg.go ├── pkgspec.go └── pkgspec_test.go ├── prompt └── prompt.go ├── run ├── command.go ├── filter.go ├── license.go ├── list.go ├── modify.go ├── run.go ├── run_test.go ├── shell.go └── sync.go ├── vcs ├── bzr.go ├── git.go ├── hg.go ├── svn.go ├── svn_test.go └── vcs.go ├── vendor ├── github.com │ ├── Bowery │ │ └── prompt │ │ │ ├── CONTRIBUTORS.md │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── ansi_unix.go │ │ │ ├── ansi_windows.go │ │ │ ├── buffer.go │ │ │ ├── buffer_unix.go │ │ │ ├── buffer_windows.go │ │ │ ├── ioctl_bsd.go │ │ │ ├── ioctl_linux.go │ │ │ ├── ioctl_sysunix.go │ │ │ ├── ioctl_unix.go │ │ │ ├── keys.go │ │ │ ├── keys_unix.go │ │ │ ├── keys_windows.go │ │ │ ├── prompt.go │ │ │ ├── term.go │ │ │ ├── term_unix.go │ │ │ └── term_windows.go │ ├── dchest │ │ └── safefile │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── appveyor.yml │ │ │ ├── rename.go │ │ │ ├── rename_nonatomic.go │ │ │ ├── safefile.go │ │ │ └── safefile_test.go │ ├── google │ │ └── shlex │ │ │ ├── COPYING │ │ │ ├── README │ │ │ ├── shlex.go │ │ │ └── shlex_test.go │ └── pkg │ │ └── errors │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── errors.go │ │ └── stack.go ├── golang.org │ └── x │ │ ├── sys │ │ ├── LICENSE │ │ ├── PATENTS │ │ └── unix │ │ │ ├── README.md │ │ │ ├── affinity_linux.go │ │ │ ├── aliases.go │ │ │ ├── asm_aix_ppc64.s │ │ │ ├── asm_darwin_386.s │ │ │ ├── asm_darwin_amd64.s │ │ │ ├── asm_darwin_arm.s │ │ │ ├── asm_darwin_arm64.s │ │ │ ├── asm_dragonfly_amd64.s │ │ │ ├── asm_freebsd_386.s │ │ │ ├── asm_freebsd_amd64.s │ │ │ ├── asm_freebsd_arm.s │ │ │ ├── asm_freebsd_arm64.s │ │ │ ├── asm_linux_386.s │ │ │ ├── asm_linux_amd64.s │ │ │ ├── asm_linux_arm.s │ │ │ ├── asm_linux_arm64.s │ │ │ ├── asm_linux_mips64x.s │ │ │ ├── asm_linux_mipsx.s │ │ │ ├── asm_linux_ppc64x.s │ │ │ ├── asm_linux_s390x.s │ │ │ ├── asm_netbsd_386.s │ │ │ ├── asm_netbsd_amd64.s │ │ │ ├── asm_netbsd_arm.s │ │ │ ├── asm_netbsd_arm64.s │ │ │ ├── asm_openbsd_386.s │ │ │ ├── asm_openbsd_amd64.s │ │ │ ├── asm_openbsd_arm.s │ │ │ ├── asm_solaris_amd64.s │ │ │ ├── bluetooth_linux.go │ │ │ ├── cap_freebsd.go │ │ │ ├── constants.go │ │ │ ├── dev_aix_ppc.go │ │ │ ├── dev_aix_ppc64.go │ │ │ ├── dev_darwin.go │ │ │ ├── dev_dragonfly.go │ │ │ ├── dev_freebsd.go │ │ │ ├── dev_linux.go │ │ │ ├── dev_netbsd.go │ │ │ ├── dev_openbsd.go │ │ │ ├── dirent.go │ │ │ ├── endian_big.go │ │ │ ├── endian_little.go │ │ │ ├── env_unix.go │ │ │ ├── errors_freebsd_386.go │ │ │ ├── errors_freebsd_amd64.go │ │ │ ├── errors_freebsd_arm.go │ │ │ ├── fcntl.go │ │ │ ├── fcntl_darwin.go │ │ │ ├── fcntl_linux_32bit.go │ │ │ ├── gccgo.go │ │ │ ├── gccgo_c.c │ │ │ ├── gccgo_linux_amd64.go │ │ │ ├── ioctl.go │ │ │ ├── mkall.sh │ │ │ ├── mkerrors.sh │ │ │ ├── mksysctl_openbsd.pl │ │ │ ├── openbsd_pledge.go │ │ │ ├── openbsd_unveil.go │ │ │ ├── pagesize_unix.go │ │ │ ├── race.go │ │ │ ├── race0.go │ │ │ ├── sockcmsg_linux.go │ │ │ ├── sockcmsg_unix.go │ │ │ ├── str.go │ │ │ ├── syscall.go │ │ │ ├── syscall_aix.go │ │ │ ├── syscall_aix_ppc.go │ │ │ ├── syscall_aix_ppc64.go │ │ │ ├── syscall_bsd.go │ │ │ ├── syscall_darwin.go │ │ │ ├── syscall_darwin_386.go │ │ │ ├── syscall_darwin_amd64.go │ │ │ ├── syscall_darwin_arm.go │ │ │ ├── syscall_darwin_arm64.go │ │ │ ├── syscall_darwin_libSystem.go │ │ │ ├── syscall_dragonfly.go │ │ │ ├── syscall_dragonfly_amd64.go │ │ │ ├── syscall_freebsd.go │ │ │ ├── syscall_freebsd_386.go │ │ │ ├── syscall_freebsd_amd64.go │ │ │ ├── syscall_freebsd_arm.go │ │ │ ├── syscall_freebsd_arm64.go │ │ │ ├── syscall_linux.go │ │ │ ├── syscall_linux_386.go │ │ │ ├── syscall_linux_amd64.go │ │ │ ├── syscall_linux_amd64_gc.go │ │ │ ├── syscall_linux_arm.go │ │ │ ├── syscall_linux_arm64.go │ │ │ ├── syscall_linux_gc.go │ │ │ ├── syscall_linux_gc_386.go │ │ │ ├── syscall_linux_gccgo_386.go │ │ │ ├── syscall_linux_gccgo_arm.go │ │ │ ├── syscall_linux_mips64x.go │ │ │ ├── syscall_linux_mipsx.go │ │ │ ├── syscall_linux_ppc64x.go │ │ │ ├── syscall_linux_riscv64.go │ │ │ ├── syscall_linux_s390x.go │ │ │ ├── syscall_linux_sparc64.go │ │ │ ├── syscall_netbsd.go │ │ │ ├── syscall_netbsd_386.go │ │ │ ├── syscall_netbsd_amd64.go │ │ │ ├── syscall_netbsd_arm.go │ │ │ ├── syscall_netbsd_arm64.go │ │ │ ├── syscall_openbsd.go │ │ │ ├── syscall_openbsd_386.go │ │ │ ├── syscall_openbsd_amd64.go │ │ │ ├── syscall_openbsd_arm.go │ │ │ ├── syscall_solaris.go │ │ │ ├── syscall_solaris_amd64.go │ │ │ ├── syscall_unix.go │ │ │ ├── syscall_unix_gc.go │ │ │ ├── syscall_unix_gc_ppc64x.go │ │ │ ├── timestruct.go │ │ │ ├── xattr_bsd.go │ │ │ ├── zerrors_aix_ppc.go │ │ │ ├── zerrors_aix_ppc64.go │ │ │ ├── zerrors_darwin_386.go │ │ │ ├── zerrors_darwin_amd64.go │ │ │ ├── zerrors_darwin_arm.go │ │ │ ├── zerrors_darwin_arm64.go │ │ │ ├── zerrors_dragonfly_amd64.go │ │ │ ├── zerrors_freebsd_386.go │ │ │ ├── zerrors_freebsd_amd64.go │ │ │ ├── zerrors_freebsd_arm.go │ │ │ ├── zerrors_freebsd_arm64.go │ │ │ ├── zerrors_linux_386.go │ │ │ ├── zerrors_linux_amd64.go │ │ │ ├── zerrors_linux_arm.go │ │ │ ├── zerrors_linux_arm64.go │ │ │ ├── zerrors_linux_mips.go │ │ │ ├── zerrors_linux_mips64.go │ │ │ ├── zerrors_linux_mips64le.go │ │ │ ├── zerrors_linux_mipsle.go │ │ │ ├── zerrors_linux_ppc64.go │ │ │ ├── zerrors_linux_ppc64le.go │ │ │ ├── zerrors_linux_riscv64.go │ │ │ ├── zerrors_linux_s390x.go │ │ │ ├── zerrors_linux_sparc64.go │ │ │ ├── zerrors_netbsd_386.go │ │ │ ├── zerrors_netbsd_amd64.go │ │ │ ├── zerrors_netbsd_arm.go │ │ │ ├── zerrors_netbsd_arm64.go │ │ │ ├── zerrors_openbsd_386.go │ │ │ ├── zerrors_openbsd_amd64.go │ │ │ ├── zerrors_openbsd_arm.go │ │ │ ├── zerrors_solaris_amd64.go │ │ │ ├── zptrace386_linux.go │ │ │ ├── zptracearm_linux.go │ │ │ ├── zptracemips_linux.go │ │ │ ├── zptracemipsle_linux.go │ │ │ ├── zsyscall_aix_ppc.go │ │ │ ├── zsyscall_aix_ppc64.go │ │ │ ├── zsyscall_aix_ppc64_gc.go │ │ │ ├── zsyscall_aix_ppc64_gccgo.go │ │ │ ├── zsyscall_darwin_386.1_11.go │ │ │ ├── zsyscall_darwin_386.go │ │ │ ├── zsyscall_darwin_386.s │ │ │ ├── zsyscall_darwin_amd64.1_11.go │ │ │ ├── zsyscall_darwin_amd64.go │ │ │ ├── zsyscall_darwin_amd64.s │ │ │ ├── zsyscall_darwin_arm.1_11.go │ │ │ ├── zsyscall_darwin_arm.go │ │ │ ├── zsyscall_darwin_arm.s │ │ │ ├── zsyscall_darwin_arm64.1_11.go │ │ │ ├── zsyscall_darwin_arm64.go │ │ │ ├── zsyscall_darwin_arm64.s │ │ │ ├── zsyscall_dragonfly_amd64.go │ │ │ ├── zsyscall_freebsd_386.go │ │ │ ├── zsyscall_freebsd_amd64.go │ │ │ ├── zsyscall_freebsd_arm.go │ │ │ ├── zsyscall_freebsd_arm64.go │ │ │ ├── zsyscall_linux_386.go │ │ │ ├── zsyscall_linux_amd64.go │ │ │ ├── zsyscall_linux_arm.go │ │ │ ├── zsyscall_linux_arm64.go │ │ │ ├── zsyscall_linux_mips.go │ │ │ ├── zsyscall_linux_mips64.go │ │ │ ├── zsyscall_linux_mips64le.go │ │ │ ├── zsyscall_linux_mipsle.go │ │ │ ├── zsyscall_linux_ppc64.go │ │ │ ├── zsyscall_linux_ppc64le.go │ │ │ ├── zsyscall_linux_riscv64.go │ │ │ ├── zsyscall_linux_s390x.go │ │ │ ├── zsyscall_linux_sparc64.go │ │ │ ├── zsyscall_netbsd_386.go │ │ │ ├── zsyscall_netbsd_amd64.go │ │ │ ├── zsyscall_netbsd_arm.go │ │ │ ├── zsyscall_netbsd_arm64.go │ │ │ ├── zsyscall_openbsd_386.go │ │ │ ├── zsyscall_openbsd_amd64.go │ │ │ ├── zsyscall_openbsd_arm.go │ │ │ ├── zsyscall_solaris_amd64.go │ │ │ ├── zsysctl_openbsd_386.go │ │ │ ├── zsysctl_openbsd_amd64.go │ │ │ ├── zsysctl_openbsd_arm.go │ │ │ ├── zsysnum_darwin_386.go │ │ │ ├── zsysnum_darwin_amd64.go │ │ │ ├── zsysnum_darwin_arm.go │ │ │ ├── zsysnum_darwin_arm64.go │ │ │ ├── zsysnum_dragonfly_amd64.go │ │ │ ├── zsysnum_freebsd_386.go │ │ │ ├── zsysnum_freebsd_amd64.go │ │ │ ├── zsysnum_freebsd_arm.go │ │ │ ├── zsysnum_freebsd_arm64.go │ │ │ ├── zsysnum_linux_386.go │ │ │ ├── zsysnum_linux_amd64.go │ │ │ ├── zsysnum_linux_arm.go │ │ │ ├── zsysnum_linux_arm64.go │ │ │ ├── zsysnum_linux_mips.go │ │ │ ├── zsysnum_linux_mips64.go │ │ │ ├── zsysnum_linux_mips64le.go │ │ │ ├── zsysnum_linux_mipsle.go │ │ │ ├── zsysnum_linux_ppc64.go │ │ │ ├── zsysnum_linux_ppc64le.go │ │ │ ├── zsysnum_linux_riscv64.go │ │ │ ├── zsysnum_linux_s390x.go │ │ │ ├── zsysnum_linux_sparc64.go │ │ │ ├── zsysnum_netbsd_386.go │ │ │ ├── zsysnum_netbsd_amd64.go │ │ │ ├── zsysnum_netbsd_arm.go │ │ │ ├── zsysnum_netbsd_arm64.go │ │ │ ├── zsysnum_openbsd_386.go │ │ │ ├── zsysnum_openbsd_amd64.go │ │ │ ├── zsysnum_openbsd_arm.go │ │ │ ├── ztypes_aix_ppc.go │ │ │ ├── ztypes_aix_ppc64.go │ │ │ ├── ztypes_darwin_386.go │ │ │ ├── ztypes_darwin_amd64.go │ │ │ ├── ztypes_darwin_arm.go │ │ │ ├── ztypes_darwin_arm64.go │ │ │ ├── ztypes_dragonfly_amd64.go │ │ │ ├── ztypes_freebsd_386.go │ │ │ ├── ztypes_freebsd_amd64.go │ │ │ ├── ztypes_freebsd_arm.go │ │ │ ├── ztypes_freebsd_arm64.go │ │ │ ├── ztypes_linux_386.go │ │ │ ├── ztypes_linux_amd64.go │ │ │ ├── ztypes_linux_arm.go │ │ │ ├── ztypes_linux_arm64.go │ │ │ ├── ztypes_linux_mips.go │ │ │ ├── ztypes_linux_mips64.go │ │ │ ├── ztypes_linux_mips64le.go │ │ │ ├── ztypes_linux_mipsle.go │ │ │ ├── ztypes_linux_ppc64.go │ │ │ ├── ztypes_linux_ppc64le.go │ │ │ ├── ztypes_linux_riscv64.go │ │ │ ├── ztypes_linux_s390x.go │ │ │ ├── ztypes_linux_sparc64.go │ │ │ ├── ztypes_netbsd_386.go │ │ │ ├── ztypes_netbsd_amd64.go │ │ │ ├── ztypes_netbsd_arm.go │ │ │ ├── ztypes_netbsd_arm64.go │ │ │ ├── ztypes_openbsd_386.go │ │ │ ├── ztypes_openbsd_amd64.go │ │ │ ├── ztypes_openbsd_arm.go │ │ │ └── ztypes_solaris_amd64.go │ │ └── tools │ │ ├── LICENSE │ │ ├── PATENTS │ │ └── go │ │ └── vcs │ │ ├── discovery.go │ │ ├── env.go │ │ ├── http.go │ │ └── vcs.go ├── gopkg.in │ └── yaml.v2 │ │ ├── LICENSE │ │ ├── LICENSE.libyaml │ │ ├── README.md │ │ ├── apic.go │ │ ├── decode.go │ │ ├── emitterc.go │ │ ├── encode.go │ │ ├── parserc.go │ │ ├── readerc.go │ │ ├── resolve.go │ │ ├── scannerc.go │ │ ├── sorter.go │ │ ├── writerc.go │ │ ├── yaml.go │ │ ├── yamlh.go │ │ └── yamlprivateh.go └── vendor.json └── vendorfile ├── file.go └── file_test.go /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.8.x 4 | - 1.9.x 5 | - 1.11.x 6 | install: 7 | before_deploy: 8 | - GOOS=linux GOARCH=amd64 go build -o govendor_linux_amd64 9 | - GOOS=linux GOARCH=386 go build -o govendor_linux_386 10 | - GOOS=linux GOARCH=arm go build -o govendor_linux_arm 11 | - GOOS=darwin GOARCH=amd64 go build -o govendor_darwin_amd64 12 | - GOOS=windows GOARCH=amd64 go build -o govendor_windows_amd64.exe 13 | - GOOS=windows GOARCH=386 go build -o govendor_windows_386.exe 14 | deploy: 15 | provider: releases 16 | api_key: 17 | secure: D4zFkClhHZBIGCWK2WkwKW0cgERHqs8cRjYdgAahEwzPKdXwHBkjsTIg58xU6tnnjNbCydAIw8U1mzJaJx6WioknWJKjnfT1MDiScdf1DFBmop6uuNLpE76PtQ3Au7XEKOKeiOs62OVL6ov2Ah/DEx8hRfilENVidKDnRa2uRw2mKn9rLj4T1zif0VDtgmVS75/IFKh469RYUbsVvvmzJsCbMjYvXo1oJQw1iXfUifX5Fawz7G3xAvYoOLWBc72hTdj8383GYOujnhlsM4paWc2blSJ8ImRim5yOnhB1jg022A49BMpyGJtIdXtXWTpkQ5RdOr4CbzgYJQQEIqkl6GjUcDx78Kxt+FLvl4M2MjJhtTjo0XF/SgI45CP5QMEwpw2tRlFH7slmJWv0cDf/K1o3VkIztlWLR6AwNJlMGy0kAf4K94wUpNZm1Z35fa3w1xV59RdSpS940Pz+bOhpR/vI8KDtGOsUX9asRMgW9aEOv6ak3W7DuEE1+LwYXRunTk/5PcyCbee3qDdFaYxbcBIVBYYKwIlTHC3VG9J6vCjlZ9efpEHJ9IVr/BCGhIGNt6Mv0Mfp2Y7zN6R4BvP1F7rZI1hjbPAgum8L3T2cz80O92sToibPBgEGEIoZ7XGPPNuw41aw5IQcQU1nD/mcgQ6JnfuEBKANgT8xGfehxdY= 18 | file: 19 | - govendor_linux_amd64 20 | - govendor_linux_386 21 | - govendor_linux_arm 22 | - govendor_darwin_amd64 23 | - govendor_windows_amd64.exe 24 | - govendor_windows_386.exe 25 | 26 | on: 27 | tags: true 28 | repo: kardianos/govendor 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Use Go modules 2 | 3 | [Go modules](https://blog.golang.org/migrating-to-go-modules) 4 | Work well now. Go modules is considered production with go1.14, but work well on 1.13 and 1.12. 5 | 6 | Please don't use this tool anymore. 7 | 8 | Please use Go modules. 9 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | os: Windows Server 2012 R2 4 | 5 | environment: 6 | GOPATH: c:\gopath 7 | GOVERSION: 1.7 8 | 9 | clone_folder: c:\gopath\src\github.com\kardianos\govendor 10 | 11 | install: 12 | - mkdir c:\tmp 13 | - set TMP=C:\tmp 14 | - go version 15 | - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% 16 | - rmdir c:\go /s /q 17 | - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.zip 18 | - 7z x go%GOVERSION%.windows-amd64.zip -y -oC:\ > NUL 19 | - go version 20 | - go env 21 | 22 | build_script: 23 | - go test -i ./... 24 | - go test ./... 25 | -------------------------------------------------------------------------------- /context/err.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context 6 | 7 | import ( 8 | "errors" 9 | "fmt" 10 | ) 11 | 12 | var ( 13 | // ErrMissingGOROOT returns if the GOROOT was not found. 14 | ErrMissingGOROOT = errors.New("Unable to determine GOROOT.") 15 | // ErrMissingGOPATH returns if no GOPATH was found. 16 | ErrMissingGOPATH = errors.New("Missing GOPATH. Check your environment variable GOPATH.") 17 | ) 18 | 19 | // ErrNotInGOPATH returns if not currently in the GOPATH. 20 | type ErrNotInGOPATH struct { 21 | Missing string 22 | } 23 | 24 | func (err ErrNotInGOPATH) Error() string { 25 | return fmt.Sprintf("Package %q not a go package or not in GOPATH.", err.Missing) 26 | } 27 | 28 | // ErrDirtyPackage returns if package is in dirty version control. 29 | type ErrDirtyPackage struct { 30 | ImportPath string 31 | } 32 | 33 | func (err ErrDirtyPackage) Error() string { 34 | return fmt.Sprintf("Package %q has uncommitted changes in the vcs.", err.ImportPath) 35 | } 36 | 37 | // ErrPackageExists returns if package already exists. 38 | type ErrPackageExists struct { 39 | Package string 40 | } 41 | 42 | func (err ErrPackageExists) Error() string { 43 | return fmt.Sprintf("Package %q already in vendor.", err.Package) 44 | } 45 | 46 | // ErrMissingVendorFile returns if package already exists. 47 | type ErrMissingVendorFile struct { 48 | Path string 49 | } 50 | 51 | func (err ErrMissingVendorFile) Error() string { 52 | return fmt.Sprintf("Vendor file at %q not found.", err.Path) 53 | } 54 | 55 | // ErrOldVersion returns if vendor file is not in the vendor folder. 56 | type ErrOldVersion struct { 57 | Message string 58 | } 59 | 60 | func (err ErrOldVersion) Error() string { 61 | return fmt.Sprintf("The vendor file or is old. %s", err.Message) 62 | } 63 | 64 | type ErrTreeChildren struct { 65 | path string 66 | children []*Package 67 | } 68 | 69 | func (err ErrTreeChildren) Error() string { 70 | return fmt.Sprintf("Cannot have a sub-tree %q contain sub-packages %q", err.path, err.children) 71 | } 72 | 73 | type ErrTreeParents struct { 74 | path string 75 | parents []string 76 | } 77 | 78 | func (err ErrTreeParents) Error() string { 79 | return fmt.Sprintf("Cannot add package %q which is already found in sub-tree %q", err.path, err.parents) 80 | } 81 | -------------------------------------------------------------------------------- /context/get.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context 6 | 7 | import ( 8 | "fmt" 9 | "go/build" 10 | "io" 11 | "os" 12 | "path/filepath" 13 | 14 | "github.com/kardianos/govendor/pkgspec" 15 | "golang.org/x/tools/go/vcs" 16 | ) 17 | 18 | func Get(logger io.Writer, pkgspecName string, insecure bool) (*pkgspec.Pkg, error) { 19 | // Get the GOPATHs. 20 | gopathList := filepath.SplitList(build.Default.GOPATH) 21 | gopath := gopathList[0] 22 | 23 | cwd, err := os.Getwd() 24 | if err != nil { 25 | return nil, err 26 | } 27 | ps, err := pkgspec.Parse(cwd, pkgspecName) 28 | if err != nil { 29 | return nil, err 30 | } 31 | return ps, get(logger, filepath.Join(gopath, "src"), ps, insecure) 32 | } 33 | 34 | func get(logger io.Writer, gopath string, ps *pkgspec.Pkg, insecure bool) error { 35 | pkgDir := filepath.Join(gopath, ps.Path) 36 | sysVcsCmd, repoRoot, err := vcs.FromDir(pkgDir, gopath) 37 | var vcsCmd *VCSCmd 38 | repoRootDir := filepath.Join(gopath, repoRoot) 39 | if err != nil { 40 | rr, err := vcs.RepoRootForImportPath(ps.PathOrigin(), false) 41 | if err != nil { 42 | return err 43 | } 44 | if !insecure && !vcsIsSecure(rr.Repo) { 45 | return fmt.Errorf("repo remote not secure") 46 | } 47 | 48 | vcsCmd = updateVcsCmd(rr.VCS) 49 | repoRoot = rr.Root 50 | repoRootDir = filepath.Join(gopath, repoRoot) 51 | 52 | err = vcsCmd.Create(repoRootDir, rr.Repo) 53 | if err != nil { 54 | return fmt.Errorf("failed to create repo %q in %q %v", rr.Repo, repoRootDir, err) 55 | } 56 | 57 | } else { 58 | vcsCmd = updateVcsCmd(sysVcsCmd) 59 | err = vcsCmd.Download(repoRootDir) 60 | if err != nil { 61 | return fmt.Errorf("failed to download repo into %q %v", repoRootDir, err) 62 | } 63 | } 64 | err = os.MkdirAll(filepath.Join(repoRootDir, "vendor"), 0777) 65 | if err != nil { 66 | return err 67 | } 68 | ctx, err := NewContext(repoRootDir, filepath.Join("vendor", vendorFilename), "vendor", false) 69 | if err != nil { 70 | return err 71 | } 72 | ctx.Insecure = insecure 73 | ctx.Logger = logger 74 | statusList, err := ctx.Status() 75 | if err != nil { 76 | return err 77 | } 78 | added := make(map[string]bool, len(statusList)) 79 | for _, item := range statusList { 80 | switch item.Status.Location { 81 | case LocationExternal, LocationNotFound: 82 | if added[item.Pkg.Path] { 83 | continue 84 | } 85 | ctx.ModifyImport(item.Pkg, Fetch) 86 | added[item.Pkg.Path] = true 87 | } 88 | } 89 | defer ctx.WriteVendorFile() 90 | return ctx.Alter() 91 | } 92 | -------------------------------------------------------------------------------- /context/license_test.go: -------------------------------------------------------------------------------- 1 | package context 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestGetLastVendorRoot(t *testing.T) { 8 | tt := []struct { 9 | From string 10 | To string 11 | }{ 12 | { 13 | From: "/foo/bar/bean", 14 | To: "/foo/bar/bean", 15 | }, 16 | { 17 | From: "/foo/bar/bean/vendor/fox/vax/bax", 18 | To: "/fox/vax/bax", 19 | }, 20 | } 21 | for _, item := range tt { 22 | got := getLastVendorRoot(item.From) 23 | if got != item.To { 24 | t.Errorf("Want: %q, Got: %q", item.To, got) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /context/syslist.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context 6 | 7 | const goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows " 8 | const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 " 9 | -------------------------------------------------------------------------------- /context/tags_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context 6 | 7 | import ( 8 | "strings" 9 | "testing" 10 | ) 11 | 12 | func TestTagComplex(t *testing.T) { 13 | list := []struct { 14 | ignoreList string 15 | file []string 16 | buildTags string 17 | ignored bool 18 | }{ 19 | { 20 | ignoreList: "mips appengine test", 21 | file: []string{"mips", "test"}, 22 | buildTags: "", 23 | ignored: true, 24 | }, 25 | { 26 | ignoreList: "", 27 | file: []string{}, 28 | buildTags: "ignore", 29 | ignored: true, 30 | }, 31 | { 32 | ignoreList: "", 33 | file: []string{}, 34 | buildTags: "", 35 | ignored: false, 36 | }, 37 | { 38 | ignoreList: "test", 39 | file: []string{"mips"}, 40 | buildTags: "amd64", 41 | ignored: false, 42 | }, 43 | { 44 | ignoreList: "mips appengine test", 45 | file: []string{}, 46 | buildTags: "", 47 | ignored: false, 48 | }, 49 | { 50 | ignoreList: "mips appengine test", 51 | file: []string{}, 52 | buildTags: "mips,appengine", 53 | ignored: true, 54 | }, 55 | { 56 | ignoreList: "appengine test", 57 | file: []string{}, 58 | buildTags: "mips,appengine", 59 | ignored: true, 60 | }, 61 | { 62 | ignoreList: "appengine test solaris", 63 | file: []string{}, 64 | buildTags: "!windows", 65 | ignored: false, 66 | }, 67 | { 68 | ignoreList: "appengine test solaris", 69 | file: []string{}, 70 | buildTags: "darwin dragonfly freebsd linux nacl netbsd openbsd solaris", 71 | ignored: false, 72 | }, 73 | { 74 | ignoreList: "darwin dragonfly freebsd linux nacl netbsd openbsd solaris", 75 | file: []string{}, 76 | buildTags: "darwin dragonfly freebsd linux nacl netbsd openbsd solaris", 77 | ignored: true, 78 | }, 79 | { 80 | ignoreList: "test", 81 | file: []string{"test"}, 82 | buildTags: "go1.8", 83 | ignored: true, 84 | }, 85 | { 86 | ignoreList: "", 87 | file: []string{"!go1.8"}, 88 | buildTags: "go1.8", 89 | ignored: true, 90 | }, 91 | } 92 | 93 | run := -1 94 | 95 | for index, item := range list { 96 | if run >= 0 && run != index { 97 | continue 98 | } 99 | ignore := strings.Fields(item.ignoreList) 100 | ts := &TagSet{} 101 | for _, f := range item.file { 102 | ts.AddFileTag(f) 103 | } 104 | ts.AddBuildTags(item.buildTags) 105 | 106 | ignored := ts.IgnoreItem(ignore...) 107 | 108 | if ignored != item.ignored { 109 | t.Errorf("index %d wanted ignored=%t, got ignored=%t: ignore=%q build=%v", index, item.ignored, ignored, item.ignoreList, ts) 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /context/vendorFile.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context 6 | 7 | import ( 8 | "bytes" 9 | ros "os" 10 | "path/filepath" 11 | "strings" 12 | 13 | "github.com/dchest/safefile" 14 | "github.com/kardianos/govendor/vendorfile" 15 | 16 | os "github.com/kardianos/govendor/internal/vos" 17 | ) 18 | 19 | // WriteVendorFile writes the current vendor file to the context location. 20 | func (ctx *Context) WriteVendorFile() (err error) { 21 | perm := ros.FileMode(0666) 22 | fi, err := os.Stat(ctx.VendorFilePath) 23 | if err == nil { 24 | perm = fi.Mode() 25 | } 26 | 27 | ctx.VendorFile.RootPath = ctx.RootImportPath 28 | 29 | buf := &bytes.Buffer{} 30 | err = ctx.VendorFile.Marshal(buf) 31 | if err != nil { 32 | return 33 | } 34 | err = buf.WriteByte('\n') 35 | if err != nil { 36 | return 37 | } 38 | dir, _ := filepath.Split(ctx.VendorFilePath) 39 | err = os.MkdirAll(dir, 0777) 40 | if err != nil { 41 | return 42 | } 43 | 44 | for i := range ctx.VendorFile.Package { 45 | vp := ctx.VendorFile.Package[i] 46 | vp.Add = false 47 | } 48 | 49 | err = safefile.WriteFile(ctx.VendorFilePath, buf.Bytes(), perm) 50 | if err == nil { 51 | for _, vp := range ctx.VendorFile.Package { 52 | vp.Add = false 53 | } 54 | } 55 | 56 | return 57 | } 58 | 59 | func readVendorFile(vendorRoot, vendorFilePath string) (*vendorfile.File, error) { 60 | vf := &vendorfile.File{} 61 | f, err := os.Open(vendorFilePath) 62 | if err != nil { 63 | return nil, err 64 | } 65 | defer f.Close() 66 | 67 | err = vf.Unmarshal(f) 68 | if err != nil { 69 | return nil, err 70 | } 71 | // Remove any existing origin field if the prefix matches the 72 | // context package root. This fixes a previous bug introduced in the file, 73 | // that is now fixed. 74 | for _, row := range vf.Package { 75 | row.Origin = strings.TrimPrefix(row.Origin, vendorRoot) 76 | } 77 | 78 | return vf, nil 79 | } 80 | -------------------------------------------------------------------------------- /context/version.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context 6 | 7 | import ( 8 | "strconv" 9 | "unicode" 10 | ) 11 | 12 | // IsVersion returns true if the string is a version. 13 | func isVersion(s string) bool { 14 | hasPunct := false 15 | onlyNumber := true 16 | onlyHexLetter := true 17 | for _, r := range s { 18 | isNumber := unicode.IsNumber(r) 19 | isLetter := unicode.IsLetter(r) 20 | 21 | hasPunct = hasPunct || unicode.IsPunct(r) 22 | onlyNumber = onlyNumber && isNumber 23 | 24 | if isLetter { 25 | low := unicode.ToLower(r) 26 | onlyHexLetter = onlyHexLetter && low <= 'f' 27 | } 28 | } 29 | if hasPunct { 30 | return true 31 | } 32 | if !onlyHexLetter { 33 | return true 34 | } 35 | 36 | num, err := strconv.ParseInt(s, 10, 64) 37 | if err == nil { 38 | if num > 100 { 39 | return false // numeric revision. 40 | } 41 | } 42 | 43 | if len(s) > 5 && onlyHexLetter { 44 | return false // hex revision 45 | } 46 | return true 47 | } 48 | -------------------------------------------------------------------------------- /context/version_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func TestIsVersion(t *testing.T) { 12 | list := []struct { 13 | Text string 14 | IsVersion bool 15 | }{ 16 | {"10", true}, 17 | {"86811224500e65b549265b273109f2166a35fe63", false}, 18 | {"v1", true}, 19 | {"v1.2-beta", true}, 20 | {"1", true}, 21 | {"3242", false}, 22 | {"2ea995a", false}, 23 | } 24 | 25 | for _, item := range list { 26 | is := isVersion(item.Text) 27 | if is != item.IsVersion { 28 | t.Errorf("For %q, got %v, want %v", item.Text, is, item.IsVersion) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /doc/dev-guide.md: -------------------------------------------------------------------------------- 1 | # Go Developer Guide 2 | 3 | * Always check-in the "vendor/vendor.json" file 4 | * Do not check-in vendor sources if you expect an external package to import it. 5 | * Do check-in vendor sources for main packages. 6 | * Main packages should vendor their own common dependencies. 7 | * Release with semver, do not break compatibility within a major version. 8 | * If you choose to release with tags or branches, keep them up-to-date. 9 | 10 | ## Always check in the "vendor/vendor.json" file 11 | 12 | You can add the ignore rule `vendor/*/` to ignore source files. 13 | This way a consumer of your package has a chance at reproducing your package tests 14 | if something appears to break later. 15 | 16 | 17 | ## Do not check-in vendor sources if you expect an external package to import it 18 | 19 | The way `go get` currently works is to download repositories into $GOPATH without 20 | modification. This is fine, but if a "library" repository contains a vendor folder, 21 | it is likely it will be unable to be used unless the consumers also vendor 22 | the dependencies. 23 | 24 | ## Do check-in vendor sources for main packages 25 | 26 | Reproducible builds are important. Repositories can and do disappear. 27 | Pull them into your own repository under the vendor folder. Your 28 | maintainers 15 years from now will thank you. 29 | 30 | ## Release with semver, do not break compatibility within a major version 31 | 32 | Release with semver: `v..[-]`. 33 | 34 | * Increment major: break existing API. 35 | * Increment minor: add API, no breaks to existing API. 36 | * Increment patch: no api changes, bug fixes. 37 | * Tag pre-release: use to prepare for a later release with the same numbers. 38 | 39 | `govendor` will also handle path prefixes, for example `ssh-v1.0.2-beta1` 40 | can be used in govendor with `govendor fetch my/util/ssh@ssh-v1`. 41 | 42 | 43 | ## If you choose to release with tags or branches, keep them up-to-date 44 | 45 | It is completely plausible to do work in branches, then only merge the branch 46 | to master when the branch is stable. This effectively releases software. 47 | 48 | If you choose to also tag revisions or release to a dedicated branch (like a 49 | branch named "v1"), ensure HEAD never gets too far ahead of the release. 50 | If it does so it renders the release obsolete and it stops being used. 51 | 52 | -------------------------------------------------------------------------------- /doc/faq.md: -------------------------------------------------------------------------------- 1 | # govendor FAQ 2 | 3 | #### Q: How do I test only my packages? 4 | A: Run `govendor test +local`. 5 | 6 | #### Q: How do I build install all my vendor packages? 7 | A: Run `govendor install +vendor,^program`. 8 | 9 | #### Q: How do I pull all my dependencies from network remotes? 10 | A: Run `govendor fetch +out`. 11 | 12 | #### Q: I have a working program with dependencies in $GOPATH. I want to vendor now. 13 | A: Run `govendor add +external`. 14 | 15 | #### Q: I have copied dependencies into "vendor". I want to update from $GOPATH. 16 | A: Run `govendor update +vendor`. 17 | 18 | #### Q: I'm getting missing packages from `appengine` but I don't care about `appengine`. How do I ignore these packages? 19 | A: Edit the `vendor/vendor.json` file. Update the "ignore" field to include "appengine". 20 | If you are already ignoring tests, it will look like: `"ignore": "test appengine",`. 21 | 22 | #### Q: I have modified a package in $GOPATH and I want to try the changes in vendor without committing them. 23 | A: Run `govendor update -uncommitted `. 24 | 25 | #### Q: I've forked a package and I haven't upstreamed the changes yet. What should I do? 26 | A: Assuming you've pushed your changes to an accessable repository, run 27 | `govendor fetch github.com/normal/pkg::github.com/myfork/pkg`. This will 28 | fetch from "myfork" but place package in "normal". 29 | 30 | #### Q: I have C files or HTML resources in sub-folders. How do I ensure they are copied as well? 31 | A: Run either `govendor fetch github.com/dep/pkg/^` or `govendor add github.com/dep/pkg/^`. 32 | This is the same as using the `-tree` argument. 33 | 34 | #### Q: How do I prevent vendor source from being checked in? 35 | A: Add `vendor/*/` to your ignore file. 36 | 37 | #### Q: How do I populate the vendor folder if it has not been checked in? 38 | A: Run `govendor sync`. 39 | -------------------------------------------------------------------------------- /help/gen-license.template: -------------------------------------------------------------------------------- 1 | // Machine generated; DO NOT EDIT. 2 | 3 | package help 4 | 5 | var msgGovendorLicenses = `{{range $index, $t := .}}{{if ne $index 0}}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | {{end}}{{.Filename}} - {{.Path}} 7 | {{.Text}}{{end}} 8 | ` 9 | -------------------------------------------------------------------------------- /help/msg.go: -------------------------------------------------------------------------------- 1 | package help 2 | 3 | type HelpMessage byte 4 | 5 | const ( 6 | MsgNone HelpMessage = iota 7 | MsgFull 8 | MsgInit 9 | MsgList 10 | MsgAdd 11 | MsgUpdate 12 | MsgRemove 13 | MsgFetch 14 | MsgStatus 15 | MsgSync 16 | MsgMigrate 17 | MsgGet 18 | MsgLicense 19 | MsgShell 20 | MsgGovendorLicense 21 | MsgGovendorVersion 22 | ) 23 | 24 | func (msg HelpMessage) String() string { 25 | msgText := "" 26 | switch msg { 27 | default: 28 | panic("Unknown message type") 29 | case MsgNone: 30 | case MsgFull: 31 | msgText = helpFull 32 | case MsgInit: 33 | msgText = helpInit 34 | case MsgList: 35 | msgText = helpList 36 | case MsgAdd: 37 | msgText = helpAdd 38 | case MsgUpdate: 39 | msgText = helpUpdate 40 | case MsgRemove: 41 | msgText = helpRemove 42 | case MsgFetch: 43 | msgText = helpFetch 44 | case MsgStatus: 45 | msgText = helpStatus 46 | case MsgSync: 47 | msgText = helpSync 48 | case MsgMigrate: 49 | msgText = helpMigrate 50 | case MsgGet: 51 | msgText = helpGet 52 | case MsgLicense: 53 | msgText = helpLicense 54 | case MsgShell: 55 | msgText = helpShell 56 | case MsgGovendorLicense: 57 | msgText = msgGovendorLicenses 58 | case MsgGovendorVersion: 59 | msgText = msgGovendorVersion 60 | } 61 | return msgText 62 | } 63 | -------------------------------------------------------------------------------- /help/version.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package help 6 | 7 | var version = "v1.0.9" 8 | -------------------------------------------------------------------------------- /internal/pathos/path_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package pathos 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func TestTrimCommonSuffix(t *testing.T) { 12 | list := []struct { 13 | slash rune 14 | base, suffix string 15 | result, common string 16 | }{ 17 | {slash: '/', base: "/a/b/c", suffix: "/x/y/b/c", result: "/a", common: "b/c"}, 18 | {slash: '/', base: "/arg/borish/client", suffix: "fooish/client", result: "/arg/borish", common: "client"}, 19 | {slash: '/', base: "/tmp/vendor_272718190/src/co2/go/pk1/", suffix: "co2/go/pk1", result: "/tmp/vendor_272718190/src", common: "co2/go/pk1"}, 20 | {slash: '/', base: "/home/daniel/code/go/src/.cache/govendor/github.com/raphael/goa", suffix: "github.com/raphael/goa", result: "/home/daniel/code/go/src/.cache/govendor", common: "github.com/raphael/goa"}, 21 | {slash: '\\', base: `d:\bob\alice\noob`, suffix: `c:\tmp\foo\alice\noob`, result: `d:\bob`, common: `alice\noob`}, 22 | } 23 | 24 | for _, item := range list { 25 | slashSep = item.slash 26 | got, common := TrimCommonSuffix(item.base, item.suffix) 27 | if got != item.result || common != item.common { 28 | t.Errorf("For %#v got %q, common: %q", item, got, common) 29 | } 30 | } 31 | } 32 | 33 | func TestGoEnv(t *testing.T) { 34 | list := []struct { 35 | line string 36 | name string 37 | result string 38 | ok bool 39 | }{ 40 | {`set GOROOT=C:\Foo\Bar`, "GOROOT", `C:\Foo\Bar`, true}, 41 | {`set GOPATH=C:\Foo\Bar`, "GOROOT", ``, false}, 42 | {`set GOROOT=`, "GOROOT", ``, true}, 43 | {`GOROOT="/foo/bar"`, "GOROOT", `/foo/bar`, true}, 44 | {`GOPATH="/foo/bar"`, "GOROOT", ``, false}, 45 | {`GOROOT=""`, "GOROOT", ``, true}, 46 | } 47 | 48 | for index, item := range list { 49 | key, value, ok := ParseGoEnvLine(item.line) 50 | if key != item.name { 51 | ok = false 52 | } 53 | if ok != item.ok { 54 | t.Errorf("index %d line %#v expected ok %t but got %t (key=%q value=%q line=%q)", index, item, item.ok, ok, key, value, item.line) 55 | continue 56 | } 57 | if ok && value != item.result { 58 | t.Errorf("index %d line %#v expected result %q but got %q", index, item, item.result, value) 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /internal/vfilepath/prefix.go: -------------------------------------------------------------------------------- 1 | package vfilepath 2 | 3 | import "strings" 4 | 5 | func HasPrefixDir(path string, prefix string) bool { 6 | return strings.HasPrefix(makeDirPath(path), makeDirPath(prefix)) 7 | } 8 | 9 | func makeDirPath(path string) string { 10 | if path != "/" { 11 | path += "/" 12 | } 13 | return path 14 | } 15 | -------------------------------------------------------------------------------- /internal/vfilepath/prefix_test.go: -------------------------------------------------------------------------------- 1 | package vfilepath 2 | 3 | import "testing" 4 | 5 | func TestHasPrefixDirTrue(t *testing.T) { 6 | tests := []struct { 7 | path string 8 | prefix string 9 | }{ 10 | { 11 | path: "/", 12 | prefix: "/", 13 | }, 14 | { 15 | path: "/foo", 16 | prefix: "/", 17 | }, 18 | { 19 | path: "/foo", 20 | prefix: "/foo", 21 | }, 22 | { 23 | path: "/foo/bar", 24 | prefix: "/foo", 25 | }, 26 | { 27 | path: "foo/bar", 28 | prefix: "foo", 29 | }, 30 | } 31 | 32 | for _, test := range tests { 33 | if !HasPrefixDir(test.path, test.prefix) { 34 | t.Errorf("%s should have %s as prefix", test.path, test.prefix) 35 | } 36 | } 37 | } 38 | 39 | func TestHasPrefixDirFalse(t *testing.T) { 40 | tests := []struct { 41 | path string 42 | prefix string 43 | }{ 44 | { 45 | path: "/", 46 | prefix: "/foo", 47 | }, 48 | { 49 | path: "/foo-bar", 50 | prefix: "/foo", 51 | }, 52 | } 53 | 54 | for _, test := range tests { 55 | if HasPrefixDir(test.path, test.prefix) { 56 | t.Errorf("%s should not have %s as prefix", test.path, test.prefix) 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /internal/vfilepath/stub.go: -------------------------------------------------------------------------------- 1 | package vfilepath 2 | 3 | import ( 4 | "path/filepath" 5 | ) 6 | 7 | func Split(path string) (string, string) { 8 | return filepath.Split(path) 9 | } 10 | 11 | func Join(parts ...string) string { 12 | return filepath.Join(parts...) 13 | } 14 | 15 | func EvalSymlinks(path string) (string, error) { 16 | return filepath.EvalSymlinks(path) 17 | } 18 | -------------------------------------------------------------------------------- /internal/vfilepath/switch.go: -------------------------------------------------------------------------------- 1 | package vfilepath 2 | -------------------------------------------------------------------------------- /internal/vfilepath/walk.go: -------------------------------------------------------------------------------- 1 | package vfilepath 2 | 3 | import ( 4 | "path/filepath" 5 | "sort" 6 | 7 | os "github.com/kardianos/govendor/internal/vos" 8 | ) 9 | 10 | // SkipDir is used as a return value from WalkFuncs to indicate that 11 | // the directory named in the call is to be skipped. It is not returned 12 | // as an error by any function. 13 | var SkipDir = filepath.SkipDir 14 | 15 | type WalkFunc func(path string, info os.FileInfo, err error) error 16 | 17 | // walk recursively descends path, calling w. 18 | func walk(path string, info os.FileInfo, walkFn WalkFunc) error { 19 | err := walkFn(path, info, nil) 20 | if err != nil { 21 | if info.IsDir() && err == SkipDir { 22 | return nil 23 | } 24 | return err 25 | } 26 | 27 | if !info.IsDir() { 28 | return nil 29 | } 30 | 31 | names, err := readDirNames(path) 32 | if err != nil { 33 | return walkFn(path, info, err) 34 | } 35 | 36 | for _, name := range names { 37 | filename := filepath.Join(path, name) 38 | fileInfo, err := os.Lstat(filename) 39 | if err != nil { 40 | if err := walkFn(filename, fileInfo, err); err != nil && err != SkipDir { 41 | return err 42 | } 43 | } else { 44 | err = walk(filename, fileInfo, walkFn) 45 | if err != nil { 46 | if !fileInfo.IsDir() || err != SkipDir { 47 | return err 48 | } 49 | } 50 | } 51 | } 52 | return nil 53 | } 54 | 55 | // readDirNames reads the directory named by dirname and returns 56 | // a sorted list of directory entries. 57 | func readDirNames(dirname string) ([]string, error) { 58 | f, err := os.Open(dirname) 59 | if err != nil { 60 | return nil, err 61 | } 62 | names, err := f.Readdirnames(-1) 63 | f.Close() 64 | if err != nil { 65 | return nil, err 66 | } 67 | sort.Strings(names) 68 | return names, nil 69 | } 70 | 71 | // Walk walks the file tree rooted at root, calling walkFn for each file or 72 | // directory in the tree, including root. All errors that arise visiting files 73 | // and directories are filtered by walkFn. The files are walked in lexical 74 | // order, which makes the output deterministic but means that for very 75 | // large directories Walk can be inefficient. 76 | // Walk does not follow symbolic links. 77 | func Walk(root string, walkFn WalkFunc) error { 78 | info, err := os.Lstat(root) 79 | if err != nil { 80 | return walkFn(root, nil, err) 81 | } 82 | return walk(root, info, walkFn) 83 | } 84 | -------------------------------------------------------------------------------- /internal/vos/stub.go: -------------------------------------------------------------------------------- 1 | package vos 2 | 3 | import ( 4 | "os" 5 | "time" 6 | ) 7 | 8 | type FileInfo os.FileInfo 9 | 10 | func Stat(name string) (FileInfo, error) { 11 | l("stat", name) 12 | fi, err := os.Stat(name) 13 | return FileInfo(fi), err 14 | } 15 | func Lstat(name string) (FileInfo, error) { 16 | l("lstat", name) 17 | fi, err := os.Lstat(name) 18 | return FileInfo(fi), err 19 | } 20 | func IsNotExist(err error) bool { 21 | return os.IsNotExist(err) 22 | } 23 | 24 | func Getwd() (string, error) { 25 | return os.Getwd() 26 | } 27 | 28 | func Getenv(key string) string { 29 | return os.Getenv(key) 30 | } 31 | 32 | func Open(name string) (*os.File, error) { 33 | l("open", name) 34 | return os.Open(name) 35 | } 36 | 37 | func MkdirAll(path string, perm os.FileMode) error { 38 | l("mkdirall", path) 39 | return os.MkdirAll(path, perm) 40 | } 41 | 42 | func Remove(name string) error { 43 | l("remove", name) 44 | return os.Remove(name) 45 | } 46 | func RemoveAll(name string) error { 47 | l("removeall", name) 48 | return os.RemoveAll(name) 49 | } 50 | func Create(name string) (*os.File, error) { 51 | l("create", name) 52 | return os.Create(name) 53 | } 54 | func Chmod(name string, mode os.FileMode) error { 55 | l("chmod", name) 56 | return os.Chmod(name, mode) 57 | } 58 | func Chtimes(name string, atime, mtime time.Time) error { 59 | l("chtimes", name) 60 | return os.Chtimes(name, atime, mtime) 61 | } 62 | -------------------------------------------------------------------------------- /internal/vos/switch.go: -------------------------------------------------------------------------------- 1 | package vos 2 | 3 | import ( 4 | "log" 5 | ) 6 | 7 | const debugLog = false 8 | 9 | func l(fname, path string) { 10 | if debugLog { 11 | log.Println(fname, path) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // vendor tool to copy external source code from GOPATH or remote location to the 6 | // local vendor folder. See README.md for usage. 7 | package main 8 | 9 | import ( 10 | "bytes" 11 | "flag" 12 | "fmt" 13 | "io" 14 | "os" 15 | "strings" 16 | 17 | "github.com/kardianos/govendor/cliprompt" 18 | "github.com/kardianos/govendor/help" 19 | "github.com/kardianos/govendor/run" 20 | ) 21 | 22 | func main() { 23 | prompt := &cliprompt.Prompt{} 24 | 25 | allArgs := os.Args 26 | 27 | if allArgs[len(allArgs)-1] == "-" { 28 | stdin := &bytes.Buffer{} 29 | if _, err := io.Copy(stdin, os.Stdin); err == nil { 30 | stdinArgs := strings.Fields(stdin.String()) 31 | allArgs = append(allArgs[:len(allArgs)-1], stdinArgs...) 32 | } 33 | } 34 | 35 | msg, err := run.Run(os.Stdout, allArgs, prompt) 36 | if err == flag.ErrHelp { 37 | err = nil 38 | } 39 | if err != nil { 40 | fmt.Fprintf(os.Stderr, "Error: %+v\n", err) 41 | } 42 | msgText := msg.String() 43 | if len(msgText) > 0 { 44 | fmt.Fprint(os.Stderr, msgText) 45 | } 46 | if err != nil { 47 | os.Exit(2) 48 | } 49 | switch msg { 50 | case help.MsgNone, help.MsgGovendorVersion, help.MsgGovendorLicense: 51 | os.Exit(0) 52 | default: 53 | os.Exit(1) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /migrate/gb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package migrate 6 | 7 | import ( 8 | "errors" 9 | "path/filepath" 10 | ) 11 | 12 | func init() { 13 | register("gb", sysGb{}) 14 | } 15 | 16 | type sysGb struct{} 17 | 18 | func (sys sysGb) Check(root string) (system, error) { 19 | if hasDirs(root, "src", filepath.Join("vendor", "src")) { 20 | return sys, nil 21 | } 22 | return nil, nil 23 | } 24 | func (sysGb) Migrate(root string) error { 25 | // Move files from "src" to first GOPATH. 26 | // Move vendor files from "vendor/src" to "vendor". 27 | // Translate "vendor/manifest" to vendor.json file. 28 | return errors.New("Migrate gb not implemented") 29 | } 30 | -------------------------------------------------------------------------------- /migrate/gdm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package migrate 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | "os" 11 | "path/filepath" 12 | 13 | "github.com/kardianos/govendor/context" 14 | "github.com/kardianos/govendor/vendorfile" 15 | ) 16 | 17 | func init() { 18 | register("gdm", sysGdm{}) 19 | } 20 | 21 | type sysGdm struct{} 22 | 23 | func (sys sysGdm) Check(root string) (system, error) { 24 | if hasFiles(root, "Godeps") { 25 | return sys, nil 26 | } 27 | return nil, nil 28 | } 29 | 30 | func (sys sysGdm) Migrate(root string) error { 31 | gdmFilePath := filepath.Join(root, "Godeps") 32 | 33 | ctx, err := context.NewContext(root, filepath.Join("vendor", "vendor.json"), "vendor", false) 34 | if err != nil { 35 | return err 36 | } 37 | ctx.VendorFile.Ignore = "test" 38 | 39 | f, err := os.Open(gdmFilePath) 40 | if err != nil { 41 | return err 42 | } 43 | defer f.Close() 44 | 45 | pkgs, err := sys.parseGdmFile(f) 46 | if err != nil { 47 | return err 48 | } 49 | ctx.VendorFile.Package = pkgs 50 | 51 | if err := ctx.WriteVendorFile(); err != nil { 52 | return err 53 | } 54 | 55 | return os.RemoveAll(gdmFilePath) 56 | } 57 | 58 | func (sysGdm) parseGdmFile(r io.Reader) ([]*vendorfile.Package, error) { 59 | var pkgs []*vendorfile.Package 60 | for { 61 | var path, rev string 62 | if _, err := fmt.Fscanf(r, "%s %s\n", &path, &rev); err != nil { 63 | if err == io.EOF { 64 | break 65 | } 66 | return nil, err 67 | } 68 | 69 | pkgs = append(pkgs, &vendorfile.Package{ 70 | Add: true, 71 | Path: path, 72 | Revision: rev, 73 | Tree: true, 74 | }) 75 | } 76 | 77 | return pkgs, nil 78 | } 79 | -------------------------------------------------------------------------------- /migrate/gdm_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package migrate 6 | 7 | import ( 8 | "reflect" 9 | "strings" 10 | "testing" 11 | 12 | "github.com/kardianos/govendor/vendorfile" 13 | ) 14 | 15 | var gdmFile = `co1/pk1 9fc824c70f713ea0f058a07b49a4c563ef2a3b98 16 | co1/pk2 a4eecd407cf4129fc902ece859a0114e4cf1a7f4 17 | co1/pk3 345426c77237ece5dab0e1605c3e4b35c3f54757` 18 | 19 | var gdmPackages = []*vendorfile.Package{ 20 | &vendorfile.Package{ 21 | Add: true, 22 | Path: "co1/pk1", 23 | Revision: "9fc824c70f713ea0f058a07b49a4c563ef2a3b98", 24 | Tree: true, 25 | }, 26 | &vendorfile.Package{ 27 | Add: true, 28 | Path: "co1/pk2", 29 | Revision: "a4eecd407cf4129fc902ece859a0114e4cf1a7f4", 30 | Tree: true, 31 | }, 32 | &vendorfile.Package{ 33 | Add: true, 34 | Path: "co1/pk3", 35 | Revision: "345426c77237ece5dab0e1605c3e4b35c3f54757", 36 | Tree: true, 37 | }, 38 | } 39 | 40 | func TestParseGDM(t *testing.T) { 41 | gdm := sysGdm{} 42 | pkgs, err := gdm.parseGdmFile(strings.NewReader(gdmFile)) 43 | if err != nil { 44 | t.Fatal(err) 45 | } 46 | 47 | if !reflect.DeepEqual(gdmPackages, pkgs) { 48 | t.Fatalf("expected parsed gdmFile to match gdmPackages") 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /migrate/glide.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package migrate 6 | 7 | import ( 8 | "io/ioutil" 9 | "os" 10 | "path" 11 | "path/filepath" 12 | 13 | "github.com/kardianos/govendor/context" 14 | "github.com/kardianos/govendor/vendorfile" 15 | "gopkg.in/yaml.v2" 16 | ) 17 | 18 | func init() { 19 | register("glide", sysGlide{}) 20 | } 21 | 22 | type sysGlide struct{} 23 | 24 | func (sys sysGlide) Check(root string) (system, error) { 25 | // Glide has two config files: glide.yaml and glide.lock. The 26 | // first file is for manual configuration. The second file is 27 | // autogenerated from the first one. Migration procedure uses 28 | // autogenerated glide.lock because it has resolved recursive 29 | // dependencies that glide make automatically from glide.yaml. 30 | if hasFiles(root, "glide.lock") { 31 | return sys, nil 32 | } 33 | return nil, nil 34 | } 35 | 36 | func (sys sysGlide) Migrate(root string) error { 37 | // Create a new empty config. 38 | ctx, err := context.NewContext(root, filepath.Join("vendor", "vendor.json"), "vendor", false) 39 | if err != nil { 40 | return err 41 | } 42 | ctx.VendorDiscoverFolder = "vendor" 43 | ctx.VendorFile.Ignore = "test" 44 | 45 | // Get&parse glide' config. 46 | rawConfigData, err := ioutil.ReadFile(filepath.Join(root, "glide.lock")) 47 | if err != nil { 48 | return err 49 | } 50 | type ( 51 | imports struct { 52 | Name string `json:"name"` 53 | Version string `json:"version"` 54 | Repo string `json:"repo,omitempty"` 55 | Subpackages []string `json:"subpackages,omitempty"` 56 | } 57 | glideLock struct { 58 | Imports []imports `json:"imports"` 59 | } 60 | ) 61 | parsedConfig := glideLock{} 62 | err = yaml.Unmarshal(rawConfigData, &parsedConfig) 63 | if err != nil { 64 | return err 65 | } 66 | 67 | // Build a new config. 68 | for _, i := range parsedConfig.Imports { 69 | pkg := vendorfile.Package{ 70 | Add: true, 71 | Path: i.Name, 72 | Revision: i.Version, 73 | } 74 | if len(i.Subpackages) > 0 { 75 | for _, p := range i.Subpackages { 76 | subpkg := vendorfile.Package{ 77 | Add: true, 78 | Path: path.Join(i.Name, p), 79 | Revision: i.Version, 80 | } 81 | if i.Repo != "" { 82 | subpkg.Origin = path.Join(i.Repo, p) 83 | } 84 | ctx.VendorFile.Package = append(ctx.VendorFile.Package, &subpkg) 85 | } 86 | } 87 | if i.Repo != "" { 88 | pkg.Origin = i.Repo 89 | } 90 | ctx.VendorFile.Package = append(ctx.VendorFile.Package, &pkg) 91 | } 92 | err = ctx.WriteVendorFile() 93 | if err != nil { 94 | return err 95 | } 96 | 97 | // Cleanup. 98 | os.RemoveAll(filepath.Join(root, "glide.yaml")) 99 | return os.RemoveAll(filepath.Join(root, "glide.lock")) 100 | } 101 | -------------------------------------------------------------------------------- /migrate/glock.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package migrate 6 | 7 | import ( 8 | "io/ioutil" 9 | "os" 10 | "path/filepath" 11 | "strings" 12 | 13 | "github.com/kardianos/govendor/context" 14 | "github.com/kardianos/govendor/pkgspec" 15 | ) 16 | 17 | func init() { 18 | register("glock", sysGlock{}) 19 | } 20 | 21 | type sysGlock struct{} 22 | 23 | func (sys sysGlock) Check(root string) (system, error) { 24 | if hasFiles(root, "GLOCKFILE") { 25 | return sys, nil 26 | } 27 | return nil, nil 28 | } 29 | func (sysGlock) Migrate(root string) error { 30 | err := os.MkdirAll(filepath.Join(root, "vendor"), 0777) 31 | if err != nil { 32 | return err 33 | } 34 | filebytes, err := ioutil.ReadFile(filepath.Join(root, "GLOCKFILE")) 35 | if err != nil { 36 | return err 37 | } 38 | lines := strings.Split(string(filebytes), "\n") 39 | for i, l := range lines { 40 | lines[i] = strings.TrimSpace(l) 41 | } 42 | 43 | /* 44 | vf := &vendorfile.File{} 45 | vf.Package = make([]*vendorfile.Package, 0, len(lines)) 46 | */ 47 | ctx, err := context.NewContext(root, filepath.Join("vendor", "vendor.json"), "vendor", false) 48 | if err != nil { 49 | return err 50 | } 51 | 52 | const cmdPrefix = "cmd " 53 | 54 | for _, l := range lines { 55 | if len(l) == 0 { 56 | continue 57 | } 58 | isCmd := strings.HasPrefix(l, cmdPrefix) 59 | if isCmd { 60 | continue 61 | } 62 | field := strings.Fields(l) 63 | if len(field) < 2 { 64 | continue 65 | } 66 | ps, err := pkgspec.Parse("", field[0]+"@"+field[1]) 67 | if err != nil { 68 | return err 69 | } 70 | ps.IncludeTree = true 71 | err = ctx.ModifyImport(ps, context.Fetch) 72 | if err != nil { 73 | return err 74 | } 75 | } 76 | for _, l := range lines { 77 | if len(l) == 0 { 78 | continue 79 | } 80 | isCmd := strings.HasPrefix(l, cmdPrefix) 81 | if !isCmd { 82 | continue 83 | } 84 | path := strings.TrimPrefix(l, cmdPrefix) 85 | ps, err := pkgspec.Parse("", path) 86 | if err != nil { 87 | return err 88 | } 89 | err = ctx.ModifyImport(ps, context.Fetch) 90 | if err != nil { 91 | return err 92 | } 93 | } 94 | err = ctx.WriteVendorFile() 95 | os.Remove(filepath.Join(root, "GLOCKFILE")) 96 | return err 97 | } 98 | -------------------------------------------------------------------------------- /migrate/old.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package migrate 6 | 7 | import ( 8 | "os" 9 | "path/filepath" 10 | 11 | "github.com/kardianos/govendor/context" 12 | ) 13 | 14 | func init() { 15 | register("internal", sysInternal{}) 16 | register("old-vendor", sysOldVendor{}) 17 | } 18 | 19 | type sysInternal struct{} 20 | 21 | func (sys sysInternal) Check(root string) (system, error) { 22 | vendorFolder := "internal" 23 | override := os.Getenv("GOVENDORFOLDER") 24 | if len(override) != 0 { 25 | vendorFolder = override 26 | } 27 | if hasDirs(root, vendorFolder) && hasFiles(root, filepath.Join(vendorFolder, "vendor.json")) { 28 | return sys, nil 29 | } 30 | return nil, nil 31 | } 32 | func (sysInternal) Migrate(root string) error { 33 | // Un-rewrite import paths. 34 | // Copy files from internal to vendor. 35 | // Update and move vendor file from "internal/vendor.json" to "vendor.json". 36 | ctx, err := context.NewContext(root, filepath.Join("internal", "vendor.json"), "internal", true) 37 | if err != nil { 38 | return err 39 | } 40 | list, err := ctx.Status() 41 | if err != nil { 42 | return err 43 | } 44 | remove := make([]string, 0, len(list)) 45 | for _, item := range list { 46 | if item.Status.Location != context.LocationVendor { 47 | continue 48 | } 49 | pkg := ctx.Package[item.Local] 50 | ctx.Operation = append(ctx.Operation, &context.Operation{ 51 | Pkg: pkg, 52 | Src: pkg.Dir, 53 | Dest: filepath.Join(ctx.RootDir, "vendor", filepath.ToSlash(item.Pkg.Path)), 54 | }) 55 | remove = append(remove, filepath.Join(ctx.RootGopath, filepath.ToSlash(item.Local))) 56 | ctx.RewriteRule[item.Local] = item.Pkg.Path 57 | } 58 | ctx.VendorFilePath = filepath.Join(ctx.RootDir, "vendor", "vendor.json") 59 | err = ctx.WriteVendorFile() 60 | if err != nil { 61 | return err 62 | } 63 | err = ctx.Alter() 64 | if err != nil { 65 | return err 66 | } 67 | 68 | // Remove existing. 69 | for _, r := range remove { 70 | err = context.RemovePackage(r, "", false) 71 | if err != nil { 72 | return err 73 | } 74 | } 75 | return os.Remove(filepath.Join(ctx.RootDir, "internal", "vendor.json")) 76 | } 77 | 78 | type sysOldVendor struct{} 79 | 80 | func (sys sysOldVendor) Check(root string) (system, error) { 81 | if hasDirs(root, "vendor") && hasFiles(root, "vendor.json") { 82 | return sys, nil 83 | } 84 | return nil, nil 85 | } 86 | func (sysOldVendor) Migrate(root string) error { 87 | ctx, err := context.NewContext(root, "vendor.json", "vendor", false) 88 | if err != nil { 89 | return err 90 | } 91 | ctx.VendorFilePath = filepath.Join(ctx.RootDir, "vendor", "vendor.json") 92 | err = ctx.WriteVendorFile() 93 | if err != nil { 94 | return err 95 | } 96 | return os.Remove(filepath.Join(ctx.RootDir, "vendor.json")) 97 | } 98 | -------------------------------------------------------------------------------- /pkgspec/pkg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package pkgspec defines a schema that contains the path, origin, version 6 | // and other properties. 7 | package pkgspec 8 | 9 | import "bytes" 10 | 11 | type Pkg struct { 12 | Path string 13 | FilePath string 14 | Origin string 15 | IncludeTree bool 16 | MatchTree bool 17 | HasVersion bool 18 | HasOrigin bool 19 | Version string 20 | 21 | Uncommitted bool 22 | } 23 | 24 | func (pkg *Pkg) String() string { 25 | buf := &bytes.Buffer{} 26 | buf.WriteString(pkg.Path) 27 | if pkg.IncludeTree { 28 | buf.WriteString(TreeIncludeSuffix) 29 | } else if pkg.MatchTree { 30 | buf.WriteString(TreeMatchSuffix) 31 | } 32 | if len(pkg.Origin) > 0 { 33 | buf.WriteString(originMatch) 34 | buf.WriteString(pkg.Origin) 35 | } 36 | if pkg.HasVersion { 37 | buf.WriteString(versionMatch) 38 | if len(pkg.Version) > 0 { 39 | buf.WriteString(pkg.Version) 40 | } 41 | } 42 | return buf.String() 43 | } 44 | 45 | func (pkg *Pkg) PathOrigin() string { 46 | if len(pkg.Origin) > 0 { 47 | return pkg.Origin 48 | } 49 | return pkg.Path 50 | } 51 | -------------------------------------------------------------------------------- /pkgspec/pkgspec.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // package pkgspec parses the package specification string 6 | package pkgspec 7 | 8 | import ( 9 | "errors" 10 | "path" 11 | "strings" 12 | ) 13 | 14 | const ( 15 | TreeIncludeSuffix = "/^" 16 | TreeMatchSuffix = "/..." 17 | ) 18 | 19 | const ( 20 | originMatch = "::" 21 | versionMatch = "@" 22 | vendorSegment = "/vendor/" 23 | ) 24 | 25 | var ( 26 | ErrEmptyPath = errors.New("Empty package path") 27 | ErrEmptyOrigin = errors.New("Empty origin specified") 28 | ErrInvalidPath = errors.New("Path contains a vendor folder and a origin") 29 | ) 30 | 31 | // Parse a package spec according to: 32 | // package-spec = [{/...|/^}][::][@[]] 33 | func Parse(currentGoPath, s string) (*Pkg, error) { 34 | // Clean up the import path before 35 | s = strings.Trim(s, "/\\ \t") 36 | if len(s) == 0 { 37 | return nil, ErrEmptyPath 38 | } 39 | s = strings.Replace(s, `\`, `/`, -1) 40 | 41 | originIndex := strings.Index(s, originMatch) 42 | versionIndex := strings.LastIndex(s, versionMatch) 43 | 44 | if originIndex == 0 { 45 | return nil, ErrEmptyPath 46 | } 47 | 48 | // Don't count the origin if it is after the "@" symbol. 49 | if originIndex > versionIndex && versionIndex > 0 { 50 | originIndex = -1 51 | } 52 | 53 | pkg := &Pkg{ 54 | Path: s, 55 | HasOrigin: (originIndex >= 0), 56 | } 57 | 58 | if versionIndex > 0 { 59 | pkg.Path = s[:versionIndex] 60 | pkg.Version = s[versionIndex+len(versionMatch):] 61 | pkg.HasVersion = true 62 | } 63 | if originIndex > 0 { 64 | pkg.Path = s[:originIndex] 65 | endOrigin := len(s) 66 | if versionIndex > 0 { 67 | endOrigin = versionIndex 68 | } 69 | pkg.Origin = s[originIndex+len(originMatch) : endOrigin] 70 | if len(pkg.Origin) == 0 { 71 | return nil, ErrEmptyOrigin 72 | } 73 | } 74 | // Look for vendor folder in package path. 75 | // This is allowed in origin, but not path. 76 | vendorIndex := strings.LastIndex(pkg.Path, vendorSegment) 77 | if vendorIndex >= 0 { 78 | if len(pkg.Origin) > 0 { 79 | return nil, ErrInvalidPath 80 | } 81 | pkg.Origin = pkg.Path 82 | pkg.Path = pkg.Path[vendorIndex+len(vendorSegment):] 83 | } 84 | 85 | if strings.HasSuffix(pkg.Path, TreeMatchSuffix) { 86 | pkg.MatchTree = true 87 | pkg.Path = strings.TrimSuffix(pkg.Path, TreeMatchSuffix) 88 | } else if strings.HasSuffix(pkg.Path, TreeIncludeSuffix) { 89 | pkg.IncludeTree = true 90 | pkg.Path = strings.TrimSuffix(pkg.Path, TreeIncludeSuffix) 91 | } 92 | if strings.HasPrefix(pkg.Path, ".") && len(currentGoPath) != 0 { 93 | currentGoPath = strings.Replace(currentGoPath, `\`, `/`, -1) 94 | currentGoPath = strings.TrimPrefix(currentGoPath, "/") 95 | pkg.Path = path.Join(currentGoPath, pkg.Path) 96 | } 97 | 98 | return pkg, nil 99 | } 100 | -------------------------------------------------------------------------------- /pkgspec/pkgspec_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package pkgspec 6 | 7 | import "testing" 8 | 9 | func TestParse(t *testing.T) { 10 | list := []struct { 11 | Spec string 12 | Str string 13 | Pkg *Pkg 14 | Err error 15 | WD string 16 | }{ 17 | {Spec: "abc/def", Pkg: &Pkg{Path: "abc/def"}}, 18 | {Spec: "", Err: ErrEmptyPath}, 19 | {Spec: "::", Err: ErrEmptyPath}, 20 | {Spec: "::foo", Err: ErrEmptyPath}, 21 | {Spec: "abc/def::", Err: ErrEmptyOrigin}, 22 | {Spec: "abc/def::foo/bar/vendor/abc/def"}, 23 | {Spec: "abc/def::foo/bar/vendor/abc/def@"}, 24 | {Spec: "abc/def::foo/bar/vendor/abc/def@v1.2.3", Pkg: &Pkg{Path: "abc/def", HasOrigin: true, Origin: "foo/bar/vendor/abc/def", HasVersion: true, Version: "v1.2.3"}}, 25 | {Spec: "abc/def/^::foo/bar/vendor/abc/def@v1.2.3", Pkg: &Pkg{Path: "abc/def", IncludeTree: true, HasOrigin: true, Origin: "foo/bar/vendor/abc/def", HasVersion: true, Version: "v1.2.3"}}, 26 | {Spec: "abc/def@", Pkg: &Pkg{Path: "abc/def", HasVersion: true}}, 27 | {Spec: "abc/def@v1.2.3", Pkg: &Pkg{Path: "abc/def", HasVersion: true, Version: "v1.2.3"}}, 28 | {Spec: "./def@v1.2.3", Str: "abc/def@v1.2.3", Pkg: &Pkg{Path: "abc/def", HasVersion: true, Version: "v1.2.3"}, WD: "abc/"}, 29 | {Spec: "abc\\def\\", Str: "abc/def", Pkg: &Pkg{Path: "abc/def"}}, 30 | {Spec: "github.com/aws/aws-sdk-go/aws/client::github.com/aws/aws-sdk-go/aws/client"}, 31 | {Spec: "a/b/vendor/z/y/x", Str: "z/y/x::a/b/vendor/z/y/x"}, 32 | {Spec: "a/b/vendor/z/y/x::a/b/vendor/z/y/x", Err: ErrInvalidPath}, 33 | } 34 | 35 | for _, item := range list { 36 | pkg, err := Parse(item.WD, item.Spec) 37 | if err != nil && item.Err != nil { 38 | if err != item.Err { 39 | t.Errorf("For %q, got error %q but expected error %q", item.Spec, err, item.Err) 40 | continue 41 | } 42 | continue 43 | } 44 | if err == nil && item.Err != nil { 45 | t.Errorf("For %q, got nil error but expected error %q, %#v", item.Spec, item.Err, pkg) 46 | continue 47 | } 48 | if pkg == nil { 49 | t.Errorf("For %q, got nil pkg", item.Spec) 50 | continue 51 | } 52 | pkgStr := pkg.String() 53 | specStr := item.Spec 54 | if len(item.Str) > 0 { 55 | specStr = item.Str 56 | } 57 | if pkgStr != specStr { 58 | t.Errorf("For %q, round tripped to %q", specStr, pkgStr) 59 | continue 60 | } 61 | if item.Pkg != nil { 62 | diffA := pkg.Path != item.Pkg.Path || pkg.Origin != item.Pkg.Origin || pkg.Version != item.Pkg.Version 63 | diffB := pkg.HasVersion != item.Pkg.HasVersion || pkg.HasOrigin != item.Pkg.HasOrigin || pkg.MatchTree != item.Pkg.MatchTree || pkg.IncludeTree != item.Pkg.IncludeTree 64 | if diffA || diffB { 65 | t.Errorf("For %q, pkg detail diff: got %#v", item.Spec, pkg) 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /prompt/prompt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package prompt prompts user for feedback. 6 | package prompt 7 | 8 | import ( 9 | "fmt" 10 | ) 11 | 12 | type Option struct { 13 | key interface{} 14 | prompt string 15 | validation string 16 | other bool 17 | 18 | Chosen bool // Set to true if chosen. 19 | Value string // Value used if chosen and option is "other". 20 | } 21 | 22 | type OptionType byte 23 | 24 | const ( 25 | TypeSelectOne OptionType = iota // Allow user to choose single option. 26 | TypeSelectMultiple // Allow user to choose multiple options. 27 | ) 28 | 29 | type Response byte 30 | 31 | const ( 32 | RespAnswer Response = iota 33 | RespCancel 34 | ) 35 | 36 | func NewOption(key interface{}, prompt string, other bool) Option { 37 | return Option{key: key, prompt: prompt, other: other} 38 | } 39 | 40 | func (opt Option) Key() interface{} { 41 | return opt.key 42 | } 43 | func (opt Option) Prompt() string { 44 | return opt.prompt 45 | } 46 | func (opt Option) Other() bool { 47 | return opt.other 48 | } 49 | func (opt Option) Validation() string { 50 | return opt.validation 51 | } 52 | func (opt Option) String() string { 53 | if opt.other { 54 | return opt.Value 55 | } 56 | return fmt.Sprintf("%v", opt.key) 57 | } 58 | 59 | func ValidateOption(opt Option, validation string) Option { 60 | return Option{ 61 | key: opt.key, 62 | prompt: opt.prompt, 63 | other: opt.other, 64 | 65 | validation: validation, 66 | 67 | Chosen: opt.Chosen, 68 | Value: opt.Value, 69 | } 70 | } 71 | 72 | type Question struct { 73 | Error string 74 | Prompt string 75 | Type OptionType 76 | Options []Option 77 | } 78 | 79 | func (q *Question) AnswerMultiple(must bool) []*Option { 80 | ans := []*Option{} 81 | for i := range q.Options { 82 | o := &q.Options[i] 83 | if o.Chosen { 84 | ans = append(ans, o) 85 | } 86 | } 87 | if must && len(ans) == 0 { 88 | panic("If no option is chosen, response must be cancelled") 89 | } 90 | return ans 91 | } 92 | 93 | func (q *Question) AnswerSingle(must bool) *Option { 94 | var ans *Option 95 | if q.Type != TypeSelectOne { 96 | panic("Question Type should match answer type") 97 | } 98 | found := false 99 | for i := range q.Options { 100 | o := &q.Options[i] 101 | if found && o.Chosen { 102 | panic("Must only respond with single option") 103 | } 104 | if o.Chosen { 105 | found = true 106 | ans = o 107 | } 108 | } 109 | if must && !found { 110 | panic("If no option is chosen, response must be cancelled") 111 | } 112 | return ans 113 | } 114 | 115 | type Prompt interface { 116 | Ask(q *Question) (Response, error) 117 | } 118 | -------------------------------------------------------------------------------- /run/shell.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package run 6 | 7 | import ( 8 | "flag" 9 | "fmt" 10 | "io" 11 | "net" 12 | "os" 13 | 14 | "net/http" 15 | _ "net/http/pprof" // imported for side effect of registering handler 16 | 17 | "github.com/kardianos/govendor/help" 18 | 19 | "github.com/Bowery/prompt" 20 | "github.com/google/shlex" 21 | ) 22 | 23 | func (r *runner) Shell(w io.Writer, subCmdArgs []string) (help.HelpMessage, error) { 24 | flags := flag.NewFlagSet("shell", flag.ContinueOnError) 25 | 26 | pprofHandlerAddr := flags.String("pprof-handler", "", "if set, turns on an HTTP server that offers pprof handlers") 27 | 28 | flags.SetOutput(nullWriter{}) 29 | err := flags.Parse(subCmdArgs) 30 | if err != nil { 31 | return help.MsgShell, err 32 | } 33 | 34 | if *pprofHandlerAddr != "" { 35 | tryEnableHTTPPprofHandler(*pprofHandlerAddr) 36 | } 37 | 38 | out := os.Stdout 39 | 40 | for { 41 | line, err := prompt.Basic("> ", false) 42 | if err != nil { 43 | break 44 | } 45 | args, err := shlex.Split(line) 46 | if err != nil { 47 | fmt.Fprintf(out, "%v", err.Error()) 48 | } 49 | if len(args) == 0 { 50 | continue 51 | } 52 | cmd := args[0] 53 | next := make([]string, 0, len(args)+1) 54 | next = append(next, "govendor") 55 | args = append(next, args...) 56 | switch cmd { 57 | case "exit", "q", "quit", "/q": 58 | return help.MsgNone, nil 59 | case "shell": 60 | continue 61 | } 62 | msg, err := r.run(out, args, nil) 63 | if err != nil { 64 | fmt.Fprintf(out, "%v", err.Error()) 65 | } 66 | msgText := msg.String() 67 | if len(msgText) > 0 { 68 | fmt.Fprintf(out, "%s\tType \"exit\" to exit.\n", msgText) 69 | } 70 | } 71 | 72 | return help.MsgNone, nil 73 | } 74 | 75 | // tryEnableHTTPPprofHandler tries to provide an http/pprof handler on `addr`. 76 | // if it fails, it logs an error but does not otherwise do anything. 77 | func tryEnableHTTPPprofHandler(addr string) { 78 | l, err := net.Listen("tcp", addr) 79 | if err != nil { 80 | fmt.Fprintf(os.Stderr, "http/pprof handlers failed to create a listener: %v\n", err) 81 | return 82 | } 83 | // port 0 means a randomly allocated one, so we 84 | // need to figure out where our listener ended up 85 | realAddr := l.Addr() 86 | 87 | fmt.Fprintf(os.Stderr, "http/pprof handlers are available on %v\n", realAddr) 88 | go func() { 89 | defer l.Close() 90 | if err := http.Serve(l, nil); err != nil { 91 | fmt.Fprintf(os.Stderr, "http/pprof handlers failed to start: %v\n", err) 92 | } 93 | }() 94 | } 95 | -------------------------------------------------------------------------------- /run/sync.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package run 6 | 7 | import ( 8 | "flag" 9 | "io" 10 | 11 | "github.com/kardianos/govendor/context" 12 | "github.com/kardianos/govendor/help" 13 | ) 14 | 15 | func (r *runner) Sync(w io.Writer, subCmdArgs []string) (help.HelpMessage, error) { 16 | flags := flag.NewFlagSet("sync", flag.ContinueOnError) 17 | insecure := flags.Bool("insecure", false, "allow insecure network updates") 18 | dryrun := flags.Bool("n", false, "dry run, print what would be done") 19 | verbose := flags.Bool("v", false, "verbose output") 20 | flags.SetOutput(nullWriter{}) 21 | err := flags.Parse(subCmdArgs) 22 | if err != nil { 23 | return help.MsgSync, err 24 | } 25 | ctx, err := r.NewContextWD(context.RootVendor) 26 | if err != nil { 27 | return help.MsgSync, err 28 | } 29 | ctx.Insecure = *insecure 30 | if *dryrun || *verbose { 31 | ctx.Logger = w 32 | } 33 | return help.MsgNone, ctx.Sync(*dryrun) 34 | } 35 | -------------------------------------------------------------------------------- /vcs/bzr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package vcs 6 | 7 | import ( 8 | "os/exec" 9 | "path/filepath" 10 | "strings" 11 | "time" 12 | 13 | os "github.com/kardianos/govendor/internal/vos" 14 | ) 15 | 16 | type VcsBzr struct{} 17 | 18 | func (VcsBzr) Find(dir string) (*VcsInfo, error) { 19 | fi, err := os.Stat(filepath.Join(dir, ".bzr")) 20 | if err != nil { 21 | if os.IsNotExist(err) { 22 | return nil, nil 23 | } 24 | return nil, err 25 | } 26 | if !fi.IsDir() { 27 | return nil, nil 28 | } 29 | 30 | // Get info. 31 | info := &VcsInfo{} 32 | 33 | cmd := exec.Command("bzr", "status") 34 | cmd.Dir = dir 35 | output, err := cmd.CombinedOutput() 36 | if err != nil { 37 | return nil, err 38 | } 39 | if string(output) != "" { 40 | info.Dirty = true 41 | } 42 | 43 | cmd = exec.Command("bzr", "log", "-r-1") 44 | cmd.Dir = dir 45 | output, err = cmd.CombinedOutput() 46 | if err != nil { 47 | return nil, err 48 | } 49 | for _, line := range strings.Split(string(output), "\n") { 50 | if strings.HasPrefix(line, "revno:") { 51 | info.Revision = strings.Split(strings.TrimSpace(strings.TrimPrefix(line, "revno:")), " ")[0] 52 | } else if strings.HasPrefix(line, "timestamp:") { 53 | tm, err := time.Parse("Mon 2006-01-02 15:04:05 -0700", strings.TrimSpace(strings.TrimPrefix(line, "timestamp:"))) 54 | if err != nil { 55 | return nil, err 56 | } 57 | info.RevisionTime = &tm 58 | } 59 | } 60 | return info, nil 61 | } 62 | -------------------------------------------------------------------------------- /vcs/git.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package vcs 6 | 7 | import ( 8 | "os/exec" 9 | "path/filepath" 10 | "strings" 11 | "time" 12 | 13 | os "github.com/kardianos/govendor/internal/vos" 14 | ) 15 | 16 | type VcsGit struct{} 17 | 18 | func (VcsGit) Find(dir string) (*VcsInfo, error) { 19 | fi, err := os.Stat(filepath.Join(dir, ".git")) 20 | if err != nil { 21 | if os.IsNotExist(err) { 22 | return nil, nil 23 | } 24 | return nil, err 25 | } 26 | if !fi.IsDir() { 27 | return nil, nil 28 | } 29 | 30 | // Get info. 31 | info := &VcsInfo{} 32 | 33 | cmd := exec.Command("git", "status", "--short") 34 | cmd.Dir = dir 35 | err = cmd.Run() 36 | if err != nil { 37 | info.Dirty = true 38 | } 39 | 40 | cmd = exec.Command("git", "show", "--pretty=format:%H@%ai", "-s") 41 | 42 | cmd.Dir = dir 43 | cmd.Stderr = nil 44 | output, err := cmd.Output() 45 | if err != nil { 46 | return nil, err 47 | } 48 | line := strings.TrimSpace(string(output)) 49 | 50 | // remove gpg parts from git show 51 | gpgLine := strings.Split(line, "\n") 52 | if len(gpgLine) > 1 { 53 | line = gpgLine[len(gpgLine)-1] 54 | } 55 | 56 | ss := strings.Split(line, "@") 57 | info.Revision = ss[0] 58 | tm, err := time.Parse("2006-01-02 15:04:05 -0700", ss[1]) 59 | if err != nil { 60 | return nil, err 61 | } 62 | info.RevisionTime = &tm 63 | return info, nil 64 | } 65 | -------------------------------------------------------------------------------- /vcs/hg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package vcs 6 | 7 | import ( 8 | "os/exec" 9 | "path/filepath" 10 | "strings" 11 | "time" 12 | 13 | os "github.com/kardianos/govendor/internal/vos" 14 | ) 15 | 16 | type VcsHg struct{} 17 | 18 | func (VcsHg) Find(dir string) (*VcsInfo, error) { 19 | fi, err := os.Stat(filepath.Join(dir, ".hg")) 20 | if err != nil { 21 | if os.IsNotExist(err) { 22 | return nil, nil 23 | } 24 | return nil, err 25 | } 26 | if !fi.IsDir() { 27 | return nil, nil 28 | } 29 | 30 | // Get info. 31 | info := &VcsInfo{} 32 | 33 | cmd := exec.Command("hg", "identify", "-i") 34 | cmd.Dir = dir 35 | output, err := cmd.CombinedOutput() 36 | if err != nil { 37 | return nil, err 38 | } 39 | rev := strings.TrimSpace(string(output)) 40 | if strings.HasSuffix(rev, "+") { 41 | info.Dirty = true 42 | rev = strings.TrimSuffix(rev, "+") 43 | } 44 | 45 | cmd = exec.Command("hg", "log", "-r", rev) 46 | cmd.Dir = dir 47 | output, err = cmd.CombinedOutput() 48 | if err != nil { 49 | return nil, err 50 | } 51 | for _, line := range strings.Split(string(output), "\n") { 52 | if strings.HasPrefix(line, "changeset:") { 53 | ss := strings.Split(line, ":") 54 | info.Revision = strings.TrimSpace(ss[len(ss)-1]) 55 | } 56 | if strings.HasPrefix(line, "date:") { 57 | line = strings.TrimPrefix(line, "date:") 58 | tm, err := time.Parse("Mon Jan 02 15:04:05 2006 -0700", strings.TrimSpace(line)) 59 | if err == nil { 60 | info.RevisionTime = &tm 61 | } 62 | } 63 | } 64 | return info, nil 65 | } 66 | -------------------------------------------------------------------------------- /vcs/svn.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package vcs 6 | 7 | import ( 8 | "encoding/xml" 9 | "os/exec" 10 | "path/filepath" 11 | "time" 12 | 13 | os "github.com/kardianos/govendor/internal/vos" 14 | ) 15 | 16 | type VcsSvn struct{} 17 | 18 | func (svn VcsSvn) Find(dir string) (*VcsInfo, error) { 19 | fi, err := os.Stat(filepath.Join(dir, ".svn")) 20 | if err != nil { 21 | if os.IsNotExist(err) { 22 | return nil, nil 23 | } 24 | return nil, err 25 | } 26 | if !fi.IsDir() { 27 | return nil, nil 28 | } 29 | 30 | // Get info. 31 | info := &VcsInfo{} 32 | 33 | cmd := exec.Command("svn", "info", "--xml") 34 | cmd.Dir = dir 35 | output, err := cmd.CombinedOutput() 36 | if err != nil { 37 | return nil, err 38 | } 39 | 40 | return info, svn.parseInfo(output, info) 41 | } 42 | func (svn VcsSvn) parseInfo(output []byte, info *VcsInfo) error { 43 | var err error 44 | XX := struct { 45 | Commit struct { 46 | Revision string `xml:"revision,attr"` 47 | RevisionTime string `xml:"date"` 48 | } `xml:"entry>commit"` 49 | }{} 50 | err = xml.Unmarshal(output, &XX) 51 | if err != nil { 52 | return err 53 | } 54 | info.Revision = XX.Commit.Revision 55 | tm, err := time.Parse(time.RFC3339, XX.Commit.RevisionTime) 56 | if err == nil { 57 | info.RevisionTime = &tm 58 | } 59 | return nil 60 | } 61 | -------------------------------------------------------------------------------- /vcs/svn_test.go: -------------------------------------------------------------------------------- 1 | package vcs 2 | 3 | import "testing" 4 | 5 | func TestSVNInfo(t *testing.T) { 6 | var err error 7 | var info = &VcsInfo{} 8 | var output = []byte(` 9 | 10 | 14 | http://svn.apache.org/repos/asf/lenya/trunk 15 | ^/lenya/trunk 16 | 17 | http://svn.apache.org/repos/asf 18 | 13f79535-47bb-0310-9956-ffa450edef68 19 | 20 | 21 | /home/daniel/src/test/test-svn/trunk 22 | normal 23 | infinity 24 | 25 | 27 | florent 28 | 2011-09-26T09:07:59.663459Z 29 | 30 | 31 | 32 | `) 33 | 34 | svn := VcsSvn{} 35 | err = svn.parseInfo(output, info) 36 | if err != nil { 37 | t.Fatal(err) 38 | } 39 | if info.Revision != "1175731" { 40 | t.Error("revision inforrect") 41 | } 42 | if info.RevisionTime.Year() != 2011 { 43 | t.Error("time incorrect") 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vcs/vcs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // package vcs gets version control information from the file system. 6 | package vcs 7 | 8 | import ( 9 | "path/filepath" 10 | "sync" 11 | "time" 12 | 13 | "github.com/kardianos/govendor/internal/pathos" 14 | ) 15 | 16 | // VcsInfo returns information about a given repo. 17 | type VcsInfo struct { 18 | Dirty bool 19 | Revision string 20 | RevisionTime *time.Time 21 | } 22 | 23 | // Vcs represents a version control system. 24 | type Vcs interface { 25 | // Return nil VcsInfo if unable to determine VCS from directory. 26 | Find(dir string) (*VcsInfo, error) 27 | } 28 | 29 | var vcsRegistry = []Vcs{ 30 | VcsGit{}, 31 | VcsHg{}, 32 | VcsSvn{}, 33 | VcsBzr{}, 34 | } 35 | var registerSync = sync.Mutex{} 36 | 37 | // RegisterVCS adds a new VCS to use. 38 | func RegisterVCS(vcs Vcs) { 39 | registerSync.Lock() 40 | defer registerSync.Unlock() 41 | 42 | vcsRegistry = append(vcsRegistry, vcs) 43 | } 44 | 45 | const looplimit = 10000 46 | 47 | // FindVcs determines the version control information given a package dir and 48 | // lowest root dir. 49 | func FindVcs(root, packageDir string) (info *VcsInfo, err error) { 50 | if !filepath.IsAbs(root) { 51 | return nil, nil 52 | } 53 | if !filepath.IsAbs(packageDir) { 54 | return nil, nil 55 | } 56 | path := packageDir 57 | for i := 0; i <= looplimit; i++ { 58 | for _, vcs := range vcsRegistry { 59 | info, err = vcs.Find(path) 60 | if err != nil { 61 | return nil, err 62 | } 63 | if info != nil { 64 | return info, nil 65 | } 66 | } 67 | 68 | nextPath := filepath.Clean(filepath.Join(path, "..")) 69 | // Check for root. 70 | if nextPath == path { 71 | return nil, nil 72 | } 73 | if !pathos.FileHasPrefix(nextPath, root) { 74 | return nil, nil 75 | } 76 | path = nextPath 77 | } 78 | panic("loop limit") 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | - [Larz Conwell](https://github.com/larzconwell) 2 | - [Steve Kaliski](https://github.com/sjkaliski) 3 | - [NHOrus](https://github.com/NHOrus) 4 | - [Attila Fülöp](https://github.com/AttilaFueloep) 5 | - [Gereon Frey](https://github.com/gfrey) 6 | - [Aaron Bieber](https://github.com/qbit) 7 | - [Ricky Medina](https://github.com/r-medina) 8 | - [sungo](https://github.com/sungo) 9 | - [Rohan Verma](https://github.com/rhnvrm) 10 | - [Clément Chigot](https://github.com/Helflym) 11 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2015 Bowery, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/README.md: -------------------------------------------------------------------------------- 1 | # Prompt 2 | 3 | [![Circle CI](https://circleci.com/gh/Bowery/prompt/tree/master.png?style=badge)](https://circleci.com/gh/Bowery/prompt/tree/master) 4 | 5 | [![GoDoc](https://godoc.org/github.com/Bowery/prompt?status.png)](https://godoc.org/github.com/Bowery/prompt) 6 | 7 | Prompt is a cross platform line-editing prompting library. Read the GoDoc page 8 | for more info and for API details. 9 | 10 | ## Features 11 | - Keyboard shortcuts in prompts 12 | - History support 13 | - Secure password prompt 14 | - Custom prompt support 15 | - Fallback prompt for unsupported terminals 16 | - ANSI conversion for Windows 17 | 18 | ## Todo 19 | - Multi-line prompt as a Terminal option 20 | - Make refresh less jittery on Windows([possible reason](https://github.com/Bowery/prompt/blob/master/output_windows.go#L108)) 21 | - Multi-byte character support on Windows 22 | - `AnsiWriter` should execute the equivalent ANSI escape code functionality on Windows 23 | - Support for more ANSI escape codes on Windows. 24 | - More keyboard shortcuts from Readlines shortcut list 25 | 26 | ## Contributing 27 | 28 | Make sure Go is setup and running the latest release version, and make sure your `GOPATH` is setup properly. 29 | 30 | Follow the guidelines [here](https://guides.github.com/activities/contributing-to-open-source/#contributing). 31 | 32 | Please be sure to `gofmt` any code before doing commits. You can simply run `gofmt -w .` to format all the code in the directory. 33 | 34 | Lastly don't forget to add your name to [`CONTRIBUTORS.md`](https://github.com/Bowery/prompt/blob/master/CONTRIBUTORS.md) 35 | 36 | ## License 37 | 38 | Prompt is MIT licensed, details can be found [here](https://raw.githubusercontent.com/Bowery/prompt/master/LICENSE). 39 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ansi_unix.go: -------------------------------------------------------------------------------- 1 | // +build aix linux darwin freebsd openbsd netbsd dragonfly solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "os" 9 | ) 10 | 11 | // AnsiReader is an io.Reader that wraps an *os.File. 12 | type AnsiReader struct { 13 | file *os.File 14 | } 15 | 16 | // NewAnsiReader creates a AnsiReader from the given input file. 17 | func NewAnsiReader(in *os.File) *AnsiReader { 18 | return &AnsiReader{file: in} 19 | } 20 | 21 | // Read reads data from the input file into b. 22 | func (ar *AnsiReader) Read(b []byte) (int, error) { 23 | return ar.file.Read(b) 24 | } 25 | 26 | // AnsiWriter is an io.Writer that wraps an *os.File. 27 | type AnsiWriter struct { 28 | file *os.File 29 | } 30 | 31 | // NewAnsiWriter creates a AnsiWriter from the given output file. 32 | func NewAnsiWriter(out *os.File) *AnsiWriter { 33 | return &AnsiWriter{file: out} 34 | } 35 | 36 | // Write writes data from b into the input file. 37 | func (aw *AnsiWriter) Write(b []byte) (int, error) { 38 | return aw.file.Write(b) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/buffer_unix.go: -------------------------------------------------------------------------------- 1 | // +build aix linux darwin freebsd openbsd netbsd dragonfly solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "fmt" 9 | ) 10 | 11 | // Refresh rewrites the prompt and buffer. 12 | func (buf *Buffer) Refresh() error { 13 | // If we're not echoing just write prompt. 14 | if !buf.Echo { 15 | _, err := buf.Out.Write(mvLeftEdge) 16 | if err != nil { 17 | return err 18 | } 19 | 20 | _, err = buf.Out.Write([]byte(buf.Prompt)) 21 | if err != nil { 22 | return err 23 | } 24 | 25 | _, err = buf.Out.Write(delRight) 26 | return err 27 | } 28 | 29 | prLen := len(buf.Prompt) 30 | start := 0 31 | size := buf.size 32 | pos := buf.pos 33 | 34 | // Get slice range that should be visible. 35 | for prLen+pos >= buf.Cols { 36 | start++ 37 | size-- 38 | pos-- 39 | } 40 | for prLen+size > buf.Cols { 41 | size-- 42 | } 43 | 44 | _, err := buf.Out.Write(mvLeftEdge) 45 | if err != nil { 46 | return err 47 | } 48 | 49 | _, err = buf.Out.Write([]byte(buf.Prompt)) 50 | if err != nil { 51 | return err 52 | } 53 | 54 | _, err = buf.Out.Write(toBytes(buf.data[start : size+start])) 55 | if err != nil { 56 | return err 57 | } 58 | 59 | _, err = buf.Out.Write(delRight) 60 | if err != nil { 61 | return err 62 | } 63 | 64 | _, err = buf.Out.Write([]byte(fmt.Sprintf(mvToCol, pos+prLen))) 65 | return err 66 | } 67 | 68 | // ClsScreen clears the screen and refreshes. 69 | func (buf *Buffer) ClsScreen() error { 70 | _, err := buf.Out.Write(clsScreen) 71 | if err != nil { 72 | return err 73 | } 74 | 75 | return buf.Refresh() 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ioctl_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | const ( 12 | tcgets = unix.TIOCGETA 13 | tcsets = unix.TIOCSETA 14 | tcsetsf = unix.TIOCSETAF 15 | ) 16 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ioctl_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 Bowery, Inc. 2 | 3 | package prompt 4 | 5 | import ( 6 | "golang.org/x/sys/unix" 7 | ) 8 | 9 | const ( 10 | tcgets = unix.TCGETS 11 | tcsets = unix.TCSETS 12 | tcsetsf = unix.TCSETSF 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ioctl_sysunix.go: -------------------------------------------------------------------------------- 1 | // +build aix solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "os" 9 | 10 | "golang.org/x/sys/unix" 11 | ) 12 | 13 | const ( 14 | tcgets = unix.TCGETS 15 | tcsetsf = unix.TCSETSF 16 | tcsets = unix.TCSETS 17 | ) 18 | 19 | // terminalSize retrieves the cols/rows for the terminal connected to out. 20 | func terminalSize(out *os.File) (int, int, error) { 21 | ws, err := unix.IoctlGetWinsize(int(out.Fd()), unix.TIOCGWINSZ) 22 | if err != nil { 23 | return 0, 0, err 24 | } 25 | 26 | return int(ws.Col), int(ws.Row), nil 27 | } 28 | 29 | // getTermios retrieves the termios settings for the terminal descriptor. 30 | func getTermios(fd uintptr) (*unix.Termios, error) { 31 | return unix.IoctlGetTermios(int(fd), tcgets) 32 | } 33 | 34 | // setTermios sets the termios settings for the terminal descriptor, 35 | // optionally flushing the buffer before setting. 36 | func setTermios(fd uintptr, flush bool, mode *unix.Termios) error { 37 | req := tcsets 38 | if flush { 39 | req = tcsetsf 40 | } 41 | 42 | return unix.IoctlSetTermios(int(fd), uint(req), mode) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ioctl_unix.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "os" 9 | "unsafe" 10 | 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | // winsize contains the size for the terminal. 15 | type winsize struct { 16 | rows uint16 17 | cols uint16 18 | _ uint32 19 | } 20 | 21 | // terminalSize retrieves the cols/rows for the terminal connected to out. 22 | func terminalSize(out *os.File) (int, int, error) { 23 | ws := new(winsize) 24 | 25 | _, _, err := unix.Syscall(unix.SYS_IOCTL, out.Fd(), 26 | uintptr(unix.TIOCGWINSZ), uintptr(unsafe.Pointer(ws))) 27 | if err != 0 { 28 | return 0, 0, err 29 | } 30 | 31 | return int(ws.cols), int(ws.rows), nil 32 | } 33 | 34 | // getTermios retrieves the termios settings for the terminal descriptor. 35 | func getTermios(fd uintptr) (*unix.Termios, error) { 36 | termios := new(unix.Termios) 37 | 38 | _, _, err := unix.Syscall(unix.SYS_IOCTL, fd, tcgets, 39 | uintptr(unsafe.Pointer(termios))) 40 | if err != 0 { 41 | return nil, err 42 | } 43 | 44 | return termios, nil 45 | } 46 | 47 | // setTermios sets the termios settings for the terminal descriptor, 48 | // optionally flushing the buffer before setting. 49 | func setTermios(fd uintptr, flush bool, mode *unix.Termios) error { 50 | req := int64(tcsets) 51 | if flush { 52 | req = int64(tcsetsf) 53 | } 54 | 55 | _, _, err := unix.Syscall(unix.SYS_IOCTL, fd, uintptr(req), 56 | uintptr(unsafe.Pointer(mode))) 57 | if err != 0 { 58 | return err 59 | } 60 | 61 | return nil 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/keys.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 Bowery, Inc. 2 | 3 | package prompt 4 | 5 | // Line ending in raw mode. 6 | var crlf = []byte("\r\n") 7 | 8 | const ( 9 | backKey = '\u007f' 10 | escKey = '\u001B' 11 | spaceKey = '\u0020' 12 | ) 13 | 14 | const ( 15 | ctrlA = iota + 1 16 | ctrlB 17 | ctrlC 18 | ctrlD 19 | ctrlE 20 | ctrlF 21 | ctrlG 22 | ctrlH 23 | tabKey 24 | ctrlJ 25 | ctrlK 26 | ctrlL 27 | returnKey 28 | ctrlN 29 | ctrlO 30 | ctrlP 31 | ctrlQ 32 | ctrlR 33 | ctrlS 34 | ctrlT 35 | ctrlU 36 | ctrlV 37 | ctrlW 38 | ctrlX 39 | ctrlY 40 | ctrlZ 41 | ) 42 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/keys_unix.go: -------------------------------------------------------------------------------- 1 | // +build aix linux darwin freebsd openbsd netbsd dragonfly solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | const mvToCol = "\u001b[0G\u001b[%dC" 8 | 9 | var ( 10 | mvLeftEdge = []byte("\u001b[0G") 11 | clsScreen = []byte("\u001b[H\u001b[2J") 12 | delRight = []byte("\u001b[0K") 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/keys_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 Bowery, Inc. 2 | 3 | package prompt 4 | 5 | const ( 6 | f1Key = 0x70 + iota 7 | f2Key 8 | f3Key 9 | f4Key 10 | f5Key 11 | f6Key 12 | f7Key 13 | f8Key 14 | f9Key 15 | f10Key 16 | f11Key 17 | f12Key 18 | 19 | homeKey = 0x24 20 | endKey = 0x23 21 | upKey = 0x26 22 | downKey = 0x28 23 | rightKey = 0x27 24 | leftKey = 0x25 25 | insertKey = 0x2d 26 | pgupKey = 0x21 27 | pgdownKey = 0x22 28 | deleteKey = 0x2e 29 | leftAltKey = 0x2 30 | rightAltKey = 0x1 31 | leftCtrlKey = 0x8 32 | rightCtrlKey = 0x4 33 | shiftKey = 0x10 34 | ) 35 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/prompt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 Bowery, Inc. 2 | 3 | // Package prompt implements a cross platform line-editing prompt. It also 4 | // provides routines to use ANSI escape sequences across platforms for 5 | // terminal connected io.Readers/io.Writers. 6 | // 7 | // If os.Stdin isn't connected to a terminal or (on Unix)if the terminal 8 | // doesn't support the ANSI escape sequences needed a fallback prompt is 9 | // provided that doesn't do line-editing. Unix terminals that are not supported 10 | // will have the TERM environment variable set to either "dumb" or "cons25". 11 | // 12 | // The keyboard shortcuts are similar to those found in the Readline library: 13 | // 14 | // - Enter / CTRL+D 15 | // - End the line. 16 | // - CTRL+C 17 | // - End the line, return error `ErrCTRLC`. 18 | // - Backspace 19 | // - Remove the character to the left. 20 | // - CTRL+L 21 | // - Clear the screen(keeping the current lines content). 22 | // - Home / End 23 | // - Jump to the beginning/end of the line. 24 | // - Up arrow / Down arrow 25 | // - Go back and forward in the history. 26 | // - Left arrow / Right arrow 27 | // - Move left/right one character. 28 | // - Delete 29 | // - Remove the character to the right. 30 | package prompt 31 | 32 | // Basic is a wrapper around Terminal.Basic. 33 | func Basic(prefix string, required bool) (string, error) { 34 | term, err := NewTerminal() 35 | if err != nil { 36 | return "", err 37 | } 38 | defer term.Close() 39 | 40 | return term.Basic(prefix, required) 41 | } 42 | 43 | // BasicDefault is a wrapper around Terminal.BasicDefault. 44 | func BasicDefault(prefix, def string) (string, error) { 45 | term, err := NewTerminal() 46 | if err != nil { 47 | return "", err 48 | } 49 | defer term.Close() 50 | 51 | return term.BasicDefault(prefix, def) 52 | } 53 | 54 | // Ask is a wrapper around Terminal.Ask. 55 | func Ask(question string) (bool, error) { 56 | term, err := NewTerminal() 57 | if err != nil { 58 | return false, err 59 | } 60 | defer term.Close() 61 | 62 | return term.Ask(question) 63 | } 64 | 65 | // Custom is a wrapper around Terminal.Custom. 66 | func Custom(prefix string, test func(string) (string, bool)) (string, error) { 67 | term, err := NewTerminal() 68 | if err != nil { 69 | return "", err 70 | } 71 | defer term.Close() 72 | 73 | return term.Custom(prefix, test) 74 | } 75 | 76 | // Password is a wrapper around Terminal.Password. 77 | func Password(prefix string) (string, error) { 78 | term, err := NewTerminal() 79 | if err != nil { 80 | return "", err 81 | } 82 | defer term.Close() 83 | 84 | return term.Password(prefix) 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/term_unix.go: -------------------------------------------------------------------------------- 1 | // +build aix linux darwin freebsd openbsd netbsd dragonfly solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "os" 9 | 10 | "golang.org/x/sys/unix" 11 | ) 12 | 13 | // List of unsupported $TERM values. 14 | var unsupported = []string{"", "dumb", "cons25"} 15 | 16 | // supportsEditing checks if the terminal supports ansi escapes. 17 | func supportsEditing() bool { 18 | term := os.Getenv("TERM") 19 | 20 | for _, t := range unsupported { 21 | if t == term { 22 | return false 23 | } 24 | } 25 | 26 | return true 27 | } 28 | 29 | // isNotTerminal checks if an error is related to the input not being a terminal. 30 | func isNotTerminal(err error) bool { 31 | return err == unix.ENOTTY 32 | } 33 | 34 | // terminal contains the private fields for a Unix terminal. 35 | type terminal struct { 36 | supportsEditing bool 37 | fd uintptr 38 | origMode unix.Termios 39 | } 40 | 41 | // newTerminal creates a terminal and sets it to raw input mode. 42 | func newTerminal(in *os.File) (*terminal, error) { 43 | term := &terminal{fd: in.Fd()} 44 | 45 | if !supportsEditing() { 46 | return term, nil 47 | } 48 | 49 | t, err := getTermios(term.fd) 50 | if err != nil { 51 | if IsNotTerminal(err) { 52 | return term, nil 53 | } 54 | 55 | return nil, err 56 | } 57 | term.origMode = *t 58 | mode := term.origMode 59 | term.supportsEditing = true 60 | 61 | // Set new mode flags, for reference see cfmakeraw(3). 62 | mode.Iflag &^= (unix.BRKINT | unix.IGNBRK | unix.ICRNL | 63 | unix.INLCR | unix.IGNCR | unix.ISTRIP | unix.IXON | 64 | unix.PARMRK) 65 | 66 | mode.Oflag &^= unix.OPOST 67 | 68 | mode.Lflag &^= (unix.ECHO | unix.ECHONL | unix.ICANON | 69 | unix.ISIG | unix.IEXTEN) 70 | 71 | mode.Cflag &^= (unix.CSIZE | unix.PARENB) 72 | mode.Cflag |= unix.CS8 73 | 74 | // Set controls; min num of bytes, and timeouts. 75 | mode.Cc[unix.VMIN] = 1 76 | mode.Cc[unix.VTIME] = 0 77 | 78 | err = setTermios(term.fd, true, &mode) 79 | if err != nil { 80 | return nil, err 81 | } 82 | 83 | return term, nil 84 | } 85 | 86 | // Close disables the terminals raw input. 87 | func (term *terminal) Close() error { 88 | if term.supportsEditing { 89 | err := setTermios(term.fd, false, &term.origMode) 90 | if err != nil { 91 | return err 92 | } 93 | } 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /vendor/github.com/dchest/safefile/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Dmitry Chestnykh 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /vendor/github.com/dchest/safefile/README.md: -------------------------------------------------------------------------------- 1 | # safefile 2 | 3 | [![Build Status](https://travis-ci.org/dchest/safefile.svg)](https://travis-ci.org/dchest/safefile) [![Windows Build status](https://ci.appveyor.com/api/projects/status/owlifxeekg75t2ho?svg=true)](https://ci.appveyor.com/project/dchest/safefile) 4 | 5 | Go package safefile implements safe "atomic" saving of files. 6 | 7 | Instead of truncating and overwriting the destination file, it creates a 8 | temporary file in the same directory, writes to it, and then renames the 9 | temporary file to the original name when calling Commit. 10 | 11 | 12 | ### Installation 13 | 14 | ``` 15 | $ go get github.com/dchest/safefile 16 | ``` 17 | 18 | ### Documentation 19 | 20 | 21 | 22 | ### Example 23 | 24 | ```go 25 | f, err := safefile.Create("/home/ken/report.txt", 0644) 26 | if err != nil { 27 | // ... 28 | } 29 | // Created temporary file /home/ken/sf-ppcyksu5hyw2mfec.tmp 30 | 31 | defer f.Close() 32 | 33 | _, err = io.WriteString(f, "Hello world") 34 | if err != nil { 35 | // ... 36 | } 37 | // Wrote "Hello world" to /home/ken/sf-ppcyksu5hyw2mfec.tmp 38 | 39 | err = f.Commit() 40 | if err != nil { 41 | // ... 42 | } 43 | // Renamed /home/ken/sf-ppcyksu5hyw2mfec.tmp to /home/ken/report.txt 44 | ``` 45 | -------------------------------------------------------------------------------- /vendor/github.com/dchest/safefile/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | os: Windows Server 2012 R2 4 | 5 | clone_folder: c:\projects\src\github.com\dchest\safefile 6 | 7 | environment: 8 | PATH: c:\projects\bin;%PATH% 9 | GOPATH: c:\projects 10 | NOTIFY_TIMEOUT: 5s 11 | 12 | install: 13 | - go version 14 | - go get golang.org/x/tools/cmd/vet 15 | - go get -v -t ./... 16 | 17 | build_script: 18 | - go tool vet -all . 19 | - go build ./... 20 | - go test -v -race ./... 21 | 22 | test: off 23 | 24 | deploy: off 25 | -------------------------------------------------------------------------------- /vendor/github.com/dchest/safefile/rename.go: -------------------------------------------------------------------------------- 1 | // +build !plan9,!windows windows,go1.5 2 | 3 | package safefile 4 | 5 | import "os" 6 | 7 | func rename(oldname, newname string) error { 8 | return os.Rename(oldname, newname) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/dchest/safefile/rename_nonatomic.go: -------------------------------------------------------------------------------- 1 | // +build plan9 windows,!go1.5 2 | 3 | // os.Rename on Windows before Go 1.5 and Plan 9 will not overwrite existing 4 | // files, thus we cannot guarantee atomic saving of file by doing rename. 5 | // We will have to do some voodoo to minimize data loss on those systems. 6 | 7 | package safefile 8 | 9 | import ( 10 | "os" 11 | "path/filepath" 12 | ) 13 | 14 | func rename(oldname, newname string) error { 15 | err := os.Rename(oldname, newname) 16 | if err != nil { 17 | // If newname exists ("original"), we will try renaming it to a 18 | // new temporary name, then renaming oldname to the newname, 19 | // and deleting the renamed original. If system crashes between 20 | // renaming and deleting, the original file will still be available 21 | // under the temporary name, so users can manually recover data. 22 | // (No automatic recovery is possible because after crash the 23 | // temporary name is not known.) 24 | var origtmp string 25 | for { 26 | origtmp, err = makeTempName(newname, filepath.Base(newname)) 27 | if err != nil { 28 | return err 29 | } 30 | _, err = os.Stat(origtmp) 31 | if err == nil { 32 | continue // most likely will never happen 33 | } 34 | break 35 | } 36 | err = os.Rename(newname, origtmp) 37 | if err != nil { 38 | return err 39 | } 40 | err = os.Rename(oldname, newname) 41 | if err != nil { 42 | // Rename still fails, try to revert original rename, 43 | // ignoring errors. 44 | os.Rename(origtmp, newname) 45 | return err 46 | } 47 | // Rename succeeded, now delete original file. 48 | os.Remove(origtmp) 49 | } 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/google/shlex/README: -------------------------------------------------------------------------------- 1 | go-shlex is a simple lexer for go that supports shell-style quoting, 2 | commenting, and escaping. 3 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/README.md: -------------------------------------------------------------------------------- 1 | # errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) 2 | 3 | Package errors provides simple error handling primitives. 4 | 5 | The traditional error handling idiom in Go is roughly akin to 6 | ```go 7 | if err != nil { 8 | return err 9 | } 10 | ``` 11 | which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. 12 | 13 | ## Adding context to an error 14 | 15 | The errors.Wrap function returns a new error that adds context to the original error. For example 16 | ```go 17 | _, err := ioutil.ReadAll(r) 18 | if err != nil { 19 | return errors.Wrap(err, "read failed") 20 | } 21 | ``` 22 | ## Retrieving the cause of an error 23 | 24 | Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. 25 | ```go 26 | type causer interface { 27 | Cause() error 28 | } 29 | ``` 30 | `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: 31 | ```go 32 | switch err := errors.Cause(err).(type) { 33 | case *MyError: 34 | // handle specifically 35 | default: 36 | // unknown error 37 | } 38 | ``` 39 | 40 | [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). 41 | 42 | ## Contributing 43 | 44 | We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. 45 | 46 | Before proposing a change, please discuss your change by raising an issue. 47 | 48 | ## Licence 49 | 50 | BSD-2-Clause 51 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 11 | // 12 | 13 | TEXT ·syscall6(SB),NOSPLIT,$0-88 14 | JMP syscall·syscall6(SB) 15 | 16 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSyscall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80 14 | // instead of the glibc-specific "CALL 0x10(GS)". 15 | #define INVOKE_SYSCALL INT $0x80 16 | 17 | // Just jump to package syscall's implementation for all these functions. 18 | // The runtime may know about them. 19 | 20 | TEXT ·Syscall(SB),NOSPLIT,$0-28 21 | JMP syscall·Syscall(SB) 22 | 23 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 24 | JMP syscall·Syscall6(SB) 25 | 26 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 27 | CALL runtime·entersyscall(SB) 28 | MOVL trap+0(FP), AX // syscall entry 29 | MOVL a1+4(FP), BX 30 | MOVL a2+8(FP), CX 31 | MOVL a3+12(FP), DX 32 | MOVL $0, SI 33 | MOVL $0, DI 34 | INVOKE_SYSCALL 35 | MOVL AX, r1+16(FP) 36 | MOVL DX, r2+20(FP) 37 | CALL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVL trap+0(FP), AX // syscall entry 48 | MOVL a1+4(FP), BX 49 | MOVL a2+8(FP), CX 50 | MOVL a3+12(FP), DX 51 | MOVL $0, SI 52 | MOVL $0, DI 53 | INVOKE_SYSCALL 54 | MOVL AX, r1+16(FP) 55 | MOVL DX, r2+20(FP) 56 | RET 57 | 58 | TEXT ·socketcall(SB),NOSPLIT,$0-36 59 | JMP syscall·socketcall(SB) 60 | 61 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 62 | JMP syscall·rawsocketcall(SB) 63 | 64 | TEXT ·seek(SB),NOSPLIT,$0-28 65 | JMP syscall·seek(SB) 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 23 | CALL runtime·entersyscall(SB) 24 | MOVQ a1+8(FP), DI 25 | MOVQ a2+16(FP), SI 26 | MOVQ a3+24(FP), DX 27 | MOVQ $0, R10 28 | MOVQ $0, R8 29 | MOVQ $0, R9 30 | MOVQ trap+0(FP), AX // syscall entry 31 | SYSCALL 32 | MOVQ AX, r1+32(FP) 33 | MOVQ DX, r2+40(FP) 34 | CALL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOVQ a1+8(FP), DI 45 | MOVQ a2+16(FP), SI 46 | MOVQ a3+24(FP), DX 47 | MOVQ $0, R10 48 | MOVQ $0, R8 49 | MOVQ $0, R9 50 | MOVQ trap+0(FP), AX // syscall entry 51 | SYSCALL 52 | MOVQ AX, r1+32(FP) 53 | MOVQ DX, r2+40(FP) 54 | RET 55 | 56 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 57 | JMP syscall·gettimeofday(SB) 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 23 | BL runtime·entersyscall(SB) 24 | MOVW trap+0(FP), R7 25 | MOVW a1+4(FP), R0 26 | MOVW a2+8(FP), R1 27 | MOVW a3+12(FP), R2 28 | MOVW $0, R3 29 | MOVW $0, R4 30 | MOVW $0, R5 31 | SWI $0 32 | MOVW R0, r1+16(FP) 33 | MOVW $0, R0 34 | MOVW R0, r2+20(FP) 35 | BL runtime·exitsyscall(SB) 36 | RET 37 | 38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 39 | B syscall·RawSyscall(SB) 40 | 41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 42 | B syscall·RawSyscall6(SB) 43 | 44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 45 | MOVW trap+0(FP), R7 // syscall entry 46 | MOVW a1+4(FP), R0 47 | MOVW a2+8(FP), R1 48 | MOVW a3+12(FP), R2 49 | SWI $0 50 | MOVW R0, r1+16(FP) 51 | MOVW $0, R0 52 | MOVW R0, r2+20(FP) 53 | RET 54 | 55 | TEXT ·seek(SB),NOSPLIT,$0-28 56 | B syscall·seek(SB) 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 21 | BL runtime·entersyscall(SB) 22 | MOVD a1+8(FP), R0 23 | MOVD a2+16(FP), R1 24 | MOVD a3+24(FP), R2 25 | MOVD $0, R3 26 | MOVD $0, R4 27 | MOVD $0, R5 28 | MOVD trap+0(FP), R8 // syscall entry 29 | SVC 30 | MOVD R0, r1+32(FP) // r1 31 | MOVD R1, r2+40(FP) // r2 32 | BL runtime·exitsyscall(SB) 33 | RET 34 | 35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 36 | B syscall·RawSyscall(SB) 37 | 38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 39 | B syscall·RawSyscall6(SB) 40 | 41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 42 | MOVD a1+8(FP), R0 43 | MOVD a2+16(FP), R1 44 | MOVD a3+24(FP), R2 45 | MOVD $0, R3 46 | MOVD $0, R4 47 | MOVD $0, R5 48 | MOVD trap+0(FP), R8 // syscall entry 49 | SVC 50 | MOVD R0, r1+32(FP) 51 | MOVD R1, r2+40(FP) 52 | RET 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | JAL runtime·entersyscall(SB) 26 | MOVV a1+8(FP), R4 27 | MOVV a2+16(FP), R5 28 | MOVV a3+24(FP), R6 29 | MOVV R0, R7 30 | MOVV R0, R8 31 | MOVV R0, R9 32 | MOVV trap+0(FP), R2 // syscall entry 33 | SYSCALL 34 | MOVV R2, r1+32(FP) 35 | MOVV R3, r2+40(FP) 36 | JAL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | JMP syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | JMP syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVV a1+8(FP), R4 47 | MOVV a2+16(FP), R5 48 | MOVV a3+24(FP), R6 49 | MOVV R0, R7 50 | MOVV R0, R8 51 | MOVV R0, R9 52 | MOVV trap+0(FP), R2 // syscall entry 53 | SYSCALL 54 | MOVV R2, r1+32(FP) 55 | MOVV R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 28 | JAL runtime·entersyscall(SB) 29 | MOVW a1+4(FP), R4 30 | MOVW a2+8(FP), R5 31 | MOVW a3+12(FP), R6 32 | MOVW R0, R7 33 | MOVW trap+0(FP), R2 // syscall entry 34 | SYSCALL 35 | MOVW R2, r1+16(FP) // r1 36 | MOVW R3, r2+20(FP) // r2 37 | JAL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVW a1+4(FP), R4 48 | MOVW a2+8(FP), R5 49 | MOVW a3+12(FP), R6 50 | MOVW trap+0(FP), R2 // syscall entry 51 | SYSCALL 52 | MOVW R2, r1+16(FP) 53 | MOVW R3, r2+20(FP) 54 | RET 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 19 | BL runtime·entersyscall(SB) 20 | MOVD a1+8(FP), R3 21 | MOVD a2+16(FP), R4 22 | MOVD a3+24(FP), R5 23 | MOVD R0, R6 24 | MOVD R0, R7 25 | MOVD R0, R8 26 | MOVD trap+0(FP), R9 // syscall entry 27 | SYSCALL R9 28 | MOVD R3, r1+32(FP) 29 | MOVD R4, r2+40(FP) 30 | BL runtime·exitsyscall(SB) 31 | RET 32 | 33 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 34 | MOVD a1+8(FP), R3 35 | MOVD a2+16(FP), R4 36 | MOVD a3+24(FP), R5 37 | MOVD R0, R6 38 | MOVD R0, R7 39 | MOVD R0, R8 40 | MOVD trap+0(FP), R9 // syscall entry 41 | SYSCALL R9 42 | MOVD R3, r1+32(FP) 43 | MOVD R4, r2+40(FP) 44 | RET 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | BL runtime·entersyscall(SB) 26 | MOVD a1+8(FP), R2 27 | MOVD a2+16(FP), R3 28 | MOVD a3+24(FP), R4 29 | MOVD $0, R5 30 | MOVD $0, R6 31 | MOVD $0, R7 32 | MOVD trap+0(FP), R1 // syscall entry 33 | SYSCALL 34 | MOVD R2, r1+32(FP) 35 | MOVD R3, r2+40(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | BR syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | BR syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVD a1+8(FP), R2 47 | MOVD a2+16(FP), R3 48 | MOVD a3+24(FP), R4 49 | MOVD $0, R5 50 | MOVD $0, R6 51 | MOVD $0, R7 52 | MOVD trap+0(FP), R1 // syscall entry 53 | SYSCALL 54 | MOVD R2, r1+32(FP) 55 | MOVD R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used by AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev >> 16) & 0xffff) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32(dev & 0xffff) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | return uint64(((major) << 16) | (minor)) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev & 0x3fffffff00000000) >> 32) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32((dev & 0x00000000ffffffff) >> 0) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | var DEVNO64 uint64 27 | DEVNO64 = 0x8000000000000000 28 | return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used by the Linux kernel and glibc. 7 | // 8 | // The information below is extracted and adapted from bits/sysmacros.h in the 9 | // glibc sources: 10 | // 11 | // dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's 12 | // default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major 13 | // number and m is a hex digit of the minor number. This is backward compatible 14 | // with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also 15 | // backward compatible with the Linux kernel, which for some architectures uses 16 | // 32-bit dev_t, encoded as mmmM MMmm. 17 | 18 | package unix 19 | 20 | // Major returns the major component of a Linux device number. 21 | func Major(dev uint64) uint32 { 22 | major := uint32((dev & 0x00000000000fff00) >> 8) 23 | major |= uint32((dev & 0xfffff00000000000) >> 32) 24 | return major 25 | } 26 | 27 | // Minor returns the minor component of a Linux device number. 28 | func Minor(dev uint64) uint32 { 29 | minor := uint32((dev & 0x00000000000000ff) >> 0) 30 | minor |= uint32((dev & 0x00000ffffff00000) >> 12) 31 | return minor 32 | } 33 | 34 | // Mkdev returns a Linux device number generated from the given major and minor 35 | // components. 36 | func Mkdev(major, minor uint32) uint64 { 37 | dev := (uint64(major) & 0x00000fff) << 8 38 | dev |= (uint64(major) & 0xfffff000) << 32 39 | dev |= (uint64(minor) & 0x000000ff) << 0 40 | dev |= (uint64(minor) & 0xffffff00) << 12 41 | return dev 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dirent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // ParseDirent parses up to max directory entries in buf, 12 | // appending the names to names. It returns the number of 13 | // bytes consumed from buf, the number of entries added 14 | // to names, and the new names slice. 15 | func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { 16 | return syscall.ParseDirent(buf, max, names) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 16 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 17 | valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg)) 18 | var err error 19 | if errno != 0 { 20 | err = errno 21 | } 22 | return int(valptr), err 23 | } 24 | 25 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 26 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 27 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 28 | if errno == 0 { 29 | return nil 30 | } 31 | return errno 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import "unsafe" 8 | 9 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 10 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 11 | return fcntl(int(fd), cmd, arg) 12 | } 13 | 14 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 15 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 16 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | // +build !aix 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | // We can't use the gc-syntax .s files for gccgo. On the plus side 13 | // much of the functionality can be written directly in Go. 14 | 15 | //extern gccgoRealSyscallNoError 16 | func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) 17 | 18 | //extern gccgoRealSyscall 19 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 20 | 21 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { 22 | syscall.Entersyscall() 23 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 24 | syscall.Exitsyscall() 25 | return r, 0 26 | } 27 | 28 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 29 | syscall.Entersyscall() 30 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 31 | syscall.Exitsyscall() 32 | return r, 0, syscall.Errno(errno) 33 | } 34 | 35 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 36 | syscall.Entersyscall() 37 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 38 | syscall.Exitsyscall() 39 | return r, 0, syscall.Errno(errno) 40 | } 41 | 42 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 43 | syscall.Entersyscall() 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 45 | syscall.Exitsyscall() 46 | return r, 0, syscall.Errno(errno) 47 | } 48 | 49 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { 50 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 51 | return r, 0 52 | } 53 | 54 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 55 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 56 | return r, 0, syscall.Errno(errno) 57 | } 58 | 59 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 60 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 61 | return r, 0, syscall.Errno(errno) 62 | } 63 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | // +build !aix 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #define _STRINGIFY2_(x) #x 13 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 14 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 15 | 16 | // Call syscall from C code because the gccgo support for calling from 17 | // Go to C does not support varargs functions. 18 | 19 | struct ret { 20 | uintptr_t r; 21 | uintptr_t err; 22 | }; 23 | 24 | struct ret 25 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 26 | { 27 | struct ret r; 28 | 29 | errno = 0; 30 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 31 | r.err = errno; 32 | return r; 33 | } 34 | 35 | uintptr_t 36 | gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 37 | { 38 | return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "runtime" 10 | 11 | // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. 12 | // 13 | // To change fd's window size, the req argument should be TIOCSWINSZ. 14 | func IoctlSetWinsize(fd int, req uint, value *Winsize) error { 15 | // TODO: if we get the chance, remove the req parameter and 16 | // hardcode TIOCSWINSZ. 17 | err := ioctlSetWinsize(fd, req, value) 18 | runtime.KeepAlive(value) 19 | return err 20 | } 21 | 22 | // IoctlSetTermios performs an ioctl on fd with a *Termios. 23 | // 24 | // The req value will usually be TCSETA or TIOCSETA. 25 | func IoctlSetTermios(fd int, req uint, value *Termios) error { 26 | // TODO: if we get the chance, remove the req parameter. 27 | err := ioctlSetTermios(fd, req, value) 28 | runtime.KeepAlive(value) 29 | return err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/openbsd_unveil.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build openbsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | // Unveil implements the unveil syscall. 15 | // For more information see unveil(2). 16 | // Note that the special case of blocking further 17 | // unveil calls is handled by UnveilBlock. 18 | func Unveil(path string, flags string) error { 19 | pathPtr, err := syscall.BytePtrFromString(path) 20 | if err != nil { 21 | return err 22 | } 23 | flagsPtr, err := syscall.BytePtrFromString(flags) 24 | if err != nil { 25 | return err 26 | } 27 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) 28 | if e != 0 { 29 | return e 30 | } 31 | return nil 32 | } 33 | 34 | // UnveilBlock blocks future unveil calls. 35 | // For more information see unveil(2). 36 | func UnveilBlock() error { 37 | // Both pointers must be nil. 38 | var pathUnsafe, flagsUnsafe unsafe.Pointer 39 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) 40 | if e != 0 { 41 | return e 42 | } 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,race linux,race freebsd,race 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Socket control messages 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // UnixCredentials encodes credentials into a socket control message 12 | // for sending to another process. This can be used for 13 | // authentication. 14 | func UnixCredentials(ucred *Ucred) []byte { 15 | b := make([]byte, CmsgSpace(SizeofUcred)) 16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 17 | h.Level = SOL_SOCKET 18 | h.Type = SCM_CREDENTIALS 19 | h.SetLen(CmsgLen(SizeofUcred)) 20 | *((*Ucred)(cmsgData(h))) = *ucred 21 | return b 22 | } 23 | 24 | // ParseUnixCredentials decodes a socket control message that contains 25 | // credentials in a Ucred structure. To receive such a message, the 26 | // SO_PASSCRED option must be enabled on the socket. 27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { 28 | if m.Header.Level != SOL_SOCKET { 29 | return nil, EINVAL 30 | } 31 | if m.Header.Type != SCM_CREDENTIALS { 32 | return nil, EINVAL 33 | } 34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) 35 | return &ucred, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Package unix contains an interface to the low-level operating system 8 | // primitives. OS details vary depending on the underlying system, and 9 | // by default, godoc will display OS-specific documentation for the current 10 | // system. If you want godoc to display OS documentation for another 11 | // system, set $GOOS and $GOARCH to the desired system. For example, if 12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS 13 | // to freebsd and $GOARCH to arm. 14 | // 15 | // The primary use of this package is inside other packages that provide a more 16 | // portable interface to the system, such as "os", "time" and "net". Use 17 | // those packages rather than this one if you can. 18 | // 19 | // For details of the functions and data types in this package consult 20 | // the manuals for the appropriate operating system. 21 | // 22 | // These calls return err == nil to indicate success; otherwise 23 | // err represents an operating system error describing the failure and 24 | // holds a value of type syscall.Errno. 25 | package unix // import "golang.org/x/sys/unix" 26 | 27 | import "strings" 28 | 29 | // ByteSliceFromString returns a NUL-terminated slice of bytes 30 | // containing the text of s. If s contains a NUL byte at any 31 | // location, it returns (nil, EINVAL). 32 | func ByteSliceFromString(s string) ([]byte, error) { 33 | if strings.IndexByte(s, 0) != -1 { 34 | return nil, EINVAL 35 | } 36 | a := make([]byte, len(s)+1) 37 | copy(a, s) 38 | return a, nil 39 | } 40 | 41 | // BytePtrFromString returns a pointer to a NUL-terminated array of 42 | // bytes containing the text of s. If s contains a NUL byte at any 43 | // location, it returns (nil, EINVAL). 44 | func BytePtrFromString(s string) (*byte, error) { 45 | a, err := ByteSliceFromString(s) 46 | if err != nil { 47 | return nil, err 48 | } 49 | return &a[0], nil 50 | } 51 | 52 | // Single-word zero for use when we need a valid pointer to 0 bytes. 53 | // See mkunix.pl. 54 | var _zero uintptr 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (cmsg *Cmsghdr) SetLen(length int) { 33 | cmsg.Len = uint32(length) 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: sec, Nsec: nsec} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int64(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (cmsg *Cmsghdr) SetLen(length int) { 33 | cmsg.Len = uint32(length) 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = int32(sec) 28 | tv.Usec = int32(usec) 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint32(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint32(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 59 | //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 60 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 61 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 62 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 63 | //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: sec, Nsec: nsec} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: sec, Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = sec 28 | tv.Usec = usec 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint64(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint64(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 59 | //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 60 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 61 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 62 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 63 | //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | ) 10 | 11 | func setTimespec(sec, nsec int64) Timespec { 12 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 13 | } 14 | 15 | func setTimeval(sec, usec int64) Timeval { 16 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 17 | } 18 | 19 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 20 | func Gettimeofday(tv *Timeval) (err error) { 21 | // The tv passed to gettimeofday must be non-nil 22 | // but is otherwise unused. The answers come back 23 | // in the two registers. 24 | sec, usec, err := gettimeofday(tv) 25 | tv.Sec = int32(sec) 26 | tv.Usec = int32(usec) 27 | return err 28 | } 29 | 30 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 31 | k.Ident = uint32(fd) 32 | k.Filter = int16(mode) 33 | k.Flags = uint16(flags) 34 | } 35 | 36 | func (iov *Iovec) SetLen(length int) { 37 | iov.Len = uint32(length) 38 | } 39 | 40 | func (msghdr *Msghdr) SetControllen(length int) { 41 | msghdr.Controllen = uint32(length) 42 | } 43 | 44 | func (cmsg *Cmsghdr) SetLen(length int) { 45 | cmsg.Len = uint32(length) 46 | } 47 | 48 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 49 | 50 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 51 | // of darwin/arm the syscall is called sysctl instead of __sysctl. 52 | const SYS___SYSCTL = SYS_SYSCTL 53 | 54 | //sys Fstat(fd int, stat *Stat_t) (err error) 55 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 56 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 57 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 58 | //sys Lstat(path string, stat *Stat_t) (err error) 59 | //sys Stat(path string, stat *Stat_t) (err error) 60 | //sys Statfs(path string, stat *Statfs_t) (err error) 61 | 62 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 63 | return 0, ENOSYS 64 | } 65 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: sec, Nsec: nsec} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: sec, Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = sec 28 | tv.Usec = usec 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint64(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint64(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 59 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 60 | //sys Lstat(path string, stat *Stat_t) (err error) 61 | //sys Stat(path string, stat *Stat_t) (err error) 62 | //sys Statfs(path string, stat *Statfs_t) (err error) 63 | 64 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 65 | return 0, ENOSYS 66 | } 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,go1.12 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // Implemented in the runtime package (runtime/sys_darwin.go) 12 | func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 13 | func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 14 | func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 15 | func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only 16 | func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 17 | func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 18 | 19 | //go:linkname syscall_syscall syscall.syscall 20 | //go:linkname syscall_syscall6 syscall.syscall6 21 | //go:linkname syscall_syscall6X syscall.syscall6X 22 | //go:linkname syscall_syscall9 syscall.syscall9 23 | //go:linkname syscall_rawSyscall syscall.rawSyscall 24 | //go:linkname syscall_rawSyscall6 syscall.rawSyscall6 25 | 26 | // Find the entry point for f. See comments in runtime/proc.go for the 27 | // function of the same name. 28 | //go:nosplit 29 | func funcPC(f func()) uintptr { 30 | return **(**uintptr)(unsafe.Pointer(&f)) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo,386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,386 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | 22 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 23 | fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 24 | return int(fd), err 25 | } 26 | 27 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 28 | fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 29 | return int(fd), err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/386 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/arm the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (cmsg *Cmsghdr) SetLen(length int) { 22 | cmsg.Len = uint32(length) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo,!ppc64le,!ppc64 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64le ppc64 7 | // +build !gccgo 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 14 | return syscall.Syscall(trap, a1, a2, a3) 15 | } 16 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 17 | return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) 18 | } 19 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 20 | return syscall.RawSyscall(trap, a1, a2, a3) 21 | } 22 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 23 | return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/timestruct.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "time" 10 | 11 | // TimespecToNsec converts a Timespec value into a number of 12 | // nanoseconds since the Unix epoch. 13 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 14 | 15 | // NsecToTimespec takes a number of nanoseconds since the Unix epoch 16 | // and returns the corresponding Timespec value. 17 | func NsecToTimespec(nsec int64) Timespec { 18 | sec := nsec / 1e9 19 | nsec = nsec % 1e9 20 | if nsec < 0 { 21 | nsec += 1e9 22 | sec-- 23 | } 24 | return setTimespec(sec, nsec) 25 | } 26 | 27 | // TimeToTimespec converts t into a Timespec. 28 | // On some 32-bit systems the range of valid Timespec values are smaller 29 | // than that of time.Time values. So if t is out of the valid range of 30 | // Timespec, it returns a zero Timespec and ERANGE. 31 | func TimeToTimespec(t time.Time) (Timespec, error) { 32 | sec := t.Unix() 33 | nsec := int64(t.Nanosecond()) 34 | ts := setTimespec(sec, nsec) 35 | 36 | // Currently all targets have either int32 or int64 for Timespec.Sec. 37 | // If there were a new target with floating point type for it, we have 38 | // to consider the rounding error. 39 | if int64(ts.Sec) != sec { 40 | return Timespec{}, ERANGE 41 | } 42 | return ts, nil 43 | } 44 | 45 | // TimevalToNsec converts a Timeval value into a number of nanoseconds 46 | // since the Unix epoch. 47 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 48 | 49 | // NsecToTimeval takes a number of nanoseconds since the Unix epoch 50 | // and returns the corresponding Timeval value. 51 | func NsecToTimeval(nsec int64) Timeval { 52 | nsec += 999 // round up to microsecond 53 | usec := nsec % 1e9 / 1e3 54 | sec := nsec / 1e9 55 | if usec < 0 { 56 | usec += 1e6 57 | sec-- 58 | } 59 | return setTimeval(sec, usec) 60 | } 61 | 62 | // Unix returns ts as the number of seconds and nanoseconds elapsed since the 63 | // Unix epoch. 64 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 65 | return int64(ts.Sec), int64(ts.Nsec) 66 | } 67 | 68 | // Unix returns tv as the number of seconds and nanoseconds elapsed since the 69 | // Unix epoch. 70 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 71 | return int64(tv.Sec), int64(tv.Usec) * 1000 72 | } 73 | 74 | // Nano returns ts as the number of nanoseconds elapsed since the Unix epoch. 75 | func (ts *Timespec) Nano() int64 { 76 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 77 | } 78 | 79 | // Nano returns tv as the number of nanoseconds elapsed since the Unix epoch. 80 | func (tv *Timeval) Nano() int64 { 81 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 82 | } 83 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace386_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(386, amd64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build 386 amd64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegs386 is the registers used by 386 binaries. 11 | type PtraceRegs386 struct { 12 | Ebx int32 13 | Ecx int32 14 | Edx int32 15 | Esi int32 16 | Edi int32 17 | Ebp int32 18 | Eax int32 19 | Xds int32 20 | Xes int32 21 | Xfs int32 22 | Xgs int32 23 | Orig_eax int32 24 | Eip int32 25 | Xcs int32 26 | Eflags int32 27 | Esp int32 28 | Xss int32 29 | } 30 | 31 | // PtraceGetRegs386 fetches the registers used by 386 binaries. 32 | func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error { 33 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 34 | } 35 | 36 | // PtraceSetRegs386 sets the registers used by 386 binaries. 37 | func PtraceSetRegs386(pid int, regs *PtraceRegs386) error { 38 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 39 | } 40 | 41 | // PtraceRegsAmd64 is the registers used by amd64 binaries. 42 | type PtraceRegsAmd64 struct { 43 | R15 uint64 44 | R14 uint64 45 | R13 uint64 46 | R12 uint64 47 | Rbp uint64 48 | Rbx uint64 49 | R11 uint64 50 | R10 uint64 51 | R9 uint64 52 | R8 uint64 53 | Rax uint64 54 | Rcx uint64 55 | Rdx uint64 56 | Rsi uint64 57 | Rdi uint64 58 | Orig_rax uint64 59 | Rip uint64 60 | Cs uint64 61 | Eflags uint64 62 | Rsp uint64 63 | Ss uint64 64 | Fs_base uint64 65 | Gs_base uint64 66 | Ds uint64 67 | Es uint64 68 | Fs uint64 69 | Gs uint64 70 | } 71 | 72 | // PtraceGetRegsAmd64 fetches the registers used by amd64 binaries. 73 | func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error { 74 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 75 | } 76 | 77 | // PtraceSetRegsAmd64 sets the registers used by amd64 binaries. 78 | func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error { 79 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracearm_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build arm arm64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsArm is the registers used by arm binaries. 11 | type PtraceRegsArm struct { 12 | Uregs [18]uint32 13 | } 14 | 15 | // PtraceGetRegsArm fetches the registers used by arm binaries. 16 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 17 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 18 | } 19 | 20 | // PtraceSetRegsArm sets the registers used by arm binaries. 21 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 22 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 23 | } 24 | 25 | // PtraceRegsArm64 is the registers used by arm64 binaries. 26 | type PtraceRegsArm64 struct { 27 | Regs [31]uint64 28 | Sp uint64 29 | Pc uint64 30 | Pstate uint64 31 | } 32 | 33 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 34 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 35 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 36 | } 37 | 38 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 39 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 40 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemips_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mips, mips64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mips mips64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMips is the registers used by mips binaries. 11 | type PtraceRegsMips struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMips fetches the registers used by mips binaries. 22 | func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMips sets the registers used by mips binaries. 27 | func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64 is the registers used by mips64 binaries. 32 | type PtraceRegsMips64 struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64 fetches the registers used by mips64 binaries. 43 | func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64 sets the registers used by mips64 binaries. 48 | func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemipsle_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mipsle mips64le 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMipsle is the registers used by mipsle binaries. 11 | type PtraceRegsMipsle struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMipsle fetches the registers used by mipsle binaries. 22 | func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMipsle sets the registers used by mipsle binaries. 27 | func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64le is the registers used by mips64le binaries. 32 | type PtraceRegsMips64le struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64le fetches the registers used by mips64le binaries. 43 | func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64le sets the registers used by mips64le binaries. 48 | func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/vcs/discovery.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package vcs 6 | 7 | import ( 8 | "encoding/xml" 9 | "fmt" 10 | "io" 11 | "strings" 12 | ) 13 | 14 | // charsetReader returns a reader for the given charset. Currently 15 | // it only supports UTF-8 and ASCII. Otherwise, it returns a meaningful 16 | // error which is printed by go get, so the user can find why the package 17 | // wasn't downloaded if the encoding is not supported. Note that, in 18 | // order to reduce potential errors, ASCII is treated as UTF-8 (i.e. characters 19 | // greater than 0x7f are not rejected). 20 | func charsetReader(charset string, input io.Reader) (io.Reader, error) { 21 | switch strings.ToLower(charset) { 22 | case "ascii": 23 | return input, nil 24 | default: 25 | return nil, fmt.Errorf("can't decode XML document using charset %q", charset) 26 | } 27 | } 28 | 29 | // parseMetaGoImports returns meta imports from the HTML in r. 30 | // Parsing ends at the end of the section or the beginning of the . 31 | // 32 | // This copy of cmd/go/internal/vcs.parseMetaGoImports always operates 33 | // in IgnoreMod ModuleMode. 34 | func parseMetaGoImports(r io.Reader) (imports []metaImport, err error) { 35 | d := xml.NewDecoder(r) 36 | d.CharsetReader = charsetReader 37 | d.Strict = false 38 | var t xml.Token 39 | for { 40 | t, err = d.RawToken() 41 | if err != nil { 42 | if err == io.EOF || len(imports) > 0 { 43 | err = nil 44 | } 45 | return 46 | } 47 | if e, ok := t.(xml.StartElement); ok && strings.EqualFold(e.Name.Local, "body") { 48 | return 49 | } 50 | if e, ok := t.(xml.EndElement); ok && strings.EqualFold(e.Name.Local, "head") { 51 | return 52 | } 53 | e, ok := t.(xml.StartElement) 54 | if !ok || !strings.EqualFold(e.Name.Local, "meta") { 55 | continue 56 | } 57 | if attrValue(e.Attr, "name") != "go-import" { 58 | continue 59 | } 60 | if f := strings.Fields(attrValue(e.Attr, "content")); len(f) == 3 { 61 | // Ignore VCS type "mod", which is applicable only in module mode. 62 | if f[1] == "mod" { 63 | continue 64 | } 65 | imports = append(imports, metaImport{ 66 | Prefix: f[0], 67 | VCS: f[1], 68 | RepoRoot: f[2], 69 | }) 70 | } 71 | } 72 | } 73 | 74 | // attrValue returns the attribute value for the case-insensitive key 75 | // `name', or the empty string if nothing is found. 76 | func attrValue(attrs []xml.Attr, name string) string { 77 | for _, a := range attrs { 78 | if strings.EqualFold(a.Name.Local, name) { 79 | return a.Value 80 | } 81 | } 82 | return "" 83 | } 84 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/vcs/env.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package vcs 6 | 7 | import ( 8 | "os" 9 | "strings" 10 | ) 11 | 12 | // envForDir returns a copy of the environment 13 | // suitable for running in the given directory. 14 | // The environment is the current process's environment 15 | // but with an updated $PWD, so that an os.Getwd in the 16 | // child will be faster. 17 | func envForDir(dir string) []string { 18 | env := os.Environ() 19 | // Internally we only use rooted paths, so dir is rooted. 20 | // Even if dir is not rooted, no harm done. 21 | return mergeEnvLists([]string{"PWD=" + dir}, env) 22 | } 23 | 24 | // mergeEnvLists merges the two environment lists such that 25 | // variables with the same name in "in" replace those in "out". 26 | func mergeEnvLists(in, out []string) []string { 27 | NextVar: 28 | for _, inkv := range in { 29 | k := strings.SplitAfterN(inkv, "=", 2)[0] 30 | for i, outkv := range out { 31 | if strings.HasPrefix(outkv, k) { 32 | out[i] = inkv 33 | continue NextVar 34 | } 35 | } 36 | out = append(out, inkv) 37 | } 38 | return out 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/vcs/http.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package vcs 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | "io/ioutil" 11 | "log" 12 | "net/http" 13 | "net/url" 14 | ) 15 | 16 | // httpClient is the default HTTP client, but a variable so it can be 17 | // changed by tests, without modifying http.DefaultClient. 18 | var httpClient = http.DefaultClient 19 | 20 | // httpGET returns the data from an HTTP GET request for the given URL. 21 | func httpGET(url string) ([]byte, error) { 22 | resp, err := httpClient.Get(url) 23 | if err != nil { 24 | return nil, err 25 | } 26 | defer resp.Body.Close() 27 | if resp.StatusCode != 200 { 28 | return nil, fmt.Errorf("%s: %s", url, resp.Status) 29 | } 30 | b, err := ioutil.ReadAll(resp.Body) 31 | if err != nil { 32 | return nil, fmt.Errorf("%s: %v", url, err) 33 | } 34 | return b, nil 35 | } 36 | 37 | // httpsOrHTTP returns the body of either the importPath's 38 | // https resource or, if unavailable, the http resource. 39 | func httpsOrHTTP(importPath string) (urlStr string, body io.ReadCloser, err error) { 40 | fetch := func(scheme string) (urlStr string, res *http.Response, err error) { 41 | u, err := url.Parse(scheme + "://" + importPath) 42 | if err != nil { 43 | return "", nil, err 44 | } 45 | u.RawQuery = "go-get=1" 46 | urlStr = u.String() 47 | if Verbose { 48 | log.Printf("Fetching %s", urlStr) 49 | } 50 | res, err = httpClient.Get(urlStr) 51 | return 52 | } 53 | closeBody := func(res *http.Response) { 54 | if res != nil { 55 | res.Body.Close() 56 | } 57 | } 58 | urlStr, res, err := fetch("https") 59 | if err != nil || res.StatusCode != 200 { 60 | if Verbose { 61 | if err != nil { 62 | log.Printf("https fetch failed.") 63 | } else { 64 | log.Printf("ignoring https fetch with status code %d", res.StatusCode) 65 | } 66 | } 67 | closeBody(res) 68 | urlStr, res, err = fetch("http") 69 | } 70 | if err != nil { 71 | closeBody(res) 72 | return "", nil, err 73 | } 74 | // Note: accepting a non-200 OK here, so people can serve a 75 | // meta import in their http 404 page. 76 | if Verbose { 77 | log.Printf("Parsing meta tags from %s (status code %d)", urlStr, res.StatusCode) 78 | } 79 | return urlStr, res.Body, nil 80 | } 81 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/sorter.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | import ( 4 | "reflect" 5 | "unicode" 6 | ) 7 | 8 | type keyList []reflect.Value 9 | 10 | func (l keyList) Len() int { return len(l) } 11 | func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } 12 | func (l keyList) Less(i, j int) bool { 13 | a := l[i] 14 | b := l[j] 15 | ak := a.Kind() 16 | bk := b.Kind() 17 | for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { 18 | a = a.Elem() 19 | ak = a.Kind() 20 | } 21 | for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { 22 | b = b.Elem() 23 | bk = b.Kind() 24 | } 25 | af, aok := keyFloat(a) 26 | bf, bok := keyFloat(b) 27 | if aok && bok { 28 | if af != bf { 29 | return af < bf 30 | } 31 | if ak != bk { 32 | return ak < bk 33 | } 34 | return numLess(a, b) 35 | } 36 | if ak != reflect.String || bk != reflect.String { 37 | return ak < bk 38 | } 39 | ar, br := []rune(a.String()), []rune(b.String()) 40 | for i := 0; i < len(ar) && i < len(br); i++ { 41 | if ar[i] == br[i] { 42 | continue 43 | } 44 | al := unicode.IsLetter(ar[i]) 45 | bl := unicode.IsLetter(br[i]) 46 | if al && bl { 47 | return ar[i] < br[i] 48 | } 49 | if al || bl { 50 | return bl 51 | } 52 | var ai, bi int 53 | var an, bn int64 54 | for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { 55 | an = an*10 + int64(ar[ai]-'0') 56 | } 57 | for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { 58 | bn = bn*10 + int64(br[bi]-'0') 59 | } 60 | if an != bn { 61 | return an < bn 62 | } 63 | if ai != bi { 64 | return ai < bi 65 | } 66 | return ar[i] < br[i] 67 | } 68 | return len(ar) < len(br) 69 | } 70 | 71 | // keyFloat returns a float value for v if it is a number/bool 72 | // and whether it is a number/bool or not. 73 | func keyFloat(v reflect.Value) (f float64, ok bool) { 74 | switch v.Kind() { 75 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 76 | return float64(v.Int()), true 77 | case reflect.Float32, reflect.Float64: 78 | return v.Float(), true 79 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 80 | return float64(v.Uint()), true 81 | case reflect.Bool: 82 | if v.Bool() { 83 | return 1, true 84 | } 85 | return 0, true 86 | } 87 | return 0, false 88 | } 89 | 90 | // numLess returns whether a < b. 91 | // a and b must necessarily have the same kind. 92 | func numLess(a, b reflect.Value) bool { 93 | switch a.Kind() { 94 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 95 | return a.Int() < b.Int() 96 | case reflect.Float32, reflect.Float64: 97 | return a.Float() < b.Float() 98 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 99 | return a.Uint() < b.Uint() 100 | case reflect.Bool: 101 | return !a.Bool() && b.Bool() 102 | } 103 | panic("not a number") 104 | } 105 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/writerc.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | // Set the writer error and return false. 4 | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { 5 | emitter.error = yaml_WRITER_ERROR 6 | emitter.problem = problem 7 | return false 8 | } 9 | 10 | // Flush the output buffer. 11 | func yaml_emitter_flush(emitter *yaml_emitter_t) bool { 12 | if emitter.write_handler == nil { 13 | panic("write handler not set") 14 | } 15 | 16 | // Check if the buffer is empty. 17 | if emitter.buffer_pos == 0 { 18 | return true 19 | } 20 | 21 | // If the output encoding is UTF-8, we don't need to recode the buffer. 22 | if emitter.encoding == yaml_UTF8_ENCODING { 23 | if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { 24 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 25 | } 26 | emitter.buffer_pos = 0 27 | return true 28 | } 29 | 30 | // Recode the buffer into the raw buffer. 31 | var low, high int 32 | if emitter.encoding == yaml_UTF16LE_ENCODING { 33 | low, high = 0, 1 34 | } else { 35 | high, low = 1, 0 36 | } 37 | 38 | pos := 0 39 | for pos < emitter.buffer_pos { 40 | // See the "reader.c" code for more details on UTF-8 encoding. Note 41 | // that we assume that the buffer contains a valid UTF-8 sequence. 42 | 43 | // Read the next UTF-8 character. 44 | octet := emitter.buffer[pos] 45 | 46 | var w int 47 | var value rune 48 | switch { 49 | case octet&0x80 == 0x00: 50 | w, value = 1, rune(octet&0x7F) 51 | case octet&0xE0 == 0xC0: 52 | w, value = 2, rune(octet&0x1F) 53 | case octet&0xF0 == 0xE0: 54 | w, value = 3, rune(octet&0x0F) 55 | case octet&0xF8 == 0xF0: 56 | w, value = 4, rune(octet&0x07) 57 | } 58 | for k := 1; k < w; k++ { 59 | octet = emitter.buffer[pos+k] 60 | value = (value << 6) + (rune(octet) & 0x3F) 61 | } 62 | pos += w 63 | 64 | // Write the character. 65 | if value < 0x10000 { 66 | var b [2]byte 67 | b[high] = byte(value >> 8) 68 | b[low] = byte(value & 0xFF) 69 | emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1]) 70 | } else { 71 | // Write the character using a surrogate pair (check "reader.c"). 72 | var b [4]byte 73 | value -= 0x10000 74 | b[high] = byte(0xD8 + (value >> 18)) 75 | b[low] = byte((value >> 10) & 0xFF) 76 | b[high+2] = byte(0xDC + ((value >> 8) & 0xFF)) 77 | b[low+2] = byte(value & 0xFF) 78 | emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1], b[2], b[3]) 79 | } 80 | } 81 | 82 | // Write the raw buffer. 83 | if err := emitter.write_handler(emitter, emitter.raw_buffer); err != nil { 84 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 85 | } 86 | emitter.buffer_pos = 0 87 | emitter.raw_buffer = emitter.raw_buffer[:0] 88 | return true 89 | } 90 | -------------------------------------------------------------------------------- /vendor/vendor.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": "", 3 | "ignore": "test", 4 | "package": [ 5 | { 6 | "checksumSHA1": "kwUfnTXFn6mjfw31/cmVIizn/Q4=", 7 | "path": "github.com/Bowery/prompt", 8 | "revision": "972d0ceb96f55132a1ba9714cb771ce19b3821ab", 9 | "revisionTime": "2019-04-19T14:42:37Z" 10 | }, 11 | { 12 | "checksumSHA1": "6VGFARaK8zd23IAiDf7a+gglC8k=", 13 | "path": "github.com/dchest/safefile", 14 | "revision": "855e8d98f1852d48dde521e0522408d1fe7e836a", 15 | "revisionTime": "2015-10-22T12:31:44+02:00" 16 | }, 17 | { 18 | "checksumSHA1": "3VJcSYFds0zeIO5opOs0AoKm3Mw=", 19 | "path": "github.com/google/shlex", 20 | "revision": "6f45313302b9c56850fc17f99e40caebce98c716", 21 | "revisionTime": "2015-01-27T13:39:51Z" 22 | }, 23 | { 24 | "checksumSHA1": "GcaTbmmzSGqTb2X6qnNtmDyew1Q=", 25 | "path": "github.com/pkg/errors", 26 | "revision": "a2d6902c6d2a2f194eb3fb474981ab7867c81505", 27 | "revisionTime": "2016-06-27T22:23:52Z" 28 | }, 29 | { 30 | "checksumSHA1": "M19t1y+ecnozxkTN9N5/J/uf1AI=", 31 | "path": "golang.org/x/sys/unix", 32 | "revision": "53818c742c03109fe2abe531e7f7ece7ab06a461", 33 | "revisionTime": "2019-04-19T09:16:35Z" 34 | }, 35 | { 36 | "checksumSHA1": "3MMloGEeOp5DSWVD80vbdIekTSo=", 37 | "path": "golang.org/x/tools/go/vcs", 38 | "revision": "d73e1c7e250b19f9948138e2df37cea712e8f06f", 39 | "revisionTime": "2019-06-11T22:07:34Z" 40 | }, 41 | { 42 | "checksumSHA1": "fALlQNY1fM99NesfLJ50KguWsio=", 43 | "path": "gopkg.in/yaml.v2", 44 | "revision": "cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b", 45 | "revisionTime": "2017-04-07T17:21:22Z" 46 | } 47 | ], 48 | "rootPath": "github.com/kardianos/govendor" 49 | } 50 | --------------------------------------------------------------------------------