forked from LaconicNetwork/kompose
add github.com/pkg/errors to glide and vendor
This adds github.com/pkg/errors to glide.yaml followed by glide and glide-vc commands. The github.com/pkg/errors package is currently required mainly for the errors.Wrap() and errors.New() methods, since this lets us to annotate the errors while passing the error message up the call stack.
This commit is contained in:
parent
5cb598fa5b
commit
e9544ca894
26
glide.lock
generated
26
glide.lock
generated
@ -1,5 +1,5 @@
|
|||||||
hash: 4ea8562ed136361f0ad9741263198f8e0bef9511ef543ff4532cd2f0f33e95ed
|
hash: a1dbf2b8c2789bec3a0e75cb5a24273d1b8ec9b38a1ef1b351eda824cdd56ae7
|
||||||
updated: 2017-03-14T11:16:50.6057693-04:00
|
updated: 2017-03-15T13:16:48.661724768+05:30
|
||||||
imports:
|
imports:
|
||||||
- name: cloud.google.com/go
|
- name: cloud.google.com/go
|
||||||
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
|
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
|
||||||
@ -210,7 +210,7 @@ imports:
|
|||||||
- name: github.com/evanphx/json-patch
|
- name: github.com/evanphx/json-patch
|
||||||
version: 465937c80b3c07a7c7ad20cc934898646a91c1de
|
version: 465937c80b3c07a7c7ad20cc934898646a91c1de
|
||||||
- name: github.com/fatih/structs
|
- name: github.com/fatih/structs
|
||||||
version: a720dfa8df582c51dee1b36feabb906bde1588bd
|
version: be738c8546f55b34e60125afa50ed73a9a9c460e
|
||||||
- name: github.com/flynn/go-shlex
|
- name: github.com/flynn/go-shlex
|
||||||
version: 3f9db97f856818214da2e1057f8ad84803971cff
|
version: 3f9db97f856818214da2e1057f8ad84803971cff
|
||||||
- name: github.com/fsnotify/fsnotify
|
- name: github.com/fsnotify/fsnotify
|
||||||
@ -405,7 +405,9 @@ imports:
|
|||||||
- name: github.com/pelletier/go-buffruneio
|
- name: github.com/pelletier/go-buffruneio
|
||||||
version: c37440a7cf42ac63b919c752ca73a85067e05992
|
version: c37440a7cf42ac63b919c752ca73a85067e05992
|
||||||
- name: github.com/pelletier/go-toml
|
- name: github.com/pelletier/go-toml
|
||||||
version: 3b00596b2e9ee541bbd72dc50cc0c60e2b46c69c
|
version: fee7787d3f811af92276f5ff10107092e95b7a1d
|
||||||
|
- name: github.com/pkg/errors
|
||||||
|
version: bfd5150e4e41705ded2129ec33379de1cb90b513
|
||||||
- name: github.com/prometheus/client_golang
|
- name: github.com/prometheus/client_golang
|
||||||
version: e51041b3fa41cece0dca035740ba6411905be473
|
version: e51041b3fa41cece0dca035740ba6411905be473
|
||||||
subpackages:
|
subpackages:
|
||||||
@ -423,7 +425,7 @@ imports:
|
|||||||
- name: github.com/prometheus/procfs
|
- name: github.com/prometheus/procfs
|
||||||
version: 454a56f35412459b5e684fd5ec0f9211b94f002a
|
version: 454a56f35412459b5e684fd5ec0f9211b94f002a
|
||||||
- name: github.com/Sirupsen/logrus
|
- name: github.com/Sirupsen/logrus
|
||||||
version: 1deb2db2a6fff8a35532079061b903c3a25eed52
|
version: 4b6ea7319e214d98c938f12692336f7ca9348d6b
|
||||||
- name: github.com/spf13/afero
|
- name: github.com/spf13/afero
|
||||||
version: 9be650865eab0c12963d8753212f4f9c66cdcf12
|
version: 9be650865eab0c12963d8753212f4f9c66cdcf12
|
||||||
subpackages:
|
subpackages:
|
||||||
@ -431,23 +433,23 @@ imports:
|
|||||||
- name: github.com/spf13/cast
|
- name: github.com/spf13/cast
|
||||||
version: ce135a4ebeee6cfe9a26c93ee0d37825f26113c7
|
version: ce135a4ebeee6cfe9a26c93ee0d37825f26113c7
|
||||||
- name: github.com/spf13/cobra
|
- name: github.com/spf13/cobra
|
||||||
version: 16c014f1a19d865b765b420e74508f80eb831ada
|
version: 7c674d9e72017ed25f6d2b5e497a1368086b6a6f
|
||||||
- name: github.com/spf13/jwalterweatherman
|
- name: github.com/spf13/jwalterweatherman
|
||||||
version: fa7ca7e836cf3a8bb4ebf799f472c12d7e903d66
|
version: fa7ca7e836cf3a8bb4ebf799f472c12d7e903d66
|
||||||
- name: github.com/spf13/pflag
|
- name: github.com/spf13/pflag
|
||||||
version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7
|
version: 5ccb023bc27df288a957c5e994cd44fd19619465
|
||||||
- name: github.com/spf13/viper
|
- name: github.com/spf13/viper
|
||||||
version: 7538d73b4eb9511d85a9f1dfef202eeb8ac260f4
|
version: 0b5690fd875739811249ca79d24afd8f89f188c6
|
||||||
- name: github.com/ugorji/go
|
- name: github.com/ugorji/go
|
||||||
version: f4485b318aadd133842532f841dc205a8e339d74
|
version: f4485b318aadd133842532f841dc205a8e339d74
|
||||||
subpackages:
|
subpackages:
|
||||||
- codec
|
- codec
|
||||||
- name: github.com/xeipuuv/gojsonpointer
|
- name: github.com/xeipuuv/gojsonpointer
|
||||||
version: 6fe8760cad3569743d51ddbb243b26f8456742dc
|
version: e0fe6f68307607d540ed8eac07a342c33fa1b54a
|
||||||
- name: github.com/xeipuuv/gojsonreference
|
- name: github.com/xeipuuv/gojsonreference
|
||||||
version: e02fc20de94c78484cd5ffb007f8af96be030a45
|
version: e02fc20de94c78484cd5ffb007f8af96be030a45
|
||||||
- name: github.com/xeipuuv/gojsonschema
|
- name: github.com/xeipuuv/gojsonschema
|
||||||
version: ff0417f4272e480246b4507459b3f6ae721a87ac
|
version: ac452913faa25c08bb78810d3e6f88b8a39f8f25
|
||||||
- name: golang.org/x/net
|
- name: golang.org/x/net
|
||||||
version: e90d6d0afc4c315a0d87a568ae68577cc15149a0
|
version: e90d6d0afc4c315a0d87a568ae68577cc15149a0
|
||||||
subpackages:
|
subpackages:
|
||||||
@ -471,7 +473,7 @@ imports:
|
|||||||
- jws
|
- jws
|
||||||
- jwt
|
- jwt
|
||||||
- name: golang.org/x/sys
|
- name: golang.org/x/sys
|
||||||
version: 99f16d856c9836c42d24e7ab64ea72916925fa97
|
version: 833a04a10549a95dc34458c195cbad61bbb6cb4d
|
||||||
subpackages:
|
subpackages:
|
||||||
- unix
|
- unix
|
||||||
- name: golang.org/x/text
|
- name: golang.org/x/text
|
||||||
@ -513,7 +515,7 @@ imports:
|
|||||||
- name: gopkg.in/inf.v0
|
- name: gopkg.in/inf.v0
|
||||||
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
||||||
- name: gopkg.in/yaml.v2
|
- name: gopkg.in/yaml.v2
|
||||||
version: a3f3340b5840cee44f372bddb5880fcbc419b46a
|
version: a83829b6f1293c91addabc89d0571c246397bbf4
|
||||||
- name: k8s.io/client-go
|
- name: k8s.io/client-go
|
||||||
version: d72c0e162789e1bbb33c33cfa26858a1375efe01
|
version: d72c0e162789e1bbb33c33cfa26858a1375efe01
|
||||||
subpackages:
|
subpackages:
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import:
|
|||||||
- package: github.com/ghodss/yaml
|
- package: github.com/ghodss/yaml
|
||||||
- package: github.com/spf13/cobra
|
- package: github.com/spf13/cobra
|
||||||
- package: github.com/spf13/viper
|
- package: github.com/spf13/viper
|
||||||
|
- package: github.com/pkg/errors
|
||||||
|
|
||||||
- package: github.com/docker/libcompose
|
- package: github.com/docker/libcompose
|
||||||
version: 8e4221d0435d29e6239adf9ccb4de1f0c0ab0935
|
version: 8e4221d0435d29e6239adf9ccb4de1f0c0ab0935
|
||||||
|
|||||||
@ -35,7 +35,6 @@ import (
|
|||||||
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus"
|
|
||||||
"github.com/kubernetes-incubator/kompose/pkg/kobject"
|
"github.com/kubernetes-incubator/kompose/pkg/kobject"
|
||||||
"github.com/kubernetes-incubator/kompose/pkg/loader"
|
"github.com/kubernetes-incubator/kompose/pkg/loader"
|
||||||
"github.com/kubernetes-incubator/kompose/pkg/transformer"
|
"github.com/kubernetes-incubator/kompose/pkg/transformer"
|
||||||
@ -214,7 +213,7 @@ func Convert(opt kobject.ConvertOptions) {
|
|||||||
}
|
}
|
||||||
komposeObject, err = l.LoadFile(opt.InputFiles)
|
komposeObject, err = l.LoadFile(opt.InputFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatalf(err.Error())
|
log.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a transformer that maps komposeObject to provider's primitives
|
// Get a transformer that maps komposeObject to provider's primitives
|
||||||
@ -224,13 +223,13 @@ func Convert(opt kobject.ConvertOptions) {
|
|||||||
objects, err := t.Transform(komposeObject, opt)
|
objects, err := t.Transform(komposeObject, opt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatalf(err.Error())
|
log.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print output
|
// Print output
|
||||||
err = kubernetes.PrintList(objects, opt)
|
err = kubernetes.PrintList(objects, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatalf(err.Error())
|
log.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +249,7 @@ func Up(opt kobject.ConvertOptions) {
|
|||||||
}
|
}
|
||||||
komposeObject, err = l.LoadFile(opt.InputFiles)
|
komposeObject, err = l.LoadFile(opt.InputFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatalf(err.Error())
|
log.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the transformer
|
// Get the transformer
|
||||||
@ -279,7 +278,7 @@ func Down(opt kobject.ConvertOptions) {
|
|||||||
}
|
}
|
||||||
komposeObject, err = l.LoadFile(opt.InputFiles)
|
komposeObject, err = l.LoadFile(opt.InputFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatalf(err.Error())
|
log.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the transformer
|
// Get the transformer
|
||||||
|
|||||||
64
vendor/github.com/Sirupsen/logrus/alt_exit.go
generated
vendored
64
vendor/github.com/Sirupsen/logrus/alt_exit.go
generated
vendored
@ -1,64 +0,0 @@
|
|||||||
package logrus
|
|
||||||
|
|
||||||
// The following code was sourced and modified from the
|
|
||||||
// https://bitbucket.org/tebeka/atexit package governed by the following license:
|
|
||||||
//
|
|
||||||
// Copyright (c) 2012 Miki Tebeka <miki.tebeka@gmail.com>.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
// this software and associated documentation files (the "Software"), to deal in
|
|
||||||
// the Software without restriction, including without limitation the rights to
|
|
||||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
// the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
// subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
var handlers = []func(){}
|
|
||||||
|
|
||||||
func runHandler(handler func()) {
|
|
||||||
defer func() {
|
|
||||||
if err := recover(); err != nil {
|
|
||||||
fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
handler()
|
|
||||||
}
|
|
||||||
|
|
||||||
func runHandlers() {
|
|
||||||
for _, handler := range handlers {
|
|
||||||
runHandler(handler)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code)
|
|
||||||
func Exit(code int) {
|
|
||||||
runHandlers()
|
|
||||||
os.Exit(code)
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke
|
|
||||||
// all handlers. The handlers will also be invoked when any Fatal log entry is
|
|
||||||
// made.
|
|
||||||
//
|
|
||||||
// This method is useful when a caller wishes to use logrus to log a fatal
|
|
||||||
// message but also needs to gracefully shutdown. An example usecase could be
|
|
||||||
// closing database connections, or sending a alert that the application is
|
|
||||||
// closing.
|
|
||||||
func RegisterExitHandler(handler func()) {
|
|
||||||
handlers = append(handlers, handler)
|
|
||||||
}
|
|
||||||
57
vendor/github.com/Sirupsen/logrus/entry.go
generated
vendored
57
vendor/github.com/Sirupsen/logrus/entry.go
generated
vendored
@ -3,21 +3,11 @@ package logrus
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var bufferPool *sync.Pool
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
bufferPool = &sync.Pool{
|
|
||||||
New: func() interface{} {
|
|
||||||
return new(bytes.Buffer)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Defines the key when adding errors using WithError.
|
// Defines the key when adding errors using WithError.
|
||||||
var ErrorKey = "error"
|
var ErrorKey = "error"
|
||||||
|
|
||||||
@ -39,9 +29,6 @@ type Entry struct {
|
|||||||
|
|
||||||
// Message passed to Debug, Info, Warn, Error, Fatal or Panic
|
// Message passed to Debug, Info, Warn, Error, Fatal or Panic
|
||||||
Message string
|
Message string
|
||||||
|
|
||||||
// When formatter is called in entry.log(), an Buffer may be set to entry
|
|
||||||
Buffer *bytes.Buffer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEntry(logger *Logger) *Entry {
|
func NewEntry(logger *Logger) *Entry {
|
||||||
@ -52,15 +39,21 @@ func NewEntry(logger *Logger) *Entry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a reader for the entry, which is a proxy to the formatter.
|
||||||
|
func (entry *Entry) Reader() (*bytes.Buffer, error) {
|
||||||
|
serialized, err := entry.Logger.Formatter.Format(entry)
|
||||||
|
return bytes.NewBuffer(serialized), err
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the string representation from the reader and ultimately the
|
// Returns the string representation from the reader and ultimately the
|
||||||
// formatter.
|
// formatter.
|
||||||
func (entry *Entry) String() (string, error) {
|
func (entry *Entry) String() (string, error) {
|
||||||
serialized, err := entry.Logger.Formatter.Format(entry)
|
reader, err := entry.Reader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
str := string(serialized)
|
|
||||||
return str, nil
|
return reader.String(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an error as single field (using the key defined in ErrorKey) to the Entry.
|
// Add an error as single field (using the key defined in ErrorKey) to the Entry.
|
||||||
@ -88,7 +81,6 @@ func (entry *Entry) WithFields(fields Fields) *Entry {
|
|||||||
// This function is not declared with a pointer value because otherwise
|
// This function is not declared with a pointer value because otherwise
|
||||||
// race conditions will occur when using multiple goroutines
|
// race conditions will occur when using multiple goroutines
|
||||||
func (entry Entry) log(level Level, msg string) {
|
func (entry Entry) log(level Level, msg string) {
|
||||||
var buffer *bytes.Buffer
|
|
||||||
entry.Time = time.Now()
|
entry.Time = time.Now()
|
||||||
entry.Level = level
|
entry.Level = level
|
||||||
entry.Message = msg
|
entry.Message = msg
|
||||||
@ -98,23 +90,20 @@ func (entry Entry) log(level Level, msg string) {
|
|||||||
fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
|
fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
|
||||||
entry.Logger.mu.Unlock()
|
entry.Logger.mu.Unlock()
|
||||||
}
|
}
|
||||||
buffer = bufferPool.Get().(*bytes.Buffer)
|
|
||||||
buffer.Reset()
|
reader, err := entry.Reader()
|
||||||
defer bufferPool.Put(buffer)
|
|
||||||
entry.Buffer = buffer
|
|
||||||
serialized, err := entry.Logger.Formatter.Format(&entry)
|
|
||||||
entry.Buffer = nil
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
entry.Logger.mu.Lock()
|
entry.Logger.mu.Lock()
|
||||||
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
|
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
|
||||||
entry.Logger.mu.Unlock()
|
entry.Logger.mu.Unlock()
|
||||||
} else {
|
}
|
||||||
entry.Logger.mu.Lock()
|
|
||||||
_, err = entry.Logger.Out.Write(serialized)
|
entry.Logger.mu.Lock()
|
||||||
if err != nil {
|
defer entry.Logger.mu.Unlock()
|
||||||
fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
|
|
||||||
}
|
_, err = io.Copy(entry.Logger.Out, reader)
|
||||||
entry.Logger.mu.Unlock()
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// To avoid Entry#log() returning a value that only would make sense for
|
// To avoid Entry#log() returning a value that only would make sense for
|
||||||
@ -161,7 +150,7 @@ func (entry *Entry) Fatal(args ...interface{}) {
|
|||||||
if entry.Logger.Level >= FatalLevel {
|
if entry.Logger.Level >= FatalLevel {
|
||||||
entry.log(FatalLevel, fmt.Sprint(args...))
|
entry.log(FatalLevel, fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (entry *Entry) Panic(args ...interface{}) {
|
func (entry *Entry) Panic(args ...interface{}) {
|
||||||
@ -209,7 +198,7 @@ func (entry *Entry) Fatalf(format string, args ...interface{}) {
|
|||||||
if entry.Logger.Level >= FatalLevel {
|
if entry.Logger.Level >= FatalLevel {
|
||||||
entry.Fatal(fmt.Sprintf(format, args...))
|
entry.Fatal(fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (entry *Entry) Panicf(format string, args ...interface{}) {
|
func (entry *Entry) Panicf(format string, args ...interface{}) {
|
||||||
@ -256,7 +245,7 @@ func (entry *Entry) Fatalln(args ...interface{}) {
|
|||||||
if entry.Logger.Level >= FatalLevel {
|
if entry.Logger.Level >= FatalLevel {
|
||||||
entry.Fatal(entry.sprintlnn(args...))
|
entry.Fatal(entry.sprintlnn(args...))
|
||||||
}
|
}
|
||||||
Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (entry *Entry) Panicln(args ...interface{}) {
|
func (entry *Entry) Panicln(args ...interface{}) {
|
||||||
|
|||||||
15
vendor/github.com/Sirupsen/logrus/formatter.go
generated
vendored
15
vendor/github.com/Sirupsen/logrus/formatter.go
generated
vendored
@ -31,15 +31,18 @@ type Formatter interface {
|
|||||||
// It's not exported because it's still using Data in an opinionated way. It's to
|
// It's not exported because it's still using Data in an opinionated way. It's to
|
||||||
// avoid code duplication between the two default formatters.
|
// avoid code duplication between the two default formatters.
|
||||||
func prefixFieldClashes(data Fields) {
|
func prefixFieldClashes(data Fields) {
|
||||||
if t, ok := data["time"]; ok {
|
_, ok := data["time"]
|
||||||
data["fields.time"] = t
|
if ok {
|
||||||
|
data["fields.time"] = data["time"]
|
||||||
}
|
}
|
||||||
|
|
||||||
if m, ok := data["msg"]; ok {
|
_, ok = data["msg"]
|
||||||
data["fields.msg"] = m
|
if ok {
|
||||||
|
data["fields.msg"] = data["msg"]
|
||||||
}
|
}
|
||||||
|
|
||||||
if l, ok := data["level"]; ok {
|
_, ok = data["level"]
|
||||||
data["fields.level"] = l
|
if ok {
|
||||||
|
data["fields.level"] = data["level"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
39
vendor/github.com/Sirupsen/logrus/json_formatter.go
generated
vendored
39
vendor/github.com/Sirupsen/logrus/json_formatter.go
generated
vendored
@ -5,40 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fieldKey string
|
|
||||||
type FieldMap map[fieldKey]string
|
|
||||||
|
|
||||||
const (
|
|
||||||
FieldKeyMsg = "msg"
|
|
||||||
FieldKeyLevel = "level"
|
|
||||||
FieldKeyTime = "time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (f FieldMap) resolve(key fieldKey) string {
|
|
||||||
if k, ok := f[key]; ok {
|
|
||||||
return k
|
|
||||||
}
|
|
||||||
|
|
||||||
return string(key)
|
|
||||||
}
|
|
||||||
|
|
||||||
type JSONFormatter struct {
|
type JSONFormatter struct {
|
||||||
// TimestampFormat sets the format used for marshaling timestamps.
|
// TimestampFormat sets the format used for marshaling timestamps.
|
||||||
TimestampFormat string
|
TimestampFormat string
|
||||||
|
|
||||||
// DisableTimestamp allows disabling automatic timestamps in output
|
|
||||||
DisableTimestamp bool
|
|
||||||
|
|
||||||
// FieldMap allows users to customize the names of keys for various fields.
|
|
||||||
// As an example:
|
|
||||||
// formatter := &JSONFormatter{
|
|
||||||
// FieldMap: FieldMap{
|
|
||||||
// FieldKeyTime: "@timestamp",
|
|
||||||
// FieldKeyLevel: "@level",
|
|
||||||
// FieldKeyLevel: "@message",
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
FieldMap FieldMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
|
func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
|
||||||
@ -60,11 +29,9 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
|
|||||||
timestampFormat = DefaultTimestampFormat
|
timestampFormat = DefaultTimestampFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
if !f.DisableTimestamp {
|
data["time"] = entry.Time.Format(timestampFormat)
|
||||||
data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat)
|
data["msg"] = entry.Message
|
||||||
}
|
data["level"] = entry.Level.String()
|
||||||
data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message
|
|
||||||
data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String()
|
|
||||||
|
|
||||||
serialized, err := json.Marshal(data)
|
serialized, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
162
vendor/github.com/Sirupsen/logrus/logger.go
generated
vendored
162
vendor/github.com/Sirupsen/logrus/logger.go
generated
vendored
@ -26,31 +26,8 @@ type Logger struct {
|
|||||||
// to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
|
// to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
|
||||||
// logged. `logrus.Debug` is useful in
|
// logged. `logrus.Debug` is useful in
|
||||||
Level Level
|
Level Level
|
||||||
// Used to sync writing to the log. Locking is enabled by Default
|
// Used to sync writing to the log.
|
||||||
mu MutexWrap
|
mu sync.Mutex
|
||||||
// Reusable empty entry
|
|
||||||
entryPool sync.Pool
|
|
||||||
}
|
|
||||||
|
|
||||||
type MutexWrap struct {
|
|
||||||
lock sync.Mutex
|
|
||||||
disabled bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mw *MutexWrap) Lock() {
|
|
||||||
if !mw.disabled {
|
|
||||||
mw.lock.Lock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mw *MutexWrap) Unlock() {
|
|
||||||
if !mw.disabled {
|
|
||||||
mw.lock.Unlock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mw *MutexWrap) Disable() {
|
|
||||||
mw.disabled = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new logger. Configuration should be set by changing `Formatter`,
|
// Creates a new logger. Configuration should be set by changing `Formatter`,
|
||||||
@ -74,235 +51,162 @@ func New() *Logger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) newEntry() *Entry {
|
// Adds a field to the log entry, note that you it doesn't log until you call
|
||||||
entry, ok := logger.entryPool.Get().(*Entry)
|
|
||||||
if ok {
|
|
||||||
return entry
|
|
||||||
}
|
|
||||||
return NewEntry(logger)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (logger *Logger) releaseEntry(entry *Entry) {
|
|
||||||
logger.entryPool.Put(entry)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds a field to the log entry, note that it doesn't log until you call
|
|
||||||
// Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry.
|
// Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry.
|
||||||
// If you want multiple fields, use `WithFields`.
|
// If you want multiple fields, use `WithFields`.
|
||||||
func (logger *Logger) WithField(key string, value interface{}) *Entry {
|
func (logger *Logger) WithField(key string, value interface{}) *Entry {
|
||||||
entry := logger.newEntry()
|
return NewEntry(logger).WithField(key, value)
|
||||||
defer logger.releaseEntry(entry)
|
|
||||||
return entry.WithField(key, value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds a struct of fields to the log entry. All it does is call `WithField` for
|
// Adds a struct of fields to the log entry. All it does is call `WithField` for
|
||||||
// each `Field`.
|
// each `Field`.
|
||||||
func (logger *Logger) WithFields(fields Fields) *Entry {
|
func (logger *Logger) WithFields(fields Fields) *Entry {
|
||||||
entry := logger.newEntry()
|
return NewEntry(logger).WithFields(fields)
|
||||||
defer logger.releaseEntry(entry)
|
|
||||||
return entry.WithFields(fields)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an error as single field to the log entry. All it does is call
|
// Add an error as single field to the log entry. All it does is call
|
||||||
// `WithError` for the given `error`.
|
// `WithError` for the given `error`.
|
||||||
func (logger *Logger) WithError(err error) *Entry {
|
func (logger *Logger) WithError(err error) *Entry {
|
||||||
entry := logger.newEntry()
|
return NewEntry(logger).WithError(err)
|
||||||
defer logger.releaseEntry(entry)
|
|
||||||
return entry.WithError(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Debugf(format string, args ...interface{}) {
|
func (logger *Logger) Debugf(format string, args ...interface{}) {
|
||||||
if logger.Level >= DebugLevel {
|
if logger.Level >= DebugLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Debugf(format, args...)
|
||||||
entry.Debugf(format, args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Infof(format string, args ...interface{}) {
|
func (logger *Logger) Infof(format string, args ...interface{}) {
|
||||||
if logger.Level >= InfoLevel {
|
if logger.Level >= InfoLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Infof(format, args...)
|
||||||
entry.Infof(format, args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Printf(format string, args ...interface{}) {
|
func (logger *Logger) Printf(format string, args ...interface{}) {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Printf(format, args...)
|
||||||
entry.Printf(format, args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Warnf(format string, args ...interface{}) {
|
func (logger *Logger) Warnf(format string, args ...interface{}) {
|
||||||
if logger.Level >= WarnLevel {
|
if logger.Level >= WarnLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Warnf(format, args...)
|
||||||
entry.Warnf(format, args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Warningf(format string, args ...interface{}) {
|
func (logger *Logger) Warningf(format string, args ...interface{}) {
|
||||||
if logger.Level >= WarnLevel {
|
if logger.Level >= WarnLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Warnf(format, args...)
|
||||||
entry.Warnf(format, args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Errorf(format string, args ...interface{}) {
|
func (logger *Logger) Errorf(format string, args ...interface{}) {
|
||||||
if logger.Level >= ErrorLevel {
|
if logger.Level >= ErrorLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Errorf(format, args...)
|
||||||
entry.Errorf(format, args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Fatalf(format string, args ...interface{}) {
|
func (logger *Logger) Fatalf(format string, args ...interface{}) {
|
||||||
if logger.Level >= FatalLevel {
|
if logger.Level >= FatalLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Fatalf(format, args...)
|
||||||
entry.Fatalf(format, args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Panicf(format string, args ...interface{}) {
|
func (logger *Logger) Panicf(format string, args ...interface{}) {
|
||||||
if logger.Level >= PanicLevel {
|
if logger.Level >= PanicLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Panicf(format, args...)
|
||||||
entry.Panicf(format, args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Debug(args ...interface{}) {
|
func (logger *Logger) Debug(args ...interface{}) {
|
||||||
if logger.Level >= DebugLevel {
|
if logger.Level >= DebugLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Debug(args...)
|
||||||
entry.Debug(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Info(args ...interface{}) {
|
func (logger *Logger) Info(args ...interface{}) {
|
||||||
if logger.Level >= InfoLevel {
|
if logger.Level >= InfoLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Info(args...)
|
||||||
entry.Info(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Print(args ...interface{}) {
|
func (logger *Logger) Print(args ...interface{}) {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Info(args...)
|
||||||
entry.Info(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Warn(args ...interface{}) {
|
func (logger *Logger) Warn(args ...interface{}) {
|
||||||
if logger.Level >= WarnLevel {
|
if logger.Level >= WarnLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Warn(args...)
|
||||||
entry.Warn(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Warning(args ...interface{}) {
|
func (logger *Logger) Warning(args ...interface{}) {
|
||||||
if logger.Level >= WarnLevel {
|
if logger.Level >= WarnLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Warn(args...)
|
||||||
entry.Warn(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Error(args ...interface{}) {
|
func (logger *Logger) Error(args ...interface{}) {
|
||||||
if logger.Level >= ErrorLevel {
|
if logger.Level >= ErrorLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Error(args...)
|
||||||
entry.Error(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Fatal(args ...interface{}) {
|
func (logger *Logger) Fatal(args ...interface{}) {
|
||||||
if logger.Level >= FatalLevel {
|
if logger.Level >= FatalLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Fatal(args...)
|
||||||
entry.Fatal(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Panic(args ...interface{}) {
|
func (logger *Logger) Panic(args ...interface{}) {
|
||||||
if logger.Level >= PanicLevel {
|
if logger.Level >= PanicLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Panic(args...)
|
||||||
entry.Panic(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Debugln(args ...interface{}) {
|
func (logger *Logger) Debugln(args ...interface{}) {
|
||||||
if logger.Level >= DebugLevel {
|
if logger.Level >= DebugLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Debugln(args...)
|
||||||
entry.Debugln(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Infoln(args ...interface{}) {
|
func (logger *Logger) Infoln(args ...interface{}) {
|
||||||
if logger.Level >= InfoLevel {
|
if logger.Level >= InfoLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Infoln(args...)
|
||||||
entry.Infoln(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Println(args ...interface{}) {
|
func (logger *Logger) Println(args ...interface{}) {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Println(args...)
|
||||||
entry.Println(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Warnln(args ...interface{}) {
|
func (logger *Logger) Warnln(args ...interface{}) {
|
||||||
if logger.Level >= WarnLevel {
|
if logger.Level >= WarnLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Warnln(args...)
|
||||||
entry.Warnln(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Warningln(args ...interface{}) {
|
func (logger *Logger) Warningln(args ...interface{}) {
|
||||||
if logger.Level >= WarnLevel {
|
if logger.Level >= WarnLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Warnln(args...)
|
||||||
entry.Warnln(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Errorln(args ...interface{}) {
|
func (logger *Logger) Errorln(args ...interface{}) {
|
||||||
if logger.Level >= ErrorLevel {
|
if logger.Level >= ErrorLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Errorln(args...)
|
||||||
entry.Errorln(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Fatalln(args ...interface{}) {
|
func (logger *Logger) Fatalln(args ...interface{}) {
|
||||||
if logger.Level >= FatalLevel {
|
if logger.Level >= FatalLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Fatalln(args...)
|
||||||
entry.Fatalln(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *Logger) Panicln(args ...interface{}) {
|
func (logger *Logger) Panicln(args ...interface{}) {
|
||||||
if logger.Level >= PanicLevel {
|
if logger.Level >= PanicLevel {
|
||||||
entry := logger.newEntry()
|
NewEntry(logger).Panicln(args...)
|
||||||
entry.Panicln(args...)
|
|
||||||
logger.releaseEntry(entry)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//When file is opened with appending mode, it's safe to
|
|
||||||
//write concurrently to a file (within 4k message on Linux).
|
|
||||||
//In these cases user can choose to disable the lock.
|
|
||||||
func (logger *Logger) SetNoLock() {
|
|
||||||
logger.mu.Disable()
|
|
||||||
}
|
|
||||||
|
|||||||
10
vendor/github.com/Sirupsen/logrus/terminal_appengine.go
generated
vendored
10
vendor/github.com/Sirupsen/logrus/terminal_appengine.go
generated
vendored
@ -1,10 +0,0 @@
|
|||||||
// +build appengine
|
|
||||||
|
|
||||||
package logrus
|
|
||||||
|
|
||||||
import "io"
|
|
||||||
|
|
||||||
// IsTerminal returns true if stderr's file descriptor is a terminal.
|
|
||||||
func IsTerminal(f io.Writer) bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
1
vendor/github.com/Sirupsen/logrus/terminal_bsd.go
generated
vendored
1
vendor/github.com/Sirupsen/logrus/terminal_bsd.go
generated
vendored
@ -1,5 +1,4 @@
|
|||||||
// +build darwin freebsd openbsd netbsd dragonfly
|
// +build darwin freebsd openbsd netbsd dragonfly
|
||||||
// +build !appengine
|
|
||||||
|
|
||||||
package logrus
|
package logrus
|
||||||
|
|
||||||
|
|||||||
2
vendor/github.com/Sirupsen/logrus/terminal_linux.go
generated
vendored
2
vendor/github.com/Sirupsen/logrus/terminal_linux.go
generated
vendored
@ -3,8 +3,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !appengine
|
|
||||||
|
|
||||||
package logrus
|
package logrus
|
||||||
|
|
||||||
import "syscall"
|
import "syscall"
|
||||||
|
|||||||
15
vendor/github.com/Sirupsen/logrus/terminal_notwindows.go
generated
vendored
15
vendor/github.com/Sirupsen/logrus/terminal_notwindows.go
generated
vendored
@ -4,25 +4,18 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build linux darwin freebsd openbsd netbsd dragonfly
|
// +build linux darwin freebsd openbsd netbsd dragonfly
|
||||||
// +build !appengine
|
|
||||||
|
|
||||||
package logrus
|
package logrus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsTerminal returns true if stderr's file descriptor is a terminal.
|
// IsTerminal returns true if stderr's file descriptor is a terminal.
|
||||||
func IsTerminal(f io.Writer) bool {
|
func IsTerminal() bool {
|
||||||
|
fd := syscall.Stderr
|
||||||
var termios Termios
|
var termios Termios
|
||||||
switch v := f.(type) {
|
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
|
||||||
case *os.File:
|
return err == 0
|
||||||
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
|
|
||||||
return err == 0
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
14
vendor/github.com/Sirupsen/logrus/terminal_solaris.go
generated
vendored
14
vendor/github.com/Sirupsen/logrus/terminal_solaris.go
generated
vendored
@ -1,21 +1,15 @@
|
|||||||
// +build solaris,!appengine
|
// +build solaris
|
||||||
|
|
||||||
package logrus
|
package logrus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsTerminal returns true if the given file descriptor is a terminal.
|
// IsTerminal returns true if the given file descriptor is a terminal.
|
||||||
func IsTerminal(f io.Writer) bool {
|
func IsTerminal() bool {
|
||||||
switch v := f.(type) {
|
_, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA)
|
||||||
case *os.File:
|
return err == nil
|
||||||
_, err := unix.IoctlGetTermios(int(v.Fd()), unix.TCGETA)
|
|
||||||
return err == nil
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
18
vendor/github.com/Sirupsen/logrus/terminal_windows.go
generated
vendored
18
vendor/github.com/Sirupsen/logrus/terminal_windows.go
generated
vendored
@ -3,13 +3,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build windows,!appengine
|
// +build windows
|
||||||
|
|
||||||
package logrus
|
package logrus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
@ -21,13 +19,9 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// IsTerminal returns true if stderr's file descriptor is a terminal.
|
// IsTerminal returns true if stderr's file descriptor is a terminal.
|
||||||
func IsTerminal(f io.Writer) bool {
|
func IsTerminal() bool {
|
||||||
switch v := f.(type) {
|
fd := syscall.Stderr
|
||||||
case *os.File:
|
var st uint32
|
||||||
var st uint32
|
r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
|
||||||
r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(v.Fd()), uintptr(unsafe.Pointer(&st)), 0)
|
return r != 0 && e == 0
|
||||||
return r != 0 && e == 0
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
76
vendor/github.com/Sirupsen/logrus/text_formatter.go
generated
vendored
76
vendor/github.com/Sirupsen/logrus/text_formatter.go
generated
vendored
@ -3,9 +3,9 @@ package logrus
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,10 +20,16 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
baseTimestamp time.Time
|
baseTimestamp time.Time
|
||||||
|
isTerminal bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
baseTimestamp = time.Now()
|
baseTimestamp = time.Now()
|
||||||
|
isTerminal = IsTerminal()
|
||||||
|
}
|
||||||
|
|
||||||
|
func miniTS() int {
|
||||||
|
return int(time.Since(baseTimestamp) / time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
type TextFormatter struct {
|
type TextFormatter struct {
|
||||||
@ -48,32 +54,10 @@ type TextFormatter struct {
|
|||||||
// that log extremely frequently and don't use the JSON formatter this may not
|
// that log extremely frequently and don't use the JSON formatter this may not
|
||||||
// be desired.
|
// be desired.
|
||||||
DisableSorting bool
|
DisableSorting bool
|
||||||
|
|
||||||
// QuoteEmptyFields will wrap empty fields in quotes if true
|
|
||||||
QuoteEmptyFields bool
|
|
||||||
|
|
||||||
// QuoteCharacter can be set to the override the default quoting character "
|
|
||||||
// with something else. For example: ', or `.
|
|
||||||
QuoteCharacter string
|
|
||||||
|
|
||||||
// Whether the logger's out is to a terminal
|
|
||||||
isTerminal bool
|
|
||||||
|
|
||||||
sync.Once
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *TextFormatter) init(entry *Entry) {
|
|
||||||
if len(f.QuoteCharacter) == 0 {
|
|
||||||
f.QuoteCharacter = "\""
|
|
||||||
}
|
|
||||||
if entry.Logger != nil {
|
|
||||||
f.isTerminal = IsTerminal(entry.Logger.Out)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
|
func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
|
||||||
var b *bytes.Buffer
|
var keys []string = make([]string, 0, len(entry.Data))
|
||||||
keys := make([]string, 0, len(entry.Data))
|
|
||||||
for k := range entry.Data {
|
for k := range entry.Data {
|
||||||
keys = append(keys, k)
|
keys = append(keys, k)
|
||||||
}
|
}
|
||||||
@ -81,17 +65,13 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
|
|||||||
if !f.DisableSorting {
|
if !f.DisableSorting {
|
||||||
sort.Strings(keys)
|
sort.Strings(keys)
|
||||||
}
|
}
|
||||||
if entry.Buffer != nil {
|
|
||||||
b = entry.Buffer
|
b := &bytes.Buffer{}
|
||||||
} else {
|
|
||||||
b = &bytes.Buffer{}
|
|
||||||
}
|
|
||||||
|
|
||||||
prefixFieldClashes(entry.Data)
|
prefixFieldClashes(entry.Data)
|
||||||
|
|
||||||
f.Do(func() { f.init(entry) })
|
isColorTerminal := isTerminal && (runtime.GOOS != "windows")
|
||||||
|
isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors
|
||||||
isColored := (f.ForceColors || f.isTerminal) && !f.DisableColors
|
|
||||||
|
|
||||||
timestampFormat := f.TimestampFormat
|
timestampFormat := f.TimestampFormat
|
||||||
if timestampFormat == "" {
|
if timestampFormat == "" {
|
||||||
@ -131,59 +111,51 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
|
|||||||
|
|
||||||
levelText := strings.ToUpper(entry.Level.String())[0:4]
|
levelText := strings.ToUpper(entry.Level.String())[0:4]
|
||||||
|
|
||||||
if f.DisableTimestamp {
|
if !f.FullTimestamp {
|
||||||
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m %-44s ", levelColor, levelText, entry.Message)
|
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, miniTS(), entry.Message)
|
||||||
} else if !f.FullTimestamp {
|
|
||||||
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), entry.Message)
|
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message)
|
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message)
|
||||||
}
|
}
|
||||||
for _, k := range keys {
|
for _, k := range keys {
|
||||||
v := entry.Data[k]
|
v := entry.Data[k]
|
||||||
fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k)
|
fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=%+v", levelColor, k, v)
|
||||||
f.appendValue(b, v)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *TextFormatter) needsQuoting(text string) bool {
|
func needsQuoting(text string) bool {
|
||||||
if f.QuoteEmptyFields && len(text) == 0 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
for _, ch := range text {
|
for _, ch := range text {
|
||||||
if !((ch >= 'a' && ch <= 'z') ||
|
if !((ch >= 'a' && ch <= 'z') ||
|
||||||
(ch >= 'A' && ch <= 'Z') ||
|
(ch >= 'A' && ch <= 'Z') ||
|
||||||
(ch >= '0' && ch <= '9') ||
|
(ch >= '0' && ch <= '9') ||
|
||||||
ch == '-' || ch == '.') {
|
ch == '-' || ch == '.') {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
|
func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
|
||||||
|
|
||||||
b.WriteString(key)
|
b.WriteString(key)
|
||||||
b.WriteByte('=')
|
b.WriteByte('=')
|
||||||
f.appendValue(b, value)
|
|
||||||
b.WriteByte(' ')
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) {
|
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
if !f.needsQuoting(value) {
|
if needsQuoting(value) {
|
||||||
b.WriteString(value)
|
b.WriteString(value)
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(b, "%s%v%s", f.QuoteCharacter, value, f.QuoteCharacter)
|
fmt.Fprintf(b, "%q", value)
|
||||||
}
|
}
|
||||||
case error:
|
case error:
|
||||||
errmsg := value.Error()
|
errmsg := value.Error()
|
||||||
if !f.needsQuoting(errmsg) {
|
if needsQuoting(errmsg) {
|
||||||
b.WriteString(errmsg)
|
b.WriteString(errmsg)
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(b, "%s%v%s", f.QuoteCharacter, errmsg, f.QuoteCharacter)
|
fmt.Fprintf(b, "%q", value)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
fmt.Fprint(b, value)
|
fmt.Fprint(b, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.WriteByte(' ')
|
||||||
}
|
}
|
||||||
|
|||||||
39
vendor/github.com/Sirupsen/logrus/writer.go
generated
vendored
39
vendor/github.com/Sirupsen/logrus/writer.go
generated
vendored
@ -7,52 +7,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (logger *Logger) Writer() *io.PipeWriter {
|
func (logger *Logger) Writer() *io.PipeWriter {
|
||||||
return logger.WriterLevel(InfoLevel)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
|
|
||||||
return NewEntry(logger).WriterLevel(level)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (entry *Entry) Writer() *io.PipeWriter {
|
|
||||||
return entry.WriterLevel(InfoLevel)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
|
|
||||||
reader, writer := io.Pipe()
|
reader, writer := io.Pipe()
|
||||||
|
|
||||||
var printFunc func(args ...interface{})
|
go logger.writerScanner(reader)
|
||||||
|
|
||||||
switch level {
|
|
||||||
case DebugLevel:
|
|
||||||
printFunc = entry.Debug
|
|
||||||
case InfoLevel:
|
|
||||||
printFunc = entry.Info
|
|
||||||
case WarnLevel:
|
|
||||||
printFunc = entry.Warn
|
|
||||||
case ErrorLevel:
|
|
||||||
printFunc = entry.Error
|
|
||||||
case FatalLevel:
|
|
||||||
printFunc = entry.Fatal
|
|
||||||
case PanicLevel:
|
|
||||||
printFunc = entry.Panic
|
|
||||||
default:
|
|
||||||
printFunc = entry.Print
|
|
||||||
}
|
|
||||||
|
|
||||||
go entry.writerScanner(reader, printFunc)
|
|
||||||
runtime.SetFinalizer(writer, writerFinalizer)
|
runtime.SetFinalizer(writer, writerFinalizer)
|
||||||
|
|
||||||
return writer
|
return writer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
|
func (logger *Logger) writerScanner(reader *io.PipeReader) {
|
||||||
scanner := bufio.NewScanner(reader)
|
scanner := bufio.NewScanner(reader)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
printFunc(scanner.Text())
|
logger.Print(scanner.Text())
|
||||||
}
|
}
|
||||||
if err := scanner.Err(); err != nil {
|
if err := scanner.Err(); err != nil {
|
||||||
entry.Errorf("Error while reading from Writer: %s", err)
|
logger.Errorf("Error while reading from Writer: %s", err)
|
||||||
}
|
}
|
||||||
reader.Close()
|
reader.Close()
|
||||||
}
|
}
|
||||||
|
|||||||
24
vendor/github.com/fatih/structs/structs.go
generated
vendored
24
vendor/github.com/fatih/structs/structs.go
generated
vendored
@ -431,7 +431,7 @@ func strctVal(s interface{}) reflect.Value {
|
|||||||
v := reflect.ValueOf(s)
|
v := reflect.ValueOf(s)
|
||||||
|
|
||||||
// if pointer get the underlying element≤
|
// if pointer get the underlying element≤
|
||||||
for v.Kind() == reflect.Ptr {
|
if v.Kind() == reflect.Ptr {
|
||||||
v = v.Elem()
|
v = v.Elem()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,22 +530,15 @@ func (s *Struct) nested(val reflect.Value) interface{} {
|
|||||||
finalVal = m
|
finalVal = m
|
||||||
}
|
}
|
||||||
case reflect.Map:
|
case reflect.Map:
|
||||||
// get the element type of the map
|
v := val.Type().Elem()
|
||||||
mapElem := val.Type()
|
if v.Kind() == reflect.Ptr {
|
||||||
switch val.Type().Kind() {
|
v = v.Elem()
|
||||||
case reflect.Ptr, reflect.Array, reflect.Map,
|
|
||||||
reflect.Slice, reflect.Chan:
|
|
||||||
mapElem = val.Type().Elem()
|
|
||||||
if mapElem.Kind() == reflect.Ptr {
|
|
||||||
mapElem = mapElem.Elem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// only iterate over struct types, ie: map[string]StructType,
|
// only iterate over struct types, ie: map[string]StructType,
|
||||||
// map[string][]StructType,
|
// map[string][]StructType,
|
||||||
if mapElem.Kind() == reflect.Struct ||
|
if v.Kind() == reflect.Struct ||
|
||||||
(mapElem.Kind() == reflect.Slice &&
|
(v.Kind() == reflect.Slice && v.Elem().Kind() == reflect.Struct) {
|
||||||
mapElem.Elem().Kind() == reflect.Struct) {
|
|
||||||
m := make(map[string]interface{}, val.Len())
|
m := make(map[string]interface{}, val.Len())
|
||||||
for _, k := range val.MapKeys() {
|
for _, k := range val.MapKeys() {
|
||||||
m[k.String()] = s.nested(val.MapIndex(k))
|
m[k.String()] = s.nested(val.MapIndex(k))
|
||||||
@ -565,10 +558,7 @@ func (s *Struct) nested(val reflect.Value) interface{} {
|
|||||||
// TODO(arslan): should this be optional?
|
// TODO(arslan): should this be optional?
|
||||||
// do not iterate of non struct types, just pass the value. Ie: []int,
|
// do not iterate of non struct types, just pass the value. Ie: []int,
|
||||||
// []string, co... We only iterate further if it's a struct.
|
// []string, co... We only iterate further if it's a struct.
|
||||||
// i.e []foo or []*foo
|
if val.Type().Elem().Kind() != reflect.Struct {
|
||||||
if val.Type().Elem().Kind() != reflect.Struct &&
|
|
||||||
!(val.Type().Elem().Kind() == reflect.Ptr &&
|
|
||||||
val.Type().Elem().Elem().Kind() == reflect.Struct) {
|
|
||||||
finalVal = val.Interface()
|
finalVal = val.Interface()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
8
vendor/github.com/pelletier/go-toml/toml.go
generated
vendored
8
vendor/github.com/pelletier/go-toml/toml.go
generated
vendored
@ -28,10 +28,12 @@ func newTomlTree() *TomlTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TreeFromMap initializes a new TomlTree object using the given map.
|
// TreeFromMap initializes a new TomlTree object using the given map.
|
||||||
func TreeFromMap(m map[string]interface{}) *TomlTree {
|
func TreeFromMap(m map[string]interface{}) (*TomlTree, error) {
|
||||||
return &TomlTree{
|
result, err := toTree(m)
|
||||||
values: m,
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
return result.(*TomlTree), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has returns a boolean indicating if the given key exists.
|
// Has returns a boolean indicating if the given key exists.
|
||||||
|
|||||||
129
vendor/github.com/pelletier/go-toml/tomltree_create.go
generated
vendored
Normal file
129
vendor/github.com/pelletier/go-toml/tomltree_create.go
generated
vendored
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
package toml
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// supported values:
|
||||||
|
// string, bool, int64, uint64, float64, time.Time, int, int8, int16, int32, uint, uint8, uint16, uint32, float32
|
||||||
|
|
||||||
|
var kindToTypeMapping = map[reflect.Kind]reflect.Type{
|
||||||
|
reflect.Bool: reflect.TypeOf(true),
|
||||||
|
reflect.String: reflect.TypeOf(""),
|
||||||
|
reflect.Float32: reflect.TypeOf(float64(1)),
|
||||||
|
reflect.Float64: reflect.TypeOf(float64(1)),
|
||||||
|
reflect.Int: reflect.TypeOf(int64(1)),
|
||||||
|
reflect.Int8: reflect.TypeOf(int64(1)),
|
||||||
|
reflect.Int16: reflect.TypeOf(int64(1)),
|
||||||
|
reflect.Int32: reflect.TypeOf(int64(1)),
|
||||||
|
reflect.Int64: reflect.TypeOf(int64(1)),
|
||||||
|
reflect.Uint: reflect.TypeOf(uint64(1)),
|
||||||
|
reflect.Uint8: reflect.TypeOf(uint64(1)),
|
||||||
|
reflect.Uint16: reflect.TypeOf(uint64(1)),
|
||||||
|
reflect.Uint32: reflect.TypeOf(uint64(1)),
|
||||||
|
reflect.Uint64: reflect.TypeOf(uint64(1)),
|
||||||
|
}
|
||||||
|
|
||||||
|
func simpleValueCoercion(object interface{}) (interface{}, error) {
|
||||||
|
switch original := object.(type) {
|
||||||
|
case string, bool, int64, uint64, float64, time.Time:
|
||||||
|
return original, nil
|
||||||
|
case int:
|
||||||
|
return int64(original), nil
|
||||||
|
case int8:
|
||||||
|
return int64(original), nil
|
||||||
|
case int16:
|
||||||
|
return int64(original), nil
|
||||||
|
case int32:
|
||||||
|
return int64(original), nil
|
||||||
|
case uint:
|
||||||
|
return uint64(original), nil
|
||||||
|
case uint8:
|
||||||
|
return uint64(original), nil
|
||||||
|
case uint16:
|
||||||
|
return uint64(original), nil
|
||||||
|
case uint32:
|
||||||
|
return uint64(original), nil
|
||||||
|
case float32:
|
||||||
|
return float64(original), nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("cannot convert type %T to TomlTree", object)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func sliceToTree(object interface{}) (interface{}, error) {
|
||||||
|
// arrays are a bit tricky, since they can represent either a
|
||||||
|
// collection of simple values, which is represented by one
|
||||||
|
// *tomlValue, or an array of tables, which is represented by an
|
||||||
|
// array of *TomlTree.
|
||||||
|
|
||||||
|
// holding the assumption that this function is called from toTree only when value.Kind() is Array or Slice
|
||||||
|
value := reflect.ValueOf(object)
|
||||||
|
insideType := value.Type().Elem()
|
||||||
|
length := value.Len()
|
||||||
|
if insideType.Kind() == reflect.Map {
|
||||||
|
// this is considered as an array of tables
|
||||||
|
tablesArray := make([]*TomlTree, 0, length)
|
||||||
|
for i := 0; i < length; i++ {
|
||||||
|
table := value.Index(i)
|
||||||
|
tree, err := toTree(table.Interface())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tablesArray = append(tablesArray, tree.(*TomlTree))
|
||||||
|
}
|
||||||
|
return tablesArray, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
sliceType := kindToTypeMapping[insideType.Kind()]
|
||||||
|
if sliceType == nil {
|
||||||
|
sliceType = insideType
|
||||||
|
}
|
||||||
|
|
||||||
|
arrayValue := reflect.MakeSlice(reflect.SliceOf(sliceType), 0, length)
|
||||||
|
|
||||||
|
for i := 0; i < length; i++ {
|
||||||
|
val := value.Index(i).Interface()
|
||||||
|
simpleValue, err := simpleValueCoercion(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
arrayValue = reflect.Append(arrayValue, reflect.ValueOf(simpleValue))
|
||||||
|
}
|
||||||
|
return &tomlValue{arrayValue.Interface(), Position{}}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func toTree(object interface{}) (interface{}, error) {
|
||||||
|
value := reflect.ValueOf(object)
|
||||||
|
|
||||||
|
if value.Kind() == reflect.Map {
|
||||||
|
values := map[string]interface{}{}
|
||||||
|
keys := value.MapKeys()
|
||||||
|
for _, key := range keys {
|
||||||
|
k, ok := key.Interface().(string)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("map key needs to be a string, not %T", key.Interface())
|
||||||
|
}
|
||||||
|
|
||||||
|
v := value.MapIndex(key)
|
||||||
|
newValue, err := toTree(v.Interface())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
values[k] = newValue
|
||||||
|
}
|
||||||
|
return &TomlTree{values, Position{}}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if value.Kind() == reflect.Array || value.Kind() == reflect.Slice {
|
||||||
|
return sliceToTree(object)
|
||||||
|
}
|
||||||
|
|
||||||
|
simpleValue, err := simpleValueCoercion(object)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &tomlValue{simpleValue, Position{}}, nil
|
||||||
|
}
|
||||||
5
vendor/github.com/pelletier/go-toml/tomltree_write.go
generated
vendored
5
vendor/github.com/pelletier/go-toml/tomltree_write.go
generated
vendored
@ -95,7 +95,7 @@ func (t *TomlTree) writeTo(w io.Writer, indent, keyspace string, bytesCount int6
|
|||||||
for _, k := range simpleValuesKeys {
|
for _, k := range simpleValuesKeys {
|
||||||
v, ok := t.values[k].(*tomlValue)
|
v, ok := t.values[k].(*tomlValue)
|
||||||
if !ok {
|
if !ok {
|
||||||
return bytesCount, fmt.Errorf("invalid key type at %s: %T", k, t.values[k])
|
return bytesCount, fmt.Errorf("invalid value type at %s: %T", k, t.values[k])
|
||||||
}
|
}
|
||||||
|
|
||||||
repr, err := tomlValueStringRepresentation(v.value)
|
repr, err := tomlValueStringRepresentation(v.value)
|
||||||
@ -201,9 +201,6 @@ func (t *TomlTree) ToMap() map[string]interface{} {
|
|||||||
result[k] = array
|
result[k] = array
|
||||||
case *TomlTree:
|
case *TomlTree:
|
||||||
result[k] = node.ToMap()
|
result[k] = node.ToMap()
|
||||||
case map[string]interface{}:
|
|
||||||
sub := TreeFromMap(node)
|
|
||||||
result[k] = sub.ToMap()
|
|
||||||
case *tomlValue:
|
case *tomlValue:
|
||||||
result[k] = node.value
|
result[k] = node.value
|
||||||
}
|
}
|
||||||
|
|||||||
23
vendor/github.com/pkg/errors/LICENSE
generated
vendored
Normal file
23
vendor/github.com/pkg/errors/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Copyright (c) 2015, Dave Cheney <dave@cheney.net>
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
269
vendor/github.com/pkg/errors/errors.go
generated
vendored
Normal file
269
vendor/github.com/pkg/errors/errors.go
generated
vendored
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
// Package errors provides simple error handling primitives.
|
||||||
|
//
|
||||||
|
// The traditional error handling idiom in Go is roughly akin to
|
||||||
|
//
|
||||||
|
// if err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// Adding context to an error
|
||||||
|
//
|
||||||
|
// The errors.Wrap function returns a new error that adds context to the
|
||||||
|
// original error by recording a stack trace at the point Wrap is called,
|
||||||
|
// and the supplied message. For example
|
||||||
|
//
|
||||||
|
// _, err := ioutil.ReadAll(r)
|
||||||
|
// if err != nil {
|
||||||
|
// return errors.Wrap(err, "read failed")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// If additional control is required the errors.WithStack and errors.WithMessage
|
||||||
|
// functions destructure errors.Wrap into its component operations of annotating
|
||||||
|
// an error with a stack trace and an a message, respectively.
|
||||||
|
//
|
||||||
|
// Retrieving the cause of an error
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// type causer interface {
|
||||||
|
// Cause() error
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// can be inspected by errors.Cause. errors.Cause will recursively retrieve
|
||||||
|
// the topmost error which does not implement causer, which is assumed to be
|
||||||
|
// the original cause. For example:
|
||||||
|
//
|
||||||
|
// switch err := errors.Cause(err).(type) {
|
||||||
|
// case *MyError:
|
||||||
|
// // handle specifically
|
||||||
|
// default:
|
||||||
|
// // unknown error
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// causer interface is not exported by this package, but is considered a part
|
||||||
|
// of stable public API.
|
||||||
|
//
|
||||||
|
// Formatted printing of errors
|
||||||
|
//
|
||||||
|
// All error values returned from this package implement fmt.Formatter and can
|
||||||
|
// be formatted by the fmt package. The following verbs are supported
|
||||||
|
//
|
||||||
|
// %s print the error. If the error has a Cause it will be
|
||||||
|
// printed recursively
|
||||||
|
// %v see %s
|
||||||
|
// %+v extended format. Each Frame of the error's StackTrace will
|
||||||
|
// be printed in detail.
|
||||||
|
//
|
||||||
|
// Retrieving the stack trace of an error or wrapper
|
||||||
|
//
|
||||||
|
// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are
|
||||||
|
// invoked. This information can be retrieved with the following interface.
|
||||||
|
//
|
||||||
|
// type stackTracer interface {
|
||||||
|
// StackTrace() errors.StackTrace
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Where errors.StackTrace is defined as
|
||||||
|
//
|
||||||
|
// type StackTrace []Frame
|
||||||
|
//
|
||||||
|
// The Frame type represents a call site in the stack trace. Frame supports
|
||||||
|
// the fmt.Formatter interface that can be used for printing information about
|
||||||
|
// the stack trace of this error. For example:
|
||||||
|
//
|
||||||
|
// if err, ok := err.(stackTracer); ok {
|
||||||
|
// for _, f := range err.StackTrace() {
|
||||||
|
// fmt.Printf("%+s:%d", f)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// stackTracer interface is not exported by this package, but is considered a part
|
||||||
|
// of stable public API.
|
||||||
|
//
|
||||||
|
// See the documentation for Frame.Format for more details.
|
||||||
|
package errors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
// New returns an error with the supplied message.
|
||||||
|
// New also records the stack trace at the point it was called.
|
||||||
|
func New(message string) error {
|
||||||
|
return &fundamental{
|
||||||
|
msg: message,
|
||||||
|
stack: callers(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Errorf formats according to a format specifier and returns the string
|
||||||
|
// as a value that satisfies error.
|
||||||
|
// Errorf also records the stack trace at the point it was called.
|
||||||
|
func Errorf(format string, args ...interface{}) error {
|
||||||
|
return &fundamental{
|
||||||
|
msg: fmt.Sprintf(format, args...),
|
||||||
|
stack: callers(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fundamental is an error that has a message and a stack, but no caller.
|
||||||
|
type fundamental struct {
|
||||||
|
msg string
|
||||||
|
*stack
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *fundamental) Error() string { return f.msg }
|
||||||
|
|
||||||
|
func (f *fundamental) Format(s fmt.State, verb rune) {
|
||||||
|
switch verb {
|
||||||
|
case 'v':
|
||||||
|
if s.Flag('+') {
|
||||||
|
io.WriteString(s, f.msg)
|
||||||
|
f.stack.Format(s, verb)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
|
case 's':
|
||||||
|
io.WriteString(s, f.msg)
|
||||||
|
case 'q':
|
||||||
|
fmt.Fprintf(s, "%q", f.msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStack annotates err with a stack trace at the point WithStack was called.
|
||||||
|
// If err is nil, WithStack returns nil.
|
||||||
|
func WithStack(err error) error {
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &withStack{
|
||||||
|
err,
|
||||||
|
callers(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withStack struct {
|
||||||
|
error
|
||||||
|
*stack
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *withStack) Cause() error { return w.error }
|
||||||
|
|
||||||
|
func (w *withStack) Format(s fmt.State, verb rune) {
|
||||||
|
switch verb {
|
||||||
|
case 'v':
|
||||||
|
if s.Flag('+') {
|
||||||
|
fmt.Fprintf(s, "%+v", w.Cause())
|
||||||
|
w.stack.Format(s, verb)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
|
case 's':
|
||||||
|
io.WriteString(s, w.Error())
|
||||||
|
case 'q':
|
||||||
|
fmt.Fprintf(s, "%q", w.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrap returns an error annotating err with a stack trace
|
||||||
|
// at the point Wrap is called, and the supplied message.
|
||||||
|
// If err is nil, Wrap returns nil.
|
||||||
|
func Wrap(err error, message string) error {
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
err = &withMessage{
|
||||||
|
cause: err,
|
||||||
|
msg: message,
|
||||||
|
}
|
||||||
|
return &withStack{
|
||||||
|
err,
|
||||||
|
callers(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapf returns an error annotating err with a stack trace
|
||||||
|
// at the point Wrapf is call, and the format specifier.
|
||||||
|
// If err is nil, Wrapf returns nil.
|
||||||
|
func Wrapf(err error, format string, args ...interface{}) error {
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
err = &withMessage{
|
||||||
|
cause: err,
|
||||||
|
msg: fmt.Sprintf(format, args...),
|
||||||
|
}
|
||||||
|
return &withStack{
|
||||||
|
err,
|
||||||
|
callers(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithMessage annotates err with a new message.
|
||||||
|
// If err is nil, WithMessage returns nil.
|
||||||
|
func WithMessage(err error, message string) error {
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &withMessage{
|
||||||
|
cause: err,
|
||||||
|
msg: message,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMessage struct {
|
||||||
|
cause error
|
||||||
|
msg string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() }
|
||||||
|
func (w *withMessage) Cause() error { return w.cause }
|
||||||
|
|
||||||
|
func (w *withMessage) Format(s fmt.State, verb rune) {
|
||||||
|
switch verb {
|
||||||
|
case 'v':
|
||||||
|
if s.Flag('+') {
|
||||||
|
fmt.Fprintf(s, "%+v\n", w.Cause())
|
||||||
|
io.WriteString(s, w.msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
|
case 's', 'q':
|
||||||
|
io.WriteString(s, w.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cause returns the underlying cause of the error, if possible.
|
||||||
|
// An error value has a cause if it implements the following
|
||||||
|
// interface:
|
||||||
|
//
|
||||||
|
// type causer interface {
|
||||||
|
// Cause() error
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// If the error does not implement Cause, the original error will
|
||||||
|
// be returned. If the error is nil, nil will be returned without further
|
||||||
|
// investigation.
|
||||||
|
func Cause(err error) error {
|
||||||
|
type causer interface {
|
||||||
|
Cause() error
|
||||||
|
}
|
||||||
|
|
||||||
|
for err != nil {
|
||||||
|
cause, ok := err.(causer)
|
||||||
|
if !ok {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
err = cause.Cause()
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
178
vendor/github.com/pkg/errors/stack.go
generated
vendored
Normal file
178
vendor/github.com/pkg/errors/stack.go
generated
vendored
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
package errors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"path"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Frame represents a program counter inside a stack frame.
|
||||||
|
type Frame uintptr
|
||||||
|
|
||||||
|
// pc returns the program counter for this frame;
|
||||||
|
// multiple frames may have the same PC value.
|
||||||
|
func (f Frame) pc() uintptr { return uintptr(f) - 1 }
|
||||||
|
|
||||||
|
// file returns the full path to the file that contains the
|
||||||
|
// function for this Frame's pc.
|
||||||
|
func (f Frame) file() string {
|
||||||
|
fn := runtime.FuncForPC(f.pc())
|
||||||
|
if fn == nil {
|
||||||
|
return "unknown"
|
||||||
|
}
|
||||||
|
file, _ := fn.FileLine(f.pc())
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
|
||||||
|
// line returns the line number of source code of the
|
||||||
|
// function for this Frame's pc.
|
||||||
|
func (f Frame) line() int {
|
||||||
|
fn := runtime.FuncForPC(f.pc())
|
||||||
|
if fn == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
_, line := fn.FileLine(f.pc())
|
||||||
|
return line
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format formats the frame according to the fmt.Formatter interface.
|
||||||
|
//
|
||||||
|
// %s source file
|
||||||
|
// %d source line
|
||||||
|
// %n function name
|
||||||
|
// %v equivalent to %s:%d
|
||||||
|
//
|
||||||
|
// Format accepts flags that alter the printing of some verbs, as follows:
|
||||||
|
//
|
||||||
|
// %+s path of source file relative to the compile time GOPATH
|
||||||
|
// %+v equivalent to %+s:%d
|
||||||
|
func (f Frame) Format(s fmt.State, verb rune) {
|
||||||
|
switch verb {
|
||||||
|
case 's':
|
||||||
|
switch {
|
||||||
|
case s.Flag('+'):
|
||||||
|
pc := f.pc()
|
||||||
|
fn := runtime.FuncForPC(pc)
|
||||||
|
if fn == nil {
|
||||||
|
io.WriteString(s, "unknown")
|
||||||
|
} else {
|
||||||
|
file, _ := fn.FileLine(pc)
|
||||||
|
fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
io.WriteString(s, path.Base(f.file()))
|
||||||
|
}
|
||||||
|
case 'd':
|
||||||
|
fmt.Fprintf(s, "%d", f.line())
|
||||||
|
case 'n':
|
||||||
|
name := runtime.FuncForPC(f.pc()).Name()
|
||||||
|
io.WriteString(s, funcname(name))
|
||||||
|
case 'v':
|
||||||
|
f.Format(s, 's')
|
||||||
|
io.WriteString(s, ":")
|
||||||
|
f.Format(s, 'd')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
|
||||||
|
type StackTrace []Frame
|
||||||
|
|
||||||
|
func (st StackTrace) Format(s fmt.State, verb rune) {
|
||||||
|
switch verb {
|
||||||
|
case 'v':
|
||||||
|
switch {
|
||||||
|
case s.Flag('+'):
|
||||||
|
for _, f := range st {
|
||||||
|
fmt.Fprintf(s, "\n%+v", f)
|
||||||
|
}
|
||||||
|
case s.Flag('#'):
|
||||||
|
fmt.Fprintf(s, "%#v", []Frame(st))
|
||||||
|
default:
|
||||||
|
fmt.Fprintf(s, "%v", []Frame(st))
|
||||||
|
}
|
||||||
|
case 's':
|
||||||
|
fmt.Fprintf(s, "%s", []Frame(st))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// stack represents a stack of program counters.
|
||||||
|
type stack []uintptr
|
||||||
|
|
||||||
|
func (s *stack) Format(st fmt.State, verb rune) {
|
||||||
|
switch verb {
|
||||||
|
case 'v':
|
||||||
|
switch {
|
||||||
|
case st.Flag('+'):
|
||||||
|
for _, pc := range *s {
|
||||||
|
f := Frame(pc)
|
||||||
|
fmt.Fprintf(st, "\n%+v", f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stack) StackTrace() StackTrace {
|
||||||
|
f := make([]Frame, len(*s))
|
||||||
|
for i := 0; i < len(f); i++ {
|
||||||
|
f[i] = Frame((*s)[i])
|
||||||
|
}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
func callers() *stack {
|
||||||
|
const depth = 32
|
||||||
|
var pcs [depth]uintptr
|
||||||
|
n := runtime.Callers(3, pcs[:])
|
||||||
|
var st stack = pcs[0:n]
|
||||||
|
return &st
|
||||||
|
}
|
||||||
|
|
||||||
|
// funcname removes the path prefix component of a function's name reported by func.Name().
|
||||||
|
func funcname(name string) string {
|
||||||
|
i := strings.LastIndex(name, "/")
|
||||||
|
name = name[i+1:]
|
||||||
|
i = strings.Index(name, ".")
|
||||||
|
return name[i+1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
func trimGOPATH(name, file string) string {
|
||||||
|
// Here we want to get the source file path relative to the compile time
|
||||||
|
// GOPATH. As of Go 1.6.x there is no direct way to know the compiled
|
||||||
|
// GOPATH at runtime, but we can infer the number of path segments in the
|
||||||
|
// GOPATH. We note that fn.Name() returns the function name qualified by
|
||||||
|
// the import path, which does not include the GOPATH. Thus we can trim
|
||||||
|
// segments from the beginning of the file path until the number of path
|
||||||
|
// separators remaining is one more than the number of path separators in
|
||||||
|
// the function name. For example, given:
|
||||||
|
//
|
||||||
|
// GOPATH /home/user
|
||||||
|
// file /home/user/src/pkg/sub/file.go
|
||||||
|
// fn.Name() pkg/sub.Type.Method
|
||||||
|
//
|
||||||
|
// We want to produce:
|
||||||
|
//
|
||||||
|
// pkg/sub/file.go
|
||||||
|
//
|
||||||
|
// From this we can easily see that fn.Name() has one less path separator
|
||||||
|
// than our desired output. We count separators from the end of the file
|
||||||
|
// path until it finds two more than in the function name and then move
|
||||||
|
// one character forward to preserve the initial path segment without a
|
||||||
|
// leading separator.
|
||||||
|
const sep = "/"
|
||||||
|
goal := strings.Count(name, sep) + 2
|
||||||
|
i := len(file)
|
||||||
|
for n := 0; n < goal; n++ {
|
||||||
|
i = strings.LastIndex(file[:i], sep)
|
||||||
|
if i == -1 {
|
||||||
|
// not enough separators found, set i so that the slice expression
|
||||||
|
// below leaves file unmodified
|
||||||
|
i = -len(sep)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// get back to 0 or trim the leading separator
|
||||||
|
file = file[i+len(sep):]
|
||||||
|
return file
|
||||||
|
}
|
||||||
16
vendor/github.com/spf13/cobra/bash_completions.go
generated
vendored
16
vendor/github.com/spf13/cobra/bash_completions.go
generated
vendored
@ -10,9 +10,8 @@ import (
|
|||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Annotations for Bash completion.
|
|
||||||
const (
|
const (
|
||||||
BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extensions"
|
BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extentions"
|
||||||
BashCompCustom = "cobra_annotation_bash_completion_custom"
|
BashCompCustom = "cobra_annotation_bash_completion_custom"
|
||||||
BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag"
|
BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag"
|
||||||
BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir"
|
BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir"
|
||||||
@ -23,7 +22,7 @@ func preamble(out io.Writer, name string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
preamStr := `
|
_, err = fmt.Fprint(out, `
|
||||||
__debug()
|
__debug()
|
||||||
{
|
{
|
||||||
if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
|
if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
|
||||||
@ -247,8 +246,7 @@ __handle_word()
|
|||||||
__handle_word
|
__handle_word
|
||||||
}
|
}
|
||||||
|
|
||||||
`
|
`)
|
||||||
_, err = fmt.Fprint(out, preamStr)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,8 +401,10 @@ func writeLocalNonPersistentFlag(flag *pflag.Flag, w io.Writer) error {
|
|||||||
format += "="
|
format += "="
|
||||||
}
|
}
|
||||||
format += "\")\n"
|
format += "\")\n"
|
||||||
_, err := fmt.Fprintf(w, format, name)
|
if _, err := fmt.Fprintf(w, format, name); err != nil {
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeFlags(cmd *Command, w io.Writer) error {
|
func writeFlags(cmd *Command, w io.Writer) error {
|
||||||
@ -568,7 +568,6 @@ func gen(cmd *Command, w io.Writer) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenBashCompletion generates bash completion file and writes to the passed writer.
|
|
||||||
func (cmd *Command) GenBashCompletion(w io.Writer) error {
|
func (cmd *Command) GenBashCompletion(w io.Writer) error {
|
||||||
if err := preamble(w, cmd.Name()); err != nil {
|
if err := preamble(w, cmd.Name()); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -588,7 +587,6 @@ func nonCompletableFlag(flag *pflag.Flag) bool {
|
|||||||
return flag.Hidden || len(flag.Deprecated) > 0
|
return flag.Hidden || len(flag.Deprecated) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenBashCompletionFile generates bash completion file.
|
|
||||||
func (cmd *Command) GenBashCompletionFile(filename string) error {
|
func (cmd *Command) GenBashCompletionFile(filename string) error {
|
||||||
outFile, err := os.Create(filename)
|
outFile, err := os.Create(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
37
vendor/github.com/spf13/cobra/cobra.go
generated
vendored
37
vendor/github.com/spf13/cobra/cobra.go
generated
vendored
@ -37,37 +37,38 @@ var templateFuncs = template.FuncMap{
|
|||||||
|
|
||||||
var initializers []func()
|
var initializers []func()
|
||||||
|
|
||||||
// EnablePrefixMatching allows to set automatic prefix matching. Automatic prefix matching can be a dangerous thing
|
// automatic prefix matching can be a dangerous thing to automatically enable in CLI tools.
|
||||||
// to automatically enable in CLI tools.
|
// Set this to true to enable it
|
||||||
// Set this to true to enable it.
|
|
||||||
var EnablePrefixMatching = false
|
var EnablePrefixMatching = false
|
||||||
|
|
||||||
// EnableCommandSorting controls sorting of the slice of commands, which is turned on by default.
|
//EnableCommandSorting controls sorting of the slice of commands, which is turned on by default.
|
||||||
// To disable sorting, set it to false.
|
//To disable sorting, set it to false.
|
||||||
var EnableCommandSorting = true
|
var EnableCommandSorting = true
|
||||||
|
|
||||||
// AddTemplateFunc adds a template function that's available to Usage and Help
|
//AddTemplateFunc adds a template function that's available to Usage and Help
|
||||||
// template generation.
|
//template generation.
|
||||||
func AddTemplateFunc(name string, tmplFunc interface{}) {
|
func AddTemplateFunc(name string, tmplFunc interface{}) {
|
||||||
templateFuncs[name] = tmplFunc
|
templateFuncs[name] = tmplFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTemplateFuncs adds multiple template functions availalble to Usage and
|
//AddTemplateFuncs adds multiple template functions availalble to Usage and
|
||||||
// Help template generation.
|
//Help template generation.
|
||||||
func AddTemplateFuncs(tmplFuncs template.FuncMap) {
|
func AddTemplateFuncs(tmplFuncs template.FuncMap) {
|
||||||
for k, v := range tmplFuncs {
|
for k, v := range tmplFuncs {
|
||||||
templateFuncs[k] = v
|
templateFuncs[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnInitialize takes a series of func() arguments and appends them to a slice of func().
|
//OnInitialize takes a series of func() arguments and appends them to a slice of func().
|
||||||
func OnInitialize(y ...func()) {
|
func OnInitialize(y ...func()) {
|
||||||
initializers = append(initializers, y...)
|
for _, x := range y {
|
||||||
|
initializers = append(initializers, x)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans,
|
//Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans,
|
||||||
// Maps and Slices, Gt will compare their lengths. Ints are compared directly while strings are first parsed as
|
//Maps and Slices, Gt will compare their lengths. Ints are compared directly while strings are first parsed as
|
||||||
// ints and then compared.
|
//ints and then compared.
|
||||||
func Gt(a interface{}, b interface{}) bool {
|
func Gt(a interface{}, b interface{}) bool {
|
||||||
var left, right int64
|
var left, right int64
|
||||||
av := reflect.ValueOf(a)
|
av := reflect.ValueOf(a)
|
||||||
@ -95,7 +96,7 @@ func Gt(a interface{}, b interface{}) bool {
|
|||||||
return left > right
|
return left > right
|
||||||
}
|
}
|
||||||
|
|
||||||
// Eq takes two types and checks whether they are equal. Supported types are int and string. Unsupported types will panic.
|
//Eq takes two types and checks whether they are equal. Supported types are int and string. Unsupported types will panic.
|
||||||
func Eq(a interface{}, b interface{}) bool {
|
func Eq(a interface{}, b interface{}) bool {
|
||||||
av := reflect.ValueOf(a)
|
av := reflect.ValueOf(a)
|
||||||
bv := reflect.ValueOf(b)
|
bv := reflect.ValueOf(b)
|
||||||
@ -115,7 +116,7 @@ func trimRightSpace(s string) string {
|
|||||||
return strings.TrimRightFunc(s, unicode.IsSpace)
|
return strings.TrimRightFunc(s, unicode.IsSpace)
|
||||||
}
|
}
|
||||||
|
|
||||||
// appendIfNotPresent will append stringToAppend to the end of s, but only if it's not yet present in s.
|
// appendIfNotPresent will append stringToAppend to the end of s, but only if it's not yet present in s
|
||||||
func appendIfNotPresent(s, stringToAppend string) string {
|
func appendIfNotPresent(s, stringToAppend string) string {
|
||||||
if strings.Contains(s, stringToAppend) {
|
if strings.Contains(s, stringToAppend) {
|
||||||
return s
|
return s
|
||||||
@ -123,7 +124,7 @@ func appendIfNotPresent(s, stringToAppend string) string {
|
|||||||
return s + " " + stringToAppend
|
return s + " " + stringToAppend
|
||||||
}
|
}
|
||||||
|
|
||||||
// rpad adds padding to the right of a string.
|
//rpad adds padding to the right of a string
|
||||||
func rpad(s string, padding int) string {
|
func rpad(s string, padding int) string {
|
||||||
template := fmt.Sprintf("%%-%ds", padding)
|
template := fmt.Sprintf("%%-%ds", padding)
|
||||||
return fmt.Sprintf(template, s)
|
return fmt.Sprintf(template, s)
|
||||||
@ -137,7 +138,7 @@ func tmpl(w io.Writer, text string, data interface{}) error {
|
|||||||
return t.Execute(w, data)
|
return t.Execute(w, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ld compares two strings and returns the levenshtein distance between them.
|
// ld compares two strings and returns the levenshtein distance between them
|
||||||
func ld(s, t string, ignoreCase bool) int {
|
func ld(s, t string, ignoreCase bool) int {
|
||||||
if ignoreCase {
|
if ignoreCase {
|
||||||
s = strings.ToLower(s)
|
s = strings.ToLower(s)
|
||||||
|
|||||||
237
vendor/github.com/spf13/cobra/command.go
generated
vendored
237
vendor/github.com/spf13/cobra/command.go
generated
vendored
@ -57,9 +57,6 @@ type Command struct {
|
|||||||
Deprecated string
|
Deprecated string
|
||||||
// Is this command hidden and should NOT show up in the list of available commands?
|
// Is this command hidden and should NOT show up in the list of available commands?
|
||||||
Hidden bool
|
Hidden bool
|
||||||
// Annotations are key/value pairs that can be used by applications to identify or
|
|
||||||
// group commands
|
|
||||||
Annotations map[string]string
|
|
||||||
// Full set of flags
|
// Full set of flags
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
// Set of flags childrens of this command will inherit
|
// Set of flags childrens of this command will inherit
|
||||||
@ -112,11 +109,10 @@ type Command struct {
|
|||||||
|
|
||||||
flagErrorBuf *bytes.Buffer
|
flagErrorBuf *bytes.Buffer
|
||||||
|
|
||||||
args []string // actual args parsed from flags
|
args []string // actual args parsed from flags
|
||||||
output *io.Writer // out writer if set in SetOutput(w)
|
output *io.Writer // out writer if set in SetOutput(w)
|
||||||
usageFunc func(*Command) error // Usage can be defined by application
|
usageFunc func(*Command) error // Usage can be defined by application
|
||||||
usageTemplate string // Can be defined by Application
|
usageTemplate string // Can be defined by Application
|
||||||
flagErrorFunc func(*Command, error) error
|
|
||||||
helpTemplate string // Can be defined by Application
|
helpTemplate string // Can be defined by Application
|
||||||
helpFunc func(*Command, []string) // Help can be defined by application
|
helpFunc func(*Command, []string) // Help can be defined by application
|
||||||
helpCommand *Command // The help command
|
helpCommand *Command // The help command
|
||||||
@ -132,7 +128,7 @@ type Command struct {
|
|||||||
DisableFlagParsing bool
|
DisableFlagParsing bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
|
// os.Args[1:] by default, if desired, can be overridden
|
||||||
// particularly useful when testing.
|
// particularly useful when testing.
|
||||||
func (c *Command) SetArgs(a []string) {
|
func (c *Command) SetArgs(a []string) {
|
||||||
c.args = a
|
c.args = a
|
||||||
@ -144,33 +140,26 @@ func (c *Command) SetOutput(output io.Writer) {
|
|||||||
c.output = &output
|
c.output = &output
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetUsageFunc sets usage function. Usage can be defined by application.
|
// Usage can be defined by application
|
||||||
func (c *Command) SetUsageFunc(f func(*Command) error) {
|
func (c *Command) SetUsageFunc(f func(*Command) error) {
|
||||||
c.usageFunc = f
|
c.usageFunc = f
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetUsageTemplate sets usage template. Can be defined by Application.
|
// Can be defined by Application
|
||||||
func (c *Command) SetUsageTemplate(s string) {
|
func (c *Command) SetUsageTemplate(s string) {
|
||||||
c.usageTemplate = s
|
c.usageTemplate = s
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetFlagErrorFunc sets a function to generate an error when flag parsing
|
// Can be defined by Application
|
||||||
// fails.
|
|
||||||
func (c *Command) SetFlagErrorFunc(f func(*Command, error) error) {
|
|
||||||
c.flagErrorFunc = f
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetHelpFunc sets help function. Can be defined by Application.
|
|
||||||
func (c *Command) SetHelpFunc(f func(*Command, []string)) {
|
func (c *Command) SetHelpFunc(f func(*Command, []string)) {
|
||||||
c.helpFunc = f
|
c.helpFunc = f
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHelpCommand sets help command.
|
|
||||||
func (c *Command) SetHelpCommand(cmd *Command) {
|
func (c *Command) SetHelpCommand(cmd *Command) {
|
||||||
c.helpCommand = cmd
|
c.helpCommand = cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHelpTemplate sets help template to be used. Application can use it to set custom template.
|
// Can be defined by Application
|
||||||
func (c *Command) SetHelpTemplate(s string) {
|
func (c *Command) SetHelpTemplate(s string) {
|
||||||
c.helpTemplate = s
|
c.helpTemplate = s
|
||||||
}
|
}
|
||||||
@ -187,12 +176,10 @@ func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// OutOrStdout returns output to stdout.
|
|
||||||
func (c *Command) OutOrStdout() io.Writer {
|
func (c *Command) OutOrStdout() io.Writer {
|
||||||
return c.getOut(os.Stdout)
|
return c.getOut(os.Stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OutOrStderr returns output to stderr
|
|
||||||
func (c *Command) OutOrStderr() io.Writer {
|
func (c *Command) OutOrStderr() io.Writer {
|
||||||
return c.getOut(os.Stderr)
|
return c.getOut(os.Stderr)
|
||||||
}
|
}
|
||||||
@ -208,7 +195,7 @@ func (c *Command) getOut(def io.Writer) io.Writer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UsageFunc returns either the function set by SetUsageFunc for this command
|
// UsageFunc returns either the function set by SetUsageFunc for this command
|
||||||
// or a parent, or it returns a default usage function.
|
// or a parent, or it returns a default usage function
|
||||||
func (c *Command) UsageFunc() (f func(*Command) error) {
|
func (c *Command) UsageFunc() (f func(*Command) error) {
|
||||||
if c.usageFunc != nil {
|
if c.usageFunc != nil {
|
||||||
return c.usageFunc
|
return c.usageFunc
|
||||||
@ -227,18 +214,22 @@ func (c *Command) UsageFunc() (f func(*Command) error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Usage puts out the usage for the command.
|
// Output the usage for the command
|
||||||
// Used when a user provides invalid input.
|
// Used when a user provides invalid input
|
||||||
// Can be defined by user by overriding UsageFunc.
|
// Can be defined by user by overriding UsageFunc
|
||||||
func (c *Command) Usage() error {
|
func (c *Command) Usage() error {
|
||||||
return c.UsageFunc()(c)
|
return c.UsageFunc()(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelpFunc returns either the function set by SetHelpFunc for this command
|
// HelpFunc returns either the function set by SetHelpFunc for this command
|
||||||
// or a parent, or it returns a function with default help behavior.
|
// or a parent, or it returns a function with default help behavior
|
||||||
func (c *Command) HelpFunc() func(*Command, []string) {
|
func (c *Command) HelpFunc() func(*Command, []string) {
|
||||||
if helpFunc := c.checkHelpFunc(); helpFunc != nil {
|
cmd := c
|
||||||
return helpFunc
|
for cmd != nil {
|
||||||
|
if cmd.helpFunc != nil {
|
||||||
|
return cmd.helpFunc
|
||||||
|
}
|
||||||
|
cmd = cmd.parent
|
||||||
}
|
}
|
||||||
return func(*Command, []string) {
|
return func(*Command, []string) {
|
||||||
c.mergePersistentFlags()
|
c.mergePersistentFlags()
|
||||||
@ -249,29 +240,14 @@ func (c *Command) HelpFunc() func(*Command, []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkHelpFunc checks if there is helpFunc in ancestors of c.
|
// Output the help for the command
|
||||||
func (c *Command) checkHelpFunc() func(*Command, []string) {
|
// Used when a user calls help [command]
|
||||||
if c == nil {
|
// Can be defined by user by overriding HelpFunc
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if c.helpFunc != nil {
|
|
||||||
return c.helpFunc
|
|
||||||
}
|
|
||||||
if c.HasParent() {
|
|
||||||
return c.parent.checkHelpFunc()
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Help puts out the help for the command.
|
|
||||||
// Used when a user calls help [command].
|
|
||||||
// Can be defined by user by overriding HelpFunc.
|
|
||||||
func (c *Command) Help() error {
|
func (c *Command) Help() error {
|
||||||
c.HelpFunc()(c, []string{})
|
c.HelpFunc()(c, []string{})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UsageString return usage string.
|
|
||||||
func (c *Command) UsageString() string {
|
func (c *Command) UsageString() string {
|
||||||
tmpOutput := c.output
|
tmpOutput := c.output
|
||||||
bb := new(bytes.Buffer)
|
bb := new(bytes.Buffer)
|
||||||
@ -281,25 +257,8 @@ func (c *Command) UsageString() string {
|
|||||||
return bb.String()
|
return bb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlagErrorFunc returns either the function set by SetFlagErrorFunc for this
|
|
||||||
// command or a parent, or it returns a function which returns the original
|
|
||||||
// error.
|
|
||||||
func (c *Command) FlagErrorFunc() (f func(*Command, error) error) {
|
|
||||||
if c.flagErrorFunc != nil {
|
|
||||||
return c.flagErrorFunc
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.HasParent() {
|
|
||||||
return c.parent.FlagErrorFunc()
|
|
||||||
}
|
|
||||||
return func(c *Command, err error) error {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var minUsagePadding = 25
|
var minUsagePadding = 25
|
||||||
|
|
||||||
// UsagePadding return padding for the usage.
|
|
||||||
func (c *Command) UsagePadding() int {
|
func (c *Command) UsagePadding() int {
|
||||||
if c.parent == nil || minUsagePadding > c.parent.commandsMaxUseLen {
|
if c.parent == nil || minUsagePadding > c.parent.commandsMaxUseLen {
|
||||||
return minUsagePadding
|
return minUsagePadding
|
||||||
@ -309,7 +268,7 @@ func (c *Command) UsagePadding() int {
|
|||||||
|
|
||||||
var minCommandPathPadding = 11
|
var minCommandPathPadding = 11
|
||||||
|
|
||||||
// CommandPathPadding return padding for the command path.
|
//
|
||||||
func (c *Command) CommandPathPadding() int {
|
func (c *Command) CommandPathPadding() int {
|
||||||
if c.parent == nil || minCommandPathPadding > c.parent.commandsMaxCommandPathLen {
|
if c.parent == nil || minCommandPathPadding > c.parent.commandsMaxCommandPathLen {
|
||||||
return minCommandPathPadding
|
return minCommandPathPadding
|
||||||
@ -319,7 +278,6 @@ func (c *Command) CommandPathPadding() int {
|
|||||||
|
|
||||||
var minNamePadding = 11
|
var minNamePadding = 11
|
||||||
|
|
||||||
// NamePadding returns padding for the name.
|
|
||||||
func (c *Command) NamePadding() int {
|
func (c *Command) NamePadding() int {
|
||||||
if c.parent == nil || minNamePadding > c.parent.commandsMaxNameLen {
|
if c.parent == nil || minNamePadding > c.parent.commandsMaxNameLen {
|
||||||
return minNamePadding
|
return minNamePadding
|
||||||
@ -327,7 +285,6 @@ func (c *Command) NamePadding() int {
|
|||||||
return c.parent.commandsMaxNameLen
|
return c.parent.commandsMaxNameLen
|
||||||
}
|
}
|
||||||
|
|
||||||
// UsageTemplate returns usage template for the command.
|
|
||||||
func (c *Command) UsageTemplate() string {
|
func (c *Command) UsageTemplate() string {
|
||||||
if c.usageTemplate != "" {
|
if c.usageTemplate != "" {
|
||||||
return c.usageTemplate
|
return c.usageTemplate
|
||||||
@ -345,25 +302,24 @@ Aliases:
|
|||||||
{{end}}{{if .HasExample}}
|
{{end}}{{if .HasExample}}
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
{{ .Example }}{{end}}{{if .HasAvailableSubCommands}}
|
{{ .Example }}{{end}}{{ if .HasAvailableSubCommands}}
|
||||||
|
|
||||||
Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
|
Available Commands:{{range .Commands}}{{if .IsAvailableCommand}}
|
||||||
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
|
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasAvailableLocalFlags}}
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
{{.LocalFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasAvailableInheritedFlags}}
|
{{.LocalFlags.FlagUsages | trimRightSpace}}{{end}}{{ if .HasAvailableInheritedFlags}}
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
{{.InheritedFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasHelpSubCommands}}
|
{{.InheritedFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasHelpSubCommands}}
|
||||||
|
|
||||||
Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
|
Additional help topics:{{range .Commands}}{{if .IsHelpCommand}}
|
||||||
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}
|
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasAvailableSubCommands }}
|
||||||
|
|
||||||
Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
|
Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelpTemplate return help template for the command.
|
|
||||||
func (c *Command) HelpTemplate() string {
|
func (c *Command) HelpTemplate() string {
|
||||||
if c.helpTemplate != "" {
|
if c.helpTemplate != "" {
|
||||||
return c.helpTemplate
|
return c.helpTemplate
|
||||||
@ -377,25 +333,27 @@ func (c *Command) HelpTemplate() string {
|
|||||||
{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
|
{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Really only used when casting a command to a commander.
|
// Really only used when casting a command to a commander
|
||||||
func (c *Command) resetChildrensParents() {
|
func (c *Command) resetChildrensParents() {
|
||||||
for _, x := range c.commands {
|
for _, x := range c.commands {
|
||||||
x.parent = c
|
x.parent = c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func hasNoOptDefVal(name string, f *flag.FlagSet) bool {
|
// Test if the named flag is a boolean flag.
|
||||||
|
func isBooleanFlag(name string, f *flag.FlagSet) bool {
|
||||||
flag := f.Lookup(name)
|
flag := f.Lookup(name)
|
||||||
if flag == nil {
|
if flag == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return len(flag.NoOptDefVal) > 0
|
return flag.Value.Type() == "bool"
|
||||||
}
|
}
|
||||||
|
|
||||||
func shortHasNoOptDefVal(name string, fs *flag.FlagSet) bool {
|
// Test if the named flag is a boolean flag.
|
||||||
|
func isBooleanShortFlag(name string, f *flag.FlagSet) bool {
|
||||||
result := false
|
result := false
|
||||||
fs.VisitAll(func(flag *flag.Flag) {
|
f.VisitAll(func(f *flag.Flag) {
|
||||||
if flag.Shorthand == name && len(flag.NoOptDefVal) > 0 {
|
if f.Shorthand == name && f.Value.Type() == "bool" {
|
||||||
result = true
|
result = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -421,13 +379,13 @@ func stripFlags(args []string, c *Command) []string {
|
|||||||
inQuote = true
|
inQuote = true
|
||||||
case strings.HasPrefix(y, "--") && !strings.Contains(y, "="):
|
case strings.HasPrefix(y, "--") && !strings.Contains(y, "="):
|
||||||
// TODO: this isn't quite right, we should really check ahead for 'true' or 'false'
|
// TODO: this isn't quite right, we should really check ahead for 'true' or 'false'
|
||||||
inFlag = !hasNoOptDefVal(y[2:], c.Flags())
|
inFlag = !isBooleanFlag(y[2:], c.Flags())
|
||||||
case strings.HasPrefix(y, "-") && !strings.Contains(y, "=") && len(y) == 2 && !shortHasNoOptDefVal(y[1:], c.Flags()):
|
case strings.HasPrefix(y, "-") && !strings.Contains(y, "=") && len(y) == 2 && !isBooleanShortFlag(y[1:], c.Flags()):
|
||||||
inFlag = true
|
inFlag = true
|
||||||
case inFlag:
|
case inFlag:
|
||||||
inFlag = false
|
inFlag = false
|
||||||
case y == "":
|
case y == "":
|
||||||
// strip empty commands, as the go tests expect this to be ok....
|
// strip empty commands, as the go tests expect this to be ok....
|
||||||
case !strings.HasPrefix(y, "-"):
|
case !strings.HasPrefix(y, "-"):
|
||||||
commands = append(commands, y)
|
commands = append(commands, y)
|
||||||
inFlag = false
|
inFlag = false
|
||||||
@ -456,7 +414,7 @@ func argsMinusFirstX(args []string, x string) []string {
|
|||||||
return args
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the target command given the args and command tree
|
// find the target command given the args and command tree
|
||||||
// Meant to be run on the highest node. Only searches down.
|
// Meant to be run on the highest node. Only searches down.
|
||||||
func (c *Command) Find(args []string) (*Command, []string, error) {
|
func (c *Command) Find(args []string) (*Command, []string, error) {
|
||||||
if c == nil {
|
if c == nil {
|
||||||
@ -524,7 +482,6 @@ func (c *Command) Find(args []string) (*Command, []string, error) {
|
|||||||
return commandFound, a, nil
|
return commandFound, a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SuggestionsFor provides suggestions for the typedName.
|
|
||||||
func (c *Command) SuggestionsFor(typedName string) []string {
|
func (c *Command) SuggestionsFor(typedName string) []string {
|
||||||
suggestions := []string{}
|
suggestions := []string{}
|
||||||
for _, cmd := range c.commands {
|
for _, cmd := range c.commands {
|
||||||
@ -545,7 +502,6 @@ func (c *Command) SuggestionsFor(typedName string) []string {
|
|||||||
return suggestions
|
return suggestions
|
||||||
}
|
}
|
||||||
|
|
||||||
// VisitParents visits all parents of the command and invokes fn on each parent.
|
|
||||||
func (c *Command) VisitParents(fn func(*Command)) {
|
func (c *Command) VisitParents(fn func(*Command)) {
|
||||||
var traverse func(*Command) *Command
|
var traverse func(*Command) *Command
|
||||||
|
|
||||||
@ -561,7 +517,6 @@ func (c *Command) VisitParents(fn func(*Command)) {
|
|||||||
traverse(c)
|
traverse(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Root finds root command.
|
|
||||||
func (c *Command) Root() *Command {
|
func (c *Command) Root() *Command {
|
||||||
var findRoot func(*Command) *Command
|
var findRoot func(*Command) *Command
|
||||||
|
|
||||||
@ -598,7 +553,7 @@ func (c *Command) execute(a []string) (err error) {
|
|||||||
|
|
||||||
err = c.ParseFlags(a)
|
err = c.ParseFlags(a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return c.FlagErrorFunc()(c, err)
|
return err
|
||||||
}
|
}
|
||||||
// If help is called, regardless of other flags, return we want help
|
// If help is called, regardless of other flags, return we want help
|
||||||
// Also say we need help if the command isn't runnable.
|
// Also say we need help if the command isn't runnable.
|
||||||
@ -686,7 +641,7 @@ func (c *Command) errorMsgFromParse() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute Call execute to use the args (os.Args[1:] by default)
|
// Call execute to use the args (os.Args[1:] by default)
|
||||||
// and run through the command tree finding appropriate matches
|
// and run through the command tree finding appropriate matches
|
||||||
// for commands and then corresponding flags.
|
// for commands and then corresponding flags.
|
||||||
func (c *Command) Execute() error {
|
func (c *Command) Execute() error {
|
||||||
@ -694,8 +649,8 @@ func (c *Command) Execute() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecuteC executes the command.
|
|
||||||
func (c *Command) ExecuteC() (cmd *Command, err error) {
|
func (c *Command) ExecuteC() (cmd *Command, err error) {
|
||||||
|
|
||||||
// Regardless of what command execute is called on, run on Root only
|
// Regardless of what command execute is called on, run on Root only
|
||||||
if c.HasParent() {
|
if c.HasParent() {
|
||||||
return c.Root().ExecuteC()
|
return c.Root().ExecuteC()
|
||||||
@ -757,7 +712,6 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Command) initHelpFlag() {
|
func (c *Command) initHelpFlag() {
|
||||||
c.mergePersistentFlags()
|
|
||||||
if c.Flags().Lookup("help") == nil {
|
if c.Flags().Lookup("help") == nil {
|
||||||
c.Flags().BoolP("help", "h", false, "help for "+c.Name())
|
c.Flags().BoolP("help", "h", false, "help for "+c.Name())
|
||||||
}
|
}
|
||||||
@ -780,7 +734,7 @@ func (c *Command) initHelpCmd() {
|
|||||||
Run: func(c *Command, args []string) {
|
Run: func(c *Command, args []string) {
|
||||||
cmd, _, e := c.Root().Find(args)
|
cmd, _, e := c.Root().Find(args)
|
||||||
if cmd == nil || e != nil {
|
if cmd == nil || e != nil {
|
||||||
c.Printf("Unknown help topic %#q\n", args)
|
c.Printf("Unknown help topic %#q.", args)
|
||||||
c.Root().Usage()
|
c.Root().Usage()
|
||||||
} else {
|
} else {
|
||||||
cmd.Help()
|
cmd.Help()
|
||||||
@ -791,13 +745,13 @@ func (c *Command) initHelpCmd() {
|
|||||||
c.AddCommand(c.helpCommand)
|
c.AddCommand(c.helpCommand)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetCommands used for testing.
|
// Used for testing
|
||||||
func (c *Command) ResetCommands() {
|
func (c *Command) ResetCommands() {
|
||||||
c.commands = nil
|
c.commands = nil
|
||||||
c.helpCommand = nil
|
c.helpCommand = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sorts commands by their names.
|
// Sorts commands by their names
|
||||||
type commandSorterByName []*Command
|
type commandSorterByName []*Command
|
||||||
|
|
||||||
func (c commandSorterByName) Len() int { return len(c) }
|
func (c commandSorterByName) Len() int { return len(c) }
|
||||||
@ -877,18 +831,18 @@ main:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print is a convenience method to Print to the defined output, fallback to Stderr if not set.
|
// Print is a convenience method to Print to the defined output, fallback to Stderr if not set
|
||||||
func (c *Command) Print(i ...interface{}) {
|
func (c *Command) Print(i ...interface{}) {
|
||||||
fmt.Fprint(c.OutOrStderr(), i...)
|
fmt.Fprint(c.OutOrStderr(), i...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Println is a convenience method to Println to the defined output, fallback to Stderr if not set.
|
// Println is a convenience method to Println to the defined output, fallback to Stderr if not set
|
||||||
func (c *Command) Println(i ...interface{}) {
|
func (c *Command) Println(i ...interface{}) {
|
||||||
str := fmt.Sprintln(i...)
|
str := fmt.Sprintln(i...)
|
||||||
c.Print(str)
|
c.Print(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set.
|
// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set
|
||||||
func (c *Command) Printf(format string, i ...interface{}) {
|
func (c *Command) Printf(format string, i ...interface{}) {
|
||||||
str := fmt.Sprintf(format, i...)
|
str := fmt.Sprintf(format, i...)
|
||||||
c.Print(str)
|
c.Print(str)
|
||||||
@ -905,7 +859,7 @@ func (c *Command) CommandPath() string {
|
|||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
// UseLine puts out the full usage for a given command (including parents).
|
//The full usage for a given command (including parents)
|
||||||
func (c *Command) UseLine() string {
|
func (c *Command) UseLine() string {
|
||||||
str := ""
|
str := ""
|
||||||
if c.HasParent() {
|
if c.HasParent() {
|
||||||
@ -914,8 +868,8 @@ func (c *Command) UseLine() string {
|
|||||||
return str + c.Use
|
return str + c.Use
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugFlags used to determine which flags have been assigned to which commands
|
// For use in determining which flags have been assigned to which commands
|
||||||
// and which persist.
|
// and which persist
|
||||||
func (c *Command) DebugFlags() {
|
func (c *Command) DebugFlags() {
|
||||||
c.Println("DebugFlags called on", c.Name())
|
c.Println("DebugFlags called on", c.Name())
|
||||||
var debugflags func(*Command)
|
var debugflags func(*Command)
|
||||||
@ -969,8 +923,7 @@ func (c *Command) Name() string {
|
|||||||
if i >= 0 {
|
if i >= 0 {
|
||||||
name = name[:i]
|
name = name[:i]
|
||||||
}
|
}
|
||||||
c.name = name
|
return name
|
||||||
return c.name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasAlias determines if a given string is an alias of the command.
|
// HasAlias determines if a given string is an alias of the command.
|
||||||
@ -983,28 +936,26 @@ func (c *Command) HasAlias(s string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// NameAndAliases returns string containing name and all aliases
|
|
||||||
func (c *Command) NameAndAliases() string {
|
func (c *Command) NameAndAliases() string {
|
||||||
return strings.Join(append([]string{c.Name()}, c.Aliases...), ", ")
|
return strings.Join(append([]string{c.Name()}, c.Aliases...), ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasExample determines if the command has example.
|
|
||||||
func (c *Command) HasExample() bool {
|
func (c *Command) HasExample() bool {
|
||||||
return len(c.Example) > 0
|
return len(c.Example) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runnable determines if the command is itself runnable.
|
// Runnable determines if the command is itself runnable
|
||||||
func (c *Command) Runnable() bool {
|
func (c *Command) Runnable() bool {
|
||||||
return c.Run != nil || c.RunE != nil
|
return c.Run != nil || c.RunE != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasSubCommands determines if the command has children commands.
|
// HasSubCommands determines if the command has children commands
|
||||||
func (c *Command) HasSubCommands() bool {
|
func (c *Command) HasSubCommands() bool {
|
||||||
return len(c.commands) > 0
|
return len(c.commands) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsAvailableCommand determines if a command is available as a non-help command
|
// IsAvailableCommand determines if a command is available as a non-help command
|
||||||
// (this includes all non deprecated/hidden commands).
|
// (this includes all non deprecated/hidden commands)
|
||||||
func (c *Command) IsAvailableCommand() bool {
|
func (c *Command) IsAvailableCommand() bool {
|
||||||
if len(c.Deprecated) != 0 || c.Hidden {
|
if len(c.Deprecated) != 0 || c.Hidden {
|
||||||
return false
|
return false
|
||||||
@ -1021,12 +972,11 @@ func (c *Command) IsAvailableCommand() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsAdditionalHelpTopicCommand determines if a command is an additional
|
// IsHelpCommand determines if a command is a 'help' command; a help command is
|
||||||
// help topic command; additional help topic command is determined by the
|
// determined by the fact that it is NOT runnable/hidden/deprecated, and has no
|
||||||
// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that
|
// sub commands that are runnable/hidden/deprecated
|
||||||
// are runnable/hidden/deprecated.
|
func (c *Command) IsHelpCommand() bool {
|
||||||
// Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924.
|
|
||||||
func (c *Command) IsAdditionalHelpTopicCommand() bool {
|
|
||||||
// if a command is runnable, deprecated, or hidden it is not a 'help' command
|
// if a command is runnable, deprecated, or hidden it is not a 'help' command
|
||||||
if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
|
if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
|
||||||
return false
|
return false
|
||||||
@ -1034,7 +984,7 @@ func (c *Command) IsAdditionalHelpTopicCommand() bool {
|
|||||||
|
|
||||||
// if any non-help sub commands are found, the command is not a 'help' command
|
// if any non-help sub commands are found, the command is not a 'help' command
|
||||||
for _, sub := range c.commands {
|
for _, sub := range c.commands {
|
||||||
if !sub.IsAdditionalHelpTopicCommand() {
|
if !sub.IsHelpCommand() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1043,13 +993,14 @@ func (c *Command) IsAdditionalHelpTopicCommand() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasHelpSubCommands determines if a command has any available 'help' sub commands
|
// HasHelpSubCommands determines if a command has any avilable 'help' sub commands
|
||||||
// that need to be shown in the usage/help default template under 'additional help
|
// that need to be shown in the usage/help default template under 'additional help
|
||||||
// topics'.
|
// topics'
|
||||||
func (c *Command) HasHelpSubCommands() bool {
|
func (c *Command) HasHelpSubCommands() bool {
|
||||||
|
|
||||||
// return true on the first found available 'help' sub command
|
// return true on the first found available 'help' sub command
|
||||||
for _, sub := range c.commands {
|
for _, sub := range c.commands {
|
||||||
if sub.IsAdditionalHelpTopicCommand() {
|
if sub.IsHelpCommand() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1059,8 +1010,9 @@ func (c *Command) HasHelpSubCommands() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HasAvailableSubCommands determines if a command has available sub commands that
|
// HasAvailableSubCommands determines if a command has available sub commands that
|
||||||
// need to be shown in the usage/help default template under 'available commands'.
|
// need to be shown in the usage/help default template under 'available commands'
|
||||||
func (c *Command) HasAvailableSubCommands() bool {
|
func (c *Command) HasAvailableSubCommands() bool {
|
||||||
|
|
||||||
// return true on the first found available (non deprecated/help/hidden)
|
// return true on the first found available (non deprecated/help/hidden)
|
||||||
// sub command
|
// sub command
|
||||||
for _, sub := range c.commands {
|
for _, sub := range c.commands {
|
||||||
@ -1074,18 +1026,17 @@ func (c *Command) HasAvailableSubCommands() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasParent determines if the command is a child command.
|
// Determine if the command is a child command
|
||||||
func (c *Command) HasParent() bool {
|
func (c *Command) HasParent() bool {
|
||||||
return c.parent != nil
|
return c.parent != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GlobalNormalizationFunc returns the global normalization function or nil if doesn't exists.
|
// GlobalNormalizationFunc returns the global normalization function or nil if doesn't exists
|
||||||
func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName {
|
func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName {
|
||||||
return c.globNormFunc
|
return c.globNormFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flags returns the complete FlagSet that applies
|
// Get the complete FlagSet that applies to this command (local and persistent declared here and by all parents)
|
||||||
// to this command (local and persistent declared here and by all parents).
|
|
||||||
func (c *Command) Flags() *flag.FlagSet {
|
func (c *Command) Flags() *flag.FlagSet {
|
||||||
if c.flags == nil {
|
if c.flags == nil {
|
||||||
c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
||||||
@ -1097,7 +1048,7 @@ func (c *Command) Flags() *flag.FlagSet {
|
|||||||
return c.flags
|
return c.flags
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands.
|
// LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands
|
||||||
func (c *Command) LocalNonPersistentFlags() *flag.FlagSet {
|
func (c *Command) LocalNonPersistentFlags() *flag.FlagSet {
|
||||||
persistentFlags := c.PersistentFlags()
|
persistentFlags := c.PersistentFlags()
|
||||||
|
|
||||||
@ -1110,7 +1061,7 @@ func (c *Command) LocalNonPersistentFlags() *flag.FlagSet {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocalFlags returns the local FlagSet specifically set in the current command.
|
// Get the local FlagSet specifically set in the current command
|
||||||
func (c *Command) LocalFlags() *flag.FlagSet {
|
func (c *Command) LocalFlags() *flag.FlagSet {
|
||||||
c.mergePersistentFlags()
|
c.mergePersistentFlags()
|
||||||
|
|
||||||
@ -1128,7 +1079,7 @@ func (c *Command) LocalFlags() *flag.FlagSet {
|
|||||||
return local
|
return local
|
||||||
}
|
}
|
||||||
|
|
||||||
// InheritedFlags returns all flags which were inherited from parents commands.
|
// All Flags which were inherited from parents commands
|
||||||
func (c *Command) InheritedFlags() *flag.FlagSet {
|
func (c *Command) InheritedFlags() *flag.FlagSet {
|
||||||
c.mergePersistentFlags()
|
c.mergePersistentFlags()
|
||||||
|
|
||||||
@ -1157,12 +1108,12 @@ func (c *Command) InheritedFlags() *flag.FlagSet {
|
|||||||
return inherited
|
return inherited
|
||||||
}
|
}
|
||||||
|
|
||||||
// NonInheritedFlags returns all flags which were not inherited from parent commands.
|
// All Flags which were not inherited from parent commands
|
||||||
func (c *Command) NonInheritedFlags() *flag.FlagSet {
|
func (c *Command) NonInheritedFlags() *flag.FlagSet {
|
||||||
return c.LocalFlags()
|
return c.LocalFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersistentFlags returns the persistent FlagSet specifically set in the current command.
|
// Get the Persistent FlagSet specifically set in the current command
|
||||||
func (c *Command) PersistentFlags() *flag.FlagSet {
|
func (c *Command) PersistentFlags() *flag.FlagSet {
|
||||||
if c.pflags == nil {
|
if c.pflags == nil {
|
||||||
c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
||||||
@ -1174,7 +1125,7 @@ func (c *Command) PersistentFlags() *flag.FlagSet {
|
|||||||
return c.pflags
|
return c.pflags
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetFlags is used in testing.
|
// For use in testing
|
||||||
func (c *Command) ResetFlags() {
|
func (c *Command) ResetFlags() {
|
||||||
c.flagErrorBuf = new(bytes.Buffer)
|
c.flagErrorBuf = new(bytes.Buffer)
|
||||||
c.flagErrorBuf.Reset()
|
c.flagErrorBuf.Reset()
|
||||||
@ -1184,50 +1135,50 @@ func (c *Command) ResetFlags() {
|
|||||||
c.pflags.SetOutput(c.flagErrorBuf)
|
c.pflags.SetOutput(c.flagErrorBuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasFlags checks if the command contains any flags (local plus persistent from the entire structure).
|
// Does the command contain any flags (local plus persistent from the entire structure)
|
||||||
func (c *Command) HasFlags() bool {
|
func (c *Command) HasFlags() bool {
|
||||||
return c.Flags().HasFlags()
|
return c.Flags().HasFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasPersistentFlags checks if the command contains persistent flags.
|
// Does the command contain persistent flags
|
||||||
func (c *Command) HasPersistentFlags() bool {
|
func (c *Command) HasPersistentFlags() bool {
|
||||||
return c.PersistentFlags().HasFlags()
|
return c.PersistentFlags().HasFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasLocalFlags checks if the command has flags specifically declared locally.
|
// Does the command has flags specifically declared locally
|
||||||
func (c *Command) HasLocalFlags() bool {
|
func (c *Command) HasLocalFlags() bool {
|
||||||
return c.LocalFlags().HasFlags()
|
return c.LocalFlags().HasFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasInheritedFlags checks if the command has flags inherited from its parent command.
|
// Does the command have flags inherited from its parent command
|
||||||
func (c *Command) HasInheritedFlags() bool {
|
func (c *Command) HasInheritedFlags() bool {
|
||||||
return c.InheritedFlags().HasFlags()
|
return c.InheritedFlags().HasFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasAvailableFlags checks if the command contains any flags (local plus persistent from the entire
|
// Does the command contain any flags (local plus persistent from the entire
|
||||||
// structure) which are not hidden or deprecated.
|
// structure) which are not hidden or deprecated
|
||||||
func (c *Command) HasAvailableFlags() bool {
|
func (c *Command) HasAvailableFlags() bool {
|
||||||
return c.Flags().HasAvailableFlags()
|
return c.Flags().HasAvailableFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasAvailablePersistentFlags checks if the command contains persistent flags which are not hidden or deprecated.
|
// Does the command contain persistent flags which are not hidden or deprecated
|
||||||
func (c *Command) HasAvailablePersistentFlags() bool {
|
func (c *Command) HasAvailablePersistentFlags() bool {
|
||||||
return c.PersistentFlags().HasAvailableFlags()
|
return c.PersistentFlags().HasAvailableFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasAvailableLocalFlags checks if the command has flags specifically declared locally which are not hidden
|
// Does the command has flags specifically declared locally which are not hidden
|
||||||
// or deprecated.
|
// or deprecated
|
||||||
func (c *Command) HasAvailableLocalFlags() bool {
|
func (c *Command) HasAvailableLocalFlags() bool {
|
||||||
return c.LocalFlags().HasAvailableFlags()
|
return c.LocalFlags().HasAvailableFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasAvailableInheritedFlags checks if the command has flags inherited from its parent command which are
|
// Does the command have flags inherited from its parent command which are
|
||||||
// not hidden or deprecated.
|
// not hidden or deprecated
|
||||||
func (c *Command) HasAvailableInheritedFlags() bool {
|
func (c *Command) HasAvailableInheritedFlags() bool {
|
||||||
return c.InheritedFlags().HasAvailableFlags()
|
return c.InheritedFlags().HasAvailableFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flag climbs up the command tree looking for matching flag.
|
// Flag climbs up the command tree looking for matching flag
|
||||||
func (c *Command) Flag(name string) (flag *flag.Flag) {
|
func (c *Command) Flag(name string) (flag *flag.Flag) {
|
||||||
flag = c.Flags().Lookup(name)
|
flag = c.Flags().Lookup(name)
|
||||||
|
|
||||||
@ -1238,7 +1189,7 @@ func (c *Command) Flag(name string) (flag *flag.Flag) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursively find matching persistent flag.
|
// recursively find matching persistent flag
|
||||||
func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
|
func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
|
||||||
if c.HasPersistentFlags() {
|
if c.HasPersistentFlags() {
|
||||||
flag = c.PersistentFlags().Lookup(name)
|
flag = c.PersistentFlags().Lookup(name)
|
||||||
@ -1250,7 +1201,7 @@ func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseFlags parses persistent flag tree and local flags.
|
// ParseFlags parses persistent flag tree & local flags
|
||||||
func (c *Command) ParseFlags(args []string) (err error) {
|
func (c *Command) ParseFlags(args []string) (err error) {
|
||||||
if c.DisableFlagParsing {
|
if c.DisableFlagParsing {
|
||||||
return nil
|
return nil
|
||||||
@ -1260,7 +1211,7 @@ func (c *Command) ParseFlags(args []string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parent returns a commands parent command.
|
// Parent returns a commands parent command
|
||||||
func (c *Command) Parent() *Command {
|
func (c *Command) Parent() *Command {
|
||||||
return c.parent
|
return c.parent
|
||||||
}
|
}
|
||||||
|
|||||||
147
vendor/github.com/spf13/pflag/bool_slice.go
generated
vendored
147
vendor/github.com/spf13/pflag/bool_slice.go
generated
vendored
@ -1,147 +0,0 @@
|
|||||||
package pflag
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- boolSlice Value
|
|
||||||
type boolSliceValue struct {
|
|
||||||
value *[]bool
|
|
||||||
changed bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func newBoolSliceValue(val []bool, p *[]bool) *boolSliceValue {
|
|
||||||
bsv := new(boolSliceValue)
|
|
||||||
bsv.value = p
|
|
||||||
*bsv.value = val
|
|
||||||
return bsv
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set converts, and assigns, the comma-separated boolean argument string representation as the []bool value of this flag.
|
|
||||||
// If Set is called on a flag that already has a []bool assigned, the newly converted values will be appended.
|
|
||||||
func (s *boolSliceValue) Set(val string) error {
|
|
||||||
|
|
||||||
// remove all quote characters
|
|
||||||
rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "")
|
|
||||||
|
|
||||||
// read flag arguments with CSV parser
|
|
||||||
boolStrSlice, err := readAsCSV(rmQuote.Replace(val))
|
|
||||||
if err != nil && err != io.EOF {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse boolean values into slice
|
|
||||||
out := make([]bool, 0, len(boolStrSlice))
|
|
||||||
for _, boolStr := range boolStrSlice {
|
|
||||||
b, err := strconv.ParseBool(strings.TrimSpace(boolStr))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
out = append(out, b)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !s.changed {
|
|
||||||
*s.value = out
|
|
||||||
} else {
|
|
||||||
*s.value = append(*s.value, out...)
|
|
||||||
}
|
|
||||||
|
|
||||||
s.changed = true
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type returns a string that uniquely represents this flag's type.
|
|
||||||
func (s *boolSliceValue) Type() string {
|
|
||||||
return "boolSlice"
|
|
||||||
}
|
|
||||||
|
|
||||||
// String defines a "native" format for this boolean slice flag value.
|
|
||||||
func (s *boolSliceValue) String() string {
|
|
||||||
|
|
||||||
boolStrSlice := make([]string, len(*s.value))
|
|
||||||
for i, b := range *s.value {
|
|
||||||
boolStrSlice[i] = strconv.FormatBool(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
out, _ := writeAsCSV(boolStrSlice)
|
|
||||||
|
|
||||||
return "[" + out + "]"
|
|
||||||
}
|
|
||||||
|
|
||||||
func boolSliceConv(val string) (interface{}, error) {
|
|
||||||
val = strings.Trim(val, "[]")
|
|
||||||
// Empty string would cause a slice with one (empty) entry
|
|
||||||
if len(val) == 0 {
|
|
||||||
return []bool{}, nil
|
|
||||||
}
|
|
||||||
ss := strings.Split(val, ",")
|
|
||||||
out := make([]bool, len(ss))
|
|
||||||
for i, t := range ss {
|
|
||||||
var err error
|
|
||||||
out[i], err = strconv.ParseBool(t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetBoolSlice returns the []bool value of a flag with the given name.
|
|
||||||
func (f *FlagSet) GetBoolSlice(name string) ([]bool, error) {
|
|
||||||
val, err := f.getFlagType(name, "boolSlice", boolSliceConv)
|
|
||||||
if err != nil {
|
|
||||||
return []bool{}, err
|
|
||||||
}
|
|
||||||
return val.([]bool), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// BoolSliceVar defines a boolSlice flag with specified name, default value, and usage string.
|
|
||||||
// The argument p points to a []bool variable in which to store the value of the flag.
|
|
||||||
func (f *FlagSet) BoolSliceVar(p *[]bool, name string, value []bool, usage string) {
|
|
||||||
f.VarP(newBoolSliceValue(value, p), name, "", usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func (f *FlagSet) BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) {
|
|
||||||
f.VarP(newBoolSliceValue(value, p), name, shorthand, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BoolSliceVar defines a []bool flag with specified name, default value, and usage string.
|
|
||||||
// The argument p points to a []bool variable in which to store the value of the flag.
|
|
||||||
func BoolSliceVar(p *[]bool, name string, value []bool, usage string) {
|
|
||||||
CommandLine.VarP(newBoolSliceValue(value, p), name, "", usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) {
|
|
||||||
CommandLine.VarP(newBoolSliceValue(value, p), name, shorthand, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BoolSlice defines a []bool flag with specified name, default value, and usage string.
|
|
||||||
// The return value is the address of a []bool variable that stores the value of the flag.
|
|
||||||
func (f *FlagSet) BoolSlice(name string, value []bool, usage string) *[]bool {
|
|
||||||
p := []bool{}
|
|
||||||
f.BoolSliceVarP(&p, name, "", value, usage)
|
|
||||||
return &p
|
|
||||||
}
|
|
||||||
|
|
||||||
// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func (f *FlagSet) BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool {
|
|
||||||
p := []bool{}
|
|
||||||
f.BoolSliceVarP(&p, name, shorthand, value, usage)
|
|
||||||
return &p
|
|
||||||
}
|
|
||||||
|
|
||||||
// BoolSlice defines a []bool flag with specified name, default value, and usage string.
|
|
||||||
// The return value is the address of a []bool variable that stores the value of the flag.
|
|
||||||
func BoolSlice(name string, value []bool, usage string) *[]bool {
|
|
||||||
return CommandLine.BoolSliceP(name, "", value, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool {
|
|
||||||
return CommandLine.BoolSliceP(name, shorthand, value, usage)
|
|
||||||
}
|
|
||||||
146
vendor/github.com/spf13/pflag/flag.go
generated
vendored
146
vendor/github.com/spf13/pflag/flag.go
generated
vendored
@ -487,76 +487,9 @@ func UnquoteUsage(flag *Flag) (name string, usage string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Splits the string `s` on whitespace into an initial substring up to
|
// FlagUsages Returns a string containing the usage information for all flags in
|
||||||
// `i` runes in length and the remainder. Will go `slop` over `i` if
|
// the FlagSet
|
||||||
// that encompasses the entire string (which allows the caller to
|
func (f *FlagSet) FlagUsages() string {
|
||||||
// avoid short orphan words on the final line).
|
|
||||||
func wrapN(i, slop int, s string) (string, string) {
|
|
||||||
if i+slop > len(s) {
|
|
||||||
return s, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
w := strings.LastIndexAny(s[:i], " \t")
|
|
||||||
if w <= 0 {
|
|
||||||
return s, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return s[:w], s[w+1:]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wraps the string `s` to a maximum width `w` with leading indent
|
|
||||||
// `i`. The first line is not indented (this is assumed to be done by
|
|
||||||
// caller). Pass `w` == 0 to do no wrapping
|
|
||||||
func wrap(i, w int, s string) string {
|
|
||||||
if w == 0 {
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
// space between indent i and end of line width w into which
|
|
||||||
// we should wrap the text.
|
|
||||||
wrap := w - i
|
|
||||||
|
|
||||||
var r, l string
|
|
||||||
|
|
||||||
// Not enough space for sensible wrapping. Wrap as a block on
|
|
||||||
// the next line instead.
|
|
||||||
if wrap < 24 {
|
|
||||||
i = 16
|
|
||||||
wrap = w - i
|
|
||||||
r += "\n" + strings.Repeat(" ", i)
|
|
||||||
}
|
|
||||||
// If still not enough space then don't even try to wrap.
|
|
||||||
if wrap < 24 {
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to avoid short orphan words on the final line, by
|
|
||||||
// allowing wrapN to go a bit over if that would fit in the
|
|
||||||
// remainder of the line.
|
|
||||||
slop := 5
|
|
||||||
wrap = wrap - slop
|
|
||||||
|
|
||||||
// Handle first line, which is indented by the caller (or the
|
|
||||||
// special case above)
|
|
||||||
l, s = wrapN(wrap, slop, s)
|
|
||||||
r = r + l
|
|
||||||
|
|
||||||
// Now wrap the rest
|
|
||||||
for s != "" {
|
|
||||||
var t string
|
|
||||||
|
|
||||||
t, s = wrapN(wrap, slop, s)
|
|
||||||
r = r + "\n" + strings.Repeat(" ", i) + t
|
|
||||||
}
|
|
||||||
|
|
||||||
return r
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// FlagUsagesWrapped returns a string containing the usage information
|
|
||||||
// for all flags in the FlagSet. Wrapped to `cols` columns (0 for no
|
|
||||||
// wrapping)
|
|
||||||
func (f *FlagSet) FlagUsagesWrapped(cols int) string {
|
|
||||||
x := new(bytes.Buffer)
|
x := new(bytes.Buffer)
|
||||||
|
|
||||||
lines := make([]string, 0, len(f.formal))
|
lines := make([]string, 0, len(f.formal))
|
||||||
@ -613,19 +546,12 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
|
|||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
sidx := strings.Index(line, "\x00")
|
sidx := strings.Index(line, "\x00")
|
||||||
spacing := strings.Repeat(" ", maxlen-sidx)
|
spacing := strings.Repeat(" ", maxlen-sidx)
|
||||||
// maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx
|
fmt.Fprintln(x, line[:sidx], spacing, line[sidx+1:])
|
||||||
fmt.Fprintln(x, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:]))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return x.String()
|
return x.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlagUsages returns a string containing the usage information for all flags in
|
|
||||||
// the FlagSet
|
|
||||||
func (f *FlagSet) FlagUsages() string {
|
|
||||||
return f.FlagUsagesWrapped(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrintDefaults prints to standard error the default values of all defined command-line flags.
|
// PrintDefaults prints to standard error the default values of all defined command-line flags.
|
||||||
func PrintDefaults() {
|
func PrintDefaults() {
|
||||||
CommandLine.PrintDefaults()
|
CommandLine.PrintDefaults()
|
||||||
@ -709,7 +635,7 @@ func (f *FlagSet) VarPF(value Value, name, shorthand, usage string) *Flag {
|
|||||||
|
|
||||||
// VarP is like Var, but accepts a shorthand letter that can be used after a single dash.
|
// VarP is like Var, but accepts a shorthand letter that can be used after a single dash.
|
||||||
func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
|
func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
|
||||||
f.VarPF(value, name, shorthand, usage)
|
_ = f.VarPF(value, name, shorthand, usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddFlag will add the flag to the FlagSet
|
// AddFlag will add the flag to the FlagSet
|
||||||
@ -826,7 +752,7 @@ func containsShorthand(arg, shorthand string) bool {
|
|||||||
return strings.Contains(arg, shorthand)
|
return strings.Contains(arg, shorthand)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {
|
func (f *FlagSet) parseLongArg(s string, args []string) (a []string, err error) {
|
||||||
a = args
|
a = args
|
||||||
name := s[2:]
|
name := s[2:]
|
||||||
if len(name) == 0 || name[0] == '-' || name[0] == '=' {
|
if len(name) == 0 || name[0] == '-' || name[0] == '=' {
|
||||||
@ -860,11 +786,11 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
|
|||||||
err = f.failf("flag needs an argument: %s", s)
|
err = f.failf("flag needs an argument: %s", s)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = fn(flag, value, s)
|
err = f.setFlag(flag, value, s)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) {
|
func (f *FlagSet) parseSingleShortArg(shorthands string, args []string) (outShorts string, outArgs []string, err error) {
|
||||||
if strings.HasPrefix(shorthands, "test.") {
|
if strings.HasPrefix(shorthands, "test.") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -899,16 +825,16 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
|
|||||||
err = f.failf("flag needs an argument: %q in -%s", c, shorthands)
|
err = f.failf("flag needs an argument: %q in -%s", c, shorthands)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = fn(flag, value, shorthands)
|
err = f.setFlag(flag, value, shorthands)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []string, err error) {
|
func (f *FlagSet) parseShortArg(s string, args []string) (a []string, err error) {
|
||||||
a = args
|
a = args
|
||||||
shorthands := s[1:]
|
shorthands := s[1:]
|
||||||
|
|
||||||
for len(shorthands) > 0 {
|
for len(shorthands) > 0 {
|
||||||
shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn)
|
shorthands, a, err = f.parseSingleShortArg(shorthands, args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -917,7 +843,7 @@ func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []stri
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
|
func (f *FlagSet) parseArgs(args []string) (err error) {
|
||||||
for len(args) > 0 {
|
for len(args) > 0 {
|
||||||
s := args[0]
|
s := args[0]
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
@ -937,9 +863,9 @@ func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
|
|||||||
f.args = append(f.args, args...)
|
f.args = append(f.args, args...)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
args, err = f.parseLongArg(s, args, fn)
|
args, err = f.parseLongArg(s, args)
|
||||||
} else {
|
} else {
|
||||||
args, err = f.parseShortArg(s, args, fn)
|
args, err = f.parseShortArg(s, args)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -955,41 +881,7 @@ func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
|
|||||||
func (f *FlagSet) Parse(arguments []string) error {
|
func (f *FlagSet) Parse(arguments []string) error {
|
||||||
f.parsed = true
|
f.parsed = true
|
||||||
f.args = make([]string, 0, len(arguments))
|
f.args = make([]string, 0, len(arguments))
|
||||||
|
err := f.parseArgs(arguments)
|
||||||
assign := func(flag *Flag, value, origArg string) error {
|
|
||||||
return f.setFlag(flag, value, origArg)
|
|
||||||
}
|
|
||||||
|
|
||||||
err := f.parseArgs(arguments, assign)
|
|
||||||
if err != nil {
|
|
||||||
switch f.errorHandling {
|
|
||||||
case ContinueOnError:
|
|
||||||
return err
|
|
||||||
case ExitOnError:
|
|
||||||
os.Exit(2)
|
|
||||||
case PanicOnError:
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type parseFunc func(flag *Flag, value, origArg string) error
|
|
||||||
|
|
||||||
// ParseAll parses flag definitions from the argument list, which should not
|
|
||||||
// include the command name. The arguments for fn are flag and value. Must be
|
|
||||||
// called after all flags in the FlagSet are defined and before flags are
|
|
||||||
// accessed by the program. The return value will be ErrHelp if -help was set
|
|
||||||
// but not defined.
|
|
||||||
func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string) error) error {
|
|
||||||
f.parsed = true
|
|
||||||
f.args = make([]string, 0, len(arguments))
|
|
||||||
|
|
||||||
assign := func(flag *Flag, value, origArg string) error {
|
|
||||||
return fn(flag, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
err := f.parseArgs(arguments, assign)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch f.errorHandling {
|
switch f.errorHandling {
|
||||||
case ContinueOnError:
|
case ContinueOnError:
|
||||||
@ -1015,14 +907,6 @@ func Parse() {
|
|||||||
CommandLine.Parse(os.Args[1:])
|
CommandLine.Parse(os.Args[1:])
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseAll parses the command-line flags from os.Args[1:] and called fn for each.
|
|
||||||
// The arguments for fn are flag and value. Must be called after all flags are
|
|
||||||
// defined and before flags are accessed by the program.
|
|
||||||
func ParseAll(fn func(flag *Flag, value string) error) {
|
|
||||||
// Ignore errors; CommandLine is set for ExitOnError.
|
|
||||||
CommandLine.ParseAll(os.Args[1:], fn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetInterspersed sets whether to support interspersed option/non-option arguments.
|
// SetInterspersed sets whether to support interspersed option/non-option arguments.
|
||||||
func SetInterspersed(interspersed bool) {
|
func SetInterspersed(interspersed bool) {
|
||||||
CommandLine.SetInterspersed(interspersed)
|
CommandLine.SetInterspersed(interspersed)
|
||||||
|
|||||||
3
vendor/github.com/spf13/pflag/golangflag.go
generated
vendored
3
vendor/github.com/spf13/pflag/golangflag.go
generated
vendored
@ -6,10 +6,13 @@ package pflag
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
goflag "flag"
|
goflag "flag"
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ = fmt.Print
|
||||||
|
|
||||||
// flagValueWrapper implements pflag.Value around a flag.Value. The main
|
// flagValueWrapper implements pflag.Value around a flag.Value. The main
|
||||||
// difference here is the addition of the Type method that returns a string
|
// difference here is the addition of the Type method that returns a string
|
||||||
// name of the type. As this is generally unknown, we approximate that with
|
// name of the type. As this is generally unknown, we approximate that with
|
||||||
|
|||||||
2
vendor/github.com/spf13/pflag/ip.go
generated
vendored
2
vendor/github.com/spf13/pflag/ip.go
generated
vendored
@ -6,6 +6,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ = strings.TrimSpace
|
||||||
|
|
||||||
// -- net.IP value
|
// -- net.IP value
|
||||||
type ipValue net.IP
|
type ipValue net.IP
|
||||||
|
|
||||||
|
|||||||
148
vendor/github.com/spf13/pflag/ip_slice.go
generated
vendored
148
vendor/github.com/spf13/pflag/ip_slice.go
generated
vendored
@ -1,148 +0,0 @@
|
|||||||
package pflag
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"net"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- ipSlice Value
|
|
||||||
type ipSliceValue struct {
|
|
||||||
value *[]net.IP
|
|
||||||
changed bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func newIPSliceValue(val []net.IP, p *[]net.IP) *ipSliceValue {
|
|
||||||
ipsv := new(ipSliceValue)
|
|
||||||
ipsv.value = p
|
|
||||||
*ipsv.value = val
|
|
||||||
return ipsv
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set converts, and assigns, the comma-separated IP argument string representation as the []net.IP value of this flag.
|
|
||||||
// If Set is called on a flag that already has a []net.IP assigned, the newly converted values will be appended.
|
|
||||||
func (s *ipSliceValue) Set(val string) error {
|
|
||||||
|
|
||||||
// remove all quote characters
|
|
||||||
rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "")
|
|
||||||
|
|
||||||
// read flag arguments with CSV parser
|
|
||||||
ipStrSlice, err := readAsCSV(rmQuote.Replace(val))
|
|
||||||
if err != nil && err != io.EOF {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse ip values into slice
|
|
||||||
out := make([]net.IP, 0, len(ipStrSlice))
|
|
||||||
for _, ipStr := range ipStrSlice {
|
|
||||||
ip := net.ParseIP(strings.TrimSpace(ipStr))
|
|
||||||
if ip == nil {
|
|
||||||
return fmt.Errorf("invalid string being converted to IP address: %s", ipStr)
|
|
||||||
}
|
|
||||||
out = append(out, ip)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !s.changed {
|
|
||||||
*s.value = out
|
|
||||||
} else {
|
|
||||||
*s.value = append(*s.value, out...)
|
|
||||||
}
|
|
||||||
|
|
||||||
s.changed = true
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type returns a string that uniquely represents this flag's type.
|
|
||||||
func (s *ipSliceValue) Type() string {
|
|
||||||
return "ipSlice"
|
|
||||||
}
|
|
||||||
|
|
||||||
// String defines a "native" format for this net.IP slice flag value.
|
|
||||||
func (s *ipSliceValue) String() string {
|
|
||||||
|
|
||||||
ipStrSlice := make([]string, len(*s.value))
|
|
||||||
for i, ip := range *s.value {
|
|
||||||
ipStrSlice[i] = ip.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
out, _ := writeAsCSV(ipStrSlice)
|
|
||||||
|
|
||||||
return "[" + out + "]"
|
|
||||||
}
|
|
||||||
|
|
||||||
func ipSliceConv(val string) (interface{}, error) {
|
|
||||||
val = strings.Trim(val, "[]")
|
|
||||||
// Emtpy string would cause a slice with one (empty) entry
|
|
||||||
if len(val) == 0 {
|
|
||||||
return []net.IP{}, nil
|
|
||||||
}
|
|
||||||
ss := strings.Split(val, ",")
|
|
||||||
out := make([]net.IP, len(ss))
|
|
||||||
for i, sval := range ss {
|
|
||||||
ip := net.ParseIP(strings.TrimSpace(sval))
|
|
||||||
if ip == nil {
|
|
||||||
return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval)
|
|
||||||
}
|
|
||||||
out[i] = ip
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetIPSlice returns the []net.IP value of a flag with the given name
|
|
||||||
func (f *FlagSet) GetIPSlice(name string) ([]net.IP, error) {
|
|
||||||
val, err := f.getFlagType(name, "ipSlice", ipSliceConv)
|
|
||||||
if err != nil {
|
|
||||||
return []net.IP{}, err
|
|
||||||
}
|
|
||||||
return val.([]net.IP), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPSliceVar defines a ipSlice flag with specified name, default value, and usage string.
|
|
||||||
// The argument p points to a []net.IP variable in which to store the value of the flag.
|
|
||||||
func (f *FlagSet) IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) {
|
|
||||||
f.VarP(newIPSliceValue(value, p), name, "", usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func (f *FlagSet) IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) {
|
|
||||||
f.VarP(newIPSliceValue(value, p), name, shorthand, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPSliceVar defines a []net.IP flag with specified name, default value, and usage string.
|
|
||||||
// The argument p points to a []net.IP variable in which to store the value of the flag.
|
|
||||||
func IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) {
|
|
||||||
CommandLine.VarP(newIPSliceValue(value, p), name, "", usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) {
|
|
||||||
CommandLine.VarP(newIPSliceValue(value, p), name, shorthand, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPSlice defines a []net.IP flag with specified name, default value, and usage string.
|
|
||||||
// The return value is the address of a []net.IP variable that stores the value of that flag.
|
|
||||||
func (f *FlagSet) IPSlice(name string, value []net.IP, usage string) *[]net.IP {
|
|
||||||
p := []net.IP{}
|
|
||||||
f.IPSliceVarP(&p, name, "", value, usage)
|
|
||||||
return &p
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func (f *FlagSet) IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP {
|
|
||||||
p := []net.IP{}
|
|
||||||
f.IPSliceVarP(&p, name, shorthand, value, usage)
|
|
||||||
return &p
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPSlice defines a []net.IP flag with specified name, default value, and usage string.
|
|
||||||
// The return value is the address of a []net.IP variable that stores the value of the flag.
|
|
||||||
func IPSlice(name string, value []net.IP, usage string) *[]net.IP {
|
|
||||||
return CommandLine.IPSliceP(name, "", value, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP {
|
|
||||||
return CommandLine.IPSliceP(name, shorthand, value, usage)
|
|
||||||
}
|
|
||||||
2
vendor/github.com/spf13/pflag/ipnet.go
generated
vendored
2
vendor/github.com/spf13/pflag/ipnet.go
generated
vendored
@ -27,6 +27,8 @@ func (*ipNetValue) Type() string {
|
|||||||
return "ipNet"
|
return "ipNet"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ = strings.TrimSpace
|
||||||
|
|
||||||
func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue {
|
func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue {
|
||||||
*p = val
|
*p = val
|
||||||
return (*ipNetValue)(p)
|
return (*ipNetValue)(p)
|
||||||
|
|||||||
6
vendor/github.com/spf13/pflag/string_array.go
generated
vendored
6
vendor/github.com/spf13/pflag/string_array.go
generated
vendored
@ -1,5 +1,11 @@
|
|||||||
package pflag
|
package pflag
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = fmt.Fprint
|
||||||
|
|
||||||
// -- stringArray Value
|
// -- stringArray Value
|
||||||
type stringArrayValue struct {
|
type stringArrayValue struct {
|
||||||
value *[]string
|
value *[]string
|
||||||
|
|||||||
5
vendor/github.com/spf13/pflag/string_slice.go
generated
vendored
5
vendor/github.com/spf13/pflag/string_slice.go
generated
vendored
@ -3,9 +3,12 @@ package pflag
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ = fmt.Fprint
|
||||||
|
|
||||||
// -- stringSlice Value
|
// -- stringSlice Value
|
||||||
type stringSliceValue struct {
|
type stringSliceValue struct {
|
||||||
value *[]string
|
value *[]string
|
||||||
@ -36,7 +39,7 @@ func writeAsCSV(vals []string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
w.Flush()
|
w.Flush()
|
||||||
return strings.TrimSuffix(b.String(), "\n"), nil
|
return strings.TrimSuffix(b.String(), fmt.Sprintln()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringSliceValue) Set(val string) error {
|
func (s *stringSliceValue) Set(val string) error {
|
||||||
|
|||||||
126
vendor/github.com/spf13/pflag/uint_slice.go
generated
vendored
126
vendor/github.com/spf13/pflag/uint_slice.go
generated
vendored
@ -1,126 +0,0 @@
|
|||||||
package pflag
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// -- uintSlice Value
|
|
||||||
type uintSliceValue struct {
|
|
||||||
value *[]uint
|
|
||||||
changed bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func newUintSliceValue(val []uint, p *[]uint) *uintSliceValue {
|
|
||||||
uisv := new(uintSliceValue)
|
|
||||||
uisv.value = p
|
|
||||||
*uisv.value = val
|
|
||||||
return uisv
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *uintSliceValue) Set(val string) error {
|
|
||||||
ss := strings.Split(val, ",")
|
|
||||||
out := make([]uint, len(ss))
|
|
||||||
for i, d := range ss {
|
|
||||||
u, err := strconv.ParseUint(d, 10, 0)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
out[i] = uint(u)
|
|
||||||
}
|
|
||||||
if !s.changed {
|
|
||||||
*s.value = out
|
|
||||||
} else {
|
|
||||||
*s.value = append(*s.value, out...)
|
|
||||||
}
|
|
||||||
s.changed = true
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *uintSliceValue) Type() string {
|
|
||||||
return "uintSlice"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *uintSliceValue) String() string {
|
|
||||||
out := make([]string, len(*s.value))
|
|
||||||
for i, d := range *s.value {
|
|
||||||
out[i] = fmt.Sprintf("%d", d)
|
|
||||||
}
|
|
||||||
return "[" + strings.Join(out, ",") + "]"
|
|
||||||
}
|
|
||||||
|
|
||||||
func uintSliceConv(val string) (interface{}, error) {
|
|
||||||
val = strings.Trim(val, "[]")
|
|
||||||
// Empty string would cause a slice with one (empty) entry
|
|
||||||
if len(val) == 0 {
|
|
||||||
return []uint{}, nil
|
|
||||||
}
|
|
||||||
ss := strings.Split(val, ",")
|
|
||||||
out := make([]uint, len(ss))
|
|
||||||
for i, d := range ss {
|
|
||||||
u, err := strconv.ParseUint(d, 10, 0)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
out[i] = uint(u)
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetUintSlice returns the []uint value of a flag with the given name.
|
|
||||||
func (f *FlagSet) GetUintSlice(name string) ([]uint, error) {
|
|
||||||
val, err := f.getFlagType(name, "uintSlice", uintSliceConv)
|
|
||||||
if err != nil {
|
|
||||||
return []uint{}, err
|
|
||||||
}
|
|
||||||
return val.([]uint), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UintSliceVar defines a uintSlice flag with specified name, default value, and usage string.
|
|
||||||
// The argument p points to a []uint variable in which to store the value of the flag.
|
|
||||||
func (f *FlagSet) UintSliceVar(p *[]uint, name string, value []uint, usage string) {
|
|
||||||
f.VarP(newUintSliceValue(value, p), name, "", usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UintSliceVarP is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func (f *FlagSet) UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) {
|
|
||||||
f.VarP(newUintSliceValue(value, p), name, shorthand, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UintSliceVar defines a uint[] flag with specified name, default value, and usage string.
|
|
||||||
// The argument p points to a uint[] variable in which to store the value of the flag.
|
|
||||||
func UintSliceVar(p *[]uint, name string, value []uint, usage string) {
|
|
||||||
CommandLine.VarP(newUintSliceValue(value, p), name, "", usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UintSliceVarP is like the UintSliceVar, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) {
|
|
||||||
CommandLine.VarP(newUintSliceValue(value, p), name, shorthand, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UintSlice defines a []uint flag with specified name, default value, and usage string.
|
|
||||||
// The return value is the address of a []uint variable that stores the value of the flag.
|
|
||||||
func (f *FlagSet) UintSlice(name string, value []uint, usage string) *[]uint {
|
|
||||||
p := []uint{}
|
|
||||||
f.UintSliceVarP(&p, name, "", value, usage)
|
|
||||||
return &p
|
|
||||||
}
|
|
||||||
|
|
||||||
// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func (f *FlagSet) UintSliceP(name, shorthand string, value []uint, usage string) *[]uint {
|
|
||||||
p := []uint{}
|
|
||||||
f.UintSliceVarP(&p, name, shorthand, value, usage)
|
|
||||||
return &p
|
|
||||||
}
|
|
||||||
|
|
||||||
// UintSlice defines a []uint flag with specified name, default value, and usage string.
|
|
||||||
// The return value is the address of a []uint variable that stores the value of the flag.
|
|
||||||
func UintSlice(name string, value []uint, usage string) *[]uint {
|
|
||||||
return CommandLine.UintSliceP(name, "", value, usage)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash.
|
|
||||||
func UintSliceP(name, shorthand string, value []uint, usage string) *[]uint {
|
|
||||||
return CommandLine.UintSliceP(name, shorthand, value, usage)
|
|
||||||
}
|
|
||||||
95
vendor/github.com/xeipuuv/gojsonpointer/pointer.go
generated
vendored
95
vendor/github.com/xeipuuv/gojsonpointer/pointer.go
generated
vendored
@ -52,24 +52,35 @@ type implStruct struct {
|
|||||||
outError error
|
outError error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewJsonPointer(jsonPointerString string) (JsonPointer, error) {
|
||||||
|
|
||||||
|
var p JsonPointer
|
||||||
|
err := p.parse(jsonPointerString)
|
||||||
|
return p, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
type JsonPointer struct {
|
type JsonPointer struct {
|
||||||
referenceTokens []string
|
referenceTokens []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewJsonPointer parses the given string JSON pointer and returns an object
|
// "Constructor", parses the given string JSON pointer
|
||||||
func NewJsonPointer(jsonPointerString string) (p JsonPointer, err error) {
|
func (p *JsonPointer) parse(jsonPointerString string) error {
|
||||||
|
|
||||||
// Pointer to the root of the document
|
var err error
|
||||||
if len(jsonPointerString) == 0 {
|
|
||||||
// Keep referenceTokens nil
|
if jsonPointerString != const_empty_pointer {
|
||||||
return
|
if !strings.HasPrefix(jsonPointerString, const_pointer_separator) {
|
||||||
}
|
err = errors.New(const_invalid_start)
|
||||||
if jsonPointerString[0] != '/' {
|
} else {
|
||||||
return p, errors.New(const_invalid_start)
|
referenceTokens := strings.Split(jsonPointerString, const_pointer_separator)
|
||||||
|
for _, referenceToken := range referenceTokens[1:] {
|
||||||
|
p.referenceTokens = append(p.referenceTokens, referenceToken)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.referenceTokens = strings.Split(jsonPointerString[1:], const_pointer_separator)
|
return err
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uses the pointer to retrieve a value from a JSON document
|
// Uses the pointer to retrieve a value from a JSON document
|
||||||
@ -108,55 +119,64 @@ func (p *JsonPointer) implementation(i *implStruct) {
|
|||||||
|
|
||||||
for ti, token := range p.referenceTokens {
|
for ti, token := range p.referenceTokens {
|
||||||
|
|
||||||
|
decodedToken := decodeReferenceToken(token)
|
||||||
isLastToken := ti == len(p.referenceTokens)-1
|
isLastToken := ti == len(p.referenceTokens)-1
|
||||||
|
|
||||||
switch v := node.(type) {
|
rValue := reflect.ValueOf(node)
|
||||||
|
kind = rValue.Kind()
|
||||||
|
|
||||||
case map[string]interface{}:
|
switch kind {
|
||||||
decodedToken := decodeReferenceToken(token)
|
|
||||||
if _, ok := v[decodedToken]; ok {
|
case reflect.Map:
|
||||||
node = v[decodedToken]
|
m := node.(map[string]interface{})
|
||||||
|
if _, ok := m[decodedToken]; ok {
|
||||||
|
node = m[decodedToken]
|
||||||
if isLastToken && i.mode == "SET" {
|
if isLastToken && i.mode == "SET" {
|
||||||
v[decodedToken] = i.setInValue
|
m[decodedToken] = i.setInValue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
i.outError = fmt.Errorf("Object has no key '%s'", decodedToken)
|
i.outError = errors.New(fmt.Sprintf("Object has no key '%s'", token))
|
||||||
i.getOutKind = reflect.Map
|
i.getOutKind = kind
|
||||||
i.getOutNode = nil
|
i.getOutNode = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case reflect.Slice:
|
||||||
|
s := node.([]interface{})
|
||||||
tokenIndex, err := strconv.Atoi(token)
|
tokenIndex, err := strconv.Atoi(token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
i.outError = fmt.Errorf("Invalid array index '%s'", token)
|
i.outError = errors.New(fmt.Sprintf("Invalid array index '%s'", token))
|
||||||
i.getOutKind = reflect.Slice
|
i.getOutKind = kind
|
||||||
i.getOutNode = nil
|
i.getOutNode = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if tokenIndex < 0 || tokenIndex >= len(v) {
|
sLength := len(s)
|
||||||
i.outError = fmt.Errorf("Out of bound array[0,%d] index '%d'", len(v), tokenIndex)
|
if tokenIndex < 0 || tokenIndex >= sLength {
|
||||||
i.getOutKind = reflect.Slice
|
i.outError = errors.New(fmt.Sprintf("Out of bound array[0,%d] index '%d'", sLength, tokenIndex))
|
||||||
|
i.getOutKind = kind
|
||||||
i.getOutNode = nil
|
i.getOutNode = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
node = v[tokenIndex]
|
node = s[tokenIndex]
|
||||||
if isLastToken && i.mode == "SET" {
|
if isLastToken && i.mode == "SET" {
|
||||||
v[tokenIndex] = i.setInValue
|
s[tokenIndex] = i.setInValue
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
i.outError = fmt.Errorf("Invalid token reference '%s'", token)
|
i.outError = errors.New(fmt.Sprintf("Invalid token reference '%s'", token))
|
||||||
i.getOutKind = reflect.ValueOf(node).Kind()
|
i.getOutKind = kind
|
||||||
i.getOutNode = nil
|
i.getOutNode = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rValue := reflect.ValueOf(node)
|
||||||
|
kind = rValue.Kind()
|
||||||
|
|
||||||
i.getOutNode = node
|
i.getOutNode = node
|
||||||
i.getOutKind = reflect.ValueOf(node).Kind()
|
i.getOutKind = kind
|
||||||
i.outError = nil
|
i.outError = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,14 +197,21 @@ func (p *JsonPointer) String() string {
|
|||||||
// ~1 => /
|
// ~1 => /
|
||||||
// ... and vice versa
|
// ... and vice versa
|
||||||
|
|
||||||
|
const (
|
||||||
|
const_encoded_reference_token_0 = `~0`
|
||||||
|
const_encoded_reference_token_1 = `~1`
|
||||||
|
const_decoded_reference_token_0 = `~`
|
||||||
|
const_decoded_reference_token_1 = `/`
|
||||||
|
)
|
||||||
|
|
||||||
func decodeReferenceToken(token string) string {
|
func decodeReferenceToken(token string) string {
|
||||||
step1 := strings.Replace(token, `~1`, `/`, -1)
|
step1 := strings.Replace(token, const_encoded_reference_token_1, const_decoded_reference_token_1, -1)
|
||||||
step2 := strings.Replace(step1, `~0`, `~`, -1)
|
step2 := strings.Replace(step1, const_encoded_reference_token_0, const_decoded_reference_token_0, -1)
|
||||||
return step2
|
return step2
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeReferenceToken(token string) string {
|
func encodeReferenceToken(token string) string {
|
||||||
step1 := strings.Replace(token, `~`, `~0`, -1)
|
step1 := strings.Replace(token, const_decoded_reference_token_1, const_encoded_reference_token_1, -1)
|
||||||
step2 := strings.Replace(step1, `/`, `~1`, -1)
|
step2 := strings.Replace(step1, const_decoded_reference_token_0, const_encoded_reference_token_0, -1)
|
||||||
return step2
|
return step2
|
||||||
}
|
}
|
||||||
|
|||||||
48
vendor/github.com/xeipuuv/gojsonschema/errors.go
generated
vendored
48
vendor/github.com/xeipuuv/gojsonschema/errors.go
generated
vendored
@ -1,20 +1,10 @@
|
|||||||
package gojsonschema
|
package gojsonschema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"fmt"
|
||||||
"sync"
|
"strings"
|
||||||
"text/template"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var errorTemplates errorTemplate = errorTemplate{template.New("errors-new"), sync.RWMutex{}}
|
|
||||||
|
|
||||||
// template.Template is not thread-safe for writing, so some locking is done
|
|
||||||
// sync.RWMutex is used for efficiently locking when new templates are created
|
|
||||||
type errorTemplate struct {
|
|
||||||
*template.Template
|
|
||||||
sync.RWMutex
|
|
||||||
}
|
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// RequiredError. ErrorDetails: property string
|
// RequiredError. ErrorDetails: property string
|
||||||
RequiredError struct {
|
RequiredError struct {
|
||||||
@ -240,35 +230,13 @@ func newError(err ResultError, context *jsonContext, value interface{}, locale l
|
|||||||
err.SetDescription(formatErrorDescription(d, details))
|
err.SetDescription(formatErrorDescription(d, details))
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatErrorDescription takes a string in the default text/template
|
// formatErrorDescription takes a string in this format: %field% is required
|
||||||
// format and converts it to a string with replacements. The fields come
|
// and converts it to a string with replacements. The fields come from
|
||||||
// from the ErrorDetails struct and vary for each type of error.
|
// the ErrorDetails struct and vary for each type of error.
|
||||||
func formatErrorDescription(s string, details ErrorDetails) string {
|
func formatErrorDescription(s string, details ErrorDetails) string {
|
||||||
|
for name, val := range details {
|
||||||
var tpl *template.Template
|
s = strings.Replace(s, "%"+strings.ToLower(name)+"%", fmt.Sprintf("%v", val), -1)
|
||||||
var descrAsBuffer bytes.Buffer
|
|
||||||
var err error
|
|
||||||
|
|
||||||
errorTemplates.RLock()
|
|
||||||
tpl = errorTemplates.Lookup(s)
|
|
||||||
errorTemplates.RUnlock()
|
|
||||||
|
|
||||||
if tpl == nil {
|
|
||||||
errorTemplates.Lock()
|
|
||||||
tpl = errorTemplates.New(s)
|
|
||||||
|
|
||||||
tpl, err = tpl.Parse(s)
|
|
||||||
errorTemplates.Unlock()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err.Error()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tpl.Execute(&descrAsBuffer, details)
|
return s
|
||||||
if err != nil {
|
|
||||||
return err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
return descrAsBuffer.String()
|
|
||||||
}
|
}
|
||||||
|
|||||||
25
vendor/github.com/xeipuuv/gojsonschema/format_checkers.go
generated
vendored
25
vendor/github.com/xeipuuv/gojsonschema/format_checkers.go
generated
vendored
@ -5,7 +5,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -60,9 +59,6 @@ type (
|
|||||||
|
|
||||||
// UUIDFormatChecker validates a UUID is in the correct format
|
// UUIDFormatChecker validates a UUID is in the correct format
|
||||||
UUIDFormatChecker struct{}
|
UUIDFormatChecker struct{}
|
||||||
|
|
||||||
// RegexFormatChecker validates a regex is in the correct format
|
|
||||||
RegexFormatChecker struct{}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -77,7 +73,6 @@ var (
|
|||||||
"ipv6": IPV6FormatChecker{},
|
"ipv6": IPV6FormatChecker{},
|
||||||
"uri": URIFormatChecker{},
|
"uri": URIFormatChecker{},
|
||||||
"uuid": UUIDFormatChecker{},
|
"uuid": UUIDFormatChecker{},
|
||||||
"regex": RegexFormatChecker{},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +80,7 @@ var (
|
|||||||
rxEmail = regexp.MustCompile("^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.?$")
|
rxEmail = regexp.MustCompile("^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.?$")
|
||||||
|
|
||||||
// Regex credit: https://www.socketloop.com/tutorials/golang-validate-hostname
|
// Regex credit: https://www.socketloop.com/tutorials/golang-validate-hostname
|
||||||
rxHostname = regexp.MustCompile(`^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$`)
|
rxHostname = regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$`)
|
||||||
|
|
||||||
rxUUID = regexp.MustCompile("^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
|
rxUUID = regexp.MustCompile("^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
|
||||||
)
|
)
|
||||||
@ -137,13 +132,13 @@ func (f EmailFormatChecker) IsFormat(input string) bool {
|
|||||||
// Credit: https://github.com/asaskevich/govalidator
|
// Credit: https://github.com/asaskevich/govalidator
|
||||||
func (f IPV4FormatChecker) IsFormat(input string) bool {
|
func (f IPV4FormatChecker) IsFormat(input string) bool {
|
||||||
ip := net.ParseIP(input)
|
ip := net.ParseIP(input)
|
||||||
return ip != nil && strings.Contains(input, ".")
|
return ip != nil && ip.To4() != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Credit: https://github.com/asaskevich/govalidator
|
// Credit: https://github.com/asaskevich/govalidator
|
||||||
func (f IPV6FormatChecker) IsFormat(input string) bool {
|
func (f IPV6FormatChecker) IsFormat(input string) bool {
|
||||||
ip := net.ParseIP(input)
|
ip := net.ParseIP(input)
|
||||||
return ip != nil && strings.Contains(input, ":")
|
return ip != nil && ip.To4() == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f DateTimeFormatChecker) IsFormat(input string) bool {
|
func (f DateTimeFormatChecker) IsFormat(input string) bool {
|
||||||
@ -174,21 +169,9 @@ func (f URIFormatChecker) IsFormat(input string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f HostnameFormatChecker) IsFormat(input string) bool {
|
func (f HostnameFormatChecker) IsFormat(input string) bool {
|
||||||
return rxHostname.MatchString(input) && len(input) < 256
|
return rxHostname.MatchString(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f UUIDFormatChecker) IsFormat(input string) bool {
|
func (f UUIDFormatChecker) IsFormat(input string) bool {
|
||||||
return rxUUID.MatchString(input)
|
return rxUUID.MatchString(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsFormat implements FormatChecker interface.
|
|
||||||
func (f RegexFormatChecker) IsFormat(input string) bool {
|
|
||||||
if input == "" {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
_, err := regexp.Compile(input)
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|||||||
218
vendor/github.com/xeipuuv/gojsonschema/jsonLoader.go
generated
vendored
218
vendor/github.com/xeipuuv/gojsonschema/jsonLoader.go
generated
vendored
@ -33,7 +33,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
@ -41,92 +40,34 @@ import (
|
|||||||
"github.com/xeipuuv/gojsonreference"
|
"github.com/xeipuuv/gojsonreference"
|
||||||
)
|
)
|
||||||
|
|
||||||
var osFS = osFileSystem(os.Open)
|
|
||||||
|
|
||||||
// JSON loader interface
|
// JSON loader interface
|
||||||
|
|
||||||
type JSONLoader interface {
|
type JSONLoader interface {
|
||||||
JsonSource() interface{}
|
jsonSource() interface{}
|
||||||
LoadJSON() (interface{}, error)
|
loadJSON() (interface{}, error)
|
||||||
JsonReference() (gojsonreference.JsonReference, error)
|
loadSchema() (*Schema, error)
|
||||||
LoaderFactory() JSONLoaderFactory
|
|
||||||
}
|
|
||||||
|
|
||||||
type JSONLoaderFactory interface {
|
|
||||||
New(source string) JSONLoader
|
|
||||||
}
|
|
||||||
|
|
||||||
type DefaultJSONLoaderFactory struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileSystemJSONLoaderFactory struct {
|
|
||||||
fs http.FileSystem
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d DefaultJSONLoaderFactory) New(source string) JSONLoader {
|
|
||||||
return &jsonReferenceLoader{
|
|
||||||
fs: osFS,
|
|
||||||
source: source,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f FileSystemJSONLoaderFactory) New(source string) JSONLoader {
|
|
||||||
return &jsonReferenceLoader{
|
|
||||||
fs: f.fs,
|
|
||||||
source: source,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// osFileSystem is a functional wrapper for os.Open that implements http.FileSystem.
|
|
||||||
type osFileSystem func(string) (*os.File, error)
|
|
||||||
|
|
||||||
func (o osFileSystem) Open(name string) (http.File, error) {
|
|
||||||
return o(name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON Reference loader
|
// JSON Reference loader
|
||||||
// references are used to load JSONs from files and HTTP
|
// references are used to load JSONs from files and HTTP
|
||||||
|
|
||||||
type jsonReferenceLoader struct {
|
type jsonReferenceLoader struct {
|
||||||
fs http.FileSystem
|
|
||||||
source string
|
source string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonReferenceLoader) JsonSource() interface{} {
|
func (l *jsonReferenceLoader) jsonSource() interface{} {
|
||||||
return l.source
|
return l.source
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonReferenceLoader) JsonReference() (gojsonreference.JsonReference, error) {
|
|
||||||
return gojsonreference.NewJsonReference(l.JsonSource().(string))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *jsonReferenceLoader) LoaderFactory() JSONLoaderFactory {
|
|
||||||
return &FileSystemJSONLoaderFactory{
|
|
||||||
fs: l.fs,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewReferenceLoader returns a JSON reference loader using the given source and the local OS file system.
|
|
||||||
func NewReferenceLoader(source string) *jsonReferenceLoader {
|
func NewReferenceLoader(source string) *jsonReferenceLoader {
|
||||||
return &jsonReferenceLoader{
|
return &jsonReferenceLoader{source: source}
|
||||||
fs: osFS,
|
|
||||||
source: source,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewReferenceLoaderFileSystem returns a JSON reference loader using the given source and file system.
|
func (l *jsonReferenceLoader) loadJSON() (interface{}, error) {
|
||||||
func NewReferenceLoaderFileSystem(source string, fs http.FileSystem) *jsonReferenceLoader {
|
|
||||||
return &jsonReferenceLoader{
|
|
||||||
fs: fs,
|
|
||||||
source: source,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *jsonReferenceLoader) LoadJSON() (interface{}, error) {
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
reference, err := gojsonreference.NewJsonReference(l.JsonSource().(string))
|
reference, err := gojsonreference.NewJsonReference(l.jsonSource().(string))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -138,7 +79,7 @@ func (l *jsonReferenceLoader) LoadJSON() (interface{}, error) {
|
|||||||
|
|
||||||
if reference.HasFileScheme {
|
if reference.HasFileScheme {
|
||||||
|
|
||||||
filename := strings.Replace(refToUrl.GetUrl().Path, "file://", "", -1)
|
filename := strings.Replace(refToUrl.String(), "file://", "", -1)
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
// on Windows, a file URL may have an extra leading slash, use slashes
|
// on Windows, a file URL may have an extra leading slash, use slashes
|
||||||
// instead of backslashes, and have spaces escaped
|
// instead of backslashes, and have spaces escaped
|
||||||
@ -146,6 +87,7 @@ func (l *jsonReferenceLoader) LoadJSON() (interface{}, error) {
|
|||||||
filename = filename[1:]
|
filename = filename[1:]
|
||||||
}
|
}
|
||||||
filename = filepath.FromSlash(filename)
|
filename = filepath.FromSlash(filename)
|
||||||
|
filename = strings.Replace(filename, "%20", " ", -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
document, err = l.loadFromFile(filename)
|
document, err = l.loadFromFile(filename)
|
||||||
@ -166,6 +108,33 @@ func (l *jsonReferenceLoader) LoadJSON() (interface{}, error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *jsonReferenceLoader) loadSchema() (*Schema, error) {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
|
||||||
|
d := Schema{}
|
||||||
|
d.pool = newSchemaPool()
|
||||||
|
d.referencePool = newSchemaReferencePool()
|
||||||
|
|
||||||
|
d.documentReference, err = gojsonreference.NewJsonReference(l.jsonSource().(string))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
spd, err := d.pool.GetDocument(d.documentReference)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = d.parse(spd.Document)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (l *jsonReferenceLoader) loadFromHTTP(address string) (interface{}, error) {
|
func (l *jsonReferenceLoader) loadFromHTTP(address string) (interface{}, error) {
|
||||||
|
|
||||||
resp, err := http.Get(address)
|
resp, err := http.Get(address)
|
||||||
@ -175,7 +144,7 @@ func (l *jsonReferenceLoader) loadFromHTTP(address string) (interface{}, error)
|
|||||||
|
|
||||||
// must return HTTP Status 200 OK
|
// must return HTTP Status 200 OK
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return nil, errors.New(formatErrorDescription(Locale.HttpBadStatus(), ErrorDetails{"status": resp.Status}))
|
return nil, errors.New(formatErrorDescription(Locale.httpBadStatus(), ErrorDetails{"status": resp.Status}))
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyBuff, err := ioutil.ReadAll(resp.Body)
|
bodyBuff, err := ioutil.ReadAll(resp.Body)
|
||||||
@ -188,13 +157,8 @@ func (l *jsonReferenceLoader) loadFromHTTP(address string) (interface{}, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonReferenceLoader) loadFromFile(path string) (interface{}, error) {
|
func (l *jsonReferenceLoader) loadFromFile(path string) (interface{}, error) {
|
||||||
f, err := l.fs.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
bodyBuff, err := ioutil.ReadAll(f)
|
bodyBuff, err := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -209,52 +173,45 @@ type jsonStringLoader struct {
|
|||||||
source string
|
source string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonStringLoader) JsonSource() interface{} {
|
func (l *jsonStringLoader) jsonSource() interface{} {
|
||||||
return l.source
|
return l.source
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonStringLoader) JsonReference() (gojsonreference.JsonReference, error) {
|
|
||||||
return gojsonreference.NewJsonReference("#")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *jsonStringLoader) LoaderFactory() JSONLoaderFactory {
|
|
||||||
return &DefaultJSONLoaderFactory{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewStringLoader(source string) *jsonStringLoader {
|
func NewStringLoader(source string) *jsonStringLoader {
|
||||||
return &jsonStringLoader{source: source}
|
return &jsonStringLoader{source: source}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonStringLoader) LoadJSON() (interface{}, error) {
|
func (l *jsonStringLoader) loadJSON() (interface{}, error) {
|
||||||
|
|
||||||
return decodeJsonUsingNumber(strings.NewReader(l.JsonSource().(string)))
|
return decodeJsonUsingNumber(strings.NewReader(l.jsonSource().(string)))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON bytes loader
|
func (l *jsonStringLoader) loadSchema() (*Schema, error) {
|
||||||
|
|
||||||
type jsonBytesLoader struct {
|
var err error
|
||||||
source []byte
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *jsonBytesLoader) JsonSource() interface{} {
|
document, err := l.loadJSON()
|
||||||
return l.source
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
func (l *jsonBytesLoader) JsonReference() (gojsonreference.JsonReference, error) {
|
d := Schema{}
|
||||||
return gojsonreference.NewJsonReference("#")
|
d.pool = newSchemaPool()
|
||||||
}
|
d.referencePool = newSchemaReferencePool()
|
||||||
|
d.documentReference, err = gojsonreference.NewJsonReference("#")
|
||||||
|
d.pool.SetStandaloneDocument(document)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
func (l *jsonBytesLoader) LoaderFactory() JSONLoaderFactory {
|
err = d.parse(document)
|
||||||
return &DefaultJSONLoaderFactory{}
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
func NewBytesLoader(source []byte) *jsonBytesLoader {
|
return &d, nil
|
||||||
return &jsonBytesLoader{source: source}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *jsonBytesLoader) LoadJSON() (interface{}, error) {
|
|
||||||
return decodeJsonUsingNumber(bytes.NewReader(l.JsonSource().([]byte)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON Go (types) loader
|
// JSON Go (types) loader
|
||||||
@ -264,27 +221,19 @@ type jsonGoLoader struct {
|
|||||||
source interface{}
|
source interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonGoLoader) JsonSource() interface{} {
|
func (l *jsonGoLoader) jsonSource() interface{} {
|
||||||
return l.source
|
return l.source
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonGoLoader) JsonReference() (gojsonreference.JsonReference, error) {
|
|
||||||
return gojsonreference.NewJsonReference("#")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *jsonGoLoader) LoaderFactory() JSONLoaderFactory {
|
|
||||||
return &DefaultJSONLoaderFactory{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewGoLoader(source interface{}) *jsonGoLoader {
|
func NewGoLoader(source interface{}) *jsonGoLoader {
|
||||||
return &jsonGoLoader{source: source}
|
return &jsonGoLoader{source: source}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonGoLoader) LoadJSON() (interface{}, error) {
|
func (l *jsonGoLoader) loadJSON() (interface{}, error) {
|
||||||
|
|
||||||
// convert it to a compliant JSON first to avoid types "mismatches"
|
// convert it to a compliant JSON first to avoid types "mismatches"
|
||||||
|
|
||||||
jsonBytes, err := json.Marshal(l.JsonSource())
|
jsonBytes, err := json.Marshal(l.jsonSource())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -293,34 +242,31 @@ func (l *jsonGoLoader) LoadJSON() (interface{}, error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type jsonIOLoader struct {
|
func (l *jsonGoLoader) loadSchema() (*Schema, error) {
|
||||||
buf *bytes.Buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewReaderLoader(source io.Reader) (*jsonIOLoader, io.Reader) {
|
var err error
|
||||||
buf := &bytes.Buffer{}
|
|
||||||
return &jsonIOLoader{buf: buf}, io.TeeReader(source, buf)
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWriterLoader(source io.Writer) (*jsonIOLoader, io.Writer) {
|
document, err := l.loadJSON()
|
||||||
buf := &bytes.Buffer{}
|
if err != nil {
|
||||||
return &jsonIOLoader{buf: buf}, io.MultiWriter(source, buf)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonIOLoader) JsonSource() interface{} {
|
d := Schema{}
|
||||||
return l.buf.String()
|
d.pool = newSchemaPool()
|
||||||
}
|
d.referencePool = newSchemaReferencePool()
|
||||||
|
d.documentReference, err = gojsonreference.NewJsonReference("#")
|
||||||
|
d.pool.SetStandaloneDocument(document)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
func (l *jsonIOLoader) LoadJSON() (interface{}, error) {
|
err = d.parse(document)
|
||||||
return decodeJsonUsingNumber(l.buf)
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
func (l *jsonIOLoader) JsonReference() (gojsonreference.JsonReference, error) {
|
return &d, nil
|
||||||
return gojsonreference.NewJsonReference("#")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *jsonIOLoader) LoaderFactory() JSONLoaderFactory {
|
|
||||||
return &DefaultJSONLoaderFactory{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeJsonUsingNumber(r io.Reader) (interface{}, error) {
|
func decodeJsonUsingNumber(r io.Reader) (interface{}, error) {
|
||||||
|
|||||||
89
vendor/github.com/xeipuuv/gojsonschema/locales.go
generated
vendored
89
vendor/github.com/xeipuuv/gojsonschema/locales.go
generated
vendored
@ -26,7 +26,7 @@
|
|||||||
package gojsonschema
|
package gojsonschema
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// locale is an interface for defining custom error strings
|
// locale is an interface for definining custom error strings
|
||||||
locale interface {
|
locale interface {
|
||||||
Required() string
|
Required() string
|
||||||
InvalidType() string
|
InvalidType() string
|
||||||
@ -37,7 +37,6 @@ type (
|
|||||||
MissingDependency() string
|
MissingDependency() string
|
||||||
Internal() string
|
Internal() string
|
||||||
Enum() string
|
Enum() string
|
||||||
ArrayNotEnoughItems() string
|
|
||||||
ArrayNoAdditionalItems() string
|
ArrayNoAdditionalItems() string
|
||||||
ArrayMinItems() string
|
ArrayMinItems() string
|
||||||
ArrayMaxItems() string
|
ArrayMaxItems() string
|
||||||
@ -73,7 +72,7 @@ type (
|
|||||||
ReferenceMustBeCanonical() string
|
ReferenceMustBeCanonical() string
|
||||||
NotAValidType() string
|
NotAValidType() string
|
||||||
Duplicated() string
|
Duplicated() string
|
||||||
HttpBadStatus() string
|
httpBadStatus() string
|
||||||
|
|
||||||
// ErrorFormat
|
// ErrorFormat
|
||||||
ErrorFormat() string
|
ErrorFormat() string
|
||||||
@ -84,11 +83,11 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (l DefaultLocale) Required() string {
|
func (l DefaultLocale) Required() string {
|
||||||
return `{{.property}} is required`
|
return `%property% is required`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) InvalidType() string {
|
func (l DefaultLocale) InvalidType() string {
|
||||||
return `Invalid type. Expected: {{.expected}}, given: {{.given}}`
|
return `Invalid type. Expected: %expected%, given: %given%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) NumberAnyOf() string {
|
func (l DefaultLocale) NumberAnyOf() string {
|
||||||
@ -108,161 +107,157 @@ func (l DefaultLocale) NumberNot() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) MissingDependency() string {
|
func (l DefaultLocale) MissingDependency() string {
|
||||||
return `Has a dependency on {{.dependency}}`
|
return `Has a dependency on %dependency%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) Internal() string {
|
func (l DefaultLocale) Internal() string {
|
||||||
return `Internal Error {{.error}}`
|
return `Internal Error %error%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) Enum() string {
|
func (l DefaultLocale) Enum() string {
|
||||||
return `{{.field}} must be one of the following: {{.allowed}}`
|
return `%field% must be one of the following: %allowed%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) ArrayNoAdditionalItems() string {
|
func (l DefaultLocale) ArrayNoAdditionalItems() string {
|
||||||
return `No additional items allowed on array`
|
return `No additional items allowed on array`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) ArrayNotEnoughItems() string {
|
|
||||||
return `Not enough items on array to match positional list of schema`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l DefaultLocale) ArrayMinItems() string {
|
func (l DefaultLocale) ArrayMinItems() string {
|
||||||
return `Array must have at least {{.min}} items`
|
return `Array must have at least %min% items`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) ArrayMaxItems() string {
|
func (l DefaultLocale) ArrayMaxItems() string {
|
||||||
return `Array must have at most {{.max}} items`
|
return `Array must have at most %max% items`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) Unique() string {
|
func (l DefaultLocale) Unique() string {
|
||||||
return `{{.type}} items must be unique`
|
return `%type% items must be unique`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) ArrayMinProperties() string {
|
func (l DefaultLocale) ArrayMinProperties() string {
|
||||||
return `Must have at least {{.min}} properties`
|
return `Must have at least %min% properties`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) ArrayMaxProperties() string {
|
func (l DefaultLocale) ArrayMaxProperties() string {
|
||||||
return `Must have at most {{.max}} properties`
|
return `Must have at most %max% properties`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) AdditionalPropertyNotAllowed() string {
|
func (l DefaultLocale) AdditionalPropertyNotAllowed() string {
|
||||||
return `Additional property {{.property}} is not allowed`
|
return `Additional property %property% is not allowed`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) InvalidPropertyPattern() string {
|
func (l DefaultLocale) InvalidPropertyPattern() string {
|
||||||
return `Property "{{.property}}" does not match pattern {{.pattern}}`
|
return `Property "%property%" does not match pattern %pattern%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) StringGTE() string {
|
func (l DefaultLocale) StringGTE() string {
|
||||||
return `String length must be greater than or equal to {{.min}}`
|
return `String length must be greater than or equal to %min%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) StringLTE() string {
|
func (l DefaultLocale) StringLTE() string {
|
||||||
return `String length must be less than or equal to {{.max}}`
|
return `String length must be less than or equal to %max%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) DoesNotMatchPattern() string {
|
func (l DefaultLocale) DoesNotMatchPattern() string {
|
||||||
return `Does not match pattern '{{.pattern}}'`
|
return `Does not match pattern '%pattern%'`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) DoesNotMatchFormat() string {
|
func (l DefaultLocale) DoesNotMatchFormat() string {
|
||||||
return `Does not match format '{{.format}}'`
|
return `Does not match format '%format%'`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) MultipleOf() string {
|
func (l DefaultLocale) MultipleOf() string {
|
||||||
return `Must be a multiple of {{.multiple}}`
|
return `Must be a multiple of %multiple%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) NumberGTE() string {
|
func (l DefaultLocale) NumberGTE() string {
|
||||||
return `Must be greater than or equal to {{.min}}`
|
return `Must be greater than or equal to %min%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) NumberGT() string {
|
func (l DefaultLocale) NumberGT() string {
|
||||||
return `Must be greater than {{.min}}`
|
return `Must be greater than %min%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) NumberLTE() string {
|
func (l DefaultLocale) NumberLTE() string {
|
||||||
return `Must be less than or equal to {{.max}}`
|
return `Must be less than or equal to %max%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) NumberLT() string {
|
func (l DefaultLocale) NumberLT() string {
|
||||||
return `Must be less than {{.max}}`
|
return `Must be less than %max%`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schema validators
|
// Schema validators
|
||||||
func (l DefaultLocale) RegexPattern() string {
|
func (l DefaultLocale) RegexPattern() string {
|
||||||
return `Invalid regex pattern '{{.pattern}}'`
|
return `Invalid regex pattern '%pattern%'`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) GreaterThanZero() string {
|
func (l DefaultLocale) GreaterThanZero() string {
|
||||||
return `{{.number}} must be strictly greater than 0`
|
return `%number% must be strictly greater than 0`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) MustBeOfA() string {
|
func (l DefaultLocale) MustBeOfA() string {
|
||||||
return `{{.x}} must be of a {{.y}}`
|
return `%x% must be of a %y%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) MustBeOfAn() string {
|
func (l DefaultLocale) MustBeOfAn() string {
|
||||||
return `{{.x}} must be of an {{.y}}`
|
return `%x% must be of an %y%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) CannotBeUsedWithout() string {
|
func (l DefaultLocale) CannotBeUsedWithout() string {
|
||||||
return `{{.x}} cannot be used without {{.y}}`
|
return `%x% cannot be used without %y%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) CannotBeGT() string {
|
func (l DefaultLocale) CannotBeGT() string {
|
||||||
return `{{.x}} cannot be greater than {{.y}}`
|
return `%x% cannot be greater than %y%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) MustBeOfType() string {
|
func (l DefaultLocale) MustBeOfType() string {
|
||||||
return `{{.key}} must be of type {{.type}}`
|
return `%key% must be of type %type%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) MustBeValidRegex() string {
|
func (l DefaultLocale) MustBeValidRegex() string {
|
||||||
return `{{.key}} must be a valid regex`
|
return `%key% must be a valid regex`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) MustBeValidFormat() string {
|
func (l DefaultLocale) MustBeValidFormat() string {
|
||||||
return `{{.key}} must be a valid format {{.given}}`
|
return `%key% must be a valid format %given%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) MustBeGTEZero() string {
|
func (l DefaultLocale) MustBeGTEZero() string {
|
||||||
return `{{.key}} must be greater than or equal to 0`
|
return `%key% must be greater than or equal to 0`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) KeyCannotBeGreaterThan() string {
|
func (l DefaultLocale) KeyCannotBeGreaterThan() string {
|
||||||
return `{{.key}} cannot be greater than {{.y}}`
|
return `%key% cannot be greater than %y%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) KeyItemsMustBeOfType() string {
|
func (l DefaultLocale) KeyItemsMustBeOfType() string {
|
||||||
return `{{.key}} items must be {{.type}}`
|
return `%key% items must be %type%`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) KeyItemsMustBeUnique() string {
|
func (l DefaultLocale) KeyItemsMustBeUnique() string {
|
||||||
return `{{.key}} items must be unique`
|
return `%key% items must be unique`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) ReferenceMustBeCanonical() string {
|
func (l DefaultLocale) ReferenceMustBeCanonical() string {
|
||||||
return `Reference {{.reference}} must be canonical`
|
return `Reference %reference% must be canonical`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) NotAValidType() string {
|
func (l DefaultLocale) NotAValidType() string {
|
||||||
return `{{.type}} is not a valid type -- `
|
return `%type% is not a valid type -- `
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) Duplicated() string {
|
func (l DefaultLocale) Duplicated() string {
|
||||||
return `{{.type}} type is duplicated`
|
return `%type% type is duplicated`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l DefaultLocale) HttpBadStatus() string {
|
func (l DefaultLocale) httpBadStatus() string {
|
||||||
return `Could not read schema from HTTP, response status is {{.status}}`
|
return `Could not read schema from HTTP, response status is %status%`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replacement options: field, description, context, value
|
// Replacement options: field, description, context, value
|
||||||
func (l DefaultLocale) ErrorFormat() string {
|
func (l DefaultLocale) ErrorFormat() string {
|
||||||
return `{{.field}}: {{.description}}`
|
return `%field%: %description%`
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
3
vendor/github.com/xeipuuv/gojsonschema/result.go
generated
vendored
3
vendor/github.com/xeipuuv/gojsonschema/result.go
generated
vendored
@ -48,7 +48,6 @@ type (
|
|||||||
Value() interface{}
|
Value() interface{}
|
||||||
SetDetails(ErrorDetails)
|
SetDetails(ErrorDetails)
|
||||||
Details() ErrorDetails
|
Details() ErrorDetails
|
||||||
String() string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResultErrorFields holds the fields for each ResultError implementation.
|
// ResultErrorFields holds the fields for each ResultError implementation.
|
||||||
@ -127,7 +126,7 @@ func (v ResultErrorFields) String() string {
|
|||||||
valueString := fmt.Sprintf("%v", v.value)
|
valueString := fmt.Sprintf("%v", v.value)
|
||||||
|
|
||||||
// marshal the go value value to json
|
// marshal the go value value to json
|
||||||
if v.value == nil {
|
if v.Value == nil {
|
||||||
valueString = TYPE_NULL
|
valueString = TYPE_NULL
|
||||||
} else {
|
} else {
|
||||||
if vs, err := marshalToJsonString(v.value); err == nil {
|
if vs, err := marshalToJsonString(v.value); err == nil {
|
||||||
|
|||||||
86
vendor/github.com/xeipuuv/gojsonschema/schema.go
generated
vendored
86
vendor/github.com/xeipuuv/gojsonschema/schema.go
generated
vendored
@ -42,39 +42,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewSchema(l JSONLoader) (*Schema, error) {
|
func NewSchema(l JSONLoader) (*Schema, error) {
|
||||||
ref, err := l.JsonReference()
|
return l.loadSchema()
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
d := Schema{}
|
|
||||||
d.pool = newSchemaPool(l.LoaderFactory())
|
|
||||||
d.documentReference = ref
|
|
||||||
d.referencePool = newSchemaReferencePool()
|
|
||||||
|
|
||||||
var doc interface{}
|
|
||||||
if ref.String() != "" {
|
|
||||||
// Get document from schema pool
|
|
||||||
spd, err := d.pool.GetDocument(d.documentReference)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
doc = spd.Document
|
|
||||||
} else {
|
|
||||||
// Load JSON directly
|
|
||||||
doc, err = l.LoadJSON()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
d.pool.SetStandaloneDocument(doc)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = d.parse(doc)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &d, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Schema struct {
|
type Schema struct {
|
||||||
@ -148,27 +116,14 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
}
|
}
|
||||||
if k, ok := m[KEY_REF].(string); ok {
|
if k, ok := m[KEY_REF].(string); ok {
|
||||||
|
|
||||||
jsonReference, err := gojsonreference.NewJsonReference(k)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if jsonReference.HasFullUrl {
|
|
||||||
currentSchema.ref = &jsonReference
|
|
||||||
} else {
|
|
||||||
inheritedReference, err := currentSchema.ref.Inherits(jsonReference)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
currentSchema.ref = inheritedReference
|
|
||||||
}
|
|
||||||
|
|
||||||
if sch, ok := d.referencePool.Get(currentSchema.ref.String() + k); ok {
|
if sch, ok := d.referencePool.Get(currentSchema.ref.String() + k); ok {
|
||||||
|
|
||||||
currentSchema.refSchema = sch
|
currentSchema.refSchema = sch
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
err := d.parseReference(documentNode, currentSchema, k)
|
|
||||||
|
var err error
|
||||||
|
err = d.parseReference(documentNode, currentSchema, k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -800,11 +755,31 @@ func (d *Schema) parseSchema(documentNode interface{}, currentSchema *subSchema)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Schema) parseReference(documentNode interface{}, currentSchema *subSchema, reference string) error {
|
func (d *Schema) parseReference(documentNode interface{}, currentSchema *subSchema, reference string) (e error) {
|
||||||
var refdDocumentNode interface{}
|
|
||||||
jsonPointer := currentSchema.ref.GetPointer()
|
var err error
|
||||||
|
|
||||||
|
jsonReference, err := gojsonreference.NewJsonReference(reference)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
standaloneDocument := d.pool.GetStandaloneDocument()
|
standaloneDocument := d.pool.GetStandaloneDocument()
|
||||||
|
|
||||||
|
if jsonReference.HasFullUrl {
|
||||||
|
currentSchema.ref = &jsonReference
|
||||||
|
} else {
|
||||||
|
inheritedReference, err := currentSchema.ref.Inherits(jsonReference)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
currentSchema.ref = inheritedReference
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonPointer := currentSchema.ref.GetPointer()
|
||||||
|
|
||||||
|
var refdDocumentNode interface{}
|
||||||
|
|
||||||
if standaloneDocument != nil {
|
if standaloneDocument != nil {
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
@ -814,6 +789,8 @@ func (d *Schema) parseReference(documentNode interface{}, currentSchema *subSche
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
var err error
|
||||||
dsp, err := d.pool.GetDocument(*currentSchema.ref)
|
dsp, err := d.pool.GetDocument(*currentSchema.ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -835,10 +812,11 @@ func (d *Schema) parseReference(documentNode interface{}, currentSchema *subSche
|
|||||||
|
|
||||||
// returns the loaded referenced subSchema for the caller to update its current subSchema
|
// returns the loaded referenced subSchema for the caller to update its current subSchema
|
||||||
newSchemaDocument := refdDocumentNode.(map[string]interface{})
|
newSchemaDocument := refdDocumentNode.(map[string]interface{})
|
||||||
|
|
||||||
newSchema := &subSchema{property: KEY_REF, parent: currentSchema, ref: currentSchema.ref}
|
newSchema := &subSchema{property: KEY_REF, parent: currentSchema, ref: currentSchema.ref}
|
||||||
d.referencePool.Add(currentSchema.ref.String()+reference, newSchema)
|
d.referencePool.Add(currentSchema.ref.String()+reference, newSchema)
|
||||||
|
|
||||||
err := d.parseSchema(newSchemaDocument, newSchema)
|
err = d.parseSchema(newSchemaDocument, newSchema)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
8
vendor/github.com/xeipuuv/gojsonschema/schemaPool.go
generated
vendored
8
vendor/github.com/xeipuuv/gojsonschema/schemaPool.go
generated
vendored
@ -39,15 +39,13 @@ type schemaPoolDocument struct {
|
|||||||
type schemaPool struct {
|
type schemaPool struct {
|
||||||
schemaPoolDocuments map[string]*schemaPoolDocument
|
schemaPoolDocuments map[string]*schemaPoolDocument
|
||||||
standaloneDocument interface{}
|
standaloneDocument interface{}
|
||||||
jsonLoaderFactory JSONLoaderFactory
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newSchemaPool(f JSONLoaderFactory) *schemaPool {
|
func newSchemaPool() *schemaPool {
|
||||||
|
|
||||||
p := &schemaPool{}
|
p := &schemaPool{}
|
||||||
p.schemaPoolDocuments = make(map[string]*schemaPoolDocument)
|
p.schemaPoolDocuments = make(map[string]*schemaPoolDocument)
|
||||||
p.standaloneDocument = nil
|
p.standaloneDocument = nil
|
||||||
p.jsonLoaderFactory = f
|
|
||||||
|
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
@ -95,8 +93,8 @@ func (p *schemaPool) GetDocument(reference gojsonreference.JsonReference) (*sche
|
|||||||
return spd, nil
|
return spd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonReferenceLoader := p.jsonLoaderFactory.New(reference.String())
|
jsonReferenceLoader := NewReferenceLoader(reference.String())
|
||||||
document, err := jsonReferenceLoader.LoadJSON()
|
document, err := jsonReferenceLoader.loadJSON()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
2
vendor/github.com/xeipuuv/gojsonschema/subSchema.go
generated
vendored
2
vendor/github.com/xeipuuv/gojsonschema/subSchema.go
generated
vendored
@ -214,7 +214,7 @@ func (s *subSchema) PatternPropertiesString() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
patternPropertiesKeySlice := []string{}
|
patternPropertiesKeySlice := []string{}
|
||||||
for pk := range s.patternProperties {
|
for pk, _ := range s.patternProperties {
|
||||||
patternPropertiesKeySlice = append(patternPropertiesKeySlice, `"`+pk+`"`)
|
patternPropertiesKeySlice = append(patternPropertiesKeySlice, `"`+pk+`"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
vendor/github.com/xeipuuv/gojsonschema/utils.go
generated
vendored
14
vendor/github.com/xeipuuv/gojsonschema/utils.go
generated
vendored
@ -34,12 +34,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func isKind(what interface{}, kind reflect.Kind) bool {
|
func isKind(what interface{}, kind reflect.Kind) bool {
|
||||||
target := what
|
return reflect.ValueOf(what).Kind() == kind
|
||||||
if isJsonNumber(what) {
|
|
||||||
// JSON Numbers are strings!
|
|
||||||
target = *mustBeNumber(what)
|
|
||||||
}
|
|
||||||
return reflect.ValueOf(target).Kind() == kind
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func existsMapKey(m map[string]interface{}, k string) bool {
|
func existsMapKey(m map[string]interface{}, k string) bool {
|
||||||
@ -82,14 +77,13 @@ func checkJsonNumber(what interface{}) (isValidFloat64 bool, isValidInt64 bool,
|
|||||||
|
|
||||||
jsonNumber := what.(json.Number)
|
jsonNumber := what.(json.Number)
|
||||||
|
|
||||||
f64, errFloat64 := jsonNumber.Float64()
|
_, errFloat64 := jsonNumber.Float64()
|
||||||
s64 := strconv.FormatFloat(f64, 'f', -1, 64)
|
_, errInt64 := jsonNumber.Int64()
|
||||||
_, errInt64 := strconv.ParseInt(s64, 10, 64)
|
|
||||||
|
|
||||||
isValidFloat64 = errFloat64 == nil
|
isValidFloat64 = errFloat64 == nil
|
||||||
isValidInt64 = errInt64 == nil
|
isValidInt64 = errInt64 == nil
|
||||||
|
|
||||||
_, errInt32 := strconv.ParseInt(s64, 10, 32)
|
_, errInt32 := strconv.ParseInt(jsonNumber.String(), 10, 32)
|
||||||
isValidInt32 = isValidInt64 && errInt32 == nil
|
isValidInt32 = isValidInt64 && errInt32 == nil
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
43
vendor/github.com/xeipuuv/gojsonschema/validation.go
generated
vendored
43
vendor/github.com/xeipuuv/gojsonschema/validation.go
generated
vendored
@ -55,7 +55,7 @@ func (v *Schema) Validate(l JSONLoader) (*Result, error) {
|
|||||||
|
|
||||||
// load document
|
// load document
|
||||||
|
|
||||||
root, err := l.LoadJSON()
|
root, err := l.loadJSON()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -412,7 +412,7 @@ func (v *subSchema) validateArray(currentSubSchema *subSchema, value []interface
|
|||||||
internalLog(" %v", value)
|
internalLog(" %v", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
nbValues := len(value)
|
nbItems := len(value)
|
||||||
|
|
||||||
// TODO explain
|
// TODO explain
|
||||||
if currentSubSchema.itemsChildrenIsSingleSchema {
|
if currentSubSchema.itemsChildrenIsSingleSchema {
|
||||||
@ -425,18 +425,15 @@ func (v *subSchema) validateArray(currentSubSchema *subSchema, value []interface
|
|||||||
if currentSubSchema.itemsChildren != nil && len(currentSubSchema.itemsChildren) > 0 {
|
if currentSubSchema.itemsChildren != nil && len(currentSubSchema.itemsChildren) > 0 {
|
||||||
|
|
||||||
nbItems := len(currentSubSchema.itemsChildren)
|
nbItems := len(currentSubSchema.itemsChildren)
|
||||||
|
nbValues := len(value)
|
||||||
|
|
||||||
// while we have both schemas and values, check them against each other
|
if nbItems == nbValues {
|
||||||
for i := 0; i != nbItems && i != nbValues; i++ {
|
for i := 0; i != nbItems; i++ {
|
||||||
subContext := newJsonContext(strconv.Itoa(i), context)
|
subContext := newJsonContext(strconv.Itoa(i), context)
|
||||||
validationResult := currentSubSchema.itemsChildren[i].subValidateWithContext(value[i], subContext)
|
validationResult := currentSubSchema.itemsChildren[i].subValidateWithContext(value[i], subContext)
|
||||||
result.mergeErrors(validationResult)
|
result.mergeErrors(validationResult)
|
||||||
}
|
}
|
||||||
|
} else if nbItems < nbValues {
|
||||||
if nbItems < nbValues {
|
|
||||||
// we have less schemas than elements in the instance array,
|
|
||||||
// but that might be ok if "additionalItems" is specified.
|
|
||||||
|
|
||||||
switch currentSubSchema.additionalItems.(type) {
|
switch currentSubSchema.additionalItems.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
if !currentSubSchema.additionalItems.(bool) {
|
if !currentSubSchema.additionalItems.(bool) {
|
||||||
@ -456,7 +453,7 @@ func (v *subSchema) validateArray(currentSubSchema *subSchema, value []interface
|
|||||||
|
|
||||||
// minItems & maxItems
|
// minItems & maxItems
|
||||||
if currentSubSchema.minItems != nil {
|
if currentSubSchema.minItems != nil {
|
||||||
if nbValues < int(*currentSubSchema.minItems) {
|
if nbItems < int(*currentSubSchema.minItems) {
|
||||||
result.addError(
|
result.addError(
|
||||||
new(ArrayMinItemsError),
|
new(ArrayMinItemsError),
|
||||||
context,
|
context,
|
||||||
@ -466,7 +463,7 @@ func (v *subSchema) validateArray(currentSubSchema *subSchema, value []interface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if currentSubSchema.maxItems != nil {
|
if currentSubSchema.maxItems != nil {
|
||||||
if nbValues > int(*currentSubSchema.maxItems) {
|
if nbItems > int(*currentSubSchema.maxItems) {
|
||||||
result.addError(
|
result.addError(
|
||||||
new(ArrayMaxItemsError),
|
new(ArrayMaxItemsError),
|
||||||
context,
|
context,
|
||||||
@ -779,22 +776,22 @@ func (v *subSchema) validateNumber(currentSubSchema *subSchema, value interface{
|
|||||||
if currentSubSchema.exclusiveMaximum {
|
if currentSubSchema.exclusiveMaximum {
|
||||||
if float64Value >= *currentSubSchema.maximum {
|
if float64Value >= *currentSubSchema.maximum {
|
||||||
result.addError(
|
result.addError(
|
||||||
new(NumberLTError),
|
new(NumberLTEError),
|
||||||
context,
|
context,
|
||||||
resultErrorFormatJsonNumber(number),
|
resultErrorFormatJsonNumber(number),
|
||||||
ErrorDetails{
|
ErrorDetails{
|
||||||
"max": resultErrorFormatNumber(*currentSubSchema.maximum),
|
"min": resultErrorFormatNumber(*currentSubSchema.maximum),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if float64Value > *currentSubSchema.maximum {
|
if float64Value > *currentSubSchema.maximum {
|
||||||
result.addError(
|
result.addError(
|
||||||
new(NumberLTEError),
|
new(NumberLTError),
|
||||||
context,
|
context,
|
||||||
resultErrorFormatJsonNumber(number),
|
resultErrorFormatJsonNumber(number),
|
||||||
ErrorDetails{
|
ErrorDetails{
|
||||||
"max": resultErrorFormatNumber(*currentSubSchema.maximum),
|
"min": resultErrorFormatNumber(*currentSubSchema.maximum),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -806,22 +803,22 @@ func (v *subSchema) validateNumber(currentSubSchema *subSchema, value interface{
|
|||||||
if currentSubSchema.exclusiveMinimum {
|
if currentSubSchema.exclusiveMinimum {
|
||||||
if float64Value <= *currentSubSchema.minimum {
|
if float64Value <= *currentSubSchema.minimum {
|
||||||
result.addError(
|
result.addError(
|
||||||
new(NumberGTError),
|
new(NumberGTEError),
|
||||||
context,
|
context,
|
||||||
resultErrorFormatJsonNumber(number),
|
resultErrorFormatJsonNumber(number),
|
||||||
ErrorDetails{
|
ErrorDetails{
|
||||||
"min": resultErrorFormatNumber(*currentSubSchema.minimum),
|
"max": resultErrorFormatNumber(*currentSubSchema.minimum),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if float64Value < *currentSubSchema.minimum {
|
if float64Value < *currentSubSchema.minimum {
|
||||||
result.addError(
|
result.addError(
|
||||||
new(NumberGTEError),
|
new(NumberGTError),
|
||||||
context,
|
context,
|
||||||
resultErrorFormatJsonNumber(number),
|
resultErrorFormatJsonNumber(number),
|
||||||
ErrorDetails{
|
ErrorDetails{
|
||||||
"min": resultErrorFormatNumber(*currentSubSchema.minimum),
|
"max": resultErrorFormatNumber(*currentSubSchema.minimum),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
10
vendor/golang.org/x/sys/unix/asm.s
generated
vendored
Normal file
10
vendor/golang.org/x/sys/unix/asm.s
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !gccgo
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
TEXT ·use(SB),NOSPLIT,$0
|
||||||
|
RET
|
||||||
@ -1,28 +1,29 @@
|
|||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build linux
|
|
||||||
// +build mips64 mips64le
|
|
||||||
// +build !gccgo
|
// +build !gccgo
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// System calls for mips64, Linux
|
// System call support for 386, FreeBSD
|
||||||
//
|
//
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
// The runtime may know about them.
|
// The runtime may know about them.
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
TEXT ·Syscall(SB),NOSPLIT,$0-32
|
||||||
JMP syscall·Syscall(SB)
|
JMP syscall·Syscall(SB)
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
TEXT ·Syscall6(SB),NOSPLIT,$0-44
|
||||||
JMP syscall·Syscall6(SB)
|
JMP syscall·Syscall6(SB)
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
TEXT ·Syscall9(SB),NOSPLIT,$0-56
|
||||||
|
JMP syscall·Syscall9(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall(SB),NOSPLIT,$0-32
|
||||||
JMP syscall·RawSyscall(SB)
|
JMP syscall·RawSyscall(SB)
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
TEXT ·RawSyscall6(SB),NOSPLIT,$0-44
|
||||||
JMP syscall·RawSyscall6(SB)
|
JMP syscall·RawSyscall6(SB)
|
||||||
31
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
generated
vendored
31
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
generated
vendored
@ -1,31 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build linux
|
|
||||||
// +build mips mipsle
|
|
||||||
// +build !gccgo
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System calls for mips, Linux
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
||||||
28
vendor/golang.org/x/sys/unix/asm_linux_s390x.s
generated
vendored
28
vendor/golang.org/x/sys/unix/asm_linux_s390x.s
generated
vendored
@ -1,28 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build s390x
|
|
||||||
// +build linux
|
|
||||||
// +build !gccgo
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System calls for s390x, Linux
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
BR syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
BR syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
BR syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
BR syscall·RawSyscall6(SB)
|
|
||||||
35
vendor/golang.org/x/sys/unix/bluetooth_linux.go
generated
vendored
35
vendor/golang.org/x/sys/unix/bluetooth_linux.go
generated
vendored
@ -1,35 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// Bluetooth sockets and messages
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
// Bluetooth Protocols
|
|
||||||
const (
|
|
||||||
BTPROTO_L2CAP = 0
|
|
||||||
BTPROTO_HCI = 1
|
|
||||||
BTPROTO_SCO = 2
|
|
||||||
BTPROTO_RFCOMM = 3
|
|
||||||
BTPROTO_BNEP = 4
|
|
||||||
BTPROTO_CMTP = 5
|
|
||||||
BTPROTO_HIDP = 6
|
|
||||||
BTPROTO_AVDTP = 7
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
HCI_CHANNEL_RAW = 0
|
|
||||||
HCI_CHANNEL_USER = 1
|
|
||||||
HCI_CHANNEL_MONITOR = 2
|
|
||||||
HCI_CHANNEL_CONTROL = 3
|
|
||||||
)
|
|
||||||
|
|
||||||
// Socketoption Level
|
|
||||||
const (
|
|
||||||
SOL_BLUETOOTH = 0x112
|
|
||||||
SOL_HCI = 0x0
|
|
||||||
SOL_L2CAP = 0x6
|
|
||||||
SOL_RFCOMM = 0x12
|
|
||||||
SOL_SCO = 0x11
|
|
||||||
)
|
|
||||||
2
vendor/golang.org/x/sys/unix/flock_linux_32bit.go
generated
vendored
2
vendor/golang.org/x/sys/unix/flock_linux_32bit.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
// +build linux,386 linux,arm linux,mips linux,mipsle
|
// +build linux,386 linux,arm
|
||||||
|
|
||||||
// Copyright 2014 The Go Authors. All rights reserved.
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
20
vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go
generated
vendored
20
vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go
generated
vendored
@ -1,20 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gccgo,linux,sparc64
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
//extern sysconf
|
|
||||||
func realSysconf(name int) int64
|
|
||||||
|
|
||||||
func sysconf(name int) (n int64, err syscall.Errno) {
|
|
||||||
r := realSysconf(name)
|
|
||||||
if r < 0 {
|
|
||||||
return 0, syscall.GetErrno()
|
|
||||||
}
|
|
||||||
return r, 0
|
|
||||||
}
|
|
||||||
62
vendor/golang.org/x/sys/unix/mkpost.go
generated
vendored
62
vendor/golang.org/x/sys/unix/mkpost.go
generated
vendored
@ -1,62 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
// mkpost processes the output of cgo -godefs to
|
|
||||||
// modify the generated types. It is used to clean up
|
|
||||||
// the sys API in an architecture specific manner.
|
|
||||||
//
|
|
||||||
// mkpost is run after cgo -godefs by mkall.sh.
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/format"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
b, err := ioutil.ReadAll(os.Stdin)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
s := string(b)
|
|
||||||
|
|
||||||
goarch := os.Getenv("GOARCH")
|
|
||||||
goos := os.Getenv("GOOS")
|
|
||||||
if goarch == "s390x" && goos == "linux" {
|
|
||||||
// Export the types of PtraceRegs fields.
|
|
||||||
re := regexp.MustCompile("ptrace(Psw|Fpregs|Per)")
|
|
||||||
s = re.ReplaceAllString(s, "Ptrace$1")
|
|
||||||
|
|
||||||
// Replace padding fields inserted by cgo with blank identifiers.
|
|
||||||
re = regexp.MustCompile("Pad_cgo[A-Za-z0-9_]*")
|
|
||||||
s = re.ReplaceAllString(s, "_")
|
|
||||||
|
|
||||||
// Replace other unwanted fields with blank identifiers.
|
|
||||||
re = regexp.MustCompile("X_[A-Za-z0-9_]*")
|
|
||||||
s = re.ReplaceAllString(s, "_")
|
|
||||||
|
|
||||||
// Replace the control_regs union with a blank identifier for now.
|
|
||||||
re = regexp.MustCompile("(Control_regs)\\s+\\[0\\]uint64")
|
|
||||||
s = re.ReplaceAllString(s, "_ [0]uint64")
|
|
||||||
}
|
|
||||||
|
|
||||||
// gofmt
|
|
||||||
b, err = format.Source([]byte(s))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append this command to the header to show where the new file
|
|
||||||
// came from.
|
|
||||||
re := regexp.MustCompile("(cgo -godefs [a-zA-Z0-9_]+\\.go.*)")
|
|
||||||
b = re.ReplaceAll(b, []byte("$1 | go run mkpost.go"))
|
|
||||||
|
|
||||||
fmt.Printf("%s", b)
|
|
||||||
}
|
|
||||||
2
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
2
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
@ -62,7 +62,7 @@ func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) {
|
|||||||
|
|
||||||
func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) {
|
func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) {
|
||||||
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||||
if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) {
|
if h.Len < SizeofCmsghdr || int(h.Len) > len(b) {
|
||||||
return nil, nil, EINVAL
|
return nil, nil, EINVAL
|
||||||
}
|
}
|
||||||
return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil
|
return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil
|
||||||
|
|||||||
7
vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
7
vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
@ -21,6 +21,8 @@
|
|||||||
// holds a value of type syscall.Errno.
|
// holds a value of type syscall.Errno.
|
||||||
package unix // import "golang.org/x/sys/unix"
|
package unix // import "golang.org/x/sys/unix"
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
||||||
// containing the text of s. If s contains a NUL byte at any
|
// containing the text of s. If s contains a NUL byte at any
|
||||||
// location, it returns (nil, EINVAL).
|
// location, it returns (nil, EINVAL).
|
||||||
@ -66,4 +68,7 @@ func (tv *Timeval) Nano() int64 {
|
|||||||
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
|
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
|
||||||
}
|
}
|
||||||
|
|
||||||
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
// use is a no-op, but the compiler cannot see that it is.
|
||||||
|
// Calling use(p) ensures that p is kept live until that point.
|
||||||
|
//go:noescape
|
||||||
|
func use(p unsafe.Pointer)
|
||||||
|
|||||||
18
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
18
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
@ -470,11 +470,25 @@ func Sysctl(name string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SysctlArgs(name string, args ...int) (string, error) {
|
func SysctlArgs(name string, args ...int) (string, error) {
|
||||||
buf, err := SysctlRaw(name, args...)
|
mib, err := sysctlmib(name, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
n := len(buf)
|
|
||||||
|
// Find size.
|
||||||
|
n := uintptr(0)
|
||||||
|
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if n == 0 {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read into buffer of that size.
|
||||||
|
buf := make([]byte, n)
|
||||||
|
if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
// Throw away terminating NUL.
|
// Throw away terminating NUL.
|
||||||
if n > 0 && buf[n-1] == '\x00' {
|
if n > 0 && buf[n-1] == '\x00' {
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
@ -21,6 +21,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
@ -23,6 +23,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
@ -19,6 +19,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
@ -21,6 +21,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
63
vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go
generated
vendored
Normal file
63
vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build 386,dragonfly
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Getpagesize() int { return 4096 }
|
||||||
|
|
||||||
|
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||||
|
|
||||||
|
func NsecToTimespec(nsec int64) (ts Timespec) {
|
||||||
|
ts.Sec = int32(nsec / 1e9)
|
||||||
|
ts.Nsec = int32(nsec % 1e9)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
|
nsec += 999 // round up to microsecond
|
||||||
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
tv.Sec = int32(nsec / 1e9)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||||
|
k.Ident = uint32(fd)
|
||||||
|
k.Filter = int16(mode)
|
||||||
|
k.Flags = uint16(flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (iov *Iovec) SetLen(length int) {
|
||||||
|
iov.Len = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msghdr *Msghdr) SetControllen(length int) {
|
||||||
|
msghdr.Controllen = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
|
cmsg.Len = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
var writtenOut uint64 = 0
|
||||||
|
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
|
||||||
|
|
||||||
|
written = int(writtenOut)
|
||||||
|
|
||||||
|
if e1 != 0 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
2
vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
generated
vendored
@ -21,6 +21,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = nsec % 1e9 / 1e3
|
tv.Usec = nsec % 1e9 / 1e3
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
generated
vendored
@ -21,6 +21,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
generated
vendored
@ -21,6 +21,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = nsec % 1e9 / 1e3
|
tv.Usec = nsec % 1e9 / 1e3
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
generated
vendored
@ -21,6 +21,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return tv.Sec*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
260
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
260
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
@ -36,10 +36,10 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
|||||||
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
//sys linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
||||||
|
|
||||||
func Link(oldpath string, newpath string) (err error) {
|
func Link(oldpath string, newpath string) (err error) {
|
||||||
return Linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0)
|
return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Mkdir(path string, mode uint32) (err error) {
|
func Mkdir(path string, mode uint32) (err error) {
|
||||||
@ -60,19 +60,10 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
|
|||||||
return openat(dirfd, path, flags|O_LARGEFILE, mode)
|
return openat(dirfd, path, flags|O_LARGEFILE, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
//sys readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||||
|
|
||||||
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return ppoll(nil, 0, timeout, sigmask)
|
|
||||||
}
|
|
||||||
return ppoll(&fds[0], len(fds), timeout, sigmask)
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
|
||||||
|
|
||||||
func Readlink(path string, buf []byte) (n int, err error) {
|
func Readlink(path string, buf []byte) (n int, err error) {
|
||||||
return Readlinkat(AT_FDCWD, path, buf)
|
return readlinkat(AT_FDCWD, path, buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Rename(oldpath string, newpath string) (err error) {
|
func Rename(oldpath string, newpath string) (err error) {
|
||||||
@ -80,41 +71,34 @@ func Rename(oldpath string, newpath string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Rmdir(path string) error {
|
func Rmdir(path string) error {
|
||||||
return Unlinkat(AT_FDCWD, path, AT_REMOVEDIR)
|
return unlinkat(AT_FDCWD, path, AT_REMOVEDIR)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
//sys symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||||
|
|
||||||
func Symlink(oldpath string, newpath string) (err error) {
|
func Symlink(oldpath string, newpath string) (err error) {
|
||||||
return Symlinkat(oldpath, AT_FDCWD, newpath)
|
return symlinkat(oldpath, AT_FDCWD, newpath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Unlink(path string) error {
|
func Unlink(path string) error {
|
||||||
return Unlinkat(AT_FDCWD, path, 0)
|
return unlinkat(AT_FDCWD, path, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
//sys unlinkat(dirfd int, path string, flags int) (err error)
|
||||||
|
|
||||||
|
func Unlinkat(dirfd int, path string) error {
|
||||||
|
return unlinkat(dirfd, path, 0)
|
||||||
|
}
|
||||||
|
|
||||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||||
|
|
||||||
func Utimes(path string, tv []Timeval) error {
|
func Utimes(path string, tv []Timeval) (err error) {
|
||||||
if tv == nil {
|
if tv == nil {
|
||||||
err := utimensat(AT_FDCWD, path, nil, 0)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return utimes(path, nil)
|
return utimes(path, nil)
|
||||||
}
|
}
|
||||||
if len(tv) != 2 {
|
if len(tv) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
var ts [2]Timespec
|
|
||||||
ts[0] = NsecToTimespec(TimevalToNsec(tv[0]))
|
|
||||||
ts[1] = NsecToTimespec(TimevalToNsec(tv[1]))
|
|
||||||
err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +123,8 @@ func UtimesNano(path string, ts []Timespec) error {
|
|||||||
// in 2.6.22, Released, 8 July 2007) then fall back to utimes
|
// in 2.6.22, Released, 8 July 2007) then fall back to utimes
|
||||||
var tv [2]Timeval
|
var tv [2]Timeval
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
tv[i] = NsecToTimeval(TimespecToNsec(ts[i]))
|
tv[i].Sec = ts[i].Sec
|
||||||
|
tv[i].Usec = ts[i].Nsec / 1000
|
||||||
}
|
}
|
||||||
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||||
}
|
}
|
||||||
@ -398,181 +383,6 @@ func (sa *SockaddrNetlink) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrNetlink, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrNetlink, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type SockaddrHCI struct {
|
|
||||||
Dev uint16
|
|
||||||
Channel uint16
|
|
||||||
raw RawSockaddrHCI
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sa *SockaddrHCI) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|
||||||
sa.raw.Family = AF_BLUETOOTH
|
|
||||||
sa.raw.Dev = sa.Dev
|
|
||||||
sa.raw.Channel = sa.Channel
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrHCI, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SockaddrCAN implements the Sockaddr interface for AF_CAN type sockets.
|
|
||||||
// The RxID and TxID fields are used for transport protocol addressing in
|
|
||||||
// (CAN_TP16, CAN_TP20, CAN_MCNET, and CAN_ISOTP), they can be left with
|
|
||||||
// zero values for CAN_RAW and CAN_BCM sockets as they have no meaning.
|
|
||||||
//
|
|
||||||
// The SockaddrCAN struct must be bound to the socket file descriptor
|
|
||||||
// using Bind before the CAN socket can be used.
|
|
||||||
//
|
|
||||||
// // Read one raw CAN frame
|
|
||||||
// fd, _ := Socket(AF_CAN, SOCK_RAW, CAN_RAW)
|
|
||||||
// addr := &SockaddrCAN{Ifindex: index}
|
|
||||||
// Bind(fd, addr)
|
|
||||||
// frame := make([]byte, 16)
|
|
||||||
// Read(fd, frame)
|
|
||||||
//
|
|
||||||
// The full SocketCAN documentation can be found in the linux kernel
|
|
||||||
// archives at: https://www.kernel.org/doc/Documentation/networking/can.txt
|
|
||||||
type SockaddrCAN struct {
|
|
||||||
Ifindex int
|
|
||||||
RxID uint32
|
|
||||||
TxID uint32
|
|
||||||
raw RawSockaddrCAN
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|
||||||
if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff {
|
|
||||||
return nil, 0, EINVAL
|
|
||||||
}
|
|
||||||
sa.raw.Family = AF_CAN
|
|
||||||
sa.raw.Ifindex = int32(sa.Ifindex)
|
|
||||||
rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
|
|
||||||
for i := 0; i < 4; i++ {
|
|
||||||
sa.raw.Addr[i] = rx[i]
|
|
||||||
}
|
|
||||||
tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
|
|
||||||
for i := 0; i < 4; i++ {
|
|
||||||
sa.raw.Addr[i+4] = tx[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
|
|
||||||
// SockaddrALG enables userspace access to the Linux kernel's cryptography
|
|
||||||
// subsystem. The Type and Name fields specify which type of hash or cipher
|
|
||||||
// should be used with a given socket.
|
|
||||||
//
|
|
||||||
// To create a file descriptor that provides access to a hash or cipher, both
|
|
||||||
// Bind and Accept must be used. Once the setup process is complete, input
|
|
||||||
// data can be written to the socket, processed by the kernel, and then read
|
|
||||||
// back as hash output or ciphertext.
|
|
||||||
//
|
|
||||||
// Here is an example of using an AF_ALG socket with SHA1 hashing.
|
|
||||||
// The initial socket setup process is as follows:
|
|
||||||
//
|
|
||||||
// // Open a socket to perform SHA1 hashing.
|
|
||||||
// fd, _ := unix.Socket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0)
|
|
||||||
// addr := &unix.SockaddrALG{Type: "hash", Name: "sha1"}
|
|
||||||
// unix.Bind(fd, addr)
|
|
||||||
// // Note: unix.Accept does not work at this time; must invoke accept()
|
|
||||||
// // manually using unix.Syscall.
|
|
||||||
// hashfd, _, _ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0)
|
|
||||||
//
|
|
||||||
// Once a file descriptor has been returned from Accept, it may be used to
|
|
||||||
// perform SHA1 hashing. The descriptor is not safe for concurrent use, but
|
|
||||||
// may be re-used repeatedly with subsequent Write and Read operations.
|
|
||||||
//
|
|
||||||
// When hashing a small byte slice or string, a single Write and Read may
|
|
||||||
// be used:
|
|
||||||
//
|
|
||||||
// // Assume hashfd is already configured using the setup process.
|
|
||||||
// hash := os.NewFile(hashfd, "sha1")
|
|
||||||
// // Hash an input string and read the results. Each Write discards
|
|
||||||
// // previous hash state. Read always reads the current state.
|
|
||||||
// b := make([]byte, 20)
|
|
||||||
// for i := 0; i < 2; i++ {
|
|
||||||
// io.WriteString(hash, "Hello, world.")
|
|
||||||
// hash.Read(b)
|
|
||||||
// fmt.Println(hex.EncodeToString(b))
|
|
||||||
// }
|
|
||||||
// // Output:
|
|
||||||
// // 2ae01472317d1935a84797ec1983ae243fc6aa28
|
|
||||||
// // 2ae01472317d1935a84797ec1983ae243fc6aa28
|
|
||||||
//
|
|
||||||
// For hashing larger byte slices, or byte streams such as those read from
|
|
||||||
// a file or socket, use Sendto with MSG_MORE to instruct the kernel to update
|
|
||||||
// the hash digest instead of creating a new one for a given chunk and finalizing it.
|
|
||||||
//
|
|
||||||
// // Assume hashfd and addr are already configured using the setup process.
|
|
||||||
// hash := os.NewFile(hashfd, "sha1")
|
|
||||||
// // Hash the contents of a file.
|
|
||||||
// f, _ := os.Open("/tmp/linux-4.10-rc7.tar.xz")
|
|
||||||
// b := make([]byte, 4096)
|
|
||||||
// for {
|
|
||||||
// n, err := f.Read(b)
|
|
||||||
// if err == io.EOF {
|
|
||||||
// break
|
|
||||||
// }
|
|
||||||
// unix.Sendto(hashfd, b[:n], unix.MSG_MORE, addr)
|
|
||||||
// }
|
|
||||||
// hash.Read(b)
|
|
||||||
// fmt.Println(hex.EncodeToString(b))
|
|
||||||
// // Output: 85cdcad0c06eef66f805ecce353bec9accbeecc5
|
|
||||||
//
|
|
||||||
// For more information, see: http://www.chronox.de/crypto-API/crypto/userspace-if.html.
|
|
||||||
type SockaddrALG struct {
|
|
||||||
Type string
|
|
||||||
Name string
|
|
||||||
Feature uint32
|
|
||||||
Mask uint32
|
|
||||||
raw RawSockaddrALG
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|
||||||
// Leave room for NUL byte terminator.
|
|
||||||
if len(sa.Type) > 13 {
|
|
||||||
return nil, 0, EINVAL
|
|
||||||
}
|
|
||||||
if len(sa.Name) > 63 {
|
|
||||||
return nil, 0, EINVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
sa.raw.Family = AF_ALG
|
|
||||||
sa.raw.Feat = sa.Feature
|
|
||||||
sa.raw.Mask = sa.Mask
|
|
||||||
|
|
||||||
typ, err := ByteSliceFromString(sa.Type)
|
|
||||||
if err != nil {
|
|
||||||
return nil, 0, err
|
|
||||||
}
|
|
||||||
name, err := ByteSliceFromString(sa.Name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
copy(sa.raw.Type[:], typ)
|
|
||||||
copy(sa.raw.Name[:], name)
|
|
||||||
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets.
|
|
||||||
// SockaddrVM provides access to Linux VM sockets: a mechanism that enables
|
|
||||||
// bidirectional communication between a hypervisor and its guest virtual
|
|
||||||
// machines.
|
|
||||||
type SockaddrVM struct {
|
|
||||||
// CID and Port specify a context ID and port address for a VM socket.
|
|
||||||
// Guests have a unique CID, and hosts may have a well-known CID of:
|
|
||||||
// - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
|
|
||||||
// - VMADDR_CID_HOST: refers to other processes on the host.
|
|
||||||
CID uint32
|
|
||||||
Port uint32
|
|
||||||
raw RawSockaddrVM
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|
||||||
sa.raw.Family = AF_VSOCK
|
|
||||||
sa.raw.Port = sa.Port
|
|
||||||
sa.raw.Cid = sa.CID
|
|
||||||
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
|
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
switch rsa.Addr.Family {
|
switch rsa.Addr.Family {
|
||||||
case AF_NETLINK:
|
case AF_NETLINK:
|
||||||
@ -642,14 +452,6 @@ func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||||||
sa.Addr[i] = pp.Addr[i]
|
sa.Addr[i] = pp.Addr[i]
|
||||||
}
|
}
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_VSOCK:
|
|
||||||
pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
|
|
||||||
sa := &SockaddrVM{
|
|
||||||
CID: pp.Cid,
|
|
||||||
Port: pp.Port,
|
|
||||||
}
|
|
||||||
return sa, nil
|
|
||||||
}
|
}
|
||||||
return nil, EAFNOSUPPORT
|
return nil, EAFNOSUPPORT
|
||||||
}
|
}
|
||||||
@ -1046,6 +848,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||||||
//sysnb EpollCreate(size int) (fd int, err error)
|
//sysnb EpollCreate(size int) (fd int, err error)
|
||||||
//sysnb EpollCreate1(flag int) (fd int, err error)
|
//sysnb EpollCreate1(flag int) (fd int, err error)
|
||||||
//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
|
//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
|
||||||
|
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||||
//sys Exit(code int) = SYS_EXIT_GROUP
|
//sys Exit(code int) = SYS_EXIT_GROUP
|
||||||
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error)
|
//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error)
|
||||||
@ -1068,9 +871,7 @@ func Getpgrp() (pid int) {
|
|||||||
//sysnb Getpid() (pid int)
|
//sysnb Getpid() (pid int)
|
||||||
//sysnb Getppid() (ppid int)
|
//sysnb Getppid() (ppid int)
|
||||||
//sys Getpriority(which int, who int) (prio int, err error)
|
//sys Getpriority(which int, who int) (prio int, err error)
|
||||||
//sys Getrandom(buf []byte, flags int) (n int, err error)
|
|
||||||
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
||||||
//sysnb Getsid(pid int) (sid int, err error)
|
|
||||||
//sysnb Gettid() (tid int)
|
//sysnb Gettid() (tid int)
|
||||||
//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
|
//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
|
||||||
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
|
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
|
||||||
@ -1082,8 +883,9 @@ func Getpgrp() (pid int) {
|
|||||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||||
|
//sys Pause() (err error)
|
||||||
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
|
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
|
||||||
//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
|
//sysnb prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) = SYS_PRLIMIT64
|
||||||
//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
|
//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
//sys Removexattr(path string, attr string) (err error)
|
//sys Removexattr(path string, attr string) (err error)
|
||||||
@ -1093,7 +895,6 @@ func Getpgrp() (pid int) {
|
|||||||
//sysnb Setpgid(pid int, pgid int) (err error)
|
//sysnb Setpgid(pid int, pgid int) (err error)
|
||||||
//sysnb Setsid() (pid int, err error)
|
//sysnb Setsid() (pid int, err error)
|
||||||
//sysnb Settimeofday(tv *Timeval) (err error)
|
//sysnb Settimeofday(tv *Timeval) (err error)
|
||||||
//sys Setns(fd int, nstype int) (err error)
|
|
||||||
|
|
||||||
// issue 1435.
|
// issue 1435.
|
||||||
// On linux Setuid and Setgid only affects the current thread, not the process.
|
// On linux Setuid and Setgid only affects the current thread, not the process.
|
||||||
@ -1120,6 +921,7 @@ func Setgid(uid int) (err error) {
|
|||||||
//sys Unmount(target string, flags int) (err error) = SYS_UMOUNT2
|
//sys Unmount(target string, flags int) (err error) = SYS_UMOUNT2
|
||||||
//sys Unshare(flags int) (err error)
|
//sys Unshare(flags int) (err error)
|
||||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||||
|
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||||
//sys write(fd int, p []byte) (n int, err error)
|
//sys write(fd int, p []byte) (n int, err error)
|
||||||
//sys exitThread(code int) (err error) = SYS_EXIT
|
//sys exitThread(code int) (err error) = SYS_EXIT
|
||||||
//sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ
|
//sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ
|
||||||
@ -1149,25 +951,6 @@ func Munmap(b []byte) (err error) {
|
|||||||
//sys Mlockall(flags int) (err error)
|
//sys Mlockall(flags int) (err error)
|
||||||
//sys Munlockall() (err error)
|
//sys Munlockall() (err error)
|
||||||
|
|
||||||
// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
|
|
||||||
// using the specified flags.
|
|
||||||
func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
|
||||||
n, _, errno := Syscall6(
|
|
||||||
SYS_VMSPLICE,
|
|
||||||
uintptr(fd),
|
|
||||||
uintptr(unsafe.Pointer(&iovs[0])),
|
|
||||||
uintptr(len(iovs)),
|
|
||||||
uintptr(flags),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
if errno != 0 {
|
|
||||||
return 0, syscall.Errno(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
return int(n), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unimplemented
|
* Unimplemented
|
||||||
*/
|
*/
|
||||||
@ -1238,6 +1021,8 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
|||||||
// Newfstatat
|
// Newfstatat
|
||||||
// Nfsservctl
|
// Nfsservctl
|
||||||
// Personality
|
// Personality
|
||||||
|
// Poll
|
||||||
|
// Ppoll
|
||||||
// Pselect6
|
// Pselect6
|
||||||
// Ptrace
|
// Ptrace
|
||||||
// Putpmsg
|
// Putpmsg
|
||||||
@ -1295,6 +1080,7 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
|||||||
// Utimensat
|
// Utimensat
|
||||||
// Vfork
|
// Vfork
|
||||||
// Vhangup
|
// Vhangup
|
||||||
|
// Vmsplice
|
||||||
// Vserver
|
// Vserver
|
||||||
// Waitid
|
// Waitid
|
||||||
// _Sysctl
|
// _Sysctl
|
||||||
|
|||||||
15
vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
15
vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
@ -24,6 +24,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Sec = int32(nsec / 1e9)
|
tv.Sec = int32(nsec / 1e9)
|
||||||
@ -91,8 +93,6 @@ func Pipe2(p []int, flags int) (err error) {
|
|||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||||
|
|
||||||
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
|
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
|
||||||
//sys Pause() (err error)
|
|
||||||
|
|
||||||
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
|
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
|
||||||
page := uintptr(offset / 4096)
|
page := uintptr(offset / 4096)
|
||||||
@ -181,8 +181,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
|||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||||
|
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
|
||||||
|
|
||||||
// On x86 Linux, all the socket calls go through an extra indirection,
|
// On x86 Linux, all the socket calls go through an extra indirection,
|
||||||
// I think because the 5-register system call interface can't handle
|
// I think because the 5-register system call interface can't handle
|
||||||
// the 6-argument calls like sendto and recvfrom. Instead the
|
// the 6-argument calls like sendto and recvfrom. Instead the
|
||||||
@ -388,12 +386,3 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
|||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
|
||||||
|
|||||||
20
vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
generated
vendored
20
vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
generated
vendored
@ -6,8 +6,9 @@
|
|||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
//sys Dup2(oldfd int, newfd int) (err error)
|
//sys Dup2(oldfd int, newfd int) (err error)
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
|
||||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
@ -24,7 +25,6 @@ package unix
|
|||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
//sys Lchown(path string, uid int, gid int) (err error)
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys Pause() (err error)
|
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
@ -61,6 +61,9 @@ package unix
|
|||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||||
|
|
||||||
|
//go:noescape
|
||||||
|
func gettimeofday(tv *Timeval) (err syscall.Errno)
|
||||||
|
|
||||||
func Gettimeofday(tv *Timeval) (err error) {
|
func Gettimeofday(tv *Timeval) (err error) {
|
||||||
errno := gettimeofday(tv)
|
errno := gettimeofday(tv)
|
||||||
if errno != 0 {
|
if errno != 0 {
|
||||||
@ -83,8 +86,6 @@ func Time(t *Time_t) (tt Time_t, err error) {
|
|||||||
return Time_t(tv.Sec), nil
|
return Time_t(tv.Sec), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
|
||||||
|
|
||||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||||
|
|
||||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
func NsecToTimespec(nsec int64) (ts Timespec) {
|
||||||
@ -93,6 +94,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Sec = nsec / 1e9
|
tv.Sec = nsec / 1e9
|
||||||
@ -141,12 +144,3 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
|||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint64(length)
|
cmsg.Len = uint64(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
|
||||||
|
|||||||
13
vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
generated
vendored
13
vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
generated
vendored
@ -1,13 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build amd64,linux
|
|
||||||
// +build !gccgo
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
//go:noescape
|
|
||||||
func gettimeofday(tv *Timeval) (err syscall.Errno)
|
|
||||||
34
vendor/golang.org/x/sys/unix/syscall_linux_arm.go
generated
vendored
34
vendor/golang.org/x/sys/unix/syscall_linux_arm.go
generated
vendored
@ -108,28 +108,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
|||||||
|
|
||||||
// Vsyscalls on amd64.
|
// Vsyscalls on amd64.
|
||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||||
//sys Pause() (err error)
|
|
||||||
|
|
||||||
func Time(t *Time_t) (Time_t, error) {
|
|
||||||
var tv Timeval
|
|
||||||
err := Gettimeofday(&tv)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
if t != nil {
|
|
||||||
*t = Time_t(tv.Sec)
|
|
||||||
}
|
|
||||||
return Time_t(tv.Sec), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Utime(path string, buf *Utimbuf) error {
|
|
||||||
tv := []Timeval{
|
|
||||||
{Sec: buf.Actime},
|
|
||||||
{Sec: buf.Modtime},
|
|
||||||
}
|
|
||||||
return Utimes(path, tv)
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
@ -179,7 +158,7 @@ type rlimit32 struct {
|
|||||||
Max uint32
|
Max uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT
|
//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
|
||||||
|
|
||||||
const rlimInf32 = ^uint32(0)
|
const rlimInf32 = ^uint32(0)
|
||||||
const rlimInf64 = ^uint64(0)
|
const rlimInf64 = ^uint64(0)
|
||||||
@ -252,12 +231,3 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
|||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
|
||||||
|
|||||||
50
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
50
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
|
const _SYS_dup = SYS_DUP3
|
||||||
|
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||||
@ -69,6 +70,7 @@ func Lstat(path string, stat *Stat_t) (err error) {
|
|||||||
func Getpagesize() int { return 65536 }
|
func Getpagesize() int { return 65536 }
|
||||||
|
|
||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||||
|
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||||
|
|
||||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||||
|
|
||||||
@ -78,6 +80,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Sec = nsec / 1e9
|
tv.Sec = nsec / 1e9
|
||||||
@ -85,26 +89,6 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func Time(t *Time_t) (Time_t, error) {
|
|
||||||
var tv Timeval
|
|
||||||
err := Gettimeofday(&tv)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
if t != nil {
|
|
||||||
*t = Time_t(tv.Sec)
|
|
||||||
}
|
|
||||||
return Time_t(tv.Sec), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Utime(path string, buf *Utimbuf) error {
|
|
||||||
tv := []Timeval{
|
|
||||||
{Sec: buf.Actime},
|
|
||||||
{Sec: buf.Modtime},
|
|
||||||
}
|
|
||||||
return Utimes(path, tv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
func Pipe(p []int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
@ -149,18 +133,6 @@ func InotifyInit() (fd int, err error) {
|
|||||||
return InotifyInit1(0)
|
return InotifyInit1(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dup2(oldfd int, newfd int) (err error) {
|
|
||||||
return Dup3(oldfd, newfd, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Pause() (err error) {
|
|
||||||
_, _, e1 := Syscall6(SYS_PPOLL, 0, 0, 0, 0, 0, 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(dfc): constants that should be in zsysnum_linux_arm64.go, remove
|
// TODO(dfc): constants that should be in zsysnum_linux_arm64.go, remove
|
||||||
// these when the deprecated syscalls that the syscall package relies on
|
// these when the deprecated syscalls that the syscall package relies on
|
||||||
// are removed.
|
// are removed.
|
||||||
@ -176,15 +148,3 @@ const (
|
|||||||
SYS_EPOLL_CREATE = 1042
|
SYS_EPOLL_CREATE = 1042
|
||||||
SYS_EPOLL_WAIT = 1069
|
SYS_EPOLL_WAIT = 1069
|
||||||
)
|
)
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
var ts *Timespec
|
|
||||||
if timeout >= 0 {
|
|
||||||
ts = new(Timespec)
|
|
||||||
*ts = NsecToTimespec(int64(timeout) * 1e6)
|
|
||||||
}
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return ppoll(nil, 0, ts, nil)
|
|
||||||
}
|
|
||||||
return ppoll(&fds[0], len(fds), ts, nil)
|
|
||||||
}
|
|
||||||
|
|||||||
208
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
generated
vendored
208
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
generated
vendored
@ -1,208 +0,0 @@
|
|||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build linux
|
|
||||||
// +build mips64 mips64le
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
|
||||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
|
||||||
//sys Ftruncate(fd int, length int64) (err error)
|
|
||||||
//sysnb Getegid() (egid int)
|
|
||||||
//sysnb Geteuid() (euid int)
|
|
||||||
//sysnb Getgid() (gid int)
|
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
|
||||||
//sysnb Getuid() (uid int)
|
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
|
||||||
//sys Listen(s int, n int) (err error)
|
|
||||||
//sys Pause() (err error)
|
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS_PSELECT6
|
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
|
||||||
//sys Setfsgid(gid int) (err error)
|
|
||||||
//sys Setfsuid(uid int) (err error)
|
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
|
||||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
|
||||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
|
||||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
|
||||||
//sys Truncate(path string, length int64) (err error)
|
|
||||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
|
||||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
|
||||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
|
||||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
|
||||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
|
||||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
|
||||||
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
|
||||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
|
||||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
|
||||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
|
||||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
|
||||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
|
||||||
|
|
||||||
func Getpagesize() int { return 65536 }
|
|
||||||
|
|
||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
|
||||||
|
|
||||||
func Time(t *Time_t) (tt Time_t, err error) {
|
|
||||||
var tv Timeval
|
|
||||||
err = Gettimeofday(&tv)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
if t != nil {
|
|
||||||
*t = Time_t(tv.Sec)
|
|
||||||
}
|
|
||||||
return Time_t(tv.Sec), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
|
||||||
|
|
||||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
|
||||||
|
|
||||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
|
||||||
ts.Sec = nsec / 1e9
|
|
||||||
ts.Nsec = nsec % 1e9
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
|
||||||
nsec += 999 // round up to microsecond
|
|
||||||
tv.Sec = nsec / 1e9
|
|
||||||
tv.Usec = nsec % 1e9 / 1e3
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, 0)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, flags)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Ioperm(from int, num int, on int) (err error) {
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
func Iopl(level int) (err error) {
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
type stat_t struct {
|
|
||||||
Dev uint32
|
|
||||||
Pad0 [3]int32
|
|
||||||
Ino uint64
|
|
||||||
Mode uint32
|
|
||||||
Nlink uint32
|
|
||||||
Uid uint32
|
|
||||||
Gid uint32
|
|
||||||
Rdev uint32
|
|
||||||
Pad1 [3]uint32
|
|
||||||
Size int64
|
|
||||||
Atime uint32
|
|
||||||
Atime_nsec uint32
|
|
||||||
Mtime uint32
|
|
||||||
Mtime_nsec uint32
|
|
||||||
Ctime uint32
|
|
||||||
Ctime_nsec uint32
|
|
||||||
Blksize uint32
|
|
||||||
Pad2 uint32
|
|
||||||
Blocks int64
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys fstat(fd int, st *stat_t) (err error)
|
|
||||||
//sys lstat(path string, st *stat_t) (err error)
|
|
||||||
//sys stat(path string, st *stat_t) (err error)
|
|
||||||
|
|
||||||
func Fstat(fd int, s *Stat_t) (err error) {
|
|
||||||
st := &stat_t{}
|
|
||||||
err = fstat(fd, st)
|
|
||||||
fillStat_t(s, st)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Lstat(path string, s *Stat_t) (err error) {
|
|
||||||
st := &stat_t{}
|
|
||||||
err = lstat(path, st)
|
|
||||||
fillStat_t(s, st)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Stat(path string, s *Stat_t) (err error) {
|
|
||||||
st := &stat_t{}
|
|
||||||
err = stat(path, st)
|
|
||||||
fillStat_t(s, st)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func fillStat_t(s *Stat_t, st *stat_t) {
|
|
||||||
s.Dev = st.Dev
|
|
||||||
s.Ino = st.Ino
|
|
||||||
s.Mode = st.Mode
|
|
||||||
s.Nlink = st.Nlink
|
|
||||||
s.Uid = st.Uid
|
|
||||||
s.Gid = st.Gid
|
|
||||||
s.Rdev = st.Rdev
|
|
||||||
s.Size = st.Size
|
|
||||||
s.Atim = Timespec{int64(st.Atime), int64(st.Atime_nsec)}
|
|
||||||
s.Mtim = Timespec{int64(st.Mtime), int64(st.Mtime_nsec)}
|
|
||||||
s.Ctim = Timespec{int64(st.Ctime), int64(st.Ctime_nsec)}
|
|
||||||
s.Blksize = st.Blksize
|
|
||||||
s.Blocks = st.Blocks
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 { return r.Regs[64] }
|
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = pc }
|
|
||||||
|
|
||||||
func (iov *Iovec) SetLen(length int) {
|
|
||||||
iov.Len = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetControllen(length int) {
|
|
||||||
msghdr.Controllen = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
||||||
cmsg.Len = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
|
||||||
239
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
generated
vendored
239
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
generated
vendored
@ -1,239 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build linux
|
|
||||||
// +build mips mipsle
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
|
||||||
|
|
||||||
//sys Dup2(oldfd int, newfd int) (err error)
|
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
|
||||||
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
|
|
||||||
//sysnb Getegid() (egid int)
|
|
||||||
//sysnb Geteuid() (euid int)
|
|
||||||
//sysnb Getgid() (gid int)
|
|
||||||
//sysnb Getuid() (uid int)
|
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
|
||||||
//sys Listen(s int, n int) (err error)
|
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
|
||||||
//sys Setfsgid(gid int) (err error)
|
|
||||||
//sys Setfsuid(uid int) (err error)
|
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
|
||||||
|
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
|
||||||
|
|
||||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
|
||||||
//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
|
|
||||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
|
||||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
|
||||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
|
||||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
|
||||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
|
||||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
|
||||||
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
|
||||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
|
||||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
|
||||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
|
||||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
|
||||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
||||||
|
|
||||||
//sysnb InotifyInit() (fd int, err error)
|
|
||||||
//sys Ioperm(from int, num int, on int) (err error)
|
|
||||||
//sys Iopl(level int) (err error)
|
|
||||||
|
|
||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
|
||||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
|
||||||
|
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
|
||||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
|
||||||
|
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
|
||||||
//sys Pause() (err error)
|
|
||||||
|
|
||||||
func Fstatfs(fd int, buf *Statfs_t) (err error) {
|
|
||||||
_, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
|
|
||||||
if e != 0 {
|
|
||||||
err = errnoErr(e)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Statfs(path string, buf *Statfs_t) (err error) {
|
|
||||||
p, err := BytePtrFromString(path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(p)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
|
|
||||||
if e != 0 {
|
|
||||||
err = errnoErr(e)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Seek(fd int, offset int64, whence int) (off int64, err error) {
|
|
||||||
_, _, e := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offset>>32), uintptr(offset), uintptr(unsafe.Pointer(&off)), uintptr(whence), 0)
|
|
||||||
if e != 0 {
|
|
||||||
err = errnoErr(e)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
|
||||||
|
|
||||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
|
||||||
ts.Sec = int32(nsec / 1e9)
|
|
||||||
ts.Nsec = int32(nsec % 1e9)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
|
||||||
nsec += 999 // round up to microsecond
|
|
||||||
tv.Sec = int32(nsec / 1e9)
|
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, flags)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, 0)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
|
|
||||||
|
|
||||||
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
|
|
||||||
page := uintptr(offset / 4096)
|
|
||||||
if offset != int64(page)*4096 {
|
|
||||||
return 0, EINVAL
|
|
||||||
}
|
|
||||||
return mmap2(addr, length, prot, flags, fd, page)
|
|
||||||
}
|
|
||||||
|
|
||||||
const rlimInf32 = ^uint32(0)
|
|
||||||
const rlimInf64 = ^uint64(0)
|
|
||||||
|
|
||||||
type rlimit32 struct {
|
|
||||||
Cur uint32
|
|
||||||
Max uint32
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
|
|
||||||
|
|
||||||
func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
err = prlimit(0, resource, nil, rlim)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rl := rlimit32{}
|
|
||||||
err = getrlimit(resource, &rl)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if rl.Cur == rlimInf32 {
|
|
||||||
rlim.Cur = rlimInf64
|
|
||||||
} else {
|
|
||||||
rlim.Cur = uint64(rl.Cur)
|
|
||||||
}
|
|
||||||
|
|
||||||
if rl.Max == rlimInf32 {
|
|
||||||
rlim.Max = rlimInf64
|
|
||||||
} else {
|
|
||||||
rlim.Max = uint64(rl.Max)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
err = prlimit(0, resource, rlim, nil)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rl := rlimit32{}
|
|
||||||
if rlim.Cur == rlimInf64 {
|
|
||||||
rl.Cur = rlimInf32
|
|
||||||
} else if rlim.Cur < uint64(rlimInf32) {
|
|
||||||
rl.Cur = uint32(rlim.Cur)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
if rlim.Max == rlimInf64 {
|
|
||||||
rl.Max = rlimInf32
|
|
||||||
} else if rlim.Max < uint64(rlimInf32) {
|
|
||||||
rl.Max = uint32(rlim.Max)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
return setrlimit(resource, &rl)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 { return uint64(r.Regs[64]) }
|
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = uint32(pc) }
|
|
||||||
|
|
||||||
func (iov *Iovec) SetLen(length int) {
|
|
||||||
iov.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetControllen(length int) {
|
|
||||||
msghdr.Controllen = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
||||||
cmsg.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Getpagesize() int { return 4096 }
|
|
||||||
43
vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
generated
vendored
43
vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
generated
vendored
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
|
||||||
//sys Dup2(oldfd int, newfd int) (err error)
|
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||||
@ -18,13 +16,11 @@ package unix
|
|||||||
//sysnb Getgid() (gid int)
|
//sysnb Getgid() (gid int)
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
|
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
|
||||||
//sysnb Getuid() (uid int)
|
//sysnb Getuid() (uid int)
|
||||||
//sysnb InotifyInit() (fd int, err error)
|
|
||||||
//sys Ioperm(from int, num int, on int) (err error)
|
//sys Ioperm(from int, num int, on int) (err error)
|
||||||
//sys Iopl(level int) (err error)
|
//sys Iopl(level int) (err error)
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
//sys Lchown(path string, uid int, gid int) (err error)
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys Pause() (err error)
|
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
@ -66,8 +62,6 @@ func Getpagesize() int { return 65536 }
|
|||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||||
|
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
|
||||||
|
|
||||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||||
|
|
||||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
func NsecToTimespec(nsec int64) (ts Timespec) {
|
||||||
@ -76,6 +70,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Sec = nsec / 1e9
|
tv.Sec = nsec / 1e9
|
||||||
@ -98,38 +94,3 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
|||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint64(length)
|
cmsg.Len = uint64(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb pipe(p *[2]_C_int) (err error)
|
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe(&pp)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, flags)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
|
||||||
|
|||||||
328
vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
generated
vendored
328
vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
generated
vendored
@ -1,328 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build s390x,linux
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import (
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
//sys Dup2(oldfd int, newfd int) (err error)
|
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
|
||||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
|
||||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
|
||||||
//sys Ftruncate(fd int, length int64) (err error)
|
|
||||||
//sysnb Getegid() (egid int)
|
|
||||||
//sysnb Geteuid() (euid int)
|
|
||||||
//sysnb Getgid() (gid int)
|
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
|
||||||
//sysnb Getuid() (uid int)
|
|
||||||
//sysnb InotifyInit() (fd int, err error)
|
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
|
||||||
//sys Pause() (err error)
|
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
|
||||||
//sys Setfsgid(gid int) (err error)
|
|
||||||
//sys Setfsuid(uid int) (err error)
|
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
|
||||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
|
||||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
|
||||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
|
||||||
//sys Truncate(path string, length int64) (err error)
|
|
||||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
|
||||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
|
||||||
|
|
||||||
func Getpagesize() int { return 4096 }
|
|
||||||
|
|
||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
|
||||||
|
|
||||||
func Time(t *Time_t) (tt Time_t, err error) {
|
|
||||||
var tv Timeval
|
|
||||||
err = Gettimeofday(&tv)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
if t != nil {
|
|
||||||
*t = Time_t(tv.Sec)
|
|
||||||
}
|
|
||||||
return Time_t(tv.Sec), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
|
||||||
|
|
||||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
|
||||||
|
|
||||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
|
||||||
ts.Sec = nsec / 1e9
|
|
||||||
ts.Nsec = nsec % 1e9
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
|
||||||
nsec += 999 // round up to microsecond
|
|
||||||
tv.Sec = nsec / 1e9
|
|
||||||
tv.Usec = nsec % 1e9 / 1e3
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, 0) // pipe2 is the same as pipe when flags are set to 0.
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, flags)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Ioperm(from int, num int, on int) (err error) {
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
func Iopl(level int) (err error) {
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 { return r.Psw.Addr }
|
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.Addr = pc }
|
|
||||||
|
|
||||||
func (iov *Iovec) SetLen(length int) {
|
|
||||||
iov.Len = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetControllen(length int) {
|
|
||||||
msghdr.Controllen = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
||||||
cmsg.Len = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct.
|
|
||||||
// mmap2 also requires arguments to be passed in a struct; it is currently not exposed in <asm/unistd.h>.
|
|
||||||
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
|
|
||||||
mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)}
|
|
||||||
r0, _, e1 := Syscall(SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0)
|
|
||||||
xaddr = uintptr(r0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// On s390x Linux, all the socket calls go through an extra indirection.
|
|
||||||
// The arguments to the underlying system call (SYS_SOCKETCALL) are the
|
|
||||||
// number below and a pointer to an array of uintptr.
|
|
||||||
const (
|
|
||||||
// see linux/net.h
|
|
||||||
netSocket = 1
|
|
||||||
netBind = 2
|
|
||||||
netConnect = 3
|
|
||||||
netListen = 4
|
|
||||||
netAccept = 5
|
|
||||||
netGetSockName = 6
|
|
||||||
netGetPeerName = 7
|
|
||||||
netSocketPair = 8
|
|
||||||
netSend = 9
|
|
||||||
netRecv = 10
|
|
||||||
netSendTo = 11
|
|
||||||
netRecvFrom = 12
|
|
||||||
netShutdown = 13
|
|
||||||
netSetSockOpt = 14
|
|
||||||
netGetSockOpt = 15
|
|
||||||
netSendMsg = 16
|
|
||||||
netRecvMsg = 17
|
|
||||||
netAccept4 = 18
|
|
||||||
netRecvMMsg = 19
|
|
||||||
netSendMMsg = 20
|
|
||||||
)
|
|
||||||
|
|
||||||
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (int, error) {
|
|
||||||
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
|
|
||||||
fd, _, err := Syscall(SYS_SOCKETCALL, netAccept, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return int(fd), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (int, error) {
|
|
||||||
args := [4]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags)}
|
|
||||||
fd, _, err := Syscall(SYS_SOCKETCALL, netAccept4, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return int(fd), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) error {
|
|
||||||
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
|
|
||||||
_, _, err := RawSyscall(SYS_SOCKETCALL, netGetSockName, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) error {
|
|
||||||
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
|
|
||||||
_, _, err := RawSyscall(SYS_SOCKETCALL, netGetPeerName, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func socketpair(domain int, typ int, flags int, fd *[2]int32) error {
|
|
||||||
args := [4]uintptr{uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd))}
|
|
||||||
_, _, err := RawSyscall(SYS_SOCKETCALL, netSocketPair, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) error {
|
|
||||||
args := [3]uintptr{uintptr(s), uintptr(addr), uintptr(addrlen)}
|
|
||||||
_, _, err := Syscall(SYS_SOCKETCALL, netBind, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) error {
|
|
||||||
args := [3]uintptr{uintptr(s), uintptr(addr), uintptr(addrlen)}
|
|
||||||
_, _, err := Syscall(SYS_SOCKETCALL, netConnect, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func socket(domain int, typ int, proto int) (int, error) {
|
|
||||||
args := [3]uintptr{uintptr(domain), uintptr(typ), uintptr(proto)}
|
|
||||||
fd, _, err := RawSyscall(SYS_SOCKETCALL, netSocket, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return int(fd), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) error {
|
|
||||||
args := [5]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen))}
|
|
||||||
_, _, err := Syscall(SYS_SOCKETCALL, netGetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error {
|
|
||||||
args := [4]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val)}
|
|
||||||
_, _, err := Syscall(SYS_SOCKETCALL, netSetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (int, error) {
|
|
||||||
var base uintptr
|
|
||||||
if len(p) > 0 {
|
|
||||||
base = uintptr(unsafe.Pointer(&p[0]))
|
|
||||||
}
|
|
||||||
args := [6]uintptr{uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))}
|
|
||||||
n, _, err := Syscall(SYS_SOCKETCALL, netRecvFrom, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return int(n), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func sendto(s int, p []byte, flags int, to unsafe.Pointer, addrlen _Socklen) error {
|
|
||||||
var base uintptr
|
|
||||||
if len(p) > 0 {
|
|
||||||
base = uintptr(unsafe.Pointer(&p[0]))
|
|
||||||
}
|
|
||||||
args := [6]uintptr{uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen)}
|
|
||||||
_, _, err := Syscall(SYS_SOCKETCALL, netSendTo, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func recvmsg(s int, msg *Msghdr, flags int) (int, error) {
|
|
||||||
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)}
|
|
||||||
n, _, err := Syscall(SYS_SOCKETCALL, netRecvMsg, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return int(n), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func sendmsg(s int, msg *Msghdr, flags int) (int, error) {
|
|
||||||
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)}
|
|
||||||
n, _, err := Syscall(SYS_SOCKETCALL, netSendMsg, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return int(n), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Listen(s int, n int) error {
|
|
||||||
args := [2]uintptr{uintptr(s), uintptr(n)}
|
|
||||||
_, _, err := Syscall(SYS_SOCKETCALL, netListen, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Shutdown(s, how int) error {
|
|
||||||
args := [2]uintptr{uintptr(s), uintptr(how)}
|
|
||||||
_, _, err := Syscall(SYS_SOCKETCALL, netShutdown, uintptr(unsafe.Pointer(&args)), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
|
||||||
169
vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
generated
vendored
169
vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
generated
vendored
@ -1,169 +0,0 @@
|
|||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build sparc64,linux
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync/atomic"
|
|
||||||
"syscall"
|
|
||||||
)
|
|
||||||
|
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
|
||||||
//sys Dup2(oldfd int, newfd int) (err error)
|
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
|
||||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
|
||||||
//sys Ftruncate(fd int, length int64) (err error)
|
|
||||||
//sysnb Getegid() (egid int)
|
|
||||||
//sysnb Geteuid() (euid int)
|
|
||||||
//sysnb Getgid() (gid int)
|
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
|
||||||
//sysnb Getuid() (uid int)
|
|
||||||
//sysnb InotifyInit() (fd int, err error)
|
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
|
||||||
//sys Listen(s int, n int) (err error)
|
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
|
||||||
//sys Pause() (err error)
|
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
|
||||||
//sys Setfsgid(gid int) (err error)
|
|
||||||
//sys Setfsuid(uid int) (err error)
|
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
|
||||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
|
||||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
|
||||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
|
||||||
//sys Truncate(path string, length int64) (err error)
|
|
||||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
|
||||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
|
||||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
|
||||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
|
||||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
|
||||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
|
||||||
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
|
||||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
|
||||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
|
||||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
|
||||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
|
||||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
|
||||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
|
||||||
|
|
||||||
func sysconf(name int) (n int64, err syscall.Errno)
|
|
||||||
|
|
||||||
// pageSize caches the value of Getpagesize, since it can't change
|
|
||||||
// once the system is booted.
|
|
||||||
var pageSize int64 // accessed atomically
|
|
||||||
|
|
||||||
func Getpagesize() int {
|
|
||||||
n := atomic.LoadInt64(&pageSize)
|
|
||||||
if n == 0 {
|
|
||||||
n, _ = sysconf(_SC_PAGESIZE)
|
|
||||||
atomic.StoreInt64(&pageSize, n)
|
|
||||||
}
|
|
||||||
return int(n)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Ioperm(from int, num int, on int) (err error) {
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
func Iopl(level int) (err error) {
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
|
||||||
|
|
||||||
func Time(t *Time_t) (tt Time_t, err error) {
|
|
||||||
var tv Timeval
|
|
||||||
err = Gettimeofday(&tv)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
if t != nil {
|
|
||||||
*t = Time_t(tv.Sec)
|
|
||||||
}
|
|
||||||
return Time_t(tv.Sec), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
|
||||||
|
|
||||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
|
||||||
|
|
||||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
|
||||||
ts.Sec = nsec / 1e9
|
|
||||||
ts.Nsec = nsec % 1e9
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
|
||||||
nsec += 999 // round up to microsecond
|
|
||||||
tv.Sec = nsec / 1e9
|
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 { return r.Tpc }
|
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Tpc = pc }
|
|
||||||
|
|
||||||
func (iov *Iovec) SetLen(length int) {
|
|
||||||
iov.Len = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetControllen(length int) {
|
|
||||||
msghdr.Controllen = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
||||||
cmsg.Len = uint64(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb pipe(p *[2]_C_int) (err error)
|
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe(&pp)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, flags)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
|
||||||
2
vendor/golang.org/x/sys/unix/syscall_netbsd_386.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_netbsd_386.go
generated
vendored
@ -16,6 +16,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go
generated
vendored
@ -16,6 +16,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go
generated
vendored
@ -16,6 +16,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
generated
vendored
@ -16,6 +16,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
generated
vendored
@ -16,6 +16,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = nsec % 1e9 / 1e3
|
tv.Usec = nsec % 1e9 / 1e3
|
||||||
|
|||||||
48
vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
48
vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
@ -72,20 +72,18 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
|
|||||||
return origlen - len(buf), count, names
|
return origlen - len(buf), count, names
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb pipe(p *[2]_C_int) (n int, err error)
|
func pipe() (r uintptr, w uintptr, err uintptr)
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
func Pipe(p []int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
var pp [2]_C_int
|
r0, w0, e1 := pipe()
|
||||||
n, err := pipe(&pp)
|
if e1 != 0 {
|
||||||
if n != 0 {
|
err = syscall.Errno(e1)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
p[0] = int(pp[0])
|
p[0], p[1] = int(r0), int(w0)
|
||||||
p[1] = int(pp[1])
|
return
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
@ -271,34 +269,24 @@ func (w WaitStatus) StopSignal() syscall.Signal {
|
|||||||
|
|
||||||
func (w WaitStatus) TrapCause() int { return -1 }
|
func (w WaitStatus) TrapCause() int { return -1 }
|
||||||
|
|
||||||
//sys wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, err error)
|
func wait4(pid uintptr, wstatus *WaitStatus, options uintptr, rusage *Rusage) (wpid uintptr, err uintptr)
|
||||||
|
|
||||||
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (int, error) {
|
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
|
||||||
var status _C_int
|
r0, e1 := wait4(uintptr(pid), wstatus, uintptr(options), rusage)
|
||||||
rpid, err := wait4(int32(pid), &status, options, rusage)
|
if e1 != 0 {
|
||||||
wpid := int(rpid)
|
err = syscall.Errno(e1)
|
||||||
if wpid == -1 {
|
|
||||||
return wpid, err
|
|
||||||
}
|
}
|
||||||
if wstatus != nil {
|
return int(r0), err
|
||||||
*wstatus = WaitStatus(status)
|
|
||||||
}
|
|
||||||
return wpid, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys gethostname(buf []byte) (n int, err error)
|
func gethostname() (name string, err uintptr)
|
||||||
|
|
||||||
func Gethostname() (name string, err error) {
|
func Gethostname() (name string, err error) {
|
||||||
var buf [MaxHostNameLen]byte
|
name, e1 := gethostname()
|
||||||
n, err := gethostname(buf[:])
|
if e1 != 0 {
|
||||||
if n != 0 {
|
err = syscall.Errno(e1)
|
||||||
return "", err
|
|
||||||
}
|
}
|
||||||
n = clen(buf[:])
|
return name, err
|
||||||
if n < 1 {
|
|
||||||
return "", EFAULT
|
|
||||||
}
|
|
||||||
return string(buf[:n]), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||||
@ -661,7 +649,7 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) {
|
|||||||
//sysnb Uname(buf *Utsname) (err error)
|
//sysnb Uname(buf *Utsname) (err error)
|
||||||
//sys Unmount(target string, flags int) (err error) = libc.umount
|
//sys Unmount(target string, flags int) (err error) = libc.umount
|
||||||
//sys Unlink(path string) (err error)
|
//sys Unlink(path string) (err error)
|
||||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
//sys Unlinkat(dirfd int, path string) (err error)
|
||||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.bind
|
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.bind
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
generated
vendored
@ -14,6 +14,8 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||||
|
|
||||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
nsec += 999 // round up to microsecond
|
nsec += 999 // round up to microsecond
|
||||||
tv.Usec = nsec % 1e9 / 1e3
|
tv.Usec = nsec % 1e9 / 1e3
|
||||||
|
|||||||
5
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
5
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
@ -49,6 +49,11 @@ func errnoErr(e syscall.Errno) error {
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
|
||||||
// Mmap manager, for use by operating system-specific implementations.
|
// Mmap manager, for use by operating system-specific implementations.
|
||||||
|
|
||||||
type mmapper struct {
|
type mmapper struct {
|
||||||
|
|||||||
15
vendor/golang.org/x/sys/unix/syscall_unix_gc.go
generated
vendored
15
vendor/golang.org/x/sys/unix/syscall_unix_gc.go
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
||||||
// +build !gccgo
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
|
||||||
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
|
||||||
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
|
||||||
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
|
||||||
65
vendor/golang.org/x/sys/unix/types_linux.go
generated
vendored
65
vendor/golang.org/x/sys/unix/types_linux.go
generated
vendored
@ -24,7 +24,6 @@ package unix
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <netpacket/packet.h>
|
#include <netpacket/packet.h>
|
||||||
#include <poll.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
@ -56,11 +55,6 @@ package unix
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ustat.h>
|
#include <ustat.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <bluetooth/bluetooth.h>
|
|
||||||
#include <bluetooth/hci.h>
|
|
||||||
#include <linux/can.h>
|
|
||||||
#include <linux/if_alg.h>
|
|
||||||
#include <linux/vm_sockets.h>
|
|
||||||
|
|
||||||
#ifdef TCSETS2
|
#ifdef TCSETS2
|
||||||
// On systems that have "struct termios2" use this as type Termios.
|
// On systems that have "struct termios2" use this as type Termios.
|
||||||
@ -104,36 +98,17 @@ typedef struct user_regs PtraceRegs;
|
|||||||
typedef struct user_pt_regs PtraceRegs;
|
typedef struct user_pt_regs PtraceRegs;
|
||||||
#elif defined(__powerpc64__)
|
#elif defined(__powerpc64__)
|
||||||
typedef struct pt_regs PtraceRegs;
|
typedef struct pt_regs PtraceRegs;
|
||||||
#elif defined(__mips__)
|
|
||||||
typedef struct user PtraceRegs;
|
|
||||||
#elif defined(__s390x__)
|
|
||||||
typedef struct _user_regs_struct PtraceRegs;
|
|
||||||
#elif defined(__sparc__)
|
|
||||||
#include <asm/ptrace.h>
|
|
||||||
typedef struct pt_regs PtraceRegs;
|
|
||||||
#else
|
#else
|
||||||
typedef struct user_regs_struct PtraceRegs;
|
typedef struct user_regs_struct PtraceRegs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__s390x__)
|
|
||||||
typedef struct _user_psw_struct ptracePsw;
|
|
||||||
typedef struct _user_fpregs_struct ptraceFpregs;
|
|
||||||
typedef struct _user_per_struct ptracePer;
|
|
||||||
#else
|
|
||||||
typedef struct {} ptracePsw;
|
|
||||||
typedef struct {} ptraceFpregs;
|
|
||||||
typedef struct {} ptracePer;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// The real epoll_event is a union, and godefs doesn't handle it well.
|
// The real epoll_event is a union, and godefs doesn't handle it well.
|
||||||
struct my_epoll_event {
|
struct my_epoll_event {
|
||||||
uint32_t events;
|
uint32_t events;
|
||||||
#if defined(__ARM_EABI__) || defined(__aarch64__) || (defined(__mips__) && _MIPS_SIM == _ABIO32)
|
#ifdef __ARM_EABI__
|
||||||
// padding is not specified in linux/eventpoll.h but added to conform to the
|
// padding is not specified in linux/eventpoll.h but added to conform to the
|
||||||
// alignment requirements of EABI
|
// alignment requirements of EABI
|
||||||
int32_t padFd;
|
int32_t padFd;
|
||||||
#elif defined(__powerpc64__) || defined(__s390x__) || defined(__sparc__)
|
|
||||||
int32_t _padFd;
|
|
||||||
#endif
|
#endif
|
||||||
int32_t fd;
|
int32_t fd;
|
||||||
int32_t pad;
|
int32_t pad;
|
||||||
@ -219,14 +194,6 @@ type RawSockaddrLinklayer C.struct_sockaddr_ll
|
|||||||
|
|
||||||
type RawSockaddrNetlink C.struct_sockaddr_nl
|
type RawSockaddrNetlink C.struct_sockaddr_nl
|
||||||
|
|
||||||
type RawSockaddrHCI C.struct_sockaddr_hci
|
|
||||||
|
|
||||||
type RawSockaddrCAN C.struct_sockaddr_can
|
|
||||||
|
|
||||||
type RawSockaddrALG C.struct_sockaddr_alg
|
|
||||||
|
|
||||||
type RawSockaddrVM C.struct_sockaddr_vm
|
|
||||||
|
|
||||||
type RawSockaddr C.struct_sockaddr
|
type RawSockaddr C.struct_sockaddr
|
||||||
|
|
||||||
type RawSockaddrAny C.struct_sockaddr_any
|
type RawSockaddrAny C.struct_sockaddr_any
|
||||||
@ -266,10 +233,6 @@ const (
|
|||||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
||||||
SizeofSockaddrLinklayer = C.sizeof_struct_sockaddr_ll
|
SizeofSockaddrLinklayer = C.sizeof_struct_sockaddr_ll
|
||||||
SizeofSockaddrNetlink = C.sizeof_struct_sockaddr_nl
|
SizeofSockaddrNetlink = C.sizeof_struct_sockaddr_nl
|
||||||
SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci
|
|
||||||
SizeofSockaddrCAN = C.sizeof_struct_sockaddr_can
|
|
||||||
SizeofSockaddrALG = C.sizeof_struct_sockaddr_alg
|
|
||||||
SizeofSockaddrVM = C.sizeof_struct_sockaddr_vm
|
|
||||||
SizeofLinger = C.sizeof_struct_linger
|
SizeofLinger = C.sizeof_struct_linger
|
||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||||
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||||
@ -420,13 +383,6 @@ const SizeofInotifyEvent = C.sizeof_struct_inotify_event
|
|||||||
// Register structures
|
// Register structures
|
||||||
type PtraceRegs C.PtraceRegs
|
type PtraceRegs C.PtraceRegs
|
||||||
|
|
||||||
// Structures contained in PtraceRegs on s390x (exported by mkpost.go)
|
|
||||||
type ptracePsw C.ptracePsw
|
|
||||||
|
|
||||||
type ptraceFpregs C.ptraceFpregs
|
|
||||||
|
|
||||||
type ptracePer C.ptracePer
|
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
|
|
||||||
type FdSet C.fd_set
|
type FdSet C.fd_set
|
||||||
@ -442,28 +398,9 @@ type EpollEvent C.struct_my_epoll_event
|
|||||||
const (
|
const (
|
||||||
AT_FDCWD = C.AT_FDCWD
|
AT_FDCWD = C.AT_FDCWD
|
||||||
AT_REMOVEDIR = C.AT_REMOVEDIR
|
AT_REMOVEDIR = C.AT_REMOVEDIR
|
||||||
AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
|
|
||||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd C.struct_pollfd
|
|
||||||
|
|
||||||
const (
|
|
||||||
POLLIN = C.POLLIN
|
|
||||||
POLLPRI = C.POLLPRI
|
|
||||||
POLLOUT = C.POLLOUT
|
|
||||||
POLLRDHUP = C.POLLRDHUP
|
|
||||||
POLLERR = C.POLLERR
|
|
||||||
POLLHUP = C.POLLHUP
|
|
||||||
POLLNVAL = C.POLLNVAL
|
|
||||||
)
|
|
||||||
|
|
||||||
type Sigset_t C.sigset_t
|
|
||||||
|
|
||||||
// sysconf information
|
|
||||||
|
|
||||||
const _SC_PAGESIZE = C._SC_PAGESIZE
|
|
||||||
|
|
||||||
// Terminal handling
|
// Terminal handling
|
||||||
|
|
||||||
type Termios C.termios_t
|
type Termios C.termios_t
|
||||||
|
|||||||
2
vendor/golang.org/x/sys/unix/types_solaris.go
generated
vendored
2
vendor/golang.org/x/sys/unix/types_solaris.go
generated
vendored
@ -22,7 +22,6 @@ package unix
|
|||||||
#define __USE_LEGACY_PROTOTYPES__ // iovec
|
#define __USE_LEGACY_PROTOTYPES__ // iovec
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <netdb.h>
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
@ -82,7 +81,6 @@ const (
|
|||||||
sizeofLong = C.sizeof_long
|
sizeofLong = C.sizeof_long
|
||||||
sizeofLongLong = C.sizeof_longlong
|
sizeofLongLong = C.sizeof_longlong
|
||||||
PathMax = C.PATH_MAX
|
PathMax = C.PATH_MAX
|
||||||
MaxHostNameLen = C.MAXHOSTNAMELEN
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Basic types
|
// Basic types
|
||||||
|
|||||||
1530
vendor/golang.org/x/sys/unix/zerrors_dragonfly_386.go
generated
vendored
Normal file
1530
vendor/golang.org/x/sys/unix/zerrors_dragonfly_386.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
70
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
70
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
@ -51,16 +51,8 @@ const (
|
|||||||
AF_TIPC = 0x1e
|
AF_TIPC = 0x1e
|
||||||
AF_UNIX = 0x1
|
AF_UNIX = 0x1
|
||||||
AF_UNSPEC = 0x0
|
AF_UNSPEC = 0x0
|
||||||
AF_VSOCK = 0x28
|
|
||||||
AF_WANPIPE = 0x19
|
AF_WANPIPE = 0x19
|
||||||
AF_X25 = 0x9
|
AF_X25 = 0x9
|
||||||
ALG_OP_DECRYPT = 0x0
|
|
||||||
ALG_OP_ENCRYPT = 0x1
|
|
||||||
ALG_SET_AEAD_ASSOCLEN = 0x4
|
|
||||||
ALG_SET_AEAD_AUTHSIZE = 0x5
|
|
||||||
ALG_SET_IV = 0x2
|
|
||||||
ALG_SET_KEY = 0x1
|
|
||||||
ALG_SET_OP = 0x3
|
|
||||||
ARPHRD_ADAPT = 0x108
|
ARPHRD_ADAPT = 0x108
|
||||||
ARPHRD_APPLETLK = 0x8
|
ARPHRD_APPLETLK = 0x8
|
||||||
ARPHRD_ARCNET = 0x7
|
ARPHRD_ARCNET = 0x7
|
||||||
@ -153,21 +145,6 @@ const (
|
|||||||
B75 = 0x2
|
B75 = 0x2
|
||||||
B921600 = 0x1007
|
B921600 = 0x1007
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BLKBSZGET = 0x80041270
|
|
||||||
BLKBSZSET = 0x40041271
|
|
||||||
BLKFLSBUF = 0x1261
|
|
||||||
BLKFRAGET = 0x1265
|
|
||||||
BLKFRASET = 0x1264
|
|
||||||
BLKGETSIZE = 0x1260
|
|
||||||
BLKGETSIZE64 = 0x80041272
|
|
||||||
BLKRAGET = 0x1263
|
|
||||||
BLKRASET = 0x1262
|
|
||||||
BLKROGET = 0x125e
|
|
||||||
BLKROSET = 0x125d
|
|
||||||
BLKRRPART = 0x125f
|
|
||||||
BLKSECTGET = 0x1267
|
|
||||||
BLKSECTSET = 0x1266
|
|
||||||
BLKSSZGET = 0x1268
|
|
||||||
BOTHER = 0x1000
|
BOTHER = 0x1000
|
||||||
BPF_A = 0x10
|
BPF_A = 0x10
|
||||||
BPF_ABS = 0x20
|
BPF_ABS = 0x20
|
||||||
@ -213,25 +190,6 @@ const (
|
|||||||
BS0 = 0x0
|
BS0 = 0x0
|
||||||
BS1 = 0x2000
|
BS1 = 0x2000
|
||||||
BSDLY = 0x2000
|
BSDLY = 0x2000
|
||||||
CAN_BCM = 0x2
|
|
||||||
CAN_EFF_FLAG = 0x80000000
|
|
||||||
CAN_EFF_ID_BITS = 0x1d
|
|
||||||
CAN_EFF_MASK = 0x1fffffff
|
|
||||||
CAN_ERR_FLAG = 0x20000000
|
|
||||||
CAN_ERR_MASK = 0x1fffffff
|
|
||||||
CAN_INV_FILTER = 0x20000000
|
|
||||||
CAN_ISOTP = 0x6
|
|
||||||
CAN_MAX_DLC = 0x8
|
|
||||||
CAN_MAX_DLEN = 0x8
|
|
||||||
CAN_MCNET = 0x5
|
|
||||||
CAN_MTU = 0x10
|
|
||||||
CAN_NPROTO = 0x7
|
|
||||||
CAN_RAW = 0x1
|
|
||||||
CAN_RTR_FLAG = 0x40000000
|
|
||||||
CAN_SFF_ID_BITS = 0xb
|
|
||||||
CAN_SFF_MASK = 0x7ff
|
|
||||||
CAN_TP16 = 0x3
|
|
||||||
CAN_TP20 = 0x4
|
|
||||||
CBAUD = 0x100f
|
CBAUD = 0x100f
|
||||||
CBAUDEX = 0x1000
|
CBAUDEX = 0x1000
|
||||||
CFLUSH = 0xf
|
CFLUSH = 0xf
|
||||||
@ -258,7 +216,6 @@ const (
|
|||||||
CLONE_FILES = 0x400
|
CLONE_FILES = 0x400
|
||||||
CLONE_FS = 0x200
|
CLONE_FS = 0x200
|
||||||
CLONE_IO = 0x80000000
|
CLONE_IO = 0x80000000
|
||||||
CLONE_NEWCGROUP = 0x2000000
|
|
||||||
CLONE_NEWIPC = 0x8000000
|
CLONE_NEWIPC = 0x8000000
|
||||||
CLONE_NEWNET = 0x40000000
|
CLONE_NEWNET = 0x40000000
|
||||||
CLONE_NEWNS = 0x20000
|
CLONE_NEWNS = 0x20000
|
||||||
@ -408,12 +365,6 @@ const (
|
|||||||
EXTA = 0xe
|
EXTA = 0xe
|
||||||
EXTB = 0xf
|
EXTB = 0xf
|
||||||
EXTPROC = 0x10000
|
EXTPROC = 0x10000
|
||||||
FALLOC_FL_COLLAPSE_RANGE = 0x8
|
|
||||||
FALLOC_FL_INSERT_RANGE = 0x20
|
|
||||||
FALLOC_FL_KEEP_SIZE = 0x1
|
|
||||||
FALLOC_FL_NO_HIDE_STALE = 0x4
|
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
@ -453,8 +404,6 @@ const (
|
|||||||
F_ULOCK = 0x0
|
F_ULOCK = 0x0
|
||||||
F_UNLCK = 0x2
|
F_UNLCK = 0x2
|
||||||
F_WRLCK = 0x1
|
F_WRLCK = 0x1
|
||||||
GRND_NONBLOCK = 0x1
|
|
||||||
GRND_RANDOM = 0x2
|
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
IBSHIFT = 0x10
|
IBSHIFT = 0x10
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
@ -839,7 +788,6 @@ const (
|
|||||||
NLM_F_ATOMIC = 0x400
|
NLM_F_ATOMIC = 0x400
|
||||||
NLM_F_CREATE = 0x400
|
NLM_F_CREATE = 0x400
|
||||||
NLM_F_DUMP = 0x300
|
NLM_F_DUMP = 0x300
|
||||||
NLM_F_DUMP_FILTERED = 0x20
|
|
||||||
NLM_F_DUMP_INTR = 0x10
|
NLM_F_DUMP_INTR = 0x10
|
||||||
NLM_F_ECHO = 0x8
|
NLM_F_ECHO = 0x8
|
||||||
NLM_F_EXCL = 0x200
|
NLM_F_EXCL = 0x200
|
||||||
@ -878,7 +826,6 @@ const (
|
|||||||
O_RDWR = 0x2
|
O_RDWR = 0x2
|
||||||
O_RSYNC = 0x101000
|
O_RSYNC = 0x101000
|
||||||
O_SYNC = 0x101000
|
O_SYNC = 0x101000
|
||||||
O_TMPFILE = 0x410000
|
|
||||||
O_TRUNC = 0x200
|
O_TRUNC = 0x200
|
||||||
O_WRONLY = 0x1
|
O_WRONLY = 0x1
|
||||||
PACKET_ADD_MEMBERSHIP = 0x1
|
PACKET_ADD_MEMBERSHIP = 0x1
|
||||||
@ -1279,7 +1226,6 @@ const (
|
|||||||
SOL_IP = 0x0
|
SOL_IP = 0x0
|
||||||
SOL_IPV6 = 0x29
|
SOL_IPV6 = 0x29
|
||||||
SOL_IRDA = 0x10a
|
SOL_IRDA = 0x10a
|
||||||
SOL_NETLINK = 0x10e
|
|
||||||
SOL_PACKET = 0x107
|
SOL_PACKET = 0x107
|
||||||
SOL_RAW = 0xff
|
SOL_RAW = 0xff
|
||||||
SOL_SOCKET = 0x1
|
SOL_SOCKET = 0x1
|
||||||
@ -1325,17 +1271,6 @@ const (
|
|||||||
SO_TIMESTAMPING = 0x25
|
SO_TIMESTAMPING = 0x25
|
||||||
SO_TIMESTAMPNS = 0x23
|
SO_TIMESTAMPNS = 0x23
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
|
|
||||||
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
|
|
||||||
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
|
|
||||||
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
|
|
||||||
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
|
|
||||||
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
|
|
||||||
SO_VM_SOCKETS_TRUSTED = 0x5
|
|
||||||
SPLICE_F_GIFT = 0x8
|
|
||||||
SPLICE_F_MORE = 0x4
|
|
||||||
SPLICE_F_MOVE = 0x1
|
|
||||||
SPLICE_F_NONBLOCK = 0x2
|
|
||||||
S_BLKSIZE = 0x200
|
S_BLKSIZE = 0x200
|
||||||
S_IEXEC = 0x40
|
S_IEXEC = 0x40
|
||||||
S_IFBLK = 0x6000
|
S_IFBLK = 0x6000
|
||||||
@ -1508,11 +1443,6 @@ const (
|
|||||||
VINTR = 0x0
|
VINTR = 0x0
|
||||||
VKILL = 0x3
|
VKILL = 0x3
|
||||||
VLNEXT = 0xf
|
VLNEXT = 0xf
|
||||||
VMADDR_CID_ANY = 0xffffffff
|
|
||||||
VMADDR_CID_HOST = 0x2
|
|
||||||
VMADDR_CID_HYPERVISOR = 0x0
|
|
||||||
VMADDR_CID_RESERVED = 0x1
|
|
||||||
VMADDR_PORT_ANY = 0xffffffff
|
|
||||||
VMIN = 0x6
|
VMIN = 0x6
|
||||||
VQUIT = 0x1
|
VQUIT = 0x1
|
||||||
VREPRINT = 0xc
|
VREPRINT = 0xc
|
||||||
|
|||||||
77
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
77
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
@ -51,16 +51,8 @@ const (
|
|||||||
AF_TIPC = 0x1e
|
AF_TIPC = 0x1e
|
||||||
AF_UNIX = 0x1
|
AF_UNIX = 0x1
|
||||||
AF_UNSPEC = 0x0
|
AF_UNSPEC = 0x0
|
||||||
AF_VSOCK = 0x28
|
|
||||||
AF_WANPIPE = 0x19
|
AF_WANPIPE = 0x19
|
||||||
AF_X25 = 0x9
|
AF_X25 = 0x9
|
||||||
ALG_OP_DECRYPT = 0x0
|
|
||||||
ALG_OP_ENCRYPT = 0x1
|
|
||||||
ALG_SET_AEAD_ASSOCLEN = 0x4
|
|
||||||
ALG_SET_AEAD_AUTHSIZE = 0x5
|
|
||||||
ALG_SET_IV = 0x2
|
|
||||||
ALG_SET_KEY = 0x1
|
|
||||||
ALG_SET_OP = 0x3
|
|
||||||
ARPHRD_ADAPT = 0x108
|
ARPHRD_ADAPT = 0x108
|
||||||
ARPHRD_APPLETLK = 0x8
|
ARPHRD_APPLETLK = 0x8
|
||||||
ARPHRD_ARCNET = 0x7
|
ARPHRD_ARCNET = 0x7
|
||||||
@ -153,21 +145,6 @@ const (
|
|||||||
B75 = 0x2
|
B75 = 0x2
|
||||||
B921600 = 0x1007
|
B921600 = 0x1007
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BLKBSZGET = 0x80081270
|
|
||||||
BLKBSZSET = 0x40081271
|
|
||||||
BLKFLSBUF = 0x1261
|
|
||||||
BLKFRAGET = 0x1265
|
|
||||||
BLKFRASET = 0x1264
|
|
||||||
BLKGETSIZE = 0x1260
|
|
||||||
BLKGETSIZE64 = 0x80081272
|
|
||||||
BLKRAGET = 0x1263
|
|
||||||
BLKRASET = 0x1262
|
|
||||||
BLKROGET = 0x125e
|
|
||||||
BLKROSET = 0x125d
|
|
||||||
BLKRRPART = 0x125f
|
|
||||||
BLKSECTGET = 0x1267
|
|
||||||
BLKSECTSET = 0x1266
|
|
||||||
BLKSSZGET = 0x1268
|
|
||||||
BOTHER = 0x1000
|
BOTHER = 0x1000
|
||||||
BPF_A = 0x10
|
BPF_A = 0x10
|
||||||
BPF_ABS = 0x20
|
BPF_ABS = 0x20
|
||||||
@ -213,25 +190,6 @@ const (
|
|||||||
BS0 = 0x0
|
BS0 = 0x0
|
||||||
BS1 = 0x2000
|
BS1 = 0x2000
|
||||||
BSDLY = 0x2000
|
BSDLY = 0x2000
|
||||||
CAN_BCM = 0x2
|
|
||||||
CAN_EFF_FLAG = 0x80000000
|
|
||||||
CAN_EFF_ID_BITS = 0x1d
|
|
||||||
CAN_EFF_MASK = 0x1fffffff
|
|
||||||
CAN_ERR_FLAG = 0x20000000
|
|
||||||
CAN_ERR_MASK = 0x1fffffff
|
|
||||||
CAN_INV_FILTER = 0x20000000
|
|
||||||
CAN_ISOTP = 0x6
|
|
||||||
CAN_MAX_DLC = 0x8
|
|
||||||
CAN_MAX_DLEN = 0x8
|
|
||||||
CAN_MCNET = 0x5
|
|
||||||
CAN_MTU = 0x10
|
|
||||||
CAN_NPROTO = 0x7
|
|
||||||
CAN_RAW = 0x1
|
|
||||||
CAN_RTR_FLAG = 0x40000000
|
|
||||||
CAN_SFF_ID_BITS = 0xb
|
|
||||||
CAN_SFF_MASK = 0x7ff
|
|
||||||
CAN_TP16 = 0x3
|
|
||||||
CAN_TP20 = 0x4
|
|
||||||
CBAUD = 0x100f
|
CBAUD = 0x100f
|
||||||
CBAUDEX = 0x1000
|
CBAUDEX = 0x1000
|
||||||
CFLUSH = 0xf
|
CFLUSH = 0xf
|
||||||
@ -258,7 +216,6 @@ const (
|
|||||||
CLONE_FILES = 0x400
|
CLONE_FILES = 0x400
|
||||||
CLONE_FS = 0x200
|
CLONE_FS = 0x200
|
||||||
CLONE_IO = 0x80000000
|
CLONE_IO = 0x80000000
|
||||||
CLONE_NEWCGROUP = 0x2000000
|
|
||||||
CLONE_NEWIPC = 0x8000000
|
CLONE_NEWIPC = 0x8000000
|
||||||
CLONE_NEWNET = 0x40000000
|
CLONE_NEWNET = 0x40000000
|
||||||
CLONE_NEWNS = 0x20000
|
CLONE_NEWNS = 0x20000
|
||||||
@ -408,12 +365,6 @@ const (
|
|||||||
EXTA = 0xe
|
EXTA = 0xe
|
||||||
EXTB = 0xf
|
EXTB = 0xf
|
||||||
EXTPROC = 0x10000
|
EXTPROC = 0x10000
|
||||||
FALLOC_FL_COLLAPSE_RANGE = 0x8
|
|
||||||
FALLOC_FL_INSERT_RANGE = 0x20
|
|
||||||
FALLOC_FL_KEEP_SIZE = 0x1
|
|
||||||
FALLOC_FL_NO_HIDE_STALE = 0x4
|
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
@ -453,8 +404,6 @@ const (
|
|||||||
F_ULOCK = 0x0
|
F_ULOCK = 0x0
|
||||||
F_UNLCK = 0x2
|
F_UNLCK = 0x2
|
||||||
F_WRLCK = 0x1
|
F_WRLCK = 0x1
|
||||||
GRND_NONBLOCK = 0x1
|
|
||||||
GRND_RANDOM = 0x2
|
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
IBSHIFT = 0x10
|
IBSHIFT = 0x10
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
@ -797,7 +746,6 @@ const (
|
|||||||
NETLINK_ADD_MEMBERSHIP = 0x1
|
NETLINK_ADD_MEMBERSHIP = 0x1
|
||||||
NETLINK_AUDIT = 0x9
|
NETLINK_AUDIT = 0x9
|
||||||
NETLINK_BROADCAST_ERROR = 0x4
|
NETLINK_BROADCAST_ERROR = 0x4
|
||||||
NETLINK_CAP_ACK = 0xa
|
|
||||||
NETLINK_CONNECTOR = 0xb
|
NETLINK_CONNECTOR = 0xb
|
||||||
NETLINK_CRYPTO = 0x15
|
NETLINK_CRYPTO = 0x15
|
||||||
NETLINK_DNRTMSG = 0xe
|
NETLINK_DNRTMSG = 0xe
|
||||||
@ -810,19 +758,14 @@ const (
|
|||||||
NETLINK_IP6_FW = 0xd
|
NETLINK_IP6_FW = 0xd
|
||||||
NETLINK_ISCSI = 0x8
|
NETLINK_ISCSI = 0x8
|
||||||
NETLINK_KOBJECT_UEVENT = 0xf
|
NETLINK_KOBJECT_UEVENT = 0xf
|
||||||
NETLINK_LISTEN_ALL_NSID = 0x8
|
|
||||||
NETLINK_LIST_MEMBERSHIPS = 0x9
|
|
||||||
NETLINK_NETFILTER = 0xc
|
NETLINK_NETFILTER = 0xc
|
||||||
NETLINK_NFLOG = 0x5
|
NETLINK_NFLOG = 0x5
|
||||||
NETLINK_NO_ENOBUFS = 0x5
|
NETLINK_NO_ENOBUFS = 0x5
|
||||||
NETLINK_PKTINFO = 0x3
|
NETLINK_PKTINFO = 0x3
|
||||||
NETLINK_RDMA = 0x14
|
NETLINK_RDMA = 0x14
|
||||||
NETLINK_ROUTE = 0x0
|
NETLINK_ROUTE = 0x0
|
||||||
NETLINK_RX_RING = 0x6
|
|
||||||
NETLINK_SCSITRANSPORT = 0x12
|
NETLINK_SCSITRANSPORT = 0x12
|
||||||
NETLINK_SELINUX = 0x7
|
NETLINK_SELINUX = 0x7
|
||||||
NETLINK_SOCK_DIAG = 0x4
|
|
||||||
NETLINK_TX_RING = 0x7
|
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
@ -845,7 +788,6 @@ const (
|
|||||||
NLM_F_ATOMIC = 0x400
|
NLM_F_ATOMIC = 0x400
|
||||||
NLM_F_CREATE = 0x400
|
NLM_F_CREATE = 0x400
|
||||||
NLM_F_DUMP = 0x300
|
NLM_F_DUMP = 0x300
|
||||||
NLM_F_DUMP_FILTERED = 0x20
|
|
||||||
NLM_F_DUMP_INTR = 0x10
|
NLM_F_DUMP_INTR = 0x10
|
||||||
NLM_F_ECHO = 0x8
|
NLM_F_ECHO = 0x8
|
||||||
NLM_F_EXCL = 0x200
|
NLM_F_EXCL = 0x200
|
||||||
@ -884,7 +826,6 @@ const (
|
|||||||
O_RDWR = 0x2
|
O_RDWR = 0x2
|
||||||
O_RSYNC = 0x101000
|
O_RSYNC = 0x101000
|
||||||
O_SYNC = 0x101000
|
O_SYNC = 0x101000
|
||||||
O_TMPFILE = 0x410000
|
|
||||||
O_TRUNC = 0x200
|
O_TRUNC = 0x200
|
||||||
O_WRONLY = 0x1
|
O_WRONLY = 0x1
|
||||||
PACKET_ADD_MEMBERSHIP = 0x1
|
PACKET_ADD_MEMBERSHIP = 0x1
|
||||||
@ -1286,7 +1227,6 @@ const (
|
|||||||
SOL_IP = 0x0
|
SOL_IP = 0x0
|
||||||
SOL_IPV6 = 0x29
|
SOL_IPV6 = 0x29
|
||||||
SOL_IRDA = 0x10a
|
SOL_IRDA = 0x10a
|
||||||
SOL_NETLINK = 0x10e
|
|
||||||
SOL_PACKET = 0x107
|
SOL_PACKET = 0x107
|
||||||
SOL_RAW = 0xff
|
SOL_RAW = 0xff
|
||||||
SOL_SOCKET = 0x1
|
SOL_SOCKET = 0x1
|
||||||
@ -1332,17 +1272,6 @@ const (
|
|||||||
SO_TIMESTAMPING = 0x25
|
SO_TIMESTAMPING = 0x25
|
||||||
SO_TIMESTAMPNS = 0x23
|
SO_TIMESTAMPNS = 0x23
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
|
|
||||||
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
|
|
||||||
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
|
|
||||||
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
|
|
||||||
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
|
|
||||||
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
|
|
||||||
SO_VM_SOCKETS_TRUSTED = 0x5
|
|
||||||
SPLICE_F_GIFT = 0x8
|
|
||||||
SPLICE_F_MORE = 0x4
|
|
||||||
SPLICE_F_MOVE = 0x1
|
|
||||||
SPLICE_F_NONBLOCK = 0x2
|
|
||||||
S_BLKSIZE = 0x200
|
S_BLKSIZE = 0x200
|
||||||
S_IEXEC = 0x40
|
S_IEXEC = 0x40
|
||||||
S_IFBLK = 0x6000
|
S_IFBLK = 0x6000
|
||||||
@ -1515,13 +1444,7 @@ const (
|
|||||||
VINTR = 0x0
|
VINTR = 0x0
|
||||||
VKILL = 0x3
|
VKILL = 0x3
|
||||||
VLNEXT = 0xf
|
VLNEXT = 0xf
|
||||||
VMADDR_CID_ANY = 0xffffffff
|
|
||||||
VMADDR_CID_HOST = 0x2
|
|
||||||
VMADDR_CID_HYPERVISOR = 0x0
|
|
||||||
VMADDR_CID_RESERVED = 0x1
|
|
||||||
VMADDR_PORT_ANY = 0xffffffff
|
|
||||||
VMIN = 0x6
|
VMIN = 0x6
|
||||||
VM_SOCKETS_INVALID_VERSION = 0xffffffff
|
|
||||||
VQUIT = 0x1
|
VQUIT = 0x1
|
||||||
VREPRINT = 0xc
|
VREPRINT = 0xc
|
||||||
VSTART = 0x8
|
VSTART = 0x8
|
||||||
|
|||||||
73
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
73
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
@ -50,16 +50,8 @@ const (
|
|||||||
AF_TIPC = 0x1e
|
AF_TIPC = 0x1e
|
||||||
AF_UNIX = 0x1
|
AF_UNIX = 0x1
|
||||||
AF_UNSPEC = 0x0
|
AF_UNSPEC = 0x0
|
||||||
AF_VSOCK = 0x28
|
|
||||||
AF_WANPIPE = 0x19
|
AF_WANPIPE = 0x19
|
||||||
AF_X25 = 0x9
|
AF_X25 = 0x9
|
||||||
ALG_OP_DECRYPT = 0x0
|
|
||||||
ALG_OP_ENCRYPT = 0x1
|
|
||||||
ALG_SET_AEAD_ASSOCLEN = 0x4
|
|
||||||
ALG_SET_AEAD_AUTHSIZE = 0x5
|
|
||||||
ALG_SET_IV = 0x2
|
|
||||||
ALG_SET_KEY = 0x1
|
|
||||||
ALG_SET_OP = 0x3
|
|
||||||
ARPHRD_ADAPT = 0x108
|
ARPHRD_ADAPT = 0x108
|
||||||
ARPHRD_APPLETLK = 0x8
|
ARPHRD_APPLETLK = 0x8
|
||||||
ARPHRD_ARCNET = 0x7
|
ARPHRD_ARCNET = 0x7
|
||||||
@ -149,21 +141,6 @@ const (
|
|||||||
B75 = 0x2
|
B75 = 0x2
|
||||||
B921600 = 0x1007
|
B921600 = 0x1007
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BLKBSZGET = 0x80081270
|
|
||||||
BLKBSZSET = 0x40081271
|
|
||||||
BLKFLSBUF = 0x1261
|
|
||||||
BLKFRAGET = 0x1265
|
|
||||||
BLKFRASET = 0x1264
|
|
||||||
BLKGETSIZE = 0x1260
|
|
||||||
BLKGETSIZE64 = 0x80081272
|
|
||||||
BLKRAGET = 0x1263
|
|
||||||
BLKRASET = 0x1262
|
|
||||||
BLKROGET = 0x125e
|
|
||||||
BLKROSET = 0x125d
|
|
||||||
BLKRRPART = 0x125f
|
|
||||||
BLKSECTGET = 0x1267
|
|
||||||
BLKSECTSET = 0x1266
|
|
||||||
BLKSSZGET = 0x1268
|
|
||||||
BOTHER = 0x1000
|
BOTHER = 0x1000
|
||||||
BPF_A = 0x10
|
BPF_A = 0x10
|
||||||
BPF_ABS = 0x20
|
BPF_ABS = 0x20
|
||||||
@ -209,25 +186,6 @@ const (
|
|||||||
BS0 = 0x0
|
BS0 = 0x0
|
||||||
BS1 = 0x2000
|
BS1 = 0x2000
|
||||||
BSDLY = 0x2000
|
BSDLY = 0x2000
|
||||||
CAN_BCM = 0x2
|
|
||||||
CAN_EFF_FLAG = 0x80000000
|
|
||||||
CAN_EFF_ID_BITS = 0x1d
|
|
||||||
CAN_EFF_MASK = 0x1fffffff
|
|
||||||
CAN_ERR_FLAG = 0x20000000
|
|
||||||
CAN_ERR_MASK = 0x1fffffff
|
|
||||||
CAN_INV_FILTER = 0x20000000
|
|
||||||
CAN_ISOTP = 0x6
|
|
||||||
CAN_MAX_DLC = 0x8
|
|
||||||
CAN_MAX_DLEN = 0x8
|
|
||||||
CAN_MCNET = 0x5
|
|
||||||
CAN_MTU = 0x10
|
|
||||||
CAN_NPROTO = 0x7
|
|
||||||
CAN_RAW = 0x1
|
|
||||||
CAN_RTR_FLAG = 0x40000000
|
|
||||||
CAN_SFF_ID_BITS = 0xb
|
|
||||||
CAN_SFF_MASK = 0x7ff
|
|
||||||
CAN_TP16 = 0x3
|
|
||||||
CAN_TP20 = 0x4
|
|
||||||
CBAUD = 0x100f
|
CBAUD = 0x100f
|
||||||
CBAUDEX = 0x1000
|
CBAUDEX = 0x1000
|
||||||
CFLUSH = 0xf
|
CFLUSH = 0xf
|
||||||
@ -254,7 +212,6 @@ const (
|
|||||||
CLONE_FILES = 0x400
|
CLONE_FILES = 0x400
|
||||||
CLONE_FS = 0x200
|
CLONE_FS = 0x200
|
||||||
CLONE_IO = 0x80000000
|
CLONE_IO = 0x80000000
|
||||||
CLONE_NEWCGROUP = 0x2000000
|
|
||||||
CLONE_NEWIPC = 0x8000000
|
CLONE_NEWIPC = 0x8000000
|
||||||
CLONE_NEWNET = 0x40000000
|
CLONE_NEWNET = 0x40000000
|
||||||
CLONE_NEWNS = 0x20000
|
CLONE_NEWNS = 0x20000
|
||||||
@ -393,12 +350,6 @@ const (
|
|||||||
EXTA = 0xe
|
EXTA = 0xe
|
||||||
EXTB = 0xf
|
EXTB = 0xf
|
||||||
EXTPROC = 0x10000
|
EXTPROC = 0x10000
|
||||||
FALLOC_FL_COLLAPSE_RANGE = 0x8
|
|
||||||
FALLOC_FL_INSERT_RANGE = 0x20
|
|
||||||
FALLOC_FL_KEEP_SIZE = 0x1
|
|
||||||
FALLOC_FL_NO_HIDE_STALE = 0x4
|
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
@ -438,8 +389,6 @@ const (
|
|||||||
F_ULOCK = 0x0
|
F_ULOCK = 0x0
|
||||||
F_UNLCK = 0x2
|
F_UNLCK = 0x2
|
||||||
F_WRLCK = 0x1
|
F_WRLCK = 0x1
|
||||||
GRND_NONBLOCK = 0x1
|
|
||||||
GRND_RANDOM = 0x2
|
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
IBSHIFT = 0x10
|
IBSHIFT = 0x10
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
@ -757,7 +706,6 @@ const (
|
|||||||
NETLINK_AUDIT = 0x9
|
NETLINK_AUDIT = 0x9
|
||||||
NETLINK_BROADCAST_ERROR = 0x4
|
NETLINK_BROADCAST_ERROR = 0x4
|
||||||
NETLINK_CONNECTOR = 0xb
|
NETLINK_CONNECTOR = 0xb
|
||||||
NETLINK_CRYPTO = 0x15
|
|
||||||
NETLINK_DNRTMSG = 0xe
|
NETLINK_DNRTMSG = 0xe
|
||||||
NETLINK_DROP_MEMBERSHIP = 0x2
|
NETLINK_DROP_MEMBERSHIP = 0x2
|
||||||
NETLINK_ECRYPTFS = 0x13
|
NETLINK_ECRYPTFS = 0x13
|
||||||
@ -774,11 +722,8 @@ const (
|
|||||||
NETLINK_PKTINFO = 0x3
|
NETLINK_PKTINFO = 0x3
|
||||||
NETLINK_RDMA = 0x14
|
NETLINK_RDMA = 0x14
|
||||||
NETLINK_ROUTE = 0x0
|
NETLINK_ROUTE = 0x0
|
||||||
NETLINK_RX_RING = 0x6
|
|
||||||
NETLINK_SCSITRANSPORT = 0x12
|
NETLINK_SCSITRANSPORT = 0x12
|
||||||
NETLINK_SELINUX = 0x7
|
NETLINK_SELINUX = 0x7
|
||||||
NETLINK_SOCK_DIAG = 0x4
|
|
||||||
NETLINK_TX_RING = 0x7
|
|
||||||
NETLINK_UNUSED = 0x1
|
NETLINK_UNUSED = 0x1
|
||||||
NETLINK_USERSOCK = 0x2
|
NETLINK_USERSOCK = 0x2
|
||||||
NETLINK_XFRM = 0x6
|
NETLINK_XFRM = 0x6
|
||||||
@ -801,7 +746,6 @@ const (
|
|||||||
NLM_F_ATOMIC = 0x400
|
NLM_F_ATOMIC = 0x400
|
||||||
NLM_F_CREATE = 0x400
|
NLM_F_CREATE = 0x400
|
||||||
NLM_F_DUMP = 0x300
|
NLM_F_DUMP = 0x300
|
||||||
NLM_F_DUMP_FILTERED = 0x20
|
|
||||||
NLM_F_ECHO = 0x8
|
NLM_F_ECHO = 0x8
|
||||||
NLM_F_EXCL = 0x200
|
NLM_F_EXCL = 0x200
|
||||||
NLM_F_MATCH = 0x200
|
NLM_F_MATCH = 0x200
|
||||||
@ -1207,7 +1151,6 @@ const (
|
|||||||
SOL_IP = 0x0
|
SOL_IP = 0x0
|
||||||
SOL_IPV6 = 0x29
|
SOL_IPV6 = 0x29
|
||||||
SOL_IRDA = 0x10a
|
SOL_IRDA = 0x10a
|
||||||
SOL_NETLINK = 0x10e
|
|
||||||
SOL_PACKET = 0x107
|
SOL_PACKET = 0x107
|
||||||
SOL_RAW = 0xff
|
SOL_RAW = 0xff
|
||||||
SOL_SOCKET = 0x1
|
SOL_SOCKET = 0x1
|
||||||
@ -1253,17 +1196,6 @@ const (
|
|||||||
SO_TIMESTAMPING = 0x25
|
SO_TIMESTAMPING = 0x25
|
||||||
SO_TIMESTAMPNS = 0x23
|
SO_TIMESTAMPNS = 0x23
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
|
|
||||||
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
|
|
||||||
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
|
|
||||||
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
|
|
||||||
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
|
|
||||||
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
|
|
||||||
SO_VM_SOCKETS_TRUSTED = 0x5
|
|
||||||
SPLICE_F_GIFT = 0x8
|
|
||||||
SPLICE_F_MORE = 0x4
|
|
||||||
SPLICE_F_MOVE = 0x1
|
|
||||||
SPLICE_F_NONBLOCK = 0x2
|
|
||||||
S_BLKSIZE = 0x200
|
S_BLKSIZE = 0x200
|
||||||
S_IEXEC = 0x40
|
S_IEXEC = 0x40
|
||||||
S_IFBLK = 0x6000
|
S_IFBLK = 0x6000
|
||||||
@ -1436,11 +1368,6 @@ const (
|
|||||||
VINTR = 0x0
|
VINTR = 0x0
|
||||||
VKILL = 0x3
|
VKILL = 0x3
|
||||||
VLNEXT = 0xf
|
VLNEXT = 0xf
|
||||||
VMADDR_CID_ANY = 0xffffffff
|
|
||||||
VMADDR_CID_HOST = 0x2
|
|
||||||
VMADDR_CID_HYPERVISOR = 0x0
|
|
||||||
VMADDR_CID_RESERVED = 0x1
|
|
||||||
VMADDR_PORT_ANY = 0xffffffff
|
|
||||||
VMIN = 0x6
|
VMIN = 0x6
|
||||||
VQUIT = 0x1
|
VQUIT = 0x1
|
||||||
VREPRINT = 0xc
|
VREPRINT = 0xc
|
||||||
|
|||||||
71
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
71
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
@ -54,13 +54,6 @@ const (
|
|||||||
AF_VSOCK = 0x28
|
AF_VSOCK = 0x28
|
||||||
AF_WANPIPE = 0x19
|
AF_WANPIPE = 0x19
|
||||||
AF_X25 = 0x9
|
AF_X25 = 0x9
|
||||||
ALG_OP_DECRYPT = 0x0
|
|
||||||
ALG_OP_ENCRYPT = 0x1
|
|
||||||
ALG_SET_AEAD_ASSOCLEN = 0x4
|
|
||||||
ALG_SET_AEAD_AUTHSIZE = 0x5
|
|
||||||
ALG_SET_IV = 0x2
|
|
||||||
ALG_SET_KEY = 0x1
|
|
||||||
ALG_SET_OP = 0x3
|
|
||||||
ARPHRD_ADAPT = 0x108
|
ARPHRD_ADAPT = 0x108
|
||||||
ARPHRD_APPLETLK = 0x8
|
ARPHRD_APPLETLK = 0x8
|
||||||
ARPHRD_ARCNET = 0x7
|
ARPHRD_ARCNET = 0x7
|
||||||
@ -156,21 +149,6 @@ const (
|
|||||||
B75 = 0x2
|
B75 = 0x2
|
||||||
B921600 = 0x1007
|
B921600 = 0x1007
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BLKBSZGET = 0x80081270
|
|
||||||
BLKBSZSET = 0x40081271
|
|
||||||
BLKFLSBUF = 0x1261
|
|
||||||
BLKFRAGET = 0x1265
|
|
||||||
BLKFRASET = 0x1264
|
|
||||||
BLKGETSIZE = 0x1260
|
|
||||||
BLKGETSIZE64 = 0x80081272
|
|
||||||
BLKRAGET = 0x1263
|
|
||||||
BLKRASET = 0x1262
|
|
||||||
BLKROGET = 0x125e
|
|
||||||
BLKROSET = 0x125d
|
|
||||||
BLKRRPART = 0x125f
|
|
||||||
BLKSECTGET = 0x1267
|
|
||||||
BLKSECTSET = 0x1266
|
|
||||||
BLKSSZGET = 0x1268
|
|
||||||
BOTHER = 0x1000
|
BOTHER = 0x1000
|
||||||
BPF_A = 0x10
|
BPF_A = 0x10
|
||||||
BPF_ABS = 0x20
|
BPF_ABS = 0x20
|
||||||
@ -218,25 +196,6 @@ const (
|
|||||||
BS0 = 0x0
|
BS0 = 0x0
|
||||||
BS1 = 0x2000
|
BS1 = 0x2000
|
||||||
BSDLY = 0x2000
|
BSDLY = 0x2000
|
||||||
CAN_BCM = 0x2
|
|
||||||
CAN_EFF_FLAG = 0x80000000
|
|
||||||
CAN_EFF_ID_BITS = 0x1d
|
|
||||||
CAN_EFF_MASK = 0x1fffffff
|
|
||||||
CAN_ERR_FLAG = 0x20000000
|
|
||||||
CAN_ERR_MASK = 0x1fffffff
|
|
||||||
CAN_INV_FILTER = 0x20000000
|
|
||||||
CAN_ISOTP = 0x6
|
|
||||||
CAN_MAX_DLC = 0x8
|
|
||||||
CAN_MAX_DLEN = 0x8
|
|
||||||
CAN_MCNET = 0x5
|
|
||||||
CAN_MTU = 0x10
|
|
||||||
CAN_NPROTO = 0x7
|
|
||||||
CAN_RAW = 0x1
|
|
||||||
CAN_RTR_FLAG = 0x40000000
|
|
||||||
CAN_SFF_ID_BITS = 0xb
|
|
||||||
CAN_SFF_MASK = 0x7ff
|
|
||||||
CAN_TP16 = 0x3
|
|
||||||
CAN_TP20 = 0x4
|
|
||||||
CBAUD = 0x100f
|
CBAUD = 0x100f
|
||||||
CBAUDEX = 0x1000
|
CBAUDEX = 0x1000
|
||||||
CFLUSH = 0xf
|
CFLUSH = 0xf
|
||||||
@ -263,7 +222,6 @@ const (
|
|||||||
CLONE_FILES = 0x400
|
CLONE_FILES = 0x400
|
||||||
CLONE_FS = 0x200
|
CLONE_FS = 0x200
|
||||||
CLONE_IO = 0x80000000
|
CLONE_IO = 0x80000000
|
||||||
CLONE_NEWCGROUP = 0x2000000
|
|
||||||
CLONE_NEWIPC = 0x8000000
|
CLONE_NEWIPC = 0x8000000
|
||||||
CLONE_NEWNET = 0x40000000
|
CLONE_NEWNET = 0x40000000
|
||||||
CLONE_NEWNS = 0x20000
|
CLONE_NEWNS = 0x20000
|
||||||
@ -421,12 +379,6 @@ const (
|
|||||||
EXTA = 0xe
|
EXTA = 0xe
|
||||||
EXTB = 0xf
|
EXTB = 0xf
|
||||||
EXTPROC = 0x10000
|
EXTPROC = 0x10000
|
||||||
FALLOC_FL_COLLAPSE_RANGE = 0x8
|
|
||||||
FALLOC_FL_INSERT_RANGE = 0x20
|
|
||||||
FALLOC_FL_KEEP_SIZE = 0x1
|
|
||||||
FALLOC_FL_NO_HIDE_STALE = 0x4
|
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
@ -466,8 +418,6 @@ const (
|
|||||||
F_ULOCK = 0x0
|
F_ULOCK = 0x0
|
||||||
F_UNLCK = 0x2
|
F_UNLCK = 0x2
|
||||||
F_WRLCK = 0x1
|
F_WRLCK = 0x1
|
||||||
GRND_NONBLOCK = 0x1
|
|
||||||
GRND_RANDOM = 0x2
|
|
||||||
HUPCL = 0x400
|
HUPCL = 0x400
|
||||||
IBSHIFT = 0x10
|
IBSHIFT = 0x10
|
||||||
ICANON = 0x2
|
ICANON = 0x2
|
||||||
@ -825,7 +775,6 @@ const (
|
|||||||
NETLINK_ADD_MEMBERSHIP = 0x1
|
NETLINK_ADD_MEMBERSHIP = 0x1
|
||||||
NETLINK_AUDIT = 0x9
|
NETLINK_AUDIT = 0x9
|
||||||
NETLINK_BROADCAST_ERROR = 0x4
|
NETLINK_BROADCAST_ERROR = 0x4
|
||||||
NETLINK_CAP_ACK = 0xa
|
|
||||||
NETLINK_CONNECTOR = 0xb
|
NETLINK_CONNECTOR = 0xb
|
||||||
NETLINK_CRYPTO = 0x15
|
NETLINK_CRYPTO = 0x15
|
||||||
NETLINK_DNRTMSG = 0xe
|
NETLINK_DNRTMSG = 0xe
|
||||||
@ -838,8 +787,6 @@ const (
|
|||||||
NETLINK_IP6_FW = 0xd
|
NETLINK_IP6_FW = 0xd
|
||||||
NETLINK_ISCSI = 0x8
|
NETLINK_ISCSI = 0x8
|
||||||
NETLINK_KOBJECT_UEVENT = 0xf
|
NETLINK_KOBJECT_UEVENT = 0xf
|
||||||
NETLINK_LISTEN_ALL_NSID = 0x8
|
|
||||||
NETLINK_LIST_MEMBERSHIPS = 0x9
|
|
||||||
NETLINK_NETFILTER = 0xc
|
NETLINK_NETFILTER = 0xc
|
||||||
NETLINK_NFLOG = 0x5
|
NETLINK_NFLOG = 0x5
|
||||||
NETLINK_NO_ENOBUFS = 0x5
|
NETLINK_NO_ENOBUFS = 0x5
|
||||||
@ -873,7 +820,6 @@ const (
|
|||||||
NLM_F_ATOMIC = 0x400
|
NLM_F_ATOMIC = 0x400
|
||||||
NLM_F_CREATE = 0x400
|
NLM_F_CREATE = 0x400
|
||||||
NLM_F_DUMP = 0x300
|
NLM_F_DUMP = 0x300
|
||||||
NLM_F_DUMP_FILTERED = 0x20
|
|
||||||
NLM_F_DUMP_INTR = 0x10
|
NLM_F_DUMP_INTR = 0x10
|
||||||
NLM_F_ECHO = 0x8
|
NLM_F_ECHO = 0x8
|
||||||
NLM_F_EXCL = 0x200
|
NLM_F_EXCL = 0x200
|
||||||
@ -1328,7 +1274,6 @@ const (
|
|||||||
SOL_IP = 0x0
|
SOL_IP = 0x0
|
||||||
SOL_IPV6 = 0x29
|
SOL_IPV6 = 0x29
|
||||||
SOL_IRDA = 0x10a
|
SOL_IRDA = 0x10a
|
||||||
SOL_NETLINK = 0x10e
|
|
||||||
SOL_PACKET = 0x107
|
SOL_PACKET = 0x107
|
||||||
SOL_RAW = 0xff
|
SOL_RAW = 0xff
|
||||||
SOL_SOCKET = 0x1
|
SOL_SOCKET = 0x1
|
||||||
@ -1382,18 +1327,7 @@ const (
|
|||||||
SO_TIMESTAMPING = 0x25
|
SO_TIMESTAMPING = 0x25
|
||||||
SO_TIMESTAMPNS = 0x23
|
SO_TIMESTAMPNS = 0x23
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
|
|
||||||
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
|
|
||||||
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
|
|
||||||
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
|
|
||||||
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
|
|
||||||
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
|
|
||||||
SO_VM_SOCKETS_TRUSTED = 0x5
|
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
SPLICE_F_GIFT = 0x8
|
|
||||||
SPLICE_F_MORE = 0x4
|
|
||||||
SPLICE_F_MOVE = 0x1
|
|
||||||
SPLICE_F_NONBLOCK = 0x2
|
|
||||||
S_BLKSIZE = 0x200
|
S_BLKSIZE = 0x200
|
||||||
S_IEXEC = 0x40
|
S_IEXEC = 0x40
|
||||||
S_IFBLK = 0x6000
|
S_IFBLK = 0x6000
|
||||||
@ -1588,11 +1522,6 @@ const (
|
|||||||
VINTR = 0x0
|
VINTR = 0x0
|
||||||
VKILL = 0x3
|
VKILL = 0x3
|
||||||
VLNEXT = 0xf
|
VLNEXT = 0xf
|
||||||
VMADDR_CID_ANY = 0xffffffff
|
|
||||||
VMADDR_CID_HOST = 0x2
|
|
||||||
VMADDR_CID_HYPERVISOR = 0x0
|
|
||||||
VMADDR_CID_RESERVED = 0x1
|
|
||||||
VMADDR_PORT_ANY = 0xffffffff
|
|
||||||
VMIN = 0x6
|
VMIN = 0x6
|
||||||
VQUIT = 0x1
|
VQUIT = 0x1
|
||||||
VREPRINT = 0xc
|
VREPRINT = 0xc
|
||||||
|
|||||||
1869
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
1869
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
File diff suppressed because it is too large
Load Diff
1965
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
1965
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
File diff suppressed because it is too large
Load Diff
1965
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
1965
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
File diff suppressed because it is too large
Load Diff
2066
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
2066
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
File diff suppressed because it is too large
Load Diff
71
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
71
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
@ -54,13 +54,6 @@ const (
|
|||||||
AF_VSOCK = 0x28
|
AF_VSOCK = 0x28
|
||||||
AF_WANPIPE = 0x19
|
AF_WANPIPE = 0x19
|
||||||
AF_X25 = 0x9
|
AF_X25 = 0x9
|
||||||
ALG_OP_DECRYPT = 0x0
|
|
||||||
ALG_OP_ENCRYPT = 0x1
|
|
||||||
ALG_SET_AEAD_ASSOCLEN = 0x4
|
|
||||||
ALG_SET_AEAD_AUTHSIZE = 0x5
|
|
||||||
ALG_SET_IV = 0x2
|
|
||||||
ALG_SET_KEY = 0x1
|
|
||||||
ALG_SET_OP = 0x3
|
|
||||||
ARPHRD_6LOWPAN = 0x339
|
ARPHRD_6LOWPAN = 0x339
|
||||||
ARPHRD_ADAPT = 0x108
|
ARPHRD_ADAPT = 0x108
|
||||||
ARPHRD_APPLETLK = 0x8
|
ARPHRD_APPLETLK = 0x8
|
||||||
@ -157,21 +150,6 @@ const (
|
|||||||
B75 = 0x2
|
B75 = 0x2
|
||||||
B921600 = 0x16
|
B921600 = 0x16
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BLKBSZGET = 0x80081270
|
|
||||||
BLKBSZSET = 0x40081271
|
|
||||||
BLKFLSBUF = 0x1261
|
|
||||||
BLKFRAGET = 0x1265
|
|
||||||
BLKFRASET = 0x1264
|
|
||||||
BLKGETSIZE = 0x1260
|
|
||||||
BLKGETSIZE64 = 0x80081272
|
|
||||||
BLKRAGET = 0x1263
|
|
||||||
BLKRASET = 0x1262
|
|
||||||
BLKROGET = 0x125e
|
|
||||||
BLKROSET = 0x125d
|
|
||||||
BLKRRPART = 0x125f
|
|
||||||
BLKSECTGET = 0x1267
|
|
||||||
BLKSECTSET = 0x1266
|
|
||||||
BLKSSZGET = 0x1268
|
|
||||||
BOTHER = 0x1f
|
BOTHER = 0x1f
|
||||||
BPF_A = 0x10
|
BPF_A = 0x10
|
||||||
BPF_ABS = 0x20
|
BPF_ABS = 0x20
|
||||||
@ -219,25 +197,6 @@ const (
|
|||||||
BS0 = 0x0
|
BS0 = 0x0
|
||||||
BS1 = 0x8000
|
BS1 = 0x8000
|
||||||
BSDLY = 0x8000
|
BSDLY = 0x8000
|
||||||
CAN_BCM = 0x2
|
|
||||||
CAN_EFF_FLAG = 0x80000000
|
|
||||||
CAN_EFF_ID_BITS = 0x1d
|
|
||||||
CAN_EFF_MASK = 0x1fffffff
|
|
||||||
CAN_ERR_FLAG = 0x20000000
|
|
||||||
CAN_ERR_MASK = 0x1fffffff
|
|
||||||
CAN_INV_FILTER = 0x20000000
|
|
||||||
CAN_ISOTP = 0x6
|
|
||||||
CAN_MAX_DLC = 0x8
|
|
||||||
CAN_MAX_DLEN = 0x8
|
|
||||||
CAN_MCNET = 0x5
|
|
||||||
CAN_MTU = 0x10
|
|
||||||
CAN_NPROTO = 0x7
|
|
||||||
CAN_RAW = 0x1
|
|
||||||
CAN_RTR_FLAG = 0x40000000
|
|
||||||
CAN_SFF_ID_BITS = 0xb
|
|
||||||
CAN_SFF_MASK = 0x7ff
|
|
||||||
CAN_TP16 = 0x3
|
|
||||||
CAN_TP20 = 0x4
|
|
||||||
CBAUD = 0xff
|
CBAUD = 0xff
|
||||||
CBAUDEX = 0x0
|
CBAUDEX = 0x0
|
||||||
CFLUSH = 0xf
|
CFLUSH = 0xf
|
||||||
@ -264,7 +223,6 @@ const (
|
|||||||
CLONE_FILES = 0x400
|
CLONE_FILES = 0x400
|
||||||
CLONE_FS = 0x200
|
CLONE_FS = 0x200
|
||||||
CLONE_IO = 0x80000000
|
CLONE_IO = 0x80000000
|
||||||
CLONE_NEWCGROUP = 0x2000000
|
|
||||||
CLONE_NEWIPC = 0x8000000
|
CLONE_NEWIPC = 0x8000000
|
||||||
CLONE_NEWNET = 0x40000000
|
CLONE_NEWNET = 0x40000000
|
||||||
CLONE_NEWNS = 0x20000
|
CLONE_NEWNS = 0x20000
|
||||||
@ -423,12 +381,6 @@ const (
|
|||||||
EXTA = 0xe
|
EXTA = 0xe
|
||||||
EXTB = 0xf
|
EXTB = 0xf
|
||||||
EXTPROC = 0x10000000
|
EXTPROC = 0x10000000
|
||||||
FALLOC_FL_COLLAPSE_RANGE = 0x8
|
|
||||||
FALLOC_FL_INSERT_RANGE = 0x20
|
|
||||||
FALLOC_FL_KEEP_SIZE = 0x1
|
|
||||||
FALLOC_FL_NO_HIDE_STALE = 0x4
|
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
@ -471,8 +423,6 @@ const (
|
|||||||
F_ULOCK = 0x0
|
F_ULOCK = 0x0
|
||||||
F_UNLCK = 0x2
|
F_UNLCK = 0x2
|
||||||
F_WRLCK = 0x1
|
F_WRLCK = 0x1
|
||||||
GRND_NONBLOCK = 0x1
|
|
||||||
GRND_RANDOM = 0x2
|
|
||||||
HUPCL = 0x4000
|
HUPCL = 0x4000
|
||||||
IBSHIFT = 0x10
|
IBSHIFT = 0x10
|
||||||
ICANON = 0x100
|
ICANON = 0x100
|
||||||
@ -815,7 +765,6 @@ const (
|
|||||||
NETLINK_ADD_MEMBERSHIP = 0x1
|
NETLINK_ADD_MEMBERSHIP = 0x1
|
||||||
NETLINK_AUDIT = 0x9
|
NETLINK_AUDIT = 0x9
|
||||||
NETLINK_BROADCAST_ERROR = 0x4
|
NETLINK_BROADCAST_ERROR = 0x4
|
||||||
NETLINK_CAP_ACK = 0xa
|
|
||||||
NETLINK_CONNECTOR = 0xb
|
NETLINK_CONNECTOR = 0xb
|
||||||
NETLINK_CRYPTO = 0x15
|
NETLINK_CRYPTO = 0x15
|
||||||
NETLINK_DNRTMSG = 0xe
|
NETLINK_DNRTMSG = 0xe
|
||||||
@ -828,8 +777,6 @@ const (
|
|||||||
NETLINK_IP6_FW = 0xd
|
NETLINK_IP6_FW = 0xd
|
||||||
NETLINK_ISCSI = 0x8
|
NETLINK_ISCSI = 0x8
|
||||||
NETLINK_KOBJECT_UEVENT = 0xf
|
NETLINK_KOBJECT_UEVENT = 0xf
|
||||||
NETLINK_LISTEN_ALL_NSID = 0x8
|
|
||||||
NETLINK_LIST_MEMBERSHIPS = 0x9
|
|
||||||
NETLINK_NETFILTER = 0xc
|
NETLINK_NETFILTER = 0xc
|
||||||
NETLINK_NFLOG = 0x5
|
NETLINK_NFLOG = 0x5
|
||||||
NETLINK_NO_ENOBUFS = 0x5
|
NETLINK_NO_ENOBUFS = 0x5
|
||||||
@ -865,7 +812,6 @@ const (
|
|||||||
NLM_F_ATOMIC = 0x400
|
NLM_F_ATOMIC = 0x400
|
||||||
NLM_F_CREATE = 0x400
|
NLM_F_CREATE = 0x400
|
||||||
NLM_F_DUMP = 0x300
|
NLM_F_DUMP = 0x300
|
||||||
NLM_F_DUMP_FILTERED = 0x20
|
|
||||||
NLM_F_DUMP_INTR = 0x10
|
NLM_F_DUMP_INTR = 0x10
|
||||||
NLM_F_ECHO = 0x8
|
NLM_F_ECHO = 0x8
|
||||||
NLM_F_EXCL = 0x200
|
NLM_F_EXCL = 0x200
|
||||||
@ -1395,7 +1341,6 @@ const (
|
|||||||
SOL_IP = 0x0
|
SOL_IP = 0x0
|
||||||
SOL_IPV6 = 0x29
|
SOL_IPV6 = 0x29
|
||||||
SOL_IRDA = 0x10a
|
SOL_IRDA = 0x10a
|
||||||
SOL_NETLINK = 0x10e
|
|
||||||
SOL_PACKET = 0x107
|
SOL_PACKET = 0x107
|
||||||
SOL_RAW = 0xff
|
SOL_RAW = 0xff
|
||||||
SOL_SOCKET = 0x1
|
SOL_SOCKET = 0x1
|
||||||
@ -1450,18 +1395,7 @@ const (
|
|||||||
SO_TIMESTAMPING = 0x25
|
SO_TIMESTAMPING = 0x25
|
||||||
SO_TIMESTAMPNS = 0x23
|
SO_TIMESTAMPNS = 0x23
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
|
|
||||||
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
|
|
||||||
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
|
|
||||||
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
|
|
||||||
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
|
|
||||||
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
|
|
||||||
SO_VM_SOCKETS_TRUSTED = 0x5
|
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
SPLICE_F_GIFT = 0x8
|
|
||||||
SPLICE_F_MORE = 0x4
|
|
||||||
SPLICE_F_MOVE = 0x1
|
|
||||||
SPLICE_F_NONBLOCK = 0x2
|
|
||||||
S_BLKSIZE = 0x200
|
S_BLKSIZE = 0x200
|
||||||
S_IEXEC = 0x40
|
S_IEXEC = 0x40
|
||||||
S_IFBLK = 0x6000
|
S_IFBLK = 0x6000
|
||||||
@ -1660,11 +1594,6 @@ const (
|
|||||||
VINTR = 0x0
|
VINTR = 0x0
|
||||||
VKILL = 0x3
|
VKILL = 0x3
|
||||||
VLNEXT = 0xf
|
VLNEXT = 0xf
|
||||||
VMADDR_CID_ANY = 0xffffffff
|
|
||||||
VMADDR_CID_HOST = 0x2
|
|
||||||
VMADDR_CID_HYPERVISOR = 0x0
|
|
||||||
VMADDR_CID_RESERVED = 0x1
|
|
||||||
VMADDR_PORT_ANY = 0xffffffff
|
|
||||||
VMIN = 0x5
|
VMIN = 0x5
|
||||||
VQUIT = 0x1
|
VQUIT = 0x1
|
||||||
VREPRINT = 0xb
|
VREPRINT = 0xb
|
||||||
|
|||||||
68
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
68
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
@ -54,13 +54,6 @@ const (
|
|||||||
AF_VSOCK = 0x28
|
AF_VSOCK = 0x28
|
||||||
AF_WANPIPE = 0x19
|
AF_WANPIPE = 0x19
|
||||||
AF_X25 = 0x9
|
AF_X25 = 0x9
|
||||||
ALG_OP_DECRYPT = 0x0
|
|
||||||
ALG_OP_ENCRYPT = 0x1
|
|
||||||
ALG_SET_AEAD_ASSOCLEN = 0x4
|
|
||||||
ALG_SET_AEAD_AUTHSIZE = 0x5
|
|
||||||
ALG_SET_IV = 0x2
|
|
||||||
ALG_SET_KEY = 0x1
|
|
||||||
ALG_SET_OP = 0x3
|
|
||||||
ARPHRD_ADAPT = 0x108
|
ARPHRD_ADAPT = 0x108
|
||||||
ARPHRD_APPLETLK = 0x8
|
ARPHRD_APPLETLK = 0x8
|
||||||
ARPHRD_ARCNET = 0x7
|
ARPHRD_ARCNET = 0x7
|
||||||
@ -156,21 +149,6 @@ const (
|
|||||||
B75 = 0x2
|
B75 = 0x2
|
||||||
B921600 = 0x16
|
B921600 = 0x16
|
||||||
B9600 = 0xd
|
B9600 = 0xd
|
||||||
BLKBSZGET = 0x80081270
|
|
||||||
BLKBSZSET = 0x40081271
|
|
||||||
BLKFLSBUF = 0x1261
|
|
||||||
BLKFRAGET = 0x1265
|
|
||||||
BLKFRASET = 0x1264
|
|
||||||
BLKGETSIZE = 0x1260
|
|
||||||
BLKGETSIZE64 = 0x80081272
|
|
||||||
BLKRAGET = 0x1263
|
|
||||||
BLKRASET = 0x1262
|
|
||||||
BLKROGET = 0x125e
|
|
||||||
BLKROSET = 0x125d
|
|
||||||
BLKRRPART = 0x125f
|
|
||||||
BLKSECTGET = 0x1267
|
|
||||||
BLKSECTSET = 0x1266
|
|
||||||
BLKSSZGET = 0x1268
|
|
||||||
BOTHER = 0x1f
|
BOTHER = 0x1f
|
||||||
BPF_A = 0x10
|
BPF_A = 0x10
|
||||||
BPF_ABS = 0x20
|
BPF_ABS = 0x20
|
||||||
@ -218,25 +196,6 @@ const (
|
|||||||
BS0 = 0x0
|
BS0 = 0x0
|
||||||
BS1 = 0x8000
|
BS1 = 0x8000
|
||||||
BSDLY = 0x8000
|
BSDLY = 0x8000
|
||||||
CAN_BCM = 0x2
|
|
||||||
CAN_EFF_FLAG = 0x80000000
|
|
||||||
CAN_EFF_ID_BITS = 0x1d
|
|
||||||
CAN_EFF_MASK = 0x1fffffff
|
|
||||||
CAN_ERR_FLAG = 0x20000000
|
|
||||||
CAN_ERR_MASK = 0x1fffffff
|
|
||||||
CAN_INV_FILTER = 0x20000000
|
|
||||||
CAN_ISOTP = 0x6
|
|
||||||
CAN_MAX_DLC = 0x8
|
|
||||||
CAN_MAX_DLEN = 0x8
|
|
||||||
CAN_MCNET = 0x5
|
|
||||||
CAN_MTU = 0x10
|
|
||||||
CAN_NPROTO = 0x7
|
|
||||||
CAN_RAW = 0x1
|
|
||||||
CAN_RTR_FLAG = 0x40000000
|
|
||||||
CAN_SFF_ID_BITS = 0xb
|
|
||||||
CAN_SFF_MASK = 0x7ff
|
|
||||||
CAN_TP16 = 0x3
|
|
||||||
CAN_TP20 = 0x4
|
|
||||||
CBAUD = 0xff
|
CBAUD = 0xff
|
||||||
CBAUDEX = 0x0
|
CBAUDEX = 0x0
|
||||||
CFLUSH = 0xf
|
CFLUSH = 0xf
|
||||||
@ -263,7 +222,6 @@ const (
|
|||||||
CLONE_FILES = 0x400
|
CLONE_FILES = 0x400
|
||||||
CLONE_FS = 0x200
|
CLONE_FS = 0x200
|
||||||
CLONE_IO = 0x80000000
|
CLONE_IO = 0x80000000
|
||||||
CLONE_NEWCGROUP = 0x2000000
|
|
||||||
CLONE_NEWIPC = 0x8000000
|
CLONE_NEWIPC = 0x8000000
|
||||||
CLONE_NEWNET = 0x40000000
|
CLONE_NEWNET = 0x40000000
|
||||||
CLONE_NEWNS = 0x20000
|
CLONE_NEWNS = 0x20000
|
||||||
@ -419,12 +377,6 @@ const (
|
|||||||
EXTA = 0xe
|
EXTA = 0xe
|
||||||
EXTB = 0xf
|
EXTB = 0xf
|
||||||
EXTPROC = 0x10000000
|
EXTPROC = 0x10000000
|
||||||
FALLOC_FL_COLLAPSE_RANGE = 0x8
|
|
||||||
FALLOC_FL_INSERT_RANGE = 0x20
|
|
||||||
FALLOC_FL_KEEP_SIZE = 0x1
|
|
||||||
FALLOC_FL_NO_HIDE_STALE = 0x4
|
|
||||||
FALLOC_FL_PUNCH_HOLE = 0x2
|
|
||||||
FALLOC_FL_ZERO_RANGE = 0x10
|
|
||||||
FD_CLOEXEC = 0x1
|
FD_CLOEXEC = 0x1
|
||||||
FD_SETSIZE = 0x400
|
FD_SETSIZE = 0x400
|
||||||
FF0 = 0x0
|
FF0 = 0x0
|
||||||
@ -464,8 +416,6 @@ const (
|
|||||||
F_ULOCK = 0x0
|
F_ULOCK = 0x0
|
||||||
F_UNLCK = 0x2
|
F_UNLCK = 0x2
|
||||||
F_WRLCK = 0x1
|
F_WRLCK = 0x1
|
||||||
GRND_NONBLOCK = 0x1
|
|
||||||
GRND_RANDOM = 0x2
|
|
||||||
HUPCL = 0x4000
|
HUPCL = 0x4000
|
||||||
IBSHIFT = 0x10
|
IBSHIFT = 0x10
|
||||||
ICANON = 0x100
|
ICANON = 0x100
|
||||||
@ -870,7 +820,6 @@ const (
|
|||||||
NLM_F_ATOMIC = 0x400
|
NLM_F_ATOMIC = 0x400
|
||||||
NLM_F_CREATE = 0x400
|
NLM_F_CREATE = 0x400
|
||||||
NLM_F_DUMP = 0x300
|
NLM_F_DUMP = 0x300
|
||||||
NLM_F_DUMP_FILTERED = 0x20
|
|
||||||
NLM_F_DUMP_INTR = 0x10
|
NLM_F_DUMP_INTR = 0x10
|
||||||
NLM_F_ECHO = 0x8
|
NLM_F_ECHO = 0x8
|
||||||
NLM_F_EXCL = 0x200
|
NLM_F_EXCL = 0x200
|
||||||
@ -1392,7 +1341,6 @@ const (
|
|||||||
SOL_IP = 0x0
|
SOL_IP = 0x0
|
||||||
SOL_IPV6 = 0x29
|
SOL_IPV6 = 0x29
|
||||||
SOL_IRDA = 0x10a
|
SOL_IRDA = 0x10a
|
||||||
SOL_NETLINK = 0x10e
|
|
||||||
SOL_PACKET = 0x107
|
SOL_PACKET = 0x107
|
||||||
SOL_RAW = 0xff
|
SOL_RAW = 0xff
|
||||||
SOL_SOCKET = 0x1
|
SOL_SOCKET = 0x1
|
||||||
@ -1446,18 +1394,7 @@ const (
|
|||||||
SO_TIMESTAMPING = 0x25
|
SO_TIMESTAMPING = 0x25
|
||||||
SO_TIMESTAMPNS = 0x23
|
SO_TIMESTAMPNS = 0x23
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
|
|
||||||
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
|
|
||||||
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
|
|
||||||
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
|
|
||||||
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
|
|
||||||
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
|
|
||||||
SO_VM_SOCKETS_TRUSTED = 0x5
|
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
SPLICE_F_GIFT = 0x8
|
|
||||||
SPLICE_F_MORE = 0x4
|
|
||||||
SPLICE_F_MOVE = 0x1
|
|
||||||
SPLICE_F_NONBLOCK = 0x2
|
|
||||||
S_BLKSIZE = 0x200
|
S_BLKSIZE = 0x200
|
||||||
S_IEXEC = 0x40
|
S_IEXEC = 0x40
|
||||||
S_IFBLK = 0x6000
|
S_IFBLK = 0x6000
|
||||||
@ -1656,11 +1593,6 @@ const (
|
|||||||
VINTR = 0x0
|
VINTR = 0x0
|
||||||
VKILL = 0x3
|
VKILL = 0x3
|
||||||
VLNEXT = 0xf
|
VLNEXT = 0xf
|
||||||
VMADDR_CID_ANY = 0xffffffff
|
|
||||||
VMADDR_CID_HOST = 0x2
|
|
||||||
VMADDR_CID_HYPERVISOR = 0x0
|
|
||||||
VMADDR_CID_RESERVED = 0x1
|
|
||||||
VMADDR_PORT_ANY = 0xffffffff
|
|
||||||
VMIN = 0x5
|
VMIN = 0x5
|
||||||
VQUIT = 0x1
|
VQUIT = 0x1
|
||||||
VREPRINT = 0xb
|
VREPRINT = 0xb
|
||||||
|
|||||||
2093
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
2093
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user