You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by st...@apache.org on 2016/02/23 00:04:51 UTC
[20/28] incubator-mynewt-newt git commit: Remove Godeps;
user can acquire deps via "go get".
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/LICENSE
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/LICENSE b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/LICENSE
deleted file mode 100644
index c33dcc7..0000000
--- a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/LICENSE
+++ /dev/null
@@ -1,354 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. “Contributor”
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. “Contributor Version”
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor’s Contribution.
-
-1.3. “Contribution”
-
- means Covered Software of a particular Contributor.
-
-1.4. “Covered Software”
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. “Incompatible With Secondary Licenses”
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of version
- 1.1 or earlier of the License, but not also under the terms of a
- Secondary License.
-
-1.6. “Executable Form”
-
- means any form of the work other than Source Code Form.
-
-1.7. “Larger Work”
-
- means a work that combines Covered Software with other material, in a separate
- file or files, that is not Covered Software.
-
-1.8. “License”
-
- means this document.
-
-1.9. “Licensable”
-
- means having the right to grant, to the maximum extent possible, whether at the
- time of the initial grant or subsequently, any and all of the rights conveyed by
- this License.
-
-1.10. “Modifications”
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to, deletion
- from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. “Patent Claims” of a Contributor
-
- means any patent claim(s), including without limitation, method, process,
- and apparatus claims, in any patent Licensable by such Contributor that
- would be infringed, but for the grant of the License, by the making,
- using, selling, offering for sale, having made, import, or transfer of
- either its Contributions or its Contributor Version.
-
-1.12. “Secondary License”
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. “Source Code Form”
-
- means the form of the work preferred for making modifications.
-
-1.14. “You” (or “Your”)
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, “You” includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, “control” means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or as
- part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its Contributions
- or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution become
- effective for each Contribution on the date the Contributor first distributes
- such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under this
- License. No additional rights or licenses will be implied from the distribution
- or licensing of Covered Software under this License. Notwithstanding Section
- 2.1(b) above, no patent license is granted by a Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party’s
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of its
- Contributions.
-
- This License does not grant any rights in the trademarks, service marks, or
- logos of any Contributor (except as may be necessary to comply with the
- notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this License
- (see Section 10.2) or under the terms of a Secondary License (if permitted
- under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its Contributions
- are its original creation(s) or it has sufficient rights to grant the
- rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under applicable
- copyright doctrines of fair use, fair dealing, or other equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under the
- terms of this License. You must inform recipients that the Source Code Form
- of the Covered Software is governed by the terms of this License, and how
- they can obtain a copy of this License. You may not attempt to alter or
- restrict the recipients’ rights in the Source Code Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this License,
- or sublicense it under different terms, provided that the license for
- the Executable Form does not attempt to limit or alter the recipients’
- rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for the
- Covered Software. If the Larger Work is a combination of Covered Software
- with a work governed by one or more Secondary Licenses, and the Covered
- Software is not Incompatible With Secondary Licenses, this License permits
- You to additionally distribute such Covered Software under the terms of
- such Secondary License(s), so that the recipient of the Larger Work may, at
- their option, further distribute the Covered Software under the terms of
- either this License or such Secondary License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices (including
- copyright notices, patent notices, disclaimers of warranty, or limitations
- of liability) contained within the Source Code Form of the Covered
- Software, except that You may alter any license notices to the extent
- required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on behalf
- of any Contributor. You must make it absolutely clear that any such
- warranty, support, indemnity, or liability obligation is offered by You
- alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute, judicial
- order, or regulation then You must: (a) comply with the terms of this License
- to the maximum extent possible; and (b) describe the limitations and the code
- they affect. Such description must be placed in a text file included with all
- distributions of the Covered Software under this License. Except to the
- extent prohibited by statute or regulation, such description must be
- sufficiently detailed for a recipient of ordinary skill to be able to
- understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing basis,
- if such Contributor fails to notify You of the non-compliance by some
- reasonable means prior to 60 days after You have come back into compliance.
- Moreover, Your grants from a particular Contributor are reinstated on an
- ongoing basis if such Contributor notifies You of the non-compliance by
- some reasonable means, this is the first time You have received notice of
- non-compliance with this License from such Contributor, and You become
- compliant prior to 30 days after Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions, counter-claims,
- and cross-claims) alleging that a Contributor Version directly or
- indirectly infringes any patent, then the rights granted to You by any and
- all Contributors for the Covered Software under Section 2.1 of this License
- shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an “as is” basis, without
- warranty of any kind, either expressed, implied, or statutory, including,
- without limitation, warranties that the Covered Software is free of defects,
- merchantable, fit for a particular purpose or non-infringing. The entire
- risk as to the quality and performance of the Covered Software is with You.
- Should any Covered Software prove defective in any respect, You (not any
- Contributor) assume the cost of any necessary servicing, repair, or
- correction. This disclaimer of warranty constitutes an essential part of this
- License. No use of any Covered Software is authorized under this License
- except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from such
- party’s negligence to the extent applicable law prohibits such limitation.
- Some jurisdictions do not allow the exclusion or limitation of incidental or
- consequential damages, so this exclusion and limitation may not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts of
- a jurisdiction where the defendant maintains its principal place of business
- and such litigation shall be governed by laws of that jurisdiction, without
- reference to its conflict-of-law provisions. Nothing in this Section shall
- prevent a party’s ability to bring cross-claims or counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject matter
- hereof. If any provision of this License is held to be unenforceable, such
- provision shall be reformed only to the extent necessary to make it
- enforceable. Any law or regulation which provides that the language of a
- contract shall be construed against the drafter shall not be used to construe
- this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version of
- the License under which You originally received the Covered Software, or
- under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a modified
- version of this License if you rename the license and remove any
- references to the name of the license steward (except to note that such
- modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
- If You choose to distribute Source Code Form that is Incompatible With
- Secondary Licenses under the terms of this version of the License, the
- notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file, then
-You may include the notice in a location (such as a LICENSE file in a relevant
-directory) where a recipient would be likely to look for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - “Incompatible With Secondary Licenses” Notice
-
- This Source Code Form is “Incompatible
- With Secondary Licenses”, as defined by
- the Mozilla Public License, v. 2.0.
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/README.md
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/README.md b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/README.md
deleted file mode 100644
index 49490ea..0000000
--- a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/README.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# logutils
-
-logutils is a Go package that augments the standard library "log" package
-to make logging a bit more modern, without fragmenting the Go ecosystem
-with new logging packages.
-
-## The simplest thing that could possibly work
-
-Presumably your application already uses the default `log` package. To switch, you'll want your code to look like the following:
-
-```go
-package main
-
-import (
- "log"
- "os"
-
- "github.com/hashicorp/logutils"
-)
-
-func main() {
- filter := &logutils.LevelFilter{
- Levels: []logutils.LogLevel{"DEBUG", "WARN", "ERROR"},
- MinLevel: logutils.LogLevel("WARN"),
- Writer: os.Stderr,
- }
- log.SetOutput(filter)
-
- log.Print("[DEBUG] Debugging") // this will not print
- log.Print("[WARN] Warning") // this will
- log.Print("[ERROR] Erring") // and so will this
- log.Print("Message I haven't updated") // and so will this
-}
-```
-
-This logs to standard error exactly like go's standard logger. Any log messages you haven't converted to have a level will continue to print as before.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level.go b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level.go
deleted file mode 100644
index 6381bf1..0000000
--- a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Package logutils augments the standard log package with levels.
-package logutils
-
-import (
- "bytes"
- "io"
- "sync"
-)
-
-type LogLevel string
-
-// LevelFilter is an io.Writer that can be used with a logger that
-// will filter out log messages that aren't at least a certain level.
-//
-// Once the filter is in use somewhere, it is not safe to modify
-// the structure.
-type LevelFilter struct {
- // Levels is the list of log levels, in increasing order of
- // severity. Example might be: {"DEBUG", "WARN", "ERROR"}.
- Levels []LogLevel
-
- // MinLevel is the minimum level allowed through
- MinLevel LogLevel
-
- // The underlying io.Writer where log messages that pass the filter
- // will be set.
- Writer io.Writer
-
- badLevels map[LogLevel]struct{}
- once sync.Once
-}
-
-// Check will check a given line if it would be included in the level
-// filter.
-func (f *LevelFilter) Check(line []byte) bool {
- f.once.Do(f.init)
-
- // Check for a log level
- var level LogLevel
- x := bytes.IndexByte(line, '[')
- if x >= 0 {
- y := bytes.IndexByte(line[x:], ']')
- if y >= 0 {
- level = LogLevel(line[x+1 : x+y])
- }
- }
-
- _, ok := f.badLevels[level]
- return !ok
-}
-
-func (f *LevelFilter) Write(p []byte) (n int, err error) {
- // Note in general that io.Writer can receive any byte sequence
- // to write, but the "log" package always guarantees that we only
- // get a single line. We use that as a slight optimization within
- // this method, assuming we're dealing with a single, complete line
- // of log data.
-
- if !f.Check(p) {
- return len(p), nil
- }
-
- return f.Writer.Write(p)
-}
-
-// SetMinLevel is used to update the minimum log level
-func (f *LevelFilter) SetMinLevel(min LogLevel) {
- f.MinLevel = min
- f.init()
-}
-
-func (f *LevelFilter) init() {
- badLevels := make(map[LogLevel]struct{})
- for _, level := range f.Levels {
- if level == f.MinLevel {
- break
- }
- badLevels[level] = struct{}{}
- }
- f.badLevels = badLevels
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_benchmark_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_benchmark_test.go b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_benchmark_test.go
deleted file mode 100644
index 3c2caf7..0000000
--- a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_benchmark_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package logutils
-
-import (
- "io/ioutil"
- "testing"
-)
-
-var messages [][]byte
-
-func init() {
- messages = [][]byte{
- []byte("[TRACE] foo"),
- []byte("[DEBUG] foo"),
- []byte("[INFO] foo"),
- []byte("[WARN] foo"),
- []byte("[ERROR] foo"),
- }
-}
-
-func BenchmarkDiscard(b *testing.B) {
- for i := 0; i < b.N; i++ {
- ioutil.Discard.Write(messages[i%len(messages)])
- }
-}
-
-func BenchmarkLevelFilter(b *testing.B) {
- filter := &LevelFilter{
- Levels: []LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR"},
- MinLevel: "WARN",
- Writer: ioutil.Discard,
- }
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- filter.Write(messages[i%len(messages)])
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_test.go b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_test.go
deleted file mode 100644
index f6b6ac3..0000000
--- a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_test.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package logutils
-
-import (
- "bytes"
- "io"
- "log"
- "testing"
-)
-
-func TestLevelFilter_impl(t *testing.T) {
- var _ io.Writer = new(LevelFilter)
-}
-
-func TestLevelFilter(t *testing.T) {
- buf := new(bytes.Buffer)
- filter := &LevelFilter{
- Levels: []LogLevel{"DEBUG", "WARN", "ERROR"},
- MinLevel: "WARN",
- Writer: buf,
- }
-
- logger := log.New(filter, "", 0)
- logger.Print("[WARN] foo")
- logger.Println("[ERROR] bar")
- logger.Println("[DEBUG] baz")
- logger.Println("[WARN] buzz")
-
- result := buf.String()
- expected := "[WARN] foo\n[ERROR] bar\n[WARN] buzz\n"
- if result != expected {
- t.Fatalf("bad: %#v", result)
- }
-}
-
-func TestLevelFilterCheck(t *testing.T) {
- filter := &LevelFilter{
- Levels: []LogLevel{"DEBUG", "WARN", "ERROR"},
- MinLevel: "WARN",
- Writer: nil,
- }
-
- testCases := []struct {
- line string
- check bool
- }{
- {"[WARN] foo\n", true},
- {"[ERROR] bar\n", true},
- {"[DEBUG] baz\n", false},
- {"[WARN] buzz\n", true},
- }
-
- for _, testCase := range testCases {
- result := filter.Check([]byte(testCase.line))
- if result != testCase.check {
- t.Errorf("Fail: %s", testCase.line)
- }
- }
-}
-
-func TestLevelFilter_SetMinLevel(t *testing.T) {
- filter := &LevelFilter{
- Levels: []LogLevel{"DEBUG", "WARN", "ERROR"},
- MinLevel: "ERROR",
- Writer: nil,
- }
-
- testCases := []struct {
- line string
- checkBefore bool
- checkAfter bool
- }{
- {"[WARN] foo\n", false, true},
- {"[ERROR] bar\n", true, true},
- {"[DEBUG] baz\n", false, false},
- {"[WARN] buzz\n", false, true},
- }
-
- for _, testCase := range testCases {
- result := filter.Check([]byte(testCase.line))
- if result != testCase.checkBefore {
- t.Errorf("Fail: %s", testCase.line)
- }
- }
-
- // Update the minimum level to WARN
- filter.SetMinLevel("WARN")
-
- for _, testCase := range testCases {
- result := filter.Check([]byte(testCase.line))
- if result != testCase.checkAfter {
- t.Errorf("Fail: %s", testCase.line)
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/LICENSE
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/LICENSE b/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/LICENSE
deleted file mode 100644
index 5f0d1fb..0000000
--- a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 2014 Alan Shreve
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/README.md
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/README.md b/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/README.md
deleted file mode 100644
index 7a950d1..0000000
--- a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# mousetrap
-
-mousetrap is a tiny library that answers a single question.
-
-On a Windows machine, was the process invoked by someone double clicking on
-the executable file while browsing in explorer?
-
-### Motivation
-
-Windows developers unfamiliar with command line tools will often "double-click"
-the executable for a tool. Because most CLI tools print the help and then exit
-when invoked without arguments, this is often very frustrating for those users.
-
-mousetrap provides a way to detect these invocations so that you can provide
-more helpful behavior and instructions on how to run the CLI tool. To see what
-this looks like, both from an organizational and a technical perspective, see
-https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/
-
-### The interface
-
-The library exposes a single interface:
-
- func StartedByExplorer() (bool)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_others.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_others.go b/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_others.go
deleted file mode 100644
index 9d2d8a4..0000000
--- a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_others.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !windows
-
-package mousetrap
-
-// StartedByExplorer returns true if the program was invoked by the user
-// double-clicking on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-//
-// On non-Windows platforms, it always returns false.
-func StartedByExplorer() bool {
- return false
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_windows.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_windows.go b/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_windows.go
deleted file mode 100644
index 336142a..0000000
--- a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_windows.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// +build windows
-// +build !go1.4
-
-package mousetrap
-
-import (
- "fmt"
- "os"
- "syscall"
- "unsafe"
-)
-
-const (
- // defined by the Win32 API
- th32cs_snapprocess uintptr = 0x2
-)
-
-var (
- kernel = syscall.MustLoadDLL("kernel32.dll")
- CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot")
- Process32First = kernel.MustFindProc("Process32FirstW")
- Process32Next = kernel.MustFindProc("Process32NextW")
-)
-
-// ProcessEntry32 structure defined by the Win32 API
-type processEntry32 struct {
- dwSize uint32
- cntUsage uint32
- th32ProcessID uint32
- th32DefaultHeapID int
- th32ModuleID uint32
- cntThreads uint32
- th32ParentProcessID uint32
- pcPriClassBase int32
- dwFlags uint32
- szExeFile [syscall.MAX_PATH]uint16
-}
-
-func getProcessEntry(pid int) (pe *processEntry32, err error) {
- snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0))
- if snapshot == uintptr(syscall.InvalidHandle) {
- err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1)
- return
- }
- defer syscall.CloseHandle(syscall.Handle(snapshot))
-
- var processEntry processEntry32
- processEntry.dwSize = uint32(unsafe.Sizeof(processEntry))
- ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
- if ok == 0 {
- err = fmt.Errorf("Process32First: %v", e1)
- return
- }
-
- for {
- if processEntry.th32ProcessID == uint32(pid) {
- pe = &processEntry
- return
- }
-
- ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
- if ok == 0 {
- err = fmt.Errorf("Process32Next: %v", e1)
- return
- }
- }
-}
-
-func getppid() (pid int, err error) {
- pe, err := getProcessEntry(os.Getpid())
- if err != nil {
- return
- }
-
- pid = int(pe.th32ParentProcessID)
- return
-}
-
-// StartedByExplorer returns true if the program was invoked by the user double-clicking
-// on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-func StartedByExplorer() bool {
- ppid, err := getppid()
- if err != nil {
- return false
- }
-
- pe, err := getProcessEntry(ppid)
- if err != nil {
- return false
- }
-
- name := syscall.UTF16ToString(pe.szExeFile[:])
- return name == "explorer.exe"
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
deleted file mode 100644
index 9a28e57..0000000
--- a/newt/Godeps/_workspace/src/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// +build windows
-// +build go1.4
-
-package mousetrap
-
-import (
- "os"
- "syscall"
- "unsafe"
-)
-
-func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) {
- snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0)
- if err != nil {
- return nil, err
- }
- defer syscall.CloseHandle(snapshot)
- var procEntry syscall.ProcessEntry32
- procEntry.Size = uint32(unsafe.Sizeof(procEntry))
- if err = syscall.Process32First(snapshot, &procEntry); err != nil {
- return nil, err
- }
- for {
- if procEntry.ProcessID == uint32(pid) {
- return &procEntry, nil
- }
- err = syscall.Process32Next(snapshot, &procEntry)
- if err != nil {
- return nil, err
- }
- }
-}
-
-// StartedByExplorer returns true if the program was invoked by the user double-clicking
-// on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-func StartedByExplorer() bool {
- pe, err := getProcessEntry(os.Getppid())
- if err != nil {
- return false
- }
- return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:])
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/.gitignore
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/.gitignore b/newt/Godeps/_workspace/src/github.com/kr/pretty/.gitignore
deleted file mode 100644
index 1f0a99f..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-[568].out
-_go*
-_test*
-_obj
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/License
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/License b/newt/Godeps/_workspace/src/github.com/kr/pretty/License
deleted file mode 100644
index 05c783c..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/License
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright 2012 Keith Rarick
-
-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.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/Readme
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/Readme b/newt/Godeps/_workspace/src/github.com/kr/pretty/Readme
deleted file mode 100644
index c589fc6..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/Readme
+++ /dev/null
@@ -1,9 +0,0 @@
-package pretty
-
- import "github.com/kr/pretty"
-
- Package pretty provides pretty-printing for Go values.
-
-Documentation
-
- http://godoc.org/github.com/kr/pretty
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/diff.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/diff.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/diff.go
deleted file mode 100644
index 8fe8e24..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/diff.go
+++ /dev/null
@@ -1,158 +0,0 @@
-package pretty
-
-import (
- "fmt"
- "io"
- "reflect"
-)
-
-type sbuf []string
-
-func (s *sbuf) Write(b []byte) (int, error) {
- *s = append(*s, string(b))
- return len(b), nil
-}
-
-// Diff returns a slice where each element describes
-// a difference between a and b.
-func Diff(a, b interface{}) (desc []string) {
- Fdiff((*sbuf)(&desc), a, b)
- return desc
-}
-
-// Fdiff writes to w a description of the differences between a and b.
-func Fdiff(w io.Writer, a, b interface{}) {
- diffWriter{w: w}.diff(reflect.ValueOf(a), reflect.ValueOf(b))
-}
-
-type diffWriter struct {
- w io.Writer
- l string // label
-}
-
-func (w diffWriter) printf(f string, a ...interface{}) {
- var l string
- if w.l != "" {
- l = w.l + ": "
- }
- fmt.Fprintf(w.w, l+f, a...)
-}
-
-func (w diffWriter) diff(av, bv reflect.Value) {
- if !av.IsValid() && bv.IsValid() {
- w.printf("nil != %#v", bv.Interface())
- return
- }
- if av.IsValid() && !bv.IsValid() {
- w.printf("%#v != nil", av.Interface())
- return
- }
- if !av.IsValid() && !bv.IsValid() {
- return
- }
-
- at := av.Type()
- bt := bv.Type()
- if at != bt {
- w.printf("%v != %v", at, bt)
- return
- }
-
- // numeric types, including bool
- if at.Kind() < reflect.Array {
- a, b := av.Interface(), bv.Interface()
- if a != b {
- w.printf("%#v != %#v", a, b)
- }
- return
- }
-
- switch at.Kind() {
- case reflect.String:
- a, b := av.Interface(), bv.Interface()
- if a != b {
- w.printf("%q != %q", a, b)
- }
- case reflect.Ptr:
- switch {
- case av.IsNil() && !bv.IsNil():
- w.printf("nil != %v", bv.Interface())
- case !av.IsNil() && bv.IsNil():
- w.printf("%v != nil", av.Interface())
- case !av.IsNil() && !bv.IsNil():
- w.diff(av.Elem(), bv.Elem())
- }
- case reflect.Struct:
- for i := 0; i < av.NumField(); i++ {
- w.relabel(at.Field(i).Name).diff(av.Field(i), bv.Field(i))
- }
- case reflect.Slice:
- lenA := av.Len()
- lenB := bv.Len()
- if lenA != lenB {
- w.printf("%s[%d] != %s[%d]", av.Type(), lenA, bv.Type(), lenB)
- break
- }
- for i := 0; i < lenA; i++ {
- w.relabel(fmt.Sprintf("[%d]", i)).diff(av.Index(i), bv.Index(i))
- }
- case reflect.Map:
- ak, both, bk := keyDiff(av.MapKeys(), bv.MapKeys())
- for _, k := range ak {
- w := w.relabel(fmt.Sprintf("[%#v]", k.Interface()))
- w.printf("%q != (missing)", av.MapIndex(k))
- }
- for _, k := range both {
- w := w.relabel(fmt.Sprintf("[%#v]", k.Interface()))
- w.diff(av.MapIndex(k), bv.MapIndex(k))
- }
- for _, k := range bk {
- w := w.relabel(fmt.Sprintf("[%#v]", k.Interface()))
- w.printf("(missing) != %q", bv.MapIndex(k))
- }
- case reflect.Interface:
- w.diff(reflect.ValueOf(av.Interface()), reflect.ValueOf(bv.Interface()))
- default:
- if !reflect.DeepEqual(av.Interface(), bv.Interface()) {
- w.printf("%# v != %# v", Formatter(av.Interface()), Formatter(bv.Interface()))
- }
- }
-}
-
-func (d diffWriter) relabel(name string) (d1 diffWriter) {
- d1 = d
- if d.l != "" && name[0] != '[' {
- d1.l += "."
- }
- d1.l += name
- return d1
-}
-
-func keyDiff(a, b []reflect.Value) (ak, both, bk []reflect.Value) {
- for _, av := range a {
- inBoth := false
- for _, bv := range b {
- if reflect.DeepEqual(av.Interface(), bv.Interface()) {
- inBoth = true
- both = append(both, av)
- break
- }
- }
- if !inBoth {
- ak = append(ak, av)
- }
- }
- for _, bv := range b {
- inBoth := false
- for _, av := range a {
- if reflect.DeepEqual(av.Interface(), bv.Interface()) {
- inBoth = true
- break
- }
- }
- if !inBoth {
- bk = append(bk, bv)
- }
- }
- return
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/diff_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/diff_test.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/diff_test.go
deleted file mode 100644
index 3c388f1..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/diff_test.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package pretty
-
-import (
- "testing"
-)
-
-type difftest struct {
- a interface{}
- b interface{}
- exp []string
-}
-
-type S struct {
- A int
- S *S
- I interface{}
- C []int
-}
-
-var diffs = []difftest{
- {a: nil, b: nil},
- {a: S{A: 1}, b: S{A: 1}},
-
- {0, "", []string{`int != string`}},
- {0, 1, []string{`0 != 1`}},
- {S{}, new(S), []string{`pretty.S != *pretty.S`}},
- {"a", "b", []string{`"a" != "b"`}},
- {S{}, S{A: 1}, []string{`A: 0 != 1`}},
- {new(S), &S{A: 1}, []string{`A: 0 != 1`}},
- {S{S: new(S)}, S{S: &S{A: 1}}, []string{`S.A: 0 != 1`}},
- {S{}, S{I: 0}, []string{`I: nil != 0`}},
- {S{I: 1}, S{I: "x"}, []string{`I: int != string`}},
- {S{}, S{C: []int{1}}, []string{`C: []int[0] != []int[1]`}},
- {S{C: []int{}}, S{C: []int{1}}, []string{`C: []int[0] != []int[1]`}},
- {S{C: []int{1, 2, 3}}, S{C: []int{1, 2, 4}}, []string{`C[2]: 3 != 4`}},
- {S{}, S{A: 1, S: new(S)}, []string{`A: 0 != 1`, `S: nil != &{0 <nil> <nil> []}`}},
-}
-
-func TestDiff(t *testing.T) {
- for _, tt := range diffs {
- got := Diff(tt.a, tt.b)
- eq := len(got) == len(tt.exp)
- if eq {
- for i := range got {
- eq = eq && got[i] == tt.exp[i]
- }
- }
- if !eq {
- t.Errorf("diffing % #v", tt.a)
- t.Errorf("with % #v", tt.b)
- diffdiff(t, got, tt.exp)
- continue
- }
- }
-}
-
-func diffdiff(t *testing.T, got, exp []string) {
- minus(t, "unexpected:", got, exp)
- minus(t, "missing:", exp, got)
-}
-
-func minus(t *testing.T, s string, a, b []string) {
- var i, j int
- for i = 0; i < len(a); i++ {
- for j = 0; j < len(b); j++ {
- if a[i] == b[j] {
- break
- }
- }
- if j == len(b) {
- t.Error(s, a[i])
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/example_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/example_test.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/example_test.go
deleted file mode 100644
index ecf40f3..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/example_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package pretty_test
-
-import (
- "fmt"
- "github.com/kr/pretty"
-)
-
-func Example() {
- type myType struct {
- a, b int
- }
- var x = []myType{{1, 2}, {3, 4}, {5, 6}}
- fmt.Printf("%# v", pretty.Formatter(x))
- // output:
- // []pretty_test.myType{
- // {a:1, b:2},
- // {a:3, b:4},
- // {a:5, b:6},
- // }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/formatter.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/formatter.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/formatter.go
deleted file mode 100644
index 8dacda2..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/formatter.go
+++ /dev/null
@@ -1,337 +0,0 @@
-package pretty
-
-import (
- "fmt"
- "io"
- "reflect"
- "strconv"
- "text/tabwriter"
-
- "github.com/kr/text"
-)
-
-const (
- limit = 50
-)
-
-type formatter struct {
- x interface{}
- force bool
- quote bool
-}
-
-// Formatter makes a wrapper, f, that will format x as go source with line
-// breaks and tabs. Object f responds to the "%v" formatting verb when both the
-// "#" and " " (space) flags are set, for example:
-//
-// fmt.Sprintf("%# v", Formatter(x))
-//
-// If one of these two flags is not set, or any other verb is used, f will
-// format x according to the usual rules of package fmt.
-// In particular, if x satisfies fmt.Formatter, then x.Format will be called.
-func Formatter(x interface{}) (f fmt.Formatter) {
- return formatter{x: x, quote: true}
-}
-
-func (fo formatter) String() string {
- return fmt.Sprint(fo.x) // unwrap it
-}
-
-func (fo formatter) passThrough(f fmt.State, c rune) {
- s := "%"
- for i := 0; i < 128; i++ {
- if f.Flag(i) {
- s += string(i)
- }
- }
- if w, ok := f.Width(); ok {
- s += fmt.Sprintf("%d", w)
- }
- if p, ok := f.Precision(); ok {
- s += fmt.Sprintf(".%d", p)
- }
- s += string(c)
- fmt.Fprintf(f, s, fo.x)
-}
-
-func (fo formatter) Format(f fmt.State, c rune) {
- if fo.force || c == 'v' && f.Flag('#') && f.Flag(' ') {
- w := tabwriter.NewWriter(f, 4, 4, 1, ' ', 0)
- p := &printer{tw: w, Writer: w, visited: make(map[visit]int)}
- p.printValue(reflect.ValueOf(fo.x), true, fo.quote)
- w.Flush()
- return
- }
- fo.passThrough(f, c)
-}
-
-type printer struct {
- io.Writer
- tw *tabwriter.Writer
- visited map[visit]int
- depth int
-}
-
-func (p *printer) indent() *printer {
- q := *p
- q.tw = tabwriter.NewWriter(p.Writer, 4, 4, 1, ' ', 0)
- q.Writer = text.NewIndentWriter(q.tw, []byte{'\t'})
- return &q
-}
-
-func (p *printer) printInline(v reflect.Value, x interface{}, showType bool) {
- if showType {
- io.WriteString(p, v.Type().String())
- fmt.Fprintf(p, "(%#v)", x)
- } else {
- fmt.Fprintf(p, "%#v", x)
- }
-}
-
-// printValue must keep track of already-printed pointer values to avoid
-// infinite recursion.
-type visit struct {
- v uintptr
- typ reflect.Type
-}
-
-func (p *printer) printValue(v reflect.Value, showType, quote bool) {
- if p.depth > 10 {
- io.WriteString(p, "!%v(DEPTH EXCEEDED)")
- return
- }
-
- switch v.Kind() {
- case reflect.Bool:
- p.printInline(v, v.Bool(), showType)
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- p.printInline(v, v.Int(), showType)
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- p.printInline(v, v.Uint(), showType)
- case reflect.Float32, reflect.Float64:
- p.printInline(v, v.Float(), showType)
- case reflect.Complex64, reflect.Complex128:
- fmt.Fprintf(p, "%#v", v.Complex())
- case reflect.String:
- p.fmtString(v.String(), quote)
- case reflect.Map:
- t := v.Type()
- if showType {
- io.WriteString(p, t.String())
- }
- writeByte(p, '{')
- if nonzero(v) {
- expand := !canInline(v.Type())
- pp := p
- if expand {
- writeByte(p, '\n')
- pp = p.indent()
- }
- keys := v.MapKeys()
- for i := 0; i < v.Len(); i++ {
- showTypeInStruct := true
- k := keys[i]
- mv := v.MapIndex(k)
- pp.printValue(k, false, true)
- writeByte(pp, ':')
- if expand {
- writeByte(pp, '\t')
- }
- showTypeInStruct = t.Elem().Kind() == reflect.Interface
- pp.printValue(mv, showTypeInStruct, true)
- if expand {
- io.WriteString(pp, ",\n")
- } else if i < v.Len()-1 {
- io.WriteString(pp, ", ")
- }
- }
- if expand {
- pp.tw.Flush()
- }
- }
- writeByte(p, '}')
- case reflect.Struct:
- t := v.Type()
- if v.CanAddr() {
- addr := v.UnsafeAddr()
- vis := visit{addr, t}
- if vd, ok := p.visited[vis]; ok && vd < p.depth {
- p.fmtString(t.String()+"{(CYCLIC REFERENCE)}", false)
- break // don't print v again
- }
- p.visited[vis] = p.depth
- }
-
- if showType {
- io.WriteString(p, t.String())
- }
- writeByte(p, '{')
- if nonzero(v) {
- expand := !canInline(v.Type())
- pp := p
- if expand {
- writeByte(p, '\n')
- pp = p.indent()
- }
- for i := 0; i < v.NumField(); i++ {
- showTypeInStruct := true
- if f := t.Field(i); f.Name != "" {
- io.WriteString(pp, f.Name)
- writeByte(pp, ':')
- if expand {
- writeByte(pp, '\t')
- }
- showTypeInStruct = labelType(f.Type)
- }
- pp.printValue(getField(v, i), showTypeInStruct, true)
- if expand {
- io.WriteString(pp, ",\n")
- } else if i < v.NumField()-1 {
- io.WriteString(pp, ", ")
- }
- }
- if expand {
- pp.tw.Flush()
- }
- }
- writeByte(p, '}')
- case reflect.Interface:
- switch e := v.Elem(); {
- case e.Kind() == reflect.Invalid:
- io.WriteString(p, "nil")
- case e.IsValid():
- pp := *p
- pp.depth++
- pp.printValue(e, showType, true)
- default:
- io.WriteString(p, v.Type().String())
- io.WriteString(p, "(nil)")
- }
- case reflect.Array, reflect.Slice:
- t := v.Type()
- if showType {
- io.WriteString(p, t.String())
- }
- if v.Kind() == reflect.Slice && v.IsNil() && showType {
- io.WriteString(p, "(nil)")
- break
- }
- if v.Kind() == reflect.Slice && v.IsNil() {
- io.WriteString(p, "nil")
- break
- }
- writeByte(p, '{')
- expand := !canInline(v.Type())
- pp := p
- if expand {
- writeByte(p, '\n')
- pp = p.indent()
- }
- for i := 0; i < v.Len(); i++ {
- showTypeInSlice := t.Elem().Kind() == reflect.Interface
- pp.printValue(v.Index(i), showTypeInSlice, true)
- if expand {
- io.WriteString(pp, ",\n")
- } else if i < v.Len()-1 {
- io.WriteString(pp, ", ")
- }
- }
- if expand {
- pp.tw.Flush()
- }
- writeByte(p, '}')
- case reflect.Ptr:
- e := v.Elem()
- if !e.IsValid() {
- writeByte(p, '(')
- io.WriteString(p, v.Type().String())
- io.WriteString(p, ")(nil)")
- } else {
- pp := *p
- pp.depth++
- writeByte(pp, '&')
- pp.printValue(e, true, true)
- }
- case reflect.Chan:
- x := v.Pointer()
- if showType {
- writeByte(p, '(')
- io.WriteString(p, v.Type().String())
- fmt.Fprintf(p, ")(%#v)", x)
- } else {
- fmt.Fprintf(p, "%#v", x)
- }
- case reflect.Func:
- io.WriteString(p, v.Type().String())
- io.WriteString(p, " {...}")
- case reflect.UnsafePointer:
- p.printInline(v, v.Pointer(), showType)
- case reflect.Invalid:
- io.WriteString(p, "nil")
- }
-}
-
-func canInline(t reflect.Type) bool {
- switch t.Kind() {
- case reflect.Map:
- return !canExpand(t.Elem())
- case reflect.Struct:
- for i := 0; i < t.NumField(); i++ {
- if canExpand(t.Field(i).Type) {
- return false
- }
- }
- return true
- case reflect.Interface:
- return false
- case reflect.Array, reflect.Slice:
- return !canExpand(t.Elem())
- case reflect.Ptr:
- return false
- case reflect.Chan, reflect.Func, reflect.UnsafePointer:
- return false
- }
- return true
-}
-
-func canExpand(t reflect.Type) bool {
- switch t.Kind() {
- case reflect.Map, reflect.Struct,
- reflect.Interface, reflect.Array, reflect.Slice,
- reflect.Ptr:
- return true
- }
- return false
-}
-
-func labelType(t reflect.Type) bool {
- switch t.Kind() {
- case reflect.Interface, reflect.Struct:
- return true
- }
- return false
-}
-
-func (p *printer) fmtString(s string, quote bool) {
- if quote {
- s = strconv.Quote(s)
- }
- io.WriteString(p, s)
-}
-
-func tryDeepEqual(a, b interface{}) bool {
- defer func() { recover() }()
- return reflect.DeepEqual(a, b)
-}
-
-func writeByte(w io.Writer, b byte) {
- w.Write([]byte{b})
-}
-
-func getField(v reflect.Value, i int) reflect.Value {
- val := v.Field(i)
- if val.Kind() == reflect.Interface && !val.IsNil() {
- val = val.Elem()
- }
- return val
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/formatter_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/formatter_test.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/formatter_test.go
deleted file mode 100644
index 5f3204e..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/formatter_test.go
+++ /dev/null
@@ -1,261 +0,0 @@
-package pretty
-
-import (
- "fmt"
- "io"
- "strings"
- "testing"
- "unsafe"
-)
-
-type test struct {
- v interface{}
- s string
-}
-
-type LongStructTypeName struct {
- longFieldName interface{}
- otherLongFieldName interface{}
-}
-
-type SA struct {
- t *T
- v T
-}
-
-type T struct {
- x, y int
-}
-
-type F int
-
-func (f F) Format(s fmt.State, c rune) {
- fmt.Fprintf(s, "F(%d)", int(f))
-}
-
-var long = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
-
-var gosyntax = []test{
- {nil, `nil`},
- {"", `""`},
- {"a", `"a"`},
- {1, "int(1)"},
- {1.0, "float64(1)"},
- {[]int(nil), "[]int(nil)"},
- {[0]int{}, "[0]int{}"},
- {complex(1, 0), "(1+0i)"},
- //{make(chan int), "(chan int)(0x1234)"},
- {unsafe.Pointer(uintptr(unsafe.Pointer(&long))), fmt.Sprintf("unsafe.Pointer(0x%02x)", uintptr(unsafe.Pointer(&long)))},
- {func(int) {}, "func(int) {...}"},
- {map[int]int{1: 1}, "map[int]int{1:1}"},
- {int32(1), "int32(1)"},
- {io.EOF, `&errors.errorString{s:"EOF"}`},
- {[]string{"a"}, `[]string{"a"}`},
- {
- []string{long},
- `[]string{"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"}`,
- },
- {F(5), "pretty.F(5)"},
- {
- SA{&T{1, 2}, T{3, 4}},
- `pretty.SA{
- t: &pretty.T{x:1, y:2},
- v: pretty.T{x:3, y:4},
-}`,
- },
- {
- map[int][]byte{1: {}},
- `map[int][]uint8{
- 1: {},
-}`,
- },
- {
- map[int]T{1: {}},
- `map[int]pretty.T{
- 1: {},
-}`,
- },
- {
- long,
- `"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"`,
- },
- {
- LongStructTypeName{
- longFieldName: LongStructTypeName{},
- otherLongFieldName: long,
- },
- `pretty.LongStructTypeName{
- longFieldName: pretty.LongStructTypeName{},
- otherLongFieldName: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
-}`,
- },
- {
- &LongStructTypeName{
- longFieldName: &LongStructTypeName{},
- otherLongFieldName: (*LongStructTypeName)(nil),
- },
- `&pretty.LongStructTypeName{
- longFieldName: &pretty.LongStructTypeName{},
- otherLongFieldName: (*pretty.LongStructTypeName)(nil),
-}`,
- },
- {
- []LongStructTypeName{
- {nil, nil},
- {3, 3},
- {long, nil},
- },
- `[]pretty.LongStructTypeName{
- {},
- {
- longFieldName: int(3),
- otherLongFieldName: int(3),
- },
- {
- longFieldName: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
- otherLongFieldName: nil,
- },
-}`,
- },
- {
- []interface{}{
- LongStructTypeName{nil, nil},
- []byte{1, 2, 3},
- T{3, 4},
- LongStructTypeName{long, nil},
- },
- `[]interface {}{
- pretty.LongStructTypeName{},
- []uint8{0x1, 0x2, 0x3},
- pretty.T{x:3, y:4},
- pretty.LongStructTypeName{
- longFieldName: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
- otherLongFieldName: nil,
- },
-}`,
- },
-}
-
-func TestGoSyntax(t *testing.T) {
- for _, tt := range gosyntax {
- s := fmt.Sprintf("%# v", Formatter(tt.v))
- if tt.s != s {
- t.Errorf("expected %q", tt.s)
- t.Errorf("got %q", s)
- t.Errorf("expraw\n%s", tt.s)
- t.Errorf("gotraw\n%s", s)
- }
- }
-}
-
-type I struct {
- i int
- R interface{}
-}
-
-func (i *I) I() *I { return i.R.(*I) }
-
-func TestCycle(t *testing.T) {
- type A struct{ *A }
- v := &A{}
- v.A = v
-
- // panics from stack overflow without cycle detection
- t.Logf("Example cycle:\n%# v", Formatter(v))
-
- p := &A{}
- s := fmt.Sprintf("%# v", Formatter([]*A{p, p}))
- if strings.Contains(s, "CYCLIC") {
- t.Errorf("Repeated address detected as cyclic reference:\n%s", s)
- }
-
- type R struct {
- i int
- *R
- }
- r := &R{
- i: 1,
- R: &R{
- i: 2,
- R: &R{
- i: 3,
- },
- },
- }
- r.R.R.R = r
- t.Logf("Example longer cycle:\n%# v", Formatter(r))
-
- r = &R{
- i: 1,
- R: &R{
- i: 2,
- R: &R{
- i: 3,
- R: &R{
- i: 4,
- R: &R{
- i: 5,
- R: &R{
- i: 6,
- R: &R{
- i: 7,
- R: &R{
- i: 8,
- R: &R{
- i: 9,
- R: &R{
- i: 10,
- R: &R{
- i: 11,
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- }
- // here be pirates
- r.R.R.R.R.R.R.R.R.R.R.R = r
- t.Logf("Example very long cycle:\n%# v", Formatter(r))
-
- i := &I{
- i: 1,
- R: &I{
- i: 2,
- R: &I{
- i: 3,
- R: &I{
- i: 4,
- R: &I{
- i: 5,
- R: &I{
- i: 6,
- R: &I{
- i: 7,
- R: &I{
- i: 8,
- R: &I{
- i: 9,
- R: &I{
- i: 10,
- R: &I{
- i: 11,
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- }
- iv := i.I().I().I().I().I().I().I().I().I().I()
- *iv = *i
- t.Logf("Example long interface cycle:\n%# v", Formatter(i))
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/pretty.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/pretty.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/pretty.go
deleted file mode 100644
index d3df868..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/pretty.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Package pretty provides pretty-printing for Go values. This is
-// useful during debugging, to avoid wrapping long output lines in
-// the terminal.
-//
-// It provides a function, Formatter, that can be used with any
-// function that accepts a format string. It also provides
-// convenience wrappers for functions in packages fmt and log.
-package pretty
-
-import (
- "fmt"
- "io"
- "log"
-)
-
-// Errorf is a convenience wrapper for fmt.Errorf.
-//
-// Calling Errorf(f, x, y) is equivalent to
-// fmt.Errorf(f, Formatter(x), Formatter(y)).
-func Errorf(format string, a ...interface{}) error {
- return fmt.Errorf(format, wrap(a, false)...)
-}
-
-// Fprintf is a convenience wrapper for fmt.Fprintf.
-//
-// Calling Fprintf(w, f, x, y) is equivalent to
-// fmt.Fprintf(w, f, Formatter(x), Formatter(y)).
-func Fprintf(w io.Writer, format string, a ...interface{}) (n int, error error) {
- return fmt.Fprintf(w, format, wrap(a, false)...)
-}
-
-// Log is a convenience wrapper for log.Printf.
-//
-// Calling Log(x, y) is equivalent to
-// log.Print(Formatter(x), Formatter(y)), but each operand is
-// formatted with "%# v".
-func Log(a ...interface{}) {
- log.Print(wrap(a, true)...)
-}
-
-// Logf is a convenience wrapper for log.Printf.
-//
-// Calling Logf(f, x, y) is equivalent to
-// log.Printf(f, Formatter(x), Formatter(y)).
-func Logf(format string, a ...interface{}) {
- log.Printf(format, wrap(a, false)...)
-}
-
-// Logln is a convenience wrapper for log.Printf.
-//
-// Calling Logln(x, y) is equivalent to
-// log.Println(Formatter(x), Formatter(y)), but each operand is
-// formatted with "%# v".
-func Logln(a ...interface{}) {
- log.Println(wrap(a, true)...)
-}
-
-// Print pretty-prints its operands and writes to standard output.
-//
-// Calling Print(x, y) is equivalent to
-// fmt.Print(Formatter(x), Formatter(y)), but each operand is
-// formatted with "%# v".
-func Print(a ...interface{}) (n int, errno error) {
- return fmt.Print(wrap(a, true)...)
-}
-
-// Printf is a convenience wrapper for fmt.Printf.
-//
-// Calling Printf(f, x, y) is equivalent to
-// fmt.Printf(f, Formatter(x), Formatter(y)).
-func Printf(format string, a ...interface{}) (n int, errno error) {
- return fmt.Printf(format, wrap(a, false)...)
-}
-
-// Println pretty-prints its operands and writes to standard output.
-//
-// Calling Print(x, y) is equivalent to
-// fmt.Println(Formatter(x), Formatter(y)), but each operand is
-// formatted with "%# v".
-func Println(a ...interface{}) (n int, errno error) {
- return fmt.Println(wrap(a, true)...)
-}
-
-// Sprintf is a convenience wrapper for fmt.Sprintf.
-//
-// Calling Sprintf(f, x, y) is equivalent to
-// fmt.Sprintf(f, Formatter(x), Formatter(y)).
-func Sprintf(format string, a ...interface{}) string {
- return fmt.Sprintf(format, wrap(a, false)...)
-}
-
-func wrap(a []interface{}, force bool) []interface{} {
- w := make([]interface{}, len(a))
- for i, x := range a {
- w[i] = formatter{x: x, force: force}
- }
- return w
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/pretty/zero.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/zero.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/zero.go
deleted file mode 100644
index abb5b6f..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/pretty/zero.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package pretty
-
-import (
- "reflect"
-)
-
-func nonzero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Bool:
- return v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() != 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() != 0
- case reflect.Float32, reflect.Float64:
- return v.Float() != 0
- case reflect.Complex64, reflect.Complex128:
- return v.Complex() != complex(0, 0)
- case reflect.String:
- return v.String() != ""
- case reflect.Struct:
- for i := 0; i < v.NumField(); i++ {
- if nonzero(getField(v, i)) {
- return true
- }
- }
- return false
- case reflect.Array:
- for i := 0; i < v.Len(); i++ {
- if nonzero(v.Index(i)) {
- return true
- }
- }
- return false
- case reflect.Map, reflect.Interface, reflect.Slice, reflect.Ptr, reflect.Chan, reflect.Func:
- return !v.IsNil()
- case reflect.UnsafePointer:
- return v.Pointer() != 0
- }
- return true
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/License
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/License b/newt/Godeps/_workspace/src/github.com/kr/text/License
deleted file mode 100644
index 480a328..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/License
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright 2012 Keith Rarick
-
-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.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/Readme
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/Readme b/newt/Godeps/_workspace/src/github.com/kr/text/Readme
deleted file mode 100644
index 7e6e7c0..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/Readme
+++ /dev/null
@@ -1,3 +0,0 @@
-This is a Go package for manipulating paragraphs of text.
-
-See http://go.pkgdoc.org/github.com/kr/text for full documentation.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/Readme
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/Readme b/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/Readme
deleted file mode 100644
index 1c1f4e6..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/Readme
+++ /dev/null
@@ -1,5 +0,0 @@
-Package colwriter provides a write filter that formats
-input lines in multiple columns.
-
-The package is a straightforward translation from
-/src/cmd/draw/mc.c in Plan 9 from User Space.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/column.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/column.go b/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/column.go
deleted file mode 100644
index 7302ce9..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/column.go
+++ /dev/null
@@ -1,147 +0,0 @@
-// Package colwriter provides a write filter that formats
-// input lines in multiple columns.
-//
-// The package is a straightforward translation from
-// /src/cmd/draw/mc.c in Plan 9 from User Space.
-package colwriter
-
-import (
- "bytes"
- "io"
- "unicode/utf8"
-)
-
-const (
- tab = 4
-)
-
-const (
- // Print each input line ending in a colon ':' separately.
- BreakOnColon uint = 1 << iota
-)
-
-// A Writer is a filter that arranges input lines in as many columns as will
-// fit in its width. Tab '\t' chars in the input are translated to sequences
-// of spaces ending at multiples of 4 positions.
-//
-// If BreakOnColon is set, each input line ending in a colon ':' is written
-// separately.
-//
-// The Writer assumes that all Unicode code points have the same width; this
-// may not be true in some fonts.
-type Writer struct {
- w io.Writer
- buf []byte
- width int
- flag uint
-}
-
-// NewWriter allocates and initializes a new Writer writing to w.
-// Parameter width controls the total number of characters on each line
-// across all columns.
-func NewWriter(w io.Writer, width int, flag uint) *Writer {
- return &Writer{
- w: w,
- width: width,
- flag: flag,
- }
-}
-
-// Write writes p to the writer w. The only errors returned are ones
-// encountered while writing to the underlying output stream.
-func (w *Writer) Write(p []byte) (n int, err error) {
- var linelen int
- var lastWasColon bool
- for i, c := range p {
- w.buf = append(w.buf, c)
- linelen++
- if c == '\t' {
- w.buf[len(w.buf)-1] = ' '
- for linelen%tab != 0 {
- w.buf = append(w.buf, ' ')
- linelen++
- }
- }
- if w.flag&BreakOnColon != 0 && c == ':' {
- lastWasColon = true
- } else if lastWasColon {
- if c == '\n' {
- pos := bytes.LastIndex(w.buf[:len(w.buf)-1], []byte{'\n'})
- if pos < 0 {
- pos = 0
- }
- line := w.buf[pos:]
- w.buf = w.buf[:pos]
- if err = w.columnate(); err != nil {
- if len(line) < i {
- return i - len(line), err
- }
- return 0, err
- }
- if n, err := w.w.Write(line); err != nil {
- if r := len(line) - n; r < i {
- return i - r, err
- }
- return 0, err
- }
- }
- lastWasColon = false
- }
- if c == '\n' {
- linelen = 0
- }
- }
- return len(p), nil
-}
-
-// Flush should be called after the last call to Write to ensure that any data
-// buffered in the Writer is written to output.
-func (w *Writer) Flush() error {
- return w.columnate()
-}
-
-func (w *Writer) columnate() error {
- words := bytes.Split(w.buf, []byte{'\n'})
- w.buf = nil
- if len(words[len(words)-1]) == 0 {
- words = words[:len(words)-1]
- }
- maxwidth := 0
- for _, wd := range words {
- if n := utf8.RuneCount(wd); n > maxwidth {
- maxwidth = n
- }
- }
- maxwidth++ // space char
- wordsPerLine := w.width / maxwidth
- if wordsPerLine <= 0 {
- wordsPerLine = 1
- }
- nlines := (len(words) + wordsPerLine - 1) / wordsPerLine
- for i := 0; i < nlines; i++ {
- col := 0
- endcol := 0
- for j := i; j < len(words); j += nlines {
- endcol += maxwidth
- _, err := w.w.Write(words[j])
- if err != nil {
- return err
- }
- col += utf8.RuneCount(words[j])
- if j+nlines < len(words) {
- for col < endcol {
- _, err := w.w.Write([]byte{' '})
- if err != nil {
- return err
- }
- col++
- }
- }
- }
- _, err := w.w.Write([]byte{'\n'})
- if err != nil {
- return err
- }
- }
- return nil
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/column_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/column_test.go b/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/column_test.go
deleted file mode 100644
index ce388f5..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/colwriter/column_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package colwriter
-
-import (
- "bytes"
- "testing"
-)
-
-var src = `
-.git
-.gitignore
-.godir
-Procfile:
-README.md
-api.go
-apps.go
-auth.go
-darwin.go
-data.go
-dyno.go:
-env.go
-git.go
-help.go
-hkdist
-linux.go
-ls.go
-main.go
-plugin.go
-run.go
-scale.go
-ssh.go
-tail.go
-term
-unix.go
-update.go
-version.go
-windows.go
-`[1:]
-
-var tests = []struct {
- wid int
- flag uint
- src string
- want string
-}{
- {80, 0, "", ""},
- {80, 0, src, `
-.git README.md darwin.go git.go ls.go scale.go unix.go
-.gitignore api.go data.go help.go main.go ssh.go update.go
-.godir apps.go dyno.go: hkdist plugin.go tail.go version.go
-Procfile: auth.go env.go linux.go run.go term windows.go
-`[1:]},
- {80, BreakOnColon, src, `
-.git .gitignore .godir
-
-Procfile:
-README.md api.go apps.go auth.go darwin.go data.go
-
-dyno.go:
-env.go hkdist main.go scale.go term version.go
-git.go linux.go plugin.go ssh.go unix.go windows.go
-help.go ls.go run.go tail.go update.go
-`[1:]},
- {20, 0, `
-Hello
-Γειά σου
-안녕
-今日は
-`[1:], `
-Hello 안녕
-Γειά σου 今日は
-`[1:]},
-}
-
-func TestWriter(t *testing.T) {
- for _, test := range tests {
- b := new(bytes.Buffer)
- w := NewWriter(b, test.wid, test.flag)
- if _, err := w.Write([]byte(test.src)); err != nil {
- t.Error(err)
- }
- if err := w.Flush(); err != nil {
- t.Error(err)
- }
- if g := b.String(); test.want != g {
- t.Log("\n" + test.want)
- t.Log("\n" + g)
- t.Errorf("%q != %q", test.want, g)
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/doc.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/doc.go b/newt/Godeps/_workspace/src/github.com/kr/text/doc.go
deleted file mode 100644
index cf4c198..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/doc.go
+++ /dev/null
@@ -1,3 +0,0 @@
-// Package text provides rudimentary functions for manipulating text in
-// paragraphs.
-package text
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/indent.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/indent.go b/newt/Godeps/_workspace/src/github.com/kr/text/indent.go
deleted file mode 100644
index 4ebac45..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/indent.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package text
-
-import (
- "io"
-)
-
-// Indent inserts prefix at the beginning of each non-empty line of s. The
-// end-of-line marker is NL.
-func Indent(s, prefix string) string {
- return string(IndentBytes([]byte(s), []byte(prefix)))
-}
-
-// IndentBytes inserts prefix at the beginning of each non-empty line of b.
-// The end-of-line marker is NL.
-func IndentBytes(b, prefix []byte) []byte {
- var res []byte
- bol := true
- for _, c := range b {
- if bol && c != '\n' {
- res = append(res, prefix...)
- }
- res = append(res, c)
- bol = c == '\n'
- }
- return res
-}
-
-// Writer indents each line of its input.
-type indentWriter struct {
- w io.Writer
- bol bool
- pre [][]byte
- sel int
- off int
-}
-
-// NewIndentWriter makes a new write filter that indents the input
-// lines. Each line is prefixed in order with the corresponding
-// element of pre. If there are more lines than elements, the last
-// element of pre is repeated for each subsequent line.
-func NewIndentWriter(w io.Writer, pre ...[]byte) io.Writer {
- return &indentWriter{
- w: w,
- pre: pre,
- bol: true,
- }
-}
-
-// The only errors returned are from the underlying indentWriter.
-func (w *indentWriter) Write(p []byte) (n int, err error) {
- for _, c := range p {
- if w.bol {
- var i int
- i, err = w.w.Write(w.pre[w.sel][w.off:])
- w.off += i
- if err != nil {
- return n, err
- }
- }
- _, err = w.w.Write([]byte{c})
- if err != nil {
- return n, err
- }
- n++
- w.bol = c == '\n'
- if w.bol {
- w.off = 0
- if w.sel < len(w.pre)-1 {
- w.sel++
- }
- }
- }
- return n, nil
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/indent_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/indent_test.go b/newt/Godeps/_workspace/src/github.com/kr/text/indent_test.go
deleted file mode 100644
index 5c723ee..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/indent_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package text
-
-import (
- "bytes"
- "testing"
-)
-
-type T struct {
- inp, exp, pre string
-}
-
-var tests = []T{
- {
- "The quick brown fox\njumps over the lazy\ndog.\nBut not quickly.\n",
- "xxxThe quick brown fox\nxxxjumps over the lazy\nxxxdog.\nxxxBut not quickly.\n",
- "xxx",
- },
- {
- "The quick brown fox\njumps over the lazy\ndog.\n\nBut not quickly.",
- "xxxThe quick brown fox\nxxxjumps over the lazy\nxxxdog.\n\nxxxBut not quickly.",
- "xxx",
- },
-}
-
-func TestIndent(t *testing.T) {
- for _, test := range tests {
- got := Indent(test.inp, test.pre)
- if got != test.exp {
- t.Errorf("mismatch %q != %q", got, test.exp)
- }
- }
-}
-
-type IndentWriterTest struct {
- inp, exp string
- pre []string
-}
-
-var ts = []IndentWriterTest{
- {
- `
-The quick brown fox
-jumps over the lazy
-dog.
-But not quickly.
-`[1:],
- `
-xxxThe quick brown fox
-xxxjumps over the lazy
-xxxdog.
-xxxBut not quickly.
-`[1:],
- []string{"xxx"},
- },
- {
- `
-The quick brown fox
-jumps over the lazy
-dog.
-But not quickly.
-`[1:],
- `
-xxaThe quick brown fox
-xxxjumps over the lazy
-xxxdog.
-xxxBut not quickly.
-`[1:],
- []string{"xxa", "xxx"},
- },
- {
- `
-The quick brown fox
-jumps over the lazy
-dog.
-But not quickly.
-`[1:],
- `
-xxaThe quick brown fox
-xxbjumps over the lazy
-xxcdog.
-xxxBut not quickly.
-`[1:],
- []string{"xxa", "xxb", "xxc", "xxx"},
- },
- {
- `
-The quick brown fox
-jumps over the lazy
-dog.
-
-But not quickly.`[1:],
- `
-xxaThe quick brown fox
-xxxjumps over the lazy
-xxxdog.
-xxx
-xxxBut not quickly.`[1:],
- []string{"xxa", "xxx"},
- },
-}
-
-func TestIndentWriter(t *testing.T) {
- for _, test := range ts {
- b := new(bytes.Buffer)
- pre := make([][]byte, len(test.pre))
- for i := range test.pre {
- pre[i] = []byte(test.pre[i])
- }
- w := NewIndentWriter(b, pre...)
- if _, err := w.Write([]byte(test.inp)); err != nil {
- t.Error(err)
- }
- if got := b.String(); got != test.exp {
- t.Errorf("mismatch %q != %q", got, test.exp)
- t.Log(got)
- t.Log(test.exp)
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/mc/Readme
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/mc/Readme b/newt/Godeps/_workspace/src/github.com/kr/text/mc/Readme
deleted file mode 100644
index 519ddc0..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/mc/Readme
+++ /dev/null
@@ -1,9 +0,0 @@
-Command mc prints in multiple columns.
-
- Usage: mc [-] [-N] [file...]
-
-Mc splits the input into as many columns as will fit in N
-print positions. If the output is a tty, the default N is
-the number of characters in a terminal line; otherwise the
-default N is 80. Under option - each input line ending in
-a colon ':' is printed separately.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/mc/mc.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/mc/mc.go b/newt/Godeps/_workspace/src/github.com/kr/text/mc/mc.go
deleted file mode 100644
index 00169a3..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/mc/mc.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Command mc prints in multiple columns.
-//
-// Usage: mc [-] [-N] [file...]
-//
-// Mc splits the input into as many columns as will fit in N
-// print positions. If the output is a tty, the default N is
-// the number of characters in a terminal line; otherwise the
-// default N is 80. Under option - each input line ending in
-// a colon ':' is printed separately.
-package main
-
-import (
- "github.com/kr/pty"
- "github.com/kr/text/colwriter"
- "io"
- "log"
- "os"
- "strconv"
-)
-
-func main() {
- var width int
- var flag uint
- args := os.Args[1:]
- for len(args) > 0 && len(args[0]) > 0 && args[0][0] == '-' {
- if len(args[0]) > 1 {
- width, _ = strconv.Atoi(args[0][1:])
- } else {
- flag |= colwriter.BreakOnColon
- }
- args = args[1:]
- }
- if width < 1 {
- _, width, _ = pty.Getsize(os.Stdout)
- }
- if width < 1 {
- width = 80
- }
-
- w := colwriter.NewWriter(os.Stdout, width, flag)
- if len(args) > 0 {
- for _, s := range args {
- if f, err := os.Open(s); err == nil {
- copyin(w, f)
- f.Close()
- } else {
- log.Println(err)
- }
- }
- } else {
- copyin(w, os.Stdin)
- }
-}
-
-func copyin(w *colwriter.Writer, r io.Reader) {
- if _, err := io.Copy(w, r); err != nil {
- log.Println(err)
- }
- if err := w.Flush(); err != nil {
- log.Println(err)
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/wrap.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/wrap.go b/newt/Godeps/_workspace/src/github.com/kr/text/wrap.go
deleted file mode 100644
index 1c85cd2..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/wrap.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package text
-
-import (
- "bytes"
- "math"
-)
-
-var (
- nl = []byte{'\n'}
- sp = []byte{' '}
-)
-
-const defaultPenalty = 1e5
-
-// Wrap wraps s into a paragraph of lines of length lim, with minimal
-// raggedness.
-func Wrap(s string, lim int) string {
- return string(WrapBytes([]byte(s), lim))
-}
-
-// WrapBytes wraps b into a paragraph of lines of length lim, with minimal
-// raggedness.
-func WrapBytes(b []byte, lim int) []byte {
- words := bytes.Split(bytes.Replace(bytes.TrimSpace(b), nl, sp, -1), sp)
- var lines [][]byte
- for _, line := range WrapWords(words, 1, lim, defaultPenalty) {
- lines = append(lines, bytes.Join(line, sp))
- }
- return bytes.Join(lines, nl)
-}
-
-// WrapWords is the low-level line-breaking algorithm, useful if you need more
-// control over the details of the text wrapping process. For most uses, either
-// Wrap or WrapBytes will be sufficient and more convenient.
-//
-// WrapWords splits a list of words into lines with minimal "raggedness",
-// treating each byte as one unit, accounting for spc units between adjacent
-// words on each line, and attempting to limit lines to lim units. Raggedness
-// is the total error over all lines, where error is the square of the
-// difference of the length of the line and lim. Too-long lines (which only
-// happen when a single word is longer than lim units) have pen penalty units
-// added to the error.
-func WrapWords(words [][]byte, spc, lim, pen int) [][][]byte {
- n := len(words)
-
- length := make([][]int, n)
- for i := 0; i < n; i++ {
- length[i] = make([]int, n)
- length[i][i] = len(words[i])
- for j := i + 1; j < n; j++ {
- length[i][j] = length[i][j-1] + spc + len(words[j])
- }
- }
-
- nbrk := make([]int, n)
- cost := make([]int, n)
- for i := range cost {
- cost[i] = math.MaxInt32
- }
- for i := n - 1; i >= 0; i-- {
- if length[i][n-1] <= lim {
- cost[i] = 0
- nbrk[i] = n
- } else {
- for j := i + 1; j < n; j++ {
- d := lim - length[i][j-1]
- c := d*d + cost[j]
- if length[i][j-1] > lim {
- c += pen // too-long lines get a worse penalty
- }
- if c < cost[i] {
- cost[i] = c
- nbrk[i] = j
- }
- }
- }
- }
-
- var lines [][][]byte
- i := 0
- for i < n {
- lines = append(lines, words[i:nbrk[i]])
- i = nbrk[i]
- }
- return lines
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/kr/text/wrap_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/text/wrap_test.go b/newt/Godeps/_workspace/src/github.com/kr/text/wrap_test.go
deleted file mode 100644
index 90f065c..0000000
--- a/newt/Godeps/_workspace/src/github.com/kr/text/wrap_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package text
-
-import (
- "bytes"
- "testing"
-)
-
-var text = "The quick brown fox jumps over the lazy dog."
-
-func TestWrap(t *testing.T) {
- exp := [][]string{
- {"The", "quick", "brown", "fox"},
- {"jumps", "over", "the", "lazy", "dog."},
- }
- words := bytes.Split([]byte(text), sp)
- got := WrapWords(words, 1, 24, defaultPenalty)
- if len(exp) != len(got) {
- t.Fail()
- }
- for i := range exp {
- if len(exp[i]) != len(got[i]) {
- t.Fail()
- }
- for j := range exp[i] {
- if exp[i][j] != string(got[i][j]) {
- t.Fatal(i, exp[i][j], got[i][j])
- }
- }
- }
-}
-
-func TestWrapNarrow(t *testing.T) {
- exp := "The\nquick\nbrown\nfox\njumps\nover\nthe\nlazy\ndog."
- if Wrap(text, 5) != exp {
- t.Fail()
- }
-}
-
-func TestWrapOneLine(t *testing.T) {
- exp := "The quick brown fox jumps over the lazy dog."
- if Wrap(text, 500) != exp {
- t.Fail()
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/magiconair/properties/.gitignore
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/magiconair/properties/.gitignore b/newt/Godeps/_workspace/src/github.com/magiconair/properties/.gitignore
deleted file mode 100644
index 0e379c5..0000000
--- a/newt/Godeps/_workspace/src/github.com/magiconair/properties/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.sublime-project
-*.sublime-workspace
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/magiconair/properties/.travis.yml
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/magiconair/properties/.travis.yml b/newt/Godeps/_workspace/src/github.com/magiconair/properties/.travis.yml
deleted file mode 100644
index 407127c..0000000
--- a/newt/Godeps/_workspace/src/github.com/magiconair/properties/.travis.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-language: go
-go:
- - release
-install: go get gopkg.in/check.v1
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/223a33d3/newt/Godeps/_workspace/src/github.com/magiconair/properties/LICENSE
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/magiconair/properties/LICENSE b/newt/Godeps/_workspace/src/github.com/magiconair/properties/LICENSE
deleted file mode 100644
index 7eab43b..0000000
--- a/newt/Godeps/_workspace/src/github.com/magiconair/properties/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-goproperties - properties file decoder for Go
-
-Copyright (c) 2013-2014 - Frank Schroeder
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-2. 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 OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.