You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/10/02 21:06:52 UTC
[4/4] incubator-mynewt-newt git commit: Revendor newtmgr.
Revendor newtmgr.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/c8c93f6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/c8c93f6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/c8c93f6b
Branch: refs/heads/develop
Commit: c8c93f6b7d60963bcb61280d3fd4c07aefae2bfd
Parents: a6cef9a
Author: Christopher Collins <cc...@apache.org>
Authored: Sun Oct 2 14:07:28 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Sun Oct 2 14:07:28 2016 -0700
----------------------------------------------------------------------
newtmgr/Godeps/Godeps.json | 34 +--
.../vendor/github.com/Sirupsen/logrus/README.md | 19 ++
.../vendor/github.com/Sirupsen/logrus/entry.go | 51 ++--
.../vendor/github.com/Sirupsen/logrus/logger.go | 154 +++++++++---
.../Sirupsen/logrus/terminal_appengine.go | 8 +
.../github.com/Sirupsen/logrus/terminal_bsd.go | 1 +
.../Sirupsen/logrus/terminal_linux.go | 2 +
.../Sirupsen/logrus/terminal_notwindows.go | 1 +
.../Sirupsen/logrus/terminal_solaris.go | 2 +-
.../Sirupsen/logrus/terminal_windows.go | 2 +-
.../Sirupsen/logrus/text_formatter.go | 8 +-
.../vendor/github.com/kr/pretty/formatter.go | 4 +-
.../mitchellh/mapstructure/mapstructure.go | 19 ++
newtmgr/vendor/github.com/spf13/cast/.gitignore | 2 +
newtmgr/vendor/github.com/spf13/cast/cast.go | 5 +
newtmgr/vendor/github.com/spf13/cast/caste.go | 70 ++++--
.../vendor/github.com/spf13/cobra/.travis.yml | 16 +-
newtmgr/vendor/github.com/spf13/cobra/README.md | 2 +-
.../github.com/spf13/cobra/bash_completions.go | 21 +-
newtmgr/vendor/github.com/spf13/cobra/cobra.go | 36 ++-
.../vendor/github.com/spf13/cobra/command.go | 97 ++++----
.../vendor/github.com/spf13/pflag/.travis.yml | 4 +
newtmgr/vendor/github.com/spf13/pflag/bool.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/count.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/flag.go | 63 +++--
.../vendor/github.com/spf13/pflag/float32.go | 7 +-
.../vendor/github.com/spf13/pflag/float64.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/int.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/int32.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/int64.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/int8.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/string.go | 4 +-
.../github.com/spf13/pflag/string_array.go | 110 +++++++++
.../github.com/spf13/pflag/string_slice.go | 31 ++-
newtmgr/vendor/github.com/spf13/pflag/uint.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/uint16.go | 9 +-
newtmgr/vendor/github.com/spf13/pflag/uint32.go | 11 +-
newtmgr/vendor/github.com/spf13/pflag/uint64.go | 7 +-
newtmgr/vendor/github.com/spf13/pflag/uint8.go | 7 +-
.../golang.org/x/sys/unix/syscall_solaris.go | 46 ++--
.../golang.org/x/sys/unix/types_solaris.go | 2 +
.../x/sys/unix/zsyscall_solaris_amd64.go | 40 +++
.../x/sys/unix/ztypes_solaris_amd64.go | 3 +-
newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml | 2 +-
newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS | 1 +
.../vendor/gopkg.in/fsnotify.v1/CHANGELOG.md | 4 +
newtmgr/vendor/gopkg.in/fsnotify.v1/fsnotify.go | 26 +-
.../vendor/mynewt.apache.org/newt/DISCLAIMER | 8 -
newtmgr/vendor/mynewt.apache.org/newt/LICENSE | 244 -------------------
newtmgr/vendor/mynewt.apache.org/newt/NOTICE | 8 -
.../vendor/mynewt.apache.org/newt/util/util.go | 28 +++
51 files changed, 712 insertions(+), 563 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/Godeps/Godeps.json
----------------------------------------------------------------------
diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json
index ae4c5e3..9b18ecd 100644
--- a/newtmgr/Godeps/Godeps.json
+++ b/newtmgr/Godeps/Godeps.json
@@ -5,8 +5,8 @@
"Deps": [
{
"ImportPath": "github.com/Sirupsen/logrus",
- "Comment": "v0.10.0-28-ga283a10",
- "Rev": "a283a10442df8dc09befd873fab202bf8a253d6a"
+ "Comment": "v0.10.0-38-g3ec0642",
+ "Rev": "3ec0642a7fb6488f65b06f9040adc67e3990296a"
},
{
"ImportPath": "github.com/inconshreveable/mousetrap",
@@ -18,8 +18,8 @@
},
{
"ImportPath": "github.com/kr/pretty",
- "Comment": "go.weekly.2011-12-22-35-g737b74a",
- "Rev": "737b74a46c4bf788349f72cb256fed10aea4d0ac"
+ "Comment": "go.weekly.2011-12-22-36-gcfb55aa",
+ "Rev": "cfb55aafdaf3ec08f0db22699ab822c50091b1c4"
},
{
"ImportPath": "github.com/kr/text",
@@ -31,7 +31,7 @@
},
{
"ImportPath": "github.com/mitchellh/mapstructure",
- "Rev": "21a35fb16463dfb7c8eee579c65d995d95e64d1e"
+ "Rev": "ca63d7c062ee3c9f34db231e352b60012b4fd0c1"
},
{
"ImportPath": "github.com/runtimeinc/gatt",
@@ -67,11 +67,11 @@
},
{
"ImportPath": "github.com/spf13/cast",
- "Rev": "27b586b42e29bec072fe7379259cc719e1289da6"
+ "Rev": "2580bc98dc0e62908119e4737030cc2fdfc45e4c"
},
{
"ImportPath": "github.com/spf13/cobra",
- "Rev": "f62e98d28ab7ad31d707ba837a966378465c7b57"
+ "Rev": "9c28e4bbd74e5c3ed7aacbc552b2cab7cfdfe744"
},
{
"ImportPath": "github.com/spf13/jwalterweatherman",
@@ -79,7 +79,7 @@
},
{
"ImportPath": "github.com/spf13/pflag",
- "Rev": "1560c1005499d61b80f865c04d39ca7505bf7f0b"
+ "Rev": "c7e63cf4530bcd3ba943729cee0efeff2ebea63f"
},
{
"ImportPath": "github.com/tarm/serial",
@@ -87,27 +87,27 @@
},
{
"ImportPath": "golang.org/x/sys/unix",
- "Rev": "a646d33e2ee3172a661fc09bca23bb4889a41bc8"
+ "Rev": "8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9"
},
{
"ImportPath": "gopkg.in/fsnotify.v1",
- "Comment": "v1.3.1",
- "Rev": "a8a77c9133d2d6fd8334f3260d06f60e8d80a5fb"
+ "Comment": "v1.4.0",
+ "Rev": "26b17cd591df34e7b1cf0087f48fc19ca67eb476"
},
{
"ImportPath": "mynewt.apache.org/newt/util",
- "Comment": "mynewt_0_9_0_rc3_tag-91-g904f79b",
- "Rev": "904f79b15feeefe76a9e4ecc139c56fd54aa4412"
+ "Comment": "pre_sterly_refactor-21-g5389f4c",
+ "Rev": "5389f4c4ef7d7587658b3374d1d0f68f7ecd14c3"
},
{
"ImportPath": "mynewt.apache.org/newt/viper",
- "Comment": "mynewt_0_9_0_rc3_tag-91-g904f79b",
- "Rev": "904f79b15feeefe76a9e4ecc139c56fd54aa4412"
+ "Comment": "pre_sterly_refactor-21-g5389f4c",
+ "Rev": "5389f4c4ef7d7587658b3374d1d0f68f7ecd14c3"
},
{
"ImportPath": "mynewt.apache.org/newt/yaml",
- "Comment": "mynewt_0_9_0_rc3_tag-91-g904f79b",
- "Rev": "904f79b15feeefe76a9e4ecc139c56fd54aa4412"
+ "Comment": "pre_sterly_refactor-21-g5389f4c",
+ "Rev": "5389f4c4ef7d7587658b3374d1d0f68f7ecd14c3"
}
]
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/README.md
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/README.md b/newtmgr/vendor/github.com/Sirupsen/logrus/README.md
index f8302c3..ab48929 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/README.md
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/README.md
@@ -229,6 +229,8 @@ Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/v
| [ElasticSearch](https://github.com/sohlich/elogrus) | Hook for logging to ElasticSearch|
| [Sumorus](https://github.com/doublefree/sumorus) | Hook for logging to [SumoLogic](https://www.sumologic.com/)|
| [Logstash](https://github.com/bshuster-repo/logrus-logstash-hook) | Hook for logging to [Logstash](https://www.elastic.co/products/logstash) |
+| [Logmatic.io](https://github.com/logmatic/logmatic-go) | Hook for logging to [Logmatic.io](http://logmatic.io/) |
+
#### Level logging
@@ -400,3 +402,20 @@ handler := func() {
logrus.RegisterExitHandler(handler)
...
```
+
+#### Thread safty
+
+By default Logger is protected by mutex for concurrent writes, this mutex is invoked when calling hooks and writing logs.
+If you are sure such locking is not needed, you can call logger.SetNoLock() to disable the locking.
+
+Situation when locking is not needed includes:
+
+* You have no hooks registered, or hooks calling is already thread-safe.
+
+* Writing to logger.Out is already thread-safe, for example:
+
+ 1) logger.Out is protected by locks.
+
+ 2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing)
+
+ (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/entry.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/entry.go b/newtmgr/vendor/github.com/Sirupsen/logrus/entry.go
index 54bfc57..4edbe7a 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/entry.go
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/entry.go
@@ -3,11 +3,21 @@ package logrus
import (
"bytes"
"fmt"
- "io"
"os"
+ "sync"
"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.
var ErrorKey = "error"
@@ -29,6 +39,9 @@ type Entry struct {
// Message passed to Debug, Info, Warn, Error, Fatal or Panic
Message string
+
+ // When formatter is called in entry.log(), an Buffer may be set to entry
+ Buffer *bytes.Buffer
}
func NewEntry(logger *Logger) *Entry {
@@ -39,21 +52,15 @@ 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
// formatter.
func (entry *Entry) String() (string, error) {
- reader, err := entry.Reader()
+ serialized, err := entry.Logger.Formatter.Format(entry)
if err != nil {
return "", err
}
-
- return reader.String(), err
+ str := string(serialized)
+ return str, nil
}
// Add an error as single field (using the key defined in ErrorKey) to the Entry.
@@ -81,6 +88,7 @@ func (entry *Entry) WithFields(fields Fields) *Entry {
// This function is not declared with a pointer value because otherwise
// race conditions will occur when using multiple goroutines
func (entry Entry) log(level Level, msg string) {
+ var buffer *bytes.Buffer
entry.Time = time.Now()
entry.Level = level
entry.Message = msg
@@ -90,20 +98,23 @@ func (entry Entry) log(level Level, msg string) {
fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
entry.Logger.mu.Unlock()
}
-
- reader, err := entry.Reader()
+ buffer = bufferPool.Get().(*bytes.Buffer)
+ buffer.Reset()
+ defer bufferPool.Put(buffer)
+ entry.Buffer = buffer
+ serialized, err := entry.Logger.Formatter.Format(&entry)
+ entry.Buffer = nil
if err != nil {
entry.Logger.mu.Lock()
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
entry.Logger.mu.Unlock()
- }
-
- entry.Logger.mu.Lock()
- defer entry.Logger.mu.Unlock()
-
- _, err = io.Copy(entry.Logger.Out, reader)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
+ } else {
+ entry.Logger.mu.Lock()
+ _, err = entry.Logger.Out.Write(serialized)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
+ }
+ entry.Logger.mu.Unlock()
}
// To avoid Entry#log() returning a value that only would make sense for
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/logger.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/logger.go b/newtmgr/vendor/github.com/Sirupsen/logrus/logger.go
index 9052a80..b769f3d 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/logger.go
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/logger.go
@@ -26,8 +26,31 @@ type Logger struct {
// to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
// logged. `logrus.Debug` is useful in
Level Level
- // Used to sync writing to the log.
- mu sync.Mutex
+ // Used to sync writing to the log. Locking is enabled by Default
+ mu MutexWrap
+ // 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`,
@@ -51,162 +74,235 @@ func New() *Logger {
}
}
+func (logger *Logger) newEntry() *Entry {
+ 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.
// If you want multiple fields, use `WithFields`.
func (logger *Logger) WithField(key string, value interface{}) *Entry {
- return NewEntry(logger).WithField(key, value)
+ entry := logger.newEntry()
+ 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
// each `Field`.
func (logger *Logger) WithFields(fields Fields) *Entry {
- return NewEntry(logger).WithFields(fields)
+ entry := logger.newEntry()
+ defer logger.releaseEntry(entry)
+ return entry.WithFields(fields)
}
// Add an error as single field to the log entry. All it does is call
// `WithError` for the given `error`.
func (logger *Logger) WithError(err error) *Entry {
- return NewEntry(logger).WithError(err)
+ entry := logger.newEntry()
+ defer logger.releaseEntry(entry)
+ return entry.WithError(err)
}
func (logger *Logger) Debugf(format string, args ...interface{}) {
if logger.Level >= DebugLevel {
- NewEntry(logger).Debugf(format, args...)
+ entry := logger.newEntry()
+ entry.Debugf(format, args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Infof(format string, args ...interface{}) {
if logger.Level >= InfoLevel {
- NewEntry(logger).Infof(format, args...)
+ entry := logger.newEntry()
+ entry.Infof(format, args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Printf(format string, args ...interface{}) {
- NewEntry(logger).Printf(format, args...)
+ entry := logger.newEntry()
+ entry.Printf(format, args...)
+ logger.releaseEntry(entry)
}
func (logger *Logger) Warnf(format string, args ...interface{}) {
if logger.Level >= WarnLevel {
- NewEntry(logger).Warnf(format, args...)
+ entry := logger.newEntry()
+ entry.Warnf(format, args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Warningf(format string, args ...interface{}) {
if logger.Level >= WarnLevel {
- NewEntry(logger).Warnf(format, args...)
+ entry := logger.newEntry()
+ entry.Warnf(format, args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Errorf(format string, args ...interface{}) {
if logger.Level >= ErrorLevel {
- NewEntry(logger).Errorf(format, args...)
+ entry := logger.newEntry()
+ entry.Errorf(format, args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Fatalf(format string, args ...interface{}) {
if logger.Level >= FatalLevel {
- NewEntry(logger).Fatalf(format, args...)
+ entry := logger.newEntry()
+ entry.Fatalf(format, args...)
+ logger.releaseEntry(entry)
}
Exit(1)
}
func (logger *Logger) Panicf(format string, args ...interface{}) {
if logger.Level >= PanicLevel {
- NewEntry(logger).Panicf(format, args...)
+ entry := logger.newEntry()
+ entry.Panicf(format, args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Debug(args ...interface{}) {
if logger.Level >= DebugLevel {
- NewEntry(logger).Debug(args...)
+ entry := logger.newEntry()
+ entry.Debug(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Info(args ...interface{}) {
if logger.Level >= InfoLevel {
- NewEntry(logger).Info(args...)
+ entry := logger.newEntry()
+ entry.Info(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Print(args ...interface{}) {
- NewEntry(logger).Info(args...)
+ entry := logger.newEntry()
+ entry.Info(args...)
+ logger.releaseEntry(entry)
}
func (logger *Logger) Warn(args ...interface{}) {
if logger.Level >= WarnLevel {
- NewEntry(logger).Warn(args...)
+ entry := logger.newEntry()
+ entry.Warn(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Warning(args ...interface{}) {
if logger.Level >= WarnLevel {
- NewEntry(logger).Warn(args...)
+ entry := logger.newEntry()
+ entry.Warn(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Error(args ...interface{}) {
if logger.Level >= ErrorLevel {
- NewEntry(logger).Error(args...)
+ entry := logger.newEntry()
+ entry.Error(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Fatal(args ...interface{}) {
if logger.Level >= FatalLevel {
- NewEntry(logger).Fatal(args...)
+ entry := logger.newEntry()
+ entry.Fatal(args...)
+ logger.releaseEntry(entry)
}
Exit(1)
}
func (logger *Logger) Panic(args ...interface{}) {
if logger.Level >= PanicLevel {
- NewEntry(logger).Panic(args...)
+ entry := logger.newEntry()
+ entry.Panic(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Debugln(args ...interface{}) {
if logger.Level >= DebugLevel {
- NewEntry(logger).Debugln(args...)
+ entry := logger.newEntry()
+ entry.Debugln(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Infoln(args ...interface{}) {
if logger.Level >= InfoLevel {
- NewEntry(logger).Infoln(args...)
+ entry := logger.newEntry()
+ entry.Infoln(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Println(args ...interface{}) {
- NewEntry(logger).Println(args...)
+ entry := logger.newEntry()
+ entry.Println(args...)
+ logger.releaseEntry(entry)
}
func (logger *Logger) Warnln(args ...interface{}) {
if logger.Level >= WarnLevel {
- NewEntry(logger).Warnln(args...)
+ entry := logger.newEntry()
+ entry.Warnln(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Warningln(args ...interface{}) {
if logger.Level >= WarnLevel {
- NewEntry(logger).Warnln(args...)
+ entry := logger.newEntry()
+ entry.Warnln(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Errorln(args ...interface{}) {
if logger.Level >= ErrorLevel {
- NewEntry(logger).Errorln(args...)
+ entry := logger.newEntry()
+ entry.Errorln(args...)
+ logger.releaseEntry(entry)
}
}
func (logger *Logger) Fatalln(args ...interface{}) {
if logger.Level >= FatalLevel {
- NewEntry(logger).Fatalln(args...)
+ entry := logger.newEntry()
+ entry.Fatalln(args...)
+ logger.releaseEntry(entry)
}
Exit(1)
}
func (logger *Logger) Panicln(args ...interface{}) {
if logger.Level >= PanicLevel {
- NewEntry(logger).Panicln(args...)
+ entry := logger.newEntry()
+ 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()
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_appengine.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_appengine.go b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_appengine.go
new file mode 100644
index 0000000..1960169
--- /dev/null
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_appengine.go
@@ -0,0 +1,8 @@
+// +build appengine
+
+package logrus
+
+// IsTerminal returns true if stderr's file descriptor is a terminal.
+func IsTerminal() bool {
+ return true
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_bsd.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_bsd.go b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_bsd.go
index 71f8d67..5f6be4d 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_bsd.go
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_bsd.go
@@ -1,4 +1,5 @@
// +build darwin freebsd openbsd netbsd dragonfly
+// +build !appengine
package logrus
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_linux.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_linux.go b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_linux.go
index a2c0b40..308160c 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_linux.go
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_linux.go
@@ -3,6 +3,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !appengine
+
package logrus
import "syscall"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go
index b343b3a..329038f 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go
@@ -4,6 +4,7 @@
// license that can be found in the LICENSE file.
// +build linux darwin freebsd openbsd netbsd dragonfly
+// +build !appengine
package logrus
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_solaris.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_solaris.go b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_solaris.go
index 3e70bf7..a3c6f6e 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_solaris.go
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_solaris.go
@@ -1,4 +1,4 @@
-// +build solaris
+// +build solaris,!appengine
package logrus
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_windows.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_windows.go b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_windows.go
index 0146845..3727e8a 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_windows.go
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/terminal_windows.go
@@ -3,7 +3,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build windows
+// +build windows,!appengine
package logrus
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/Sirupsen/logrus/text_formatter.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/Sirupsen/logrus/text_formatter.go b/newtmgr/vendor/github.com/Sirupsen/logrus/text_formatter.go
index 6afd0e0..cce61f2 100644
--- a/newtmgr/vendor/github.com/Sirupsen/logrus/text_formatter.go
+++ b/newtmgr/vendor/github.com/Sirupsen/logrus/text_formatter.go
@@ -57,6 +57,7 @@ type TextFormatter struct {
}
func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
+ var b *bytes.Buffer
var keys []string = make([]string, 0, len(entry.Data))
for k := range entry.Data {
keys = append(keys, k)
@@ -65,8 +66,11 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
if !f.DisableSorting {
sort.Strings(keys)
}
-
- b := &bytes.Buffer{}
+ if entry.Buffer != nil {
+ b = entry.Buffer
+ } else {
+ b = &bytes.Buffer{}
+ }
prefixFieldClashes(entry.Data)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/kr/pretty/formatter.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/kr/pretty/formatter.go b/newtmgr/vendor/github.com/kr/pretty/formatter.go
index 5efaa94..a317d7b 100644
--- a/newtmgr/vendor/github.com/kr/pretty/formatter.go
+++ b/newtmgr/vendor/github.com/kr/pretty/formatter.go
@@ -30,7 +30,7 @@ func Formatter(x interface{}) (f fmt.Formatter) {
}
func (fo formatter) String() string {
- return fmt.Sprint(fo.v) // unwrap it
+ return fmt.Sprint(fo.v.Interface()) // unwrap it
}
func (fo formatter) passThrough(f fmt.State, c rune) {
@@ -47,7 +47,7 @@ func (fo formatter) passThrough(f fmt.State, c rune) {
s += fmt.Sprintf(".%d", p)
}
s += string(c)
- fmt.Fprintf(f, s, fo.v)
+ fmt.Fprintf(f, s, fo.v.Interface())
}
func (fo formatter) Format(f fmt.State, c rune) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go
index 4490521..a554e79 100644
--- a/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go
+++ b/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go
@@ -8,6 +8,7 @@
package mapstructure
import (
+ "encoding/json"
"errors"
"fmt"
"reflect"
@@ -306,6 +307,7 @@ func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value)
func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error {
dataVal := reflect.ValueOf(data)
dataKind := getKind(dataVal)
+ dataType := dataVal.Type()
switch {
case dataKind == reflect.Int:
@@ -327,6 +329,14 @@ func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) er
} else {
return fmt.Errorf("cannot parse '%s' as int: %s", name, err)
}
+ case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
+ jn := data.(json.Number)
+ i, err := jn.Int64()
+ if err != nil {
+ return fmt.Errorf(
+ "error decoding json.Number into %s: %s", name, err)
+ }
+ val.SetInt(i)
default:
return fmt.Errorf(
"'%s' expected type '%s', got unconvertible type '%s'",
@@ -413,6 +423,7 @@ func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) e
func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error {
dataVal := reflect.ValueOf(data)
dataKind := getKind(dataVal)
+ dataType := dataVal.Type()
switch {
case dataKind == reflect.Int:
@@ -434,6 +445,14 @@ func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value)
} else {
return fmt.Errorf("cannot parse '%s' as float: %s", name, err)
}
+ case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
+ jn := data.(json.Number)
+ i, err := jn.Float64()
+ if err != nil {
+ return fmt.Errorf(
+ "error decoding json.Number into %s: %s", name, err)
+ }
+ val.SetFloat(i)
default:
return fmt.Errorf(
"'%s' expected type '%s', got unconvertible type '%s'",
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/cast/.gitignore
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cast/.gitignore b/newtmgr/vendor/github.com/spf13/cast/.gitignore
index 8365624..53053a8 100644
--- a/newtmgr/vendor/github.com/spf13/cast/.gitignore
+++ b/newtmgr/vendor/github.com/spf13/cast/.gitignore
@@ -21,3 +21,5 @@ _testmain.go
*.exe
*.test
+
+*.bench
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/cast/cast.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cast/cast.go b/newtmgr/vendor/github.com/spf13/cast/cast.go
index de5a686..6ca3e0e 100644
--- a/newtmgr/vendor/github.com/spf13/cast/cast.go
+++ b/newtmgr/vendor/github.com/spf13/cast/cast.go
@@ -67,6 +67,11 @@ func ToSlice(i interface{}) []interface{} {
return v
}
+func ToBoolSlice(i interface{}) []bool {
+ v, _ := ToBoolSliceE(i)
+ return v
+}
+
func ToStringSlice(i interface{}) []string {
v, _ := ToStringSliceE(i)
return v
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/cast/caste.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cast/caste.go b/newtmgr/vendor/github.com/spf13/cast/caste.go
index 2377896..23f59a1 100644
--- a/newtmgr/vendor/github.com/spf13/cast/caste.go
+++ b/newtmgr/vendor/github.com/spf13/cast/caste.go
@@ -12,14 +12,11 @@ import (
"strconv"
"strings"
"time"
-
- jww "github.com/spf13/jwalterweatherman"
)
// ToTimeE casts an empty interface to time.Time.
func ToTimeE(i interface{}) (tim time.Time, err error) {
i = indirect(i)
- jww.DEBUG.Println("ToTimeE called on type:", reflect.TypeOf(i))
switch s := i.(type) {
case time.Time:
@@ -38,19 +35,22 @@ func ToTimeE(i interface{}) (tim time.Time, err error) {
// ToDurationE casts an empty interface to time.Duration.
func ToDurationE(i interface{}) (d time.Duration, err error) {
i = indirect(i)
- jww.DEBUG.Println("ToDurationE called on type:", reflect.TypeOf(i))
switch s := i.(type) {
case time.Duration:
return s, nil
- case int64:
- d = time.Duration(s)
+ case int64, int32, int16, int8, int:
+ d = time.Duration(ToInt64(s))
return
- case float64:
- d = time.Duration(s)
+ case float32, float64:
+ d = time.Duration(ToFloat64(s))
return
case string:
- d, err = time.ParseDuration(s)
+ if strings.ContainsAny(s, "nsu�mh") {
+ d, err = time.ParseDuration(s)
+ } else {
+ d, err = time.ParseDuration(s + "ns")
+ }
return
default:
err = fmt.Errorf("Unable to Cast %#v to Duration\n", i)
@@ -60,8 +60,8 @@ func ToDurationE(i interface{}) (d time.Duration, err error) {
// ToBoolE casts an empty interface to a bool.
func ToBoolE(i interface{}) (bool, error) {
+
i = indirect(i)
- jww.DEBUG.Println("ToBoolE called on type:", reflect.TypeOf(i))
switch b := i.(type) {
case bool:
@@ -83,7 +83,6 @@ func ToBoolE(i interface{}) (bool, error) {
// ToFloat64E casts an empty interface to a float64.
func ToFloat64E(i interface{}) (float64, error) {
i = indirect(i)
- jww.DEBUG.Println("ToFloat64E called on type:", reflect.TypeOf(i))
switch s := i.(type) {
case float64:
@@ -114,7 +113,6 @@ func ToFloat64E(i interface{}) (float64, error) {
// ToInt64E casts an empty interface to an int64.
func ToInt64E(i interface{}) (int64, error) {
i = indirect(i)
- jww.DEBUG.Println("ToInt64E called on type:", reflect.TypeOf(i))
switch s := i.(type) {
case int64:
@@ -150,7 +148,6 @@ func ToInt64E(i interface{}) (int64, error) {
// ToIntE casts an empty interface to an int.
func ToIntE(i interface{}) (int, error) {
i = indirect(i)
- jww.DEBUG.Println("ToIntE called on type:", reflect.TypeOf(i))
switch s := i.(type) {
case int:
@@ -225,7 +222,6 @@ func indirectToStringerOrError(a interface{}) interface{} {
// ToStringE casts an empty interface to a string.
func ToStringE(i interface{}) (string, error) {
i = indirectToStringerOrError(i)
- jww.DEBUG.Println("ToStringE called on type:", reflect.TypeOf(i))
switch s := i.(type) {
case string:
@@ -263,7 +259,6 @@ func ToStringE(i interface{}) (string, error) {
// ToStringMapStringE casts an empty interface to a map[string]string.
func ToStringMapStringE(i interface{}) (map[string]string, error) {
- jww.DEBUG.Println("ToStringMapStringE called on type:", reflect.TypeOf(i))
var m = map[string]string{}
@@ -292,7 +287,6 @@ func ToStringMapStringE(i interface{}) (map[string]string, error) {
// ToStringMapStringSliceE casts an empty interface to a map[string][]string.
func ToStringMapStringSliceE(i interface{}) (map[string][]string, error) {
- jww.DEBUG.Println("ToStringMapStringSliceE called on type:", reflect.TypeOf(i))
var m = map[string][]string{}
@@ -310,7 +304,14 @@ func ToStringMapStringSliceE(i interface{}) (map[string][]string, error) {
}
case map[string]interface{}:
for k, val := range v {
- m[ToString(k)] = []string{ToString(val)}
+ switch vt := val.(type) {
+ case []interface{}:
+ m[ToString(k)] = ToStringSlice(vt)
+ case []string:
+ m[ToString(k)] = vt
+ default:
+ m[ToString(k)] = []string{ToString(val)}
+ }
}
return m, nil
case map[interface{}][]string:
@@ -348,7 +349,6 @@ func ToStringMapStringSliceE(i interface{}) (map[string][]string, error) {
// ToStringMapBoolE casts an empty interface to a map[string]bool.
func ToStringMapBoolE(i interface{}) (map[string]bool, error) {
- jww.DEBUG.Println("ToStringMapBoolE called on type:", reflect.TypeOf(i))
var m = map[string]bool{}
@@ -372,7 +372,6 @@ func ToStringMapBoolE(i interface{}) (map[string]bool, error) {
// ToStringMapE casts an empty interface to a map[string]interface{}.
func ToStringMapE(i interface{}) (map[string]interface{}, error) {
- jww.DEBUG.Println("ToStringMapE called on type:", reflect.TypeOf(i))
var m = map[string]interface{}{}
@@ -391,7 +390,6 @@ func ToStringMapE(i interface{}) (map[string]interface{}, error) {
// ToSliceE casts an empty interface to a []interface{}.
func ToSliceE(i interface{}) ([]interface{}, error) {
- jww.DEBUG.Println("ToSliceE called on type:", reflect.TypeOf(i))
var s []interface{}
@@ -411,9 +409,38 @@ func ToSliceE(i interface{}) ([]interface{}, error) {
}
}
+// ToBoolSliceE casts an empty interface to a []bool.
+func ToBoolSliceE(i interface{}) ([]bool, error) {
+
+ if i == nil {
+ return []bool{}, fmt.Errorf("Unable to Cast %#v to []bool", i)
+ }
+
+ switch v := i.(type) {
+ case []bool:
+ return v, nil
+ }
+
+ kind := reflect.TypeOf(i).Kind()
+ switch kind {
+ case reflect.Slice, reflect.Array:
+ s := reflect.ValueOf(i)
+ a := make([]bool, s.Len())
+ for j := 0; j < s.Len(); j++ {
+ val, err := ToBoolE(s.Index(j).Interface())
+ if err != nil {
+ return []bool{}, fmt.Errorf("Unable to Cast %#v to []bool", i)
+ }
+ a[j] = val
+ }
+ return a, nil
+ default:
+ return []bool{}, fmt.Errorf("Unable to Cast %#v to []bool", i)
+ }
+}
+
// ToStringSliceE casts an empty interface to a []string.
func ToStringSliceE(i interface{}) ([]string, error) {
- jww.DEBUG.Println("ToStringSliceE called on type:", reflect.TypeOf(i))
var a []string
@@ -440,7 +467,6 @@ func ToStringSliceE(i interface{}) ([]string, error) {
// ToIntSliceE casts an empty interface to a []int.
func ToIntSliceE(i interface{}) ([]int, error) {
- jww.DEBUG.Println("ToIntSliceE called on type:", reflect.TypeOf(i))
if i == nil {
return []int{}, fmt.Errorf("Unable to Cast %#v to []int", i)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/cobra/.travis.yml
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cobra/.travis.yml b/newtmgr/vendor/github.com/spf13/cobra/.travis.yml
index 6e84be5..bd72adf 100644
--- a/newtmgr/vendor/github.com/spf13/cobra/.travis.yml
+++ b/newtmgr/vendor/github.com/spf13/cobra/.travis.yml
@@ -1,11 +1,13 @@
language: go
-go:
- - 1.4.3
- - 1.5.4
- - 1.6.3
- - tip
matrix:
+ include:
+ - go: 1.4.3
+ env: NOVET=true # No bundled vet.
+ - go: 1.5.4
+ - go: 1.6.3
+ - go: 1.7
+ - go: tip
allow_failures:
- go: tip
@@ -16,3 +18,7 @@ before_install:
script:
- PATH=$PATH:$PWD/bin go test -v ./...
- go build
+ - diff -u <(echo -n) <(gofmt -d -s .)
+ - if [ -z $NOVET ]; then
+ diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
+ fi
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/cobra/README.md
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cobra/README.md b/newtmgr/vendor/github.com/spf13/cobra/README.md
index b338a0e..5d2504b 100644
--- a/newtmgr/vendor/github.com/spf13/cobra/README.md
+++ b/newtmgr/vendor/github.com/spf13/cobra/README.md
@@ -663,7 +663,7 @@ command.SetUsageTemplate(s string)
## PreRun or PostRun Hooks
-It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherrited by children if they do not declare their own. These function are run in the following order:
+It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order:
- `PersistentPreRun`
- `PreRun`
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/cobra/bash_completions.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cobra/bash_completions.go b/newtmgr/vendor/github.com/spf13/cobra/bash_completions.go
index 236dee6..7a5bd4d 100644
--- a/newtmgr/vendor/github.com/spf13/cobra/bash_completions.go
+++ b/newtmgr/vendor/github.com/spf13/cobra/bash_completions.go
@@ -11,7 +11,7 @@ import (
)
const (
- BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extentions"
+ BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extensions"
BashCompCustom = "cobra_annotation_bash_completion_custom"
BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag"
BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir"
@@ -401,10 +401,8 @@ func writeLocalNonPersistentFlag(flag *pflag.Flag, w io.Writer) error {
format += "="
}
format += "\")\n"
- if _, err := fmt.Fprintf(w, format, name); err != nil {
- return err
- }
- return nil
+ _, err := fmt.Fprintf(w, format, name)
+ return err
}
func writeFlags(cmd *Command, w io.Writer) error {
@@ -421,6 +419,9 @@ func writeFlags(cmd *Command, w io.Writer) error {
localNonPersistentFlags := cmd.LocalNonPersistentFlags()
var visitErr error
cmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) {
+ if nonCompletableFlag(flag) {
+ return
+ }
if err := writeFlag(flag, w); err != nil {
visitErr = err
return
@@ -442,6 +443,9 @@ func writeFlags(cmd *Command, w io.Writer) error {
return visitErr
}
cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {
+ if nonCompletableFlag(flag) {
+ return
+ }
if err := writeFlag(flag, w); err != nil {
visitErr = err
return
@@ -468,6 +472,9 @@ func writeRequiredFlag(cmd *Command, w io.Writer) error {
flags := cmd.NonInheritedFlags()
var visitErr error
flags.VisitAll(func(flag *pflag.Flag) {
+ if nonCompletableFlag(flag) {
+ return
+ }
for key := range flag.Annotations {
switch key {
case BashCompOneRequiredFlag:
@@ -574,6 +581,10 @@ func (cmd *Command) GenBashCompletion(w io.Writer) error {
return postscript(w, cmd.Name())
}
+func nonCompletableFlag(flag *pflag.Flag) bool {
+ return flag.Hidden || len(flag.Deprecated) > 0
+}
+
func (cmd *Command) GenBashCompletionFile(filename string) error {
outFile, err := os.Create(filename)
if err != nil {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/cobra/cobra.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cobra/cobra.go b/newtmgr/vendor/github.com/spf13/cobra/cobra.go
index 93a2c0f..b39c715 100644
--- a/newtmgr/vendor/github.com/spf13/cobra/cobra.go
+++ b/newtmgr/vendor/github.com/spf13/cobra/cobra.go
@@ -37,38 +37,36 @@ var templateFuncs = template.FuncMap{
var initializers []func()
-// automatic prefix matching can be a dangerous thing to automatically enable in CLI tools.
-// Set this to true to enable it
+// Automatic prefix matching can be a dangerous thing to automatically enable in CLI tools.
+// Set this to true to enable it.
var EnablePrefixMatching = false
-//EnableCommandSorting controls sorting of the slice of commands, which is turned on by default.
-//To disable sorting, set it to false.
+// EnableCommandSorting controls sorting of the slice of commands, which is turned on by default.
+// To disable sorting, set it to false.
var EnableCommandSorting = true
-//AddTemplateFunc adds a template function that's available to Usage and Help
-//template generation.
+// AddTemplateFunc adds a template function that's available to Usage and Help
+// template generation.
func AddTemplateFunc(name string, tmplFunc interface{}) {
templateFuncs[name] = tmplFunc
}
-//AddTemplateFuncs adds multiple template functions availalble to Usage and
-//Help template generation.
+// AddTemplateFuncs adds multiple template functions availalble to Usage and
+// Help template generation.
func AddTemplateFuncs(tmplFuncs template.FuncMap) {
for k, v := range tmplFuncs {
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()) {
- for _, x := range y {
- initializers = append(initializers, x)
- }
+ initializers = append(initializers, y...)
}
-//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
-//ints and then compared.
+// 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
+// ints and then compared.
func Gt(a interface{}, b interface{}) bool {
var left, right int64
av := reflect.ValueOf(a)
@@ -96,7 +94,7 @@ func Gt(a interface{}, b interface{}) bool {
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 {
av := reflect.ValueOf(a)
bv := reflect.ValueOf(b)
@@ -116,7 +114,7 @@ func trimRightSpace(s string) string {
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 {
if strings.Contains(s, stringToAppend) {
return s
@@ -124,7 +122,7 @@ func appendIfNotPresent(s, stringToAppend string) string {
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 {
template := fmt.Sprintf("%%-%ds", padding)
return fmt.Sprintf(template, s)
@@ -138,7 +136,7 @@ func tmpl(w io.Writer, text string, data interface{}) error {
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 {
if ignoreCase {
s = strings.ToLower(s)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/cobra/command.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cobra/command.go b/newtmgr/vendor/github.com/spf13/cobra/command.go
index 083e4ea..9ae9836 100644
--- a/newtmgr/vendor/github.com/spf13/cobra/command.go
+++ b/newtmgr/vendor/github.com/spf13/cobra/command.go
@@ -140,17 +140,17 @@ func (c *Command) SetOutput(output io.Writer) {
c.output = &output
}
-// Usage can be defined by application
+// Usage can be defined by application.
func (c *Command) SetUsageFunc(f func(*Command) error) {
c.usageFunc = f
}
-// Can be defined by Application
+// Can be defined by Application.
func (c *Command) SetUsageTemplate(s string) {
c.usageTemplate = s
}
-// Can be defined by Application
+// Can be defined by Application.
func (c *Command) SetHelpFunc(f func(*Command, []string)) {
c.helpFunc = f
}
@@ -159,7 +159,7 @@ func (c *Command) SetHelpCommand(cmd *Command) {
c.helpCommand = cmd
}
-// Can be defined by Application
+// Can be defined by Application.
func (c *Command) SetHelpTemplate(s string) {
c.helpTemplate = s
}
@@ -195,7 +195,7 @@ func (c *Command) getOut(def io.Writer) io.Writer {
}
// 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) {
if c.usageFunc != nil {
return c.usageFunc
@@ -214,15 +214,15 @@ func (c *Command) UsageFunc() (f func(*Command) error) {
}
}
-// Output the usage for the command
-// Used when a user provides invalid input
-// Can be defined by user by overriding UsageFunc
+// Usage puts out the usage for the command.
+// Used when a user provides invalid input.
+// Can be defined by user by overriding UsageFunc.
func (c *Command) Usage() error {
return c.UsageFunc()(c)
}
// 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) {
cmd := c
for cmd != nil {
@@ -240,9 +240,9 @@ func (c *Command) HelpFunc() func(*Command, []string) {
}
}
-// Output the help for the command
-// Used when a user calls help [command]
-// Can be defined by user by overriding HelpFunc
+// 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 {
c.HelpFunc()(c, []string{})
return nil
@@ -333,7 +333,7 @@ func (c *Command) HelpTemplate() string {
{{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() {
for _, x := range c.commands {
x.parent = c
@@ -745,13 +745,13 @@ func (c *Command) initHelpCmd() {
c.AddCommand(c.helpCommand)
}
-// Used for testing
+// Used for testing.
func (c *Command) ResetCommands() {
c.commands = nil
c.helpCommand = nil
}
-// Sorts commands by their names
+// Sorts commands by their names.
type commandSorterByName []*Command
func (c commandSorterByName) Len() int { return len(c) }
@@ -831,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{}) {
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{}) {
str := fmt.Sprintln(i...)
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{}) {
str := fmt.Sprintf(format, i...)
c.Print(str)
@@ -859,7 +859,7 @@ func (c *Command) CommandPath() string {
return str
}
-//The full usage for a given command (including parents)
+// UseLine puts out the full usage for a given command (including parents).
func (c *Command) UseLine() string {
str := ""
if c.HasParent() {
@@ -869,7 +869,7 @@ func (c *Command) UseLine() string {
}
// For use in determining which flags have been assigned to which commands
-// and which persist
+// and which persist.
func (c *Command) DebugFlags() {
c.Println("DebugFlags called on", c.Name())
var debugflags func(*Command)
@@ -944,18 +944,18 @@ func (c *Command) HasExample() bool {
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 {
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 {
return len(c.commands) > 0
}
// 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 {
if len(c.Deprecated) != 0 || c.Hidden {
return false
@@ -974,7 +974,7 @@ func (c *Command) IsAvailableCommand() bool {
// IsHelpCommand determines if a command is a 'help' command; a help command is
// determined by the fact that it is NOT runnable/hidden/deprecated, and has no
-// sub commands that are runnable/hidden/deprecated
+// sub commands that are runnable/hidden/deprecated.
func (c *Command) IsHelpCommand() bool {
// if a command is runnable, deprecated, or hidden it is not a 'help' command
@@ -993,9 +993,9 @@ func (c *Command) IsHelpCommand() bool {
return true
}
-// HasHelpSubCommands determines if a command has any avilable 'help' sub commands
+// HasHelpSubCommands determines if a command has any available 'help' sub commands
// that need to be shown in the usage/help default template under 'additional help
-// topics'
+// topics'.
func (c *Command) HasHelpSubCommands() bool {
// return true on the first found available 'help' sub command
@@ -1010,7 +1010,7 @@ func (c *Command) HasHelpSubCommands() bool {
}
// 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 {
// return true on the first found available (non deprecated/help/hidden)
@@ -1026,17 +1026,18 @@ func (c *Command) HasAvailableSubCommands() bool {
return false
}
-// Determine if the command is a child command
+// HasParent determines if the command is a child command.
func (c *Command) HasParent() bool {
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 {
return c.globNormFunc
}
-// Get the complete FlagSet that applies to this command (local and persistent declared here and by all parents)
+// Flage returns the complete FlagSet that applies
+// to this command (local and persistent declared here and by all parents).
func (c *Command) Flags() *flag.FlagSet {
if c.flags == nil {
c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
@@ -1048,7 +1049,7 @@ func (c *Command) Flags() *flag.FlagSet {
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 {
persistentFlags := c.PersistentFlags()
@@ -1061,7 +1062,7 @@ func (c *Command) LocalNonPersistentFlags() *flag.FlagSet {
return out
}
-// Get the local FlagSet specifically set in the current command
+// LocalFlags returns the local FlagSet specifically set in the current command.
func (c *Command) LocalFlags() *flag.FlagSet {
c.mergePersistentFlags()
@@ -1079,7 +1080,7 @@ func (c *Command) LocalFlags() *flag.FlagSet {
return local
}
-// All Flags which were inherited from parents commands
+// InheritedFlags returns all flags which were inherited from parents commands.
func (c *Command) InheritedFlags() *flag.FlagSet {
c.mergePersistentFlags()
@@ -1108,12 +1109,12 @@ func (c *Command) InheritedFlags() *flag.FlagSet {
return inherited
}
-// All Flags which were not inherited from parent commands
+// NonInheritedFlags returns all flags which were not inherited from parent commands.
func (c *Command) NonInheritedFlags() *flag.FlagSet {
return c.LocalFlags()
}
-// Get the Persistent FlagSet specifically set in the current command
+// PersistentFlags returns the persistent FlagSet specifically set in the current command.
func (c *Command) PersistentFlags() *flag.FlagSet {
if c.pflags == nil {
c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
@@ -1125,7 +1126,7 @@ func (c *Command) PersistentFlags() *flag.FlagSet {
return c.pflags
}
-// For use in testing
+// ResetFlags is used in testing.
func (c *Command) ResetFlags() {
c.flagErrorBuf = new(bytes.Buffer)
c.flagErrorBuf.Reset()
@@ -1135,50 +1136,50 @@ func (c *Command) ResetFlags() {
c.pflags.SetOutput(c.flagErrorBuf)
}
-// Does the command contain 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 {
return c.Flags().HasFlags()
}
-// Does the command contain persistent flags
+// Does the command contain persistent flags.
func (c *Command) HasPersistentFlags() bool {
return c.PersistentFlags().HasFlags()
}
-// Does the command has flags specifically declared locally
+// Does the command has flags specifically declared locally.
func (c *Command) HasLocalFlags() bool {
return c.LocalFlags().HasFlags()
}
-// Does the command have flags inherited from its parent command
+// Does the command have flags inherited from its parent command.
func (c *Command) HasInheritedFlags() bool {
return c.InheritedFlags().HasFlags()
}
// 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 {
return c.Flags().HasAvailableFlags()
}
-// Does the command contain 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 {
return c.PersistentFlags().HasAvailableFlags()
}
// Does the command has flags specifically declared locally which are not hidden
-// or deprecated
+// or deprecated.
func (c *Command) HasAvailableLocalFlags() bool {
return c.LocalFlags().HasAvailableFlags()
}
// 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 {
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) {
flag = c.Flags().Lookup(name)
@@ -1189,7 +1190,7 @@ func (c *Command) Flag(name string) (flag *flag.Flag) {
return
}
-// recursively find matching persistent flag
+// Recursively find matching persistent flag.
func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
if c.HasPersistentFlags() {
flag = c.PersistentFlags().Lookup(name)
@@ -1201,7 +1202,7 @@ func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
return
}
-// ParseFlags parses persistent flag tree & local flags
+// ParseFlags parses persistent flag tree and local flags.
func (c *Command) ParseFlags(args []string) (err error) {
if c.DisableFlagParsing {
return nil
@@ -1211,7 +1212,7 @@ func (c *Command) ParseFlags(args []string) (err error) {
return
}
-// Parent returns a commands parent command
+// Parent returns a commands parent command.
func (c *Command) Parent() *Command {
return c.parent
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/.travis.yml
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/.travis.yml b/newtmgr/vendor/github.com/spf13/pflag/.travis.yml
index 580ad22..0a7c136 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/.travis.yml
+++ b/newtmgr/vendor/github.com/spf13/pflag/.travis.yml
@@ -5,8 +5,12 @@ language: go
go:
- 1.5.4
- 1.6.3
+ - 1.7
- tip
+matrix:
+ allow_failures:
+ - go: tip
install:
- go get github.com/golang/lint/golint
- export PATH=$GOPATH/bin:$PATH
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/bool.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/bool.go b/newtmgr/vendor/github.com/spf13/pflag/bool.go
index d272e40..c4c5c0b 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/bool.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/bool.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// optional interface to indicate boolean flags that can be
// supplied without "=value" text
@@ -30,7 +27,7 @@ func (b *boolValue) Type() string {
return "bool"
}
-func (b *boolValue) String() string { return fmt.Sprintf("%v", *b) }
+func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) }
func (b *boolValue) IsBoolFlag() bool { return true }
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/count.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/count.go b/newtmgr/vendor/github.com/spf13/pflag/count.go
index 7b1f142..d22be41 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/count.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/count.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- count Value
type countValue int
@@ -28,7 +25,7 @@ func (i *countValue) Type() string {
return "count"
}
-func (i *countValue) String() string { return fmt.Sprintf("%v", *i) }
+func (i *countValue) String() string { return strconv.Itoa(int(*i)) }
func countConv(sval string) (interface{}, error) {
i, err := strconv.Atoi(sval)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/flag.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/flag.go b/newtmgr/vendor/github.com/spf13/pflag/flag.go
index 965df13..b0b0d46 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/flag.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/flag.go
@@ -419,20 +419,36 @@ func (f *FlagSet) PrintDefaults() {
fmt.Fprintf(f.out(), "%s", usages)
}
-// isZeroValue guesses whether the string represents the zero
-// value for a flag. It is not accurate but in practice works OK.
-func isZeroValue(value string) bool {
- switch value {
- case "false":
- return true
- case "<nil>":
- return true
- case "":
- return true
- case "0":
- return true
+// defaultIsZeroValue returns true if the default value for this flag represents
+// a zero value.
+func (f *Flag) defaultIsZeroValue() bool {
+ switch f.Value.(type) {
+ case boolFlag:
+ return f.DefValue == "false"
+ case *durationValue:
+ // Beginning in Go 1.7, duration zero values are "0s"
+ return f.DefValue == "0" || f.DefValue == "0s"
+ case *intValue, *int8Value, *int32Value, *int64Value, *uintValue, *uint8Value, *uint16Value, *uint32Value, *uint64Value, *countValue, *float32Value, *float64Value:
+ return f.DefValue == "0"
+ case *stringValue:
+ return f.DefValue == ""
+ case *ipValue, *ipMaskValue, *ipNetValue:
+ return f.DefValue == "<nil>"
+ case *intSliceValue, *stringSliceValue, *stringArrayValue:
+ return f.DefValue == "[]"
+ default:
+ switch f.Value.String() {
+ case "false":
+ return true
+ case "<nil>":
+ return true
+ case "":
+ return true
+ case "0":
+ return true
+ }
+ return false
}
- return false
}
// UnquoteUsage extracts a back-quoted name from the usage
@@ -455,22 +471,19 @@ func UnquoteUsage(flag *Flag) (name string, usage string) {
break // Only one back quote; use type name.
}
}
- // No explicit name, so use type if we can find one.
- name = "value"
- switch flag.Value.(type) {
- case boolFlag:
+
+ name = flag.Value.Type()
+ switch name {
+ case "bool":
name = ""
- case *durationValue:
- name = "duration"
- case *float64Value:
+ case "float64":
name = "float"
- case *intValue, *int64Value:
+ case "int64":
name = "int"
- case *stringValue:
- name = "string"
- case *uintValue, *uint64Value:
+ case "uint64":
name = "uint"
}
+
return
}
@@ -519,7 +532,7 @@ func (f *FlagSet) FlagUsages() string {
}
line += usage
- if !isZeroValue(flag.DefValue) {
+ if !flag.defaultIsZeroValue() {
if flag.Value.Type() == "string" {
line += fmt.Sprintf(" (default %q)", flag.DefValue)
} else {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/float32.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/float32.go b/newtmgr/vendor/github.com/spf13/pflag/float32.go
index 7683fae..a243f81 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/float32.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/float32.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- float32 Value
type float32Value float32
@@ -23,7 +20,7 @@ func (f *float32Value) Type() string {
return "float32"
}
-func (f *float32Value) String() string { return fmt.Sprintf("%v", *f) }
+func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) }
func float32Conv(sval string) (interface{}, error) {
v, err := strconv.ParseFloat(sval, 32)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/float64.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/float64.go b/newtmgr/vendor/github.com/spf13/pflag/float64.go
index 50fbf8c..04b5492 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/float64.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/float64.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- float64 Value
type float64Value float64
@@ -23,7 +20,7 @@ func (f *float64Value) Type() string {
return "float64"
}
-func (f *float64Value) String() string { return fmt.Sprintf("%v", *f) }
+func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) }
func float64Conv(sval string) (interface{}, error) {
return strconv.ParseFloat(sval, 64)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/int.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/int.go b/newtmgr/vendor/github.com/spf13/pflag/int.go
index b656036..1474b89 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/int.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/int.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- int Value
type intValue int
@@ -23,7 +20,7 @@ func (i *intValue) Type() string {
return "int"
}
-func (i *intValue) String() string { return fmt.Sprintf("%v", *i) }
+func (i *intValue) String() string { return strconv.Itoa(int(*i)) }
func intConv(sval string) (interface{}, error) {
return strconv.Atoi(sval)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/int32.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/int32.go b/newtmgr/vendor/github.com/spf13/pflag/int32.go
index 41659a9..9b95944 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/int32.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/int32.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- int32 Value
type int32Value int32
@@ -23,7 +20,7 @@ func (i *int32Value) Type() string {
return "int32"
}
-func (i *int32Value) String() string { return fmt.Sprintf("%v", *i) }
+func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) }
func int32Conv(sval string) (interface{}, error) {
v, err := strconv.ParseInt(sval, 0, 32)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/int64.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/int64.go b/newtmgr/vendor/github.com/spf13/pflag/int64.go
index 6e67e38..0026d78 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/int64.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/int64.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- int64 Value
type int64Value int64
@@ -23,7 +20,7 @@ func (i *int64Value) Type() string {
return "int64"
}
-func (i *int64Value) String() string { return fmt.Sprintf("%v", *i) }
+func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) }
func int64Conv(sval string) (interface{}, error) {
return strconv.ParseInt(sval, 0, 64)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/int8.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/int8.go b/newtmgr/vendor/github.com/spf13/pflag/int8.go
index 400db21..4da9222 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/int8.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/int8.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- int8 Value
type int8Value int8
@@ -23,7 +20,7 @@ func (i *int8Value) Type() string {
return "int8"
}
-func (i *int8Value) String() string { return fmt.Sprintf("%v", *i) }
+func (i *int8Value) String() string { return strconv.FormatInt(int64(*i), 10) }
func int8Conv(sval string) (interface{}, error) {
v, err := strconv.ParseInt(sval, 0, 8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/string.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/string.go b/newtmgr/vendor/github.com/spf13/pflag/string.go
index e296136..04e0a26 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/string.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/string.go
@@ -1,7 +1,5 @@
package pflag
-import "fmt"
-
// -- string Value
type stringValue string
@@ -18,7 +16,7 @@ func (s *stringValue) Type() string {
return "string"
}
-func (s *stringValue) String() string { return fmt.Sprintf("%s", *s) }
+func (s *stringValue) String() string { return string(*s) }
func stringConv(sval string) (interface{}, error) {
return sval, nil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/string_array.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/string_array.go b/newtmgr/vendor/github.com/spf13/pflag/string_array.go
new file mode 100644
index 0000000..f320f2e
--- /dev/null
+++ b/newtmgr/vendor/github.com/spf13/pflag/string_array.go
@@ -0,0 +1,110 @@
+package pflag
+
+import (
+ "fmt"
+ "strings"
+)
+
+var _ = fmt.Fprint
+
+// -- stringArray Value
+type stringArrayValue struct {
+ value *[]string
+ changed bool
+}
+
+func newStringArrayValue(val []string, p *[]string) *stringArrayValue {
+ ssv := new(stringArrayValue)
+ ssv.value = p
+ *ssv.value = val
+ return ssv
+}
+
+func (s *stringArrayValue) Set(val string) error {
+ if !s.changed {
+ *s.value = []string{val}
+ s.changed = true
+ } else {
+ *s.value = append(*s.value, val)
+ }
+ return nil
+}
+
+func (s *stringArrayValue) Type() string {
+ return "stringArray"
+}
+
+func (s *stringArrayValue) String() string {
+ str, _ := writeAsCSV(*s.value)
+ return "[" + str + "]"
+}
+
+func stringArrayConv(sval string) (interface{}, error) {
+ sval = strings.Trim(sval, "[]")
+ // An empty string would cause a array with one (empty) string
+ if len(sval) == 0 {
+ return []string{}, nil
+ }
+ return readAsCSV(sval)
+}
+
+// GetStringArray return the []string value of a flag with the given name
+func (f *FlagSet) GetStringArray(name string) ([]string, error) {
+ val, err := f.getFlagType(name, "stringArray", stringArrayConv)
+ if err != nil {
+ return []string{}, err
+ }
+ return val.([]string), nil
+}
+
+// StringArrayVar defines a string flag with specified name, default value, and usage string.
+// The argument p points to a []string variable in which to store the values of the multiple flags.
+// The value of each argument will not try to be separated by comma
+func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) {
+ f.VarP(newStringArrayValue(value, p), name, "", usage)
+}
+
+// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
+func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
+ f.VarP(newStringArrayValue(value, p), name, shorthand, usage)
+}
+
+// StringArrayVar defines a string flag with specified name, default value, and usage string.
+// The argument p points to a []string variable in which to store the value of the flag.
+// The value of each argument will not try to be separated by comma
+func StringArrayVar(p *[]string, name string, value []string, usage string) {
+ CommandLine.VarP(newStringArrayValue(value, p), name, "", usage)
+}
+
+// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
+func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
+ CommandLine.VarP(newStringArrayValue(value, p), name, shorthand, usage)
+}
+
+// StringArray defines a string flag with specified name, default value, and usage string.
+// The return value is the address of a []string variable that stores the value of the flag.
+// The value of each argument will not try to be separated by comma
+func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string {
+ p := []string{}
+ f.StringArrayVarP(&p, name, "", value, usage)
+ return &p
+}
+
+// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
+func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage string) *[]string {
+ p := []string{}
+ f.StringArrayVarP(&p, name, shorthand, value, usage)
+ return &p
+}
+
+// StringArray defines a string flag with specified name, default value, and usage string.
+// The return value is the address of a []string variable that stores the value of the flag.
+// The value of each argument will not try to be separated by comma
+func StringArray(name string, value []string, usage string) *[]string {
+ return CommandLine.StringArrayP(name, "", value, usage)
+}
+
+// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
+func StringArrayP(name, shorthand string, value []string, usage string) *[]string {
+ return CommandLine.StringArrayP(name, shorthand, value, usage)
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/string_slice.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/string_slice.go b/newtmgr/vendor/github.com/spf13/pflag/string_slice.go
index b53648b..51e3c5d 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/string_slice.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/string_slice.go
@@ -1,6 +1,7 @@
package pflag
import (
+ "bytes"
"encoding/csv"
"fmt"
"strings"
@@ -21,10 +22,28 @@ func newStringSliceValue(val []string, p *[]string) *stringSliceValue {
return ssv
}
-func (s *stringSliceValue) Set(val string) error {
+func readAsCSV(val string) ([]string, error) {
+ if val == "" {
+ return []string{}, nil
+ }
stringReader := strings.NewReader(val)
csvReader := csv.NewReader(stringReader)
- v, err := csvReader.Read()
+ return csvReader.Read()
+}
+
+func writeAsCSV(vals []string) (string, error) {
+ b := &bytes.Buffer{}
+ w := csv.NewWriter(b)
+ err := w.Write(vals)
+ if err != nil {
+ return "", err
+ }
+ w.Flush()
+ return strings.TrimSuffix(b.String(), fmt.Sprintln()), nil
+}
+
+func (s *stringSliceValue) Set(val string) error {
+ v, err := readAsCSV(val)
if err != nil {
return err
}
@@ -41,7 +60,10 @@ func (s *stringSliceValue) Type() string {
return "stringSlice"
}
-func (s *stringSliceValue) String() string { return "[" + strings.Join(*s.value, ",") + "]" }
+func (s *stringSliceValue) String() string {
+ str, _ := writeAsCSV(*s.value)
+ return "[" + str + "]"
+}
func stringSliceConv(sval string) (interface{}, error) {
sval = strings.Trim(sval, "[]")
@@ -49,8 +71,7 @@ func stringSliceConv(sval string) (interface{}, error) {
if len(sval) == 0 {
return []string{}, nil
}
- v := strings.Split(sval, ",")
- return v, nil
+ return readAsCSV(sval)
}
// GetStringSlice return the []string value of a flag with the given name
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/uint.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/uint.go b/newtmgr/vendor/github.com/spf13/pflag/uint.go
index e142b49..dcbc2b7 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/uint.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/uint.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- uint Value
type uintValue uint
@@ -23,7 +20,7 @@ func (i *uintValue) Type() string {
return "uint"
}
-func (i *uintValue) String() string { return fmt.Sprintf("%v", *i) }
+func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) }
func uintConv(sval string) (interface{}, error) {
v, err := strconv.ParseUint(sval, 0, 0)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/uint16.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/uint16.go b/newtmgr/vendor/github.com/spf13/pflag/uint16.go
index 5c96c19..7e9914e 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/uint16.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/uint16.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- uint16 value
type uint16Value uint16
@@ -12,7 +9,7 @@ func newUint16Value(val uint16, p *uint16) *uint16Value {
*p = val
return (*uint16Value)(p)
}
-func (i *uint16Value) String() string { return fmt.Sprintf("%d", *i) }
+
func (i *uint16Value) Set(s string) error {
v, err := strconv.ParseUint(s, 0, 16)
*i = uint16Value(v)
@@ -23,6 +20,8 @@ func (i *uint16Value) Type() string {
return "uint16"
}
+func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
+
func uint16Conv(sval string) (interface{}, error) {
v, err := strconv.ParseUint(sval, 0, 16)
if err != nil {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/uint32.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/uint32.go b/newtmgr/vendor/github.com/spf13/pflag/uint32.go
index 294fcaa..d802453 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/uint32.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/uint32.go
@@ -1,18 +1,15 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
-// -- uint16 value
+// -- uint32 value
type uint32Value uint32
func newUint32Value(val uint32, p *uint32) *uint32Value {
*p = val
return (*uint32Value)(p)
}
-func (i *uint32Value) String() string { return fmt.Sprintf("%d", *i) }
+
func (i *uint32Value) Set(s string) error {
v, err := strconv.ParseUint(s, 0, 32)
*i = uint32Value(v)
@@ -23,6 +20,8 @@ func (i *uint32Value) Type() string {
return "uint32"
}
+func (i *uint32Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
+
func uint32Conv(sval string) (interface{}, error) {
v, err := strconv.ParseUint(sval, 0, 32)
if err != nil {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/uint64.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/uint64.go b/newtmgr/vendor/github.com/spf13/pflag/uint64.go
index c681885..f62240f 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/uint64.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/uint64.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- uint64 Value
type uint64Value uint64
@@ -23,7 +20,7 @@ func (i *uint64Value) Type() string {
return "uint64"
}
-func (i *uint64Value) String() string { return fmt.Sprintf("%v", *i) }
+func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
func uint64Conv(sval string) (interface{}, error) {
v, err := strconv.ParseUint(sval, 0, 64)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/github.com/spf13/pflag/uint8.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/uint8.go b/newtmgr/vendor/github.com/spf13/pflag/uint8.go
index 26db418..bb0e83c 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/uint8.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/uint8.go
@@ -1,9 +1,6 @@
package pflag
-import (
- "fmt"
- "strconv"
-)
+import "strconv"
// -- uint8 Value
type uint8Value uint8
@@ -23,7 +20,7 @@ func (i *uint8Value) Type() string {
return "uint8"
}
-func (i *uint8Value) String() string { return fmt.Sprintf("%v", *i) }
+func (i *uint8Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
func uint8Conv(sval string) (interface{}, error) {
v, err := strconv.ParseUint(sval, 0, 8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/golang.org/x/sys/unix/syscall_solaris.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/golang.org/x/sys/unix/syscall_solaris.go b/newtmgr/vendor/golang.org/x/sys/unix/syscall_solaris.go
index eb489b1..acb74b1 100644
--- a/newtmgr/vendor/golang.org/x/sys/unix/syscall_solaris.go
+++ b/newtmgr/vendor/golang.org/x/sys/unix/syscall_solaris.go
@@ -72,18 +72,20 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
return origlen - len(buf), count, names
}
-func pipe() (r uintptr, w uintptr, err uintptr)
+//sysnb pipe(p *[2]_C_int) (n int, err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
return EINVAL
}
- r0, w0, e1 := pipe()
- if e1 != 0 {
- err = syscall.Errno(e1)
+ var pp [2]_C_int
+ n, err := pipe(&pp)
+ if n != 0 {
+ return err
}
- p[0], p[1] = int(r0), int(w0)
- return
+ p[0] = int(pp[0])
+ p[1] = int(pp[1])
+ return nil
}
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
@@ -269,24 +271,34 @@ func (w WaitStatus) StopSignal() syscall.Signal {
func (w WaitStatus) TrapCause() int { return -1 }
-func wait4(pid uintptr, wstatus *WaitStatus, options uintptr, rusage *Rusage) (wpid uintptr, err uintptr)
+//sys wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, err error)
-func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
- r0, e1 := wait4(uintptr(pid), wstatus, uintptr(options), rusage)
- if e1 != 0 {
- err = syscall.Errno(e1)
+func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (int, error) {
+ var status _C_int
+ rpid, err := wait4(int32(pid), &status, options, rusage)
+ wpid := int(rpid)
+ if wpid == -1 {
+ return wpid, err
+ }
+ if wstatus != nil {
+ *wstatus = WaitStatus(status)
}
- return int(r0), err
+ return wpid, nil
}
-func gethostname() (name string, err uintptr)
+//sys gethostname(buf []byte) (n int, err error)
func Gethostname() (name string, err error) {
- name, e1 := gethostname()
- if e1 != 0 {
- err = syscall.Errno(e1)
+ var buf [MaxHostNameLen]byte
+ n, err := gethostname(buf[:])
+ if n != 0 {
+ return "", err
}
- return name, err
+ n = clen(buf[:])
+ if n < 1 {
+ return "", EFAULT
+ }
+ return string(buf[:n]), nil
}
//sys utimes(path string, times *[2]Timeval) (err error)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/golang.org/x/sys/unix/types_solaris.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/golang.org/x/sys/unix/types_solaris.go b/newtmgr/vendor/golang.org/x/sys/unix/types_solaris.go
index 6ad50ea..c5d5c8f 100644
--- a/newtmgr/vendor/golang.org/x/sys/unix/types_solaris.go
+++ b/newtmgr/vendor/golang.org/x/sys/unix/types_solaris.go
@@ -22,6 +22,7 @@ package unix
#define __USE_LEGACY_PROTOTYPES__ // iovec
#include <dirent.h>
#include <fcntl.h>
+#include <netdb.h>
#include <limits.h>
#include <signal.h>
#include <termios.h>
@@ -81,6 +82,7 @@ const (
sizeofLong = C.sizeof_long
sizeofLongLong = C.sizeof_longlong
PathMax = C.PATH_MAX
+ MaxHostNameLen = C.MAXHOSTNAMELEN
)
// Basic types
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/newtmgr/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
index 4326427..c0ecfc0 100644
--- a/newtmgr/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
+++ b/newtmgr/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
@@ -10,10 +10,13 @@ import (
"unsafe"
)
+//go:cgo_import_dynamic libc_pipe pipe "libc.so"
//go:cgo_import_dynamic libc_getsockname getsockname "libsocket.so"
//go:cgo_import_dynamic libc_getcwd getcwd "libc.so"
//go:cgo_import_dynamic libc_getgroups getgroups "libc.so"
//go:cgo_import_dynamic libc_setgroups setgroups "libc.so"
+//go:cgo_import_dynamic libc_wait4 wait4 "libc.so"
+//go:cgo_import_dynamic libc_gethostname gethostname "libc.so"
//go:cgo_import_dynamic libc_utimes utimes "libc.so"
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
@@ -125,10 +128,13 @@ import (
//go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so"
//go:cgo_import_dynamic libc_sysconf sysconf "libc.so"
+//go:linkname procpipe libc_pipe
//go:linkname procgetsockname libc_getsockname
//go:linkname procGetcwd libc_getcwd
//go:linkname procgetgroups libc_getgroups
//go:linkname procsetgroups libc_setgroups
+//go:linkname procwait4 libc_wait4
+//go:linkname procgethostname libc_gethostname
//go:linkname procutimes libc_utimes
//go:linkname procutimensat libc_utimensat
//go:linkname procfcntl libc_fcntl
@@ -241,10 +247,13 @@ import (
//go:linkname procsysconf libc_sysconf
var (
+ procpipe,
procgetsockname,
procGetcwd,
procgetgroups,
procsetgroups,
+ procwait4,
+ procgethostname,
procutimes,
procutimensat,
procfcntl,
@@ -357,6 +366,15 @@ var (
procsysconf syscallFunc
)
+func pipe(p *[2]_C_int) (n int, err error) {
+ r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe)), 1, uintptr(unsafe.Pointer(p)), 0, 0, 0, 0, 0)
+ n = int(r0)
+ if e1 != 0 {
+ err = e1
+ }
+ return
+}
+
func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e1 != 0 {
@@ -395,6 +413,28 @@ func setgroups(ngid int, gid *_Gid_t) (err error) {
return
}
+func wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, err error) {
+ r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwait4)), 4, uintptr(pid), uintptr(unsafe.Pointer(statusp)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
+ wpid = int32(r0)
+ if e1 != 0 {
+ err = e1
+ }
+ return
+}
+
+func gethostname(buf []byte) (n int, err error) {
+ var _p0 *byte
+ if len(buf) > 0 {
+ _p0 = &buf[0]
+ }
+ r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgethostname)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0, 0, 0, 0)
+ n = int(r0)
+ if e1 != 0 {
+ err = e1
+ }
+ return
+}
+
func utimes(path string, times *[2]Timeval) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/newtmgr/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
index b3b928a..02777e4 100644
--- a/newtmgr/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
+++ b/newtmgr/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
@@ -1,6 +1,6 @@
// +build amd64,solaris
// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs types_solaris.go
+// cgo -godefs types_solaris.go | go run mkpost.go
package unix
@@ -11,6 +11,7 @@ const (
sizeofLong = 0x8
sizeofLongLong = 0x8
PathMax = 0x400
+ MaxHostNameLen = 0x100
)
type (
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml b/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml
index 00fd5dd..e6def9a 100644
--- a/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml
+++ b/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml
@@ -3,7 +3,7 @@ language: go
go:
- 1.5.4
- - 1.6.1
+ - 1.6.3
- tip
matrix:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c8c93f6b/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS b/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS
index 71c47ce..2e64e5c 100644
--- a/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS
+++ b/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS
@@ -32,6 +32,7 @@ Pieter Droogendijk <pi...@binky.org.uk>
Pursuit92 <Jo...@techpursuit.net>
Riku Voipio <ri...@linaro.org>
Rob Figueiredo <ro...@gmail.com>
+Slawek Ligus <ro...@ooz.ie>
Soge Zhang <zh...@gmail.com>
Tiffany Jernigan <ti...@intel.com>
Tilak Sharma <ti...@google.com>