Use split-out hashicorp/uuid
This commit is contained in:
parent
9f0b1547bb
commit
a9155ef85e
|
@ -15,58 +15,58 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/endpoints",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/ec2query",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/query",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/rest",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/restxml",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/signer/v4",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/ec2",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/iam",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/s3",
|
||||
"Comment": "v0.9.13",
|
||||
"Rev": "f28e73d4791500a90d49190e0a01b769748cc2a8"
|
||||
"Comment": "v0.9.14-1-g7d9ac5f",
|
||||
"Rev": "7d9ac5f2079172b9725513796718eaad96218f3b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/go-etcd/etcd",
|
||||
|
@ -93,8 +93,8 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/gocql/gocql",
|
||||
"Comment": "1st_gen_framing-277-g7ac7761",
|
||||
"Rev": "7ac77618338ef076ba157eeae4716fa4966410e0"
|
||||
"Comment": "1st_gen_framing-282-g6e86253",
|
||||
"Rev": "6e86253e1c7c91bcdcfe3afd6417d3ddfbe5771c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/snappy",
|
||||
|
@ -102,7 +102,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/go-github/github",
|
||||
"Rev": "0d67682ce830f252a1d56215f39b71199036361d"
|
||||
"Rev": "2570a87f54b43ed0957cabd7a0819f0dab85217b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/go-querystring/query",
|
||||
|
@ -110,8 +110,8 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/consul/api",
|
||||
"Comment": "v0.5.2-322-g78aa6f1",
|
||||
"Rev": "78aa6f1443ba506e8c9bc88b6f4448ad6fee325f"
|
||||
"Comment": "v0.5.2-323-ge34c321",
|
||||
"Rev": "e34c321fce1bbf0502c74d55448c8e41a7bcb5a3"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/errwrap",
|
||||
|
@ -127,7 +127,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/golang-lru",
|
||||
"Rev": "7f9ef20a0256f494e24126014135cf893ab71e9e"
|
||||
"Rev": "17e3543cc4e0b72d6c71d2e59e27a10821ea353b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/hcl",
|
||||
|
@ -137,6 +137,10 @@
|
|||
"ImportPath": "github.com/hashicorp/logutils",
|
||||
"Rev": "0dc08b1671f34c4250ce212759ebd880f743d883"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/uuid",
|
||||
"Rev": "2951e8b9707a040acdb49145ed9f36a088f3532e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/kardianos/osext",
|
||||
"Rev": "6e7f843663477789fac7c02def0d0909e969b4e5"
|
||||
|
@ -177,7 +181,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/ugorji/go/codec",
|
||||
"Rev": "45ce7596ace4534e47b69051a92aef7b64ec7b3f"
|
||||
"Rev": "2f4b94206aae781e63846a9bf02ad83c387d5296"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/vaughan0/go-ini",
|
||||
|
@ -209,7 +213,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/context",
|
||||
"Rev": "47990a1ba55743e6ef1affd3a14e5bac8553615d"
|
||||
"Rev": "4b709d93778b93d2f34943e3142c71578d83ad31"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/oauth2",
|
||||
|
|
|
@ -2,7 +2,9 @@ package ec2metadata
|
|||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
|
@ -88,7 +90,19 @@ func copyConfig(config *Config) *aws.Config {
|
|||
}
|
||||
|
||||
if c.HTTPClient == nil {
|
||||
c.HTTPClient = http.DefaultClient
|
||||
c.HTTPClient = &http.Client{
|
||||
Transport: &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
Dial: (&net.Dialer{
|
||||
// use a shorter timeout than default because the metadata
|
||||
// service is local if it is running, and to fail faster
|
||||
// if not running on an ec2 instance.
|
||||
Timeout: 5 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
},
|
||||
}
|
||||
}
|
||||
if c.Logger == nil {
|
||||
c.Logger = aws.NewDefaultLogger()
|
||||
|
|
|
@ -24,6 +24,8 @@ var retryableCodes = map[string]struct{}{
|
|||
"ThrottlingException": {},
|
||||
"RequestLimitExceeded": {},
|
||||
"RequestThrottled": {},
|
||||
"LimitExceededException": {}, // Deleting 10+ DynamoDb tables at once
|
||||
"TooManyRequestsException": {}, // Lambda functions
|
||||
}
|
||||
|
||||
// credsExpiredCodes is a collection of error codes which signify the credentials
|
||||
|
|
4
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints/endpoints.json
generated
vendored
4
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints/endpoints.json
generated
vendored
|
@ -25,6 +25,10 @@
|
|||
"endpoint": "",
|
||||
"signingRegion": "us-east-1"
|
||||
},
|
||||
"*/data.iot": {
|
||||
"endpoint": "",
|
||||
"signingRegion": "us-east-1"
|
||||
},
|
||||
"*/iam": {
|
||||
"endpoint": "iam.amazonaws.com",
|
||||
"signingRegion": "us-east-1"
|
||||
|
|
4
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints/endpoints_map.go
generated
vendored
4
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints/endpoints_map.go
generated
vendored
|
@ -26,6 +26,10 @@ var endpointsMap = endpointStruct{
|
|||
Endpoint: "",
|
||||
SigningRegion: "us-east-1",
|
||||
},
|
||||
"*/data.iot": {
|
||||
Endpoint: "",
|
||||
SigningRegion: "us-east-1",
|
||||
},
|
||||
"*/iam": {
|
||||
Endpoint: "iam.amazonaws.com",
|
||||
SigningRegion: "us-east-1",
|
||||
|
|
|
@ -54,3 +54,4 @@ Jamie Cuthill <jamie.cuthill@gmail.com>
|
|||
Adrian Casajus <adriancasajus@gmail.com>
|
||||
John Weldon <johnweldon4@gmail.com>
|
||||
Adrien Bustany <adrien@bustany.org>
|
||||
Andrey Smirnov <smirnov.andrey@gmail.com>
|
||||
|
|
|
@ -91,6 +91,8 @@ func Marshal(info TypeInfo, value interface{}) ([]byte, error) {
|
|||
return marshalVarint(info, value)
|
||||
case TypeInet:
|
||||
return marshalInet(info, value)
|
||||
case TypeTuple:
|
||||
return marshalTuple(info, value)
|
||||
case TypeUDT:
|
||||
return marshalUDT(info, value)
|
||||
}
|
||||
|
@ -1194,6 +1196,37 @@ func unmarshalInet(info TypeInfo, data []byte, value interface{}) error {
|
|||
return unmarshalErrorf("cannot unmarshal %s into %T", info, value)
|
||||
}
|
||||
|
||||
func marshalTuple(info TypeInfo, value interface{}) ([]byte, error) {
|
||||
tuple := info.(TupleTypeInfo)
|
||||
switch v := value.(type) {
|
||||
case []interface{}:
|
||||
var buf []byte
|
||||
|
||||
if len(v) != len(tuple.Elems) {
|
||||
return nil, unmarshalErrorf("cannont marshal tuple: wrong number of elements")
|
||||
}
|
||||
|
||||
for i, elem := range v {
|
||||
data, err := Marshal(tuple.Elems[i], elem)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
n := len(data)
|
||||
buf = append(buf, byte(n>>24),
|
||||
byte(n>>16),
|
||||
byte(n>>8),
|
||||
byte(n))
|
||||
|
||||
buf = append(buf, data...)
|
||||
}
|
||||
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
return nil, unmarshalErrorf("cannot marshal %T into %s", value, tuple)
|
||||
}
|
||||
|
||||
// currently only support unmarshal into a list of values, this makes it possible
|
||||
// to support tuples without changing the query API. In the future this can be extend
|
||||
// to allow unmarshalling into custom tuple types.
|
||||
|
|
|
@ -156,10 +156,10 @@ type IssueListByRepoOptions struct {
|
|||
// any assigned user.
|
||||
Assignee string `url:"assignee,omitempty"`
|
||||
|
||||
// Assignee filters issues based on their creator.
|
||||
// Creator filters issues based on their creator.
|
||||
Creator string `url:"creator,omitempty"`
|
||||
|
||||
// Assignee filters issues to those mentioned a specific user.
|
||||
// Mentioned filters issues to those mentioned a specific user.
|
||||
Mentioned string `url:"mentioned,omitempty"`
|
||||
|
||||
// Labels filters issues based on their label.
|
||||
|
|
|
@ -47,14 +47,15 @@ func (c *Cache) Purge() {
|
|||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
if c.onEvicted != nil {
|
||||
for k, v := range c.items {
|
||||
for k, v := range c.items {
|
||||
if c.onEvicted != nil {
|
||||
c.onEvicted(k, v.Value.(*entry).value)
|
||||
}
|
||||
|
||||
delete(c.items, k)
|
||||
}
|
||||
|
||||
c.evictList = list.New()
|
||||
c.items = make(map[interface{}]*list.Element, c.size)
|
||||
c.evictList.Init()
|
||||
}
|
||||
|
||||
// Add adds a value to the cache. Returns true if an eviction occured.
|
||||
|
|
|
@ -0,0 +1,363 @@
|
|||
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.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# uuid
|
||||
|
||||
Generates UUID-format strings using purely high quality random bytes.
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
The full documentation is available on [Godoc](http://godoc.org/github.com/hashicorp/uuid).
|
|
@ -48,6 +48,7 @@ import (
|
|||
"os"
|
||||
"reflect"
|
||||
"bytes"
|
||||
"strings"
|
||||
"go/format"
|
||||
)
|
||||
|
||||
|
@ -72,7 +73,7 @@ func CodecGenTempWrite{{ .RandString }}() {
|
|||
var t{{ $index }} {{ . }}
|
||||
typs = append(typs, reflect.TypeOf(t{{ $index }}))
|
||||
{{ end }}
|
||||
{{ if not .CodecPkgFiles }}{{ .CodecPkgName }}.{{ end }}Gen(&out, "{{ .BuildTag }}", "{{ .PackageName }}", "{{ .RandString }}", {{ .UseUnsafe }}, typs...)
|
||||
{{ if not .CodecPkgFiles }}{{ .CodecPkgName }}.{{ end }}Gen(&out, "{{ .BuildTag }}", "{{ .PackageName }}", "{{ .RandString }}", {{ .UseUnsafe }}, {{ if not .CodecPkgFiles }}{{ .CodecPkgName }}.{{ end }}NewTypeInfos(strings.Split("{{ .StructTags }}", ",")), typs...)
|
||||
bout, err := format.Source(out.Bytes())
|
||||
if err != nil {
|
||||
fout.Write(out.Bytes())
|
||||
|
@ -93,7 +94,7 @@ func CodecGenTempWrite{{ .RandString }}() {
|
|||
// fout contains Codec(En|De)codeSelf implementations for every type T.
|
||||
//
|
||||
func Generate(outfile, buildTag, codecPkgPath string, uid int64, useUnsafe bool, goRunTag string,
|
||||
regexName *regexp.Regexp, deleteTempFile bool, infiles ...string) (err error) {
|
||||
st string, regexName *regexp.Regexp, deleteTempFile bool, infiles ...string) (err error) {
|
||||
// For each file, grab AST, find each type, and write a call to it.
|
||||
if len(infiles) == 0 {
|
||||
return
|
||||
|
@ -128,6 +129,7 @@ func Generate(outfile, buildTag, codecPkgPath string, uid int64, useUnsafe bool,
|
|||
PackageName string
|
||||
RandString string
|
||||
BuildTag string
|
||||
StructTags string
|
||||
Types []string
|
||||
CodecPkgFiles bool
|
||||
UseUnsafe bool
|
||||
|
@ -139,6 +141,7 @@ func Generate(outfile, buildTag, codecPkgPath string, uid int64, useUnsafe bool,
|
|||
BuildTag: buildTag,
|
||||
UseUnsafe: useUnsafe,
|
||||
RandString: strconv.FormatInt(uid, 10),
|
||||
StructTags: st,
|
||||
}
|
||||
tv.ImportPath = pkg.ImportPath
|
||||
if tv.ImportPath == tv.CodecImportPath {
|
||||
|
@ -269,11 +272,12 @@ func main() {
|
|||
t := flag.String("t", "", "build tag to put in file")
|
||||
r := flag.String("r", ".*", "regex for type name to match")
|
||||
rt := flag.String("rt", "", "tags for go run")
|
||||
st := flag.String("st", "codec,json", "struct tag keys to introspect")
|
||||
x := flag.Bool("x", false, "keep temp file")
|
||||
u := flag.Bool("u", false, "Use unsafe, e.g. to avoid unnecessary allocation on []byte->string")
|
||||
d := flag.Int64("d", 0, "random identifier for use in generated code")
|
||||
flag.Parse()
|
||||
if err := Generate(*o, *t, *c, *d, *u, *rt,
|
||||
if err := Generate(*o, *t, *c, *d, *u, *rt, *st,
|
||||
regexp.MustCompile(*r), !*x, flag.Args()...); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "codecgen error: %v\n", err)
|
||||
os.Exit(1)
|
||||
|
|
|
@ -1309,7 +1309,7 @@ func (d *Decoder) getDecFn(rt reflect.Type, checkFastpath, checkCodecSelfer bool
|
|||
}
|
||||
|
||||
// debugf("\tCreating new dec fn for type: %v\n", rt)
|
||||
ti := getTypeInfo(rtid, rt)
|
||||
ti := d.h.getTypeInfo(rtid, rt)
|
||||
fi := &(fn.i)
|
||||
fi.d = d
|
||||
fi.ti = ti
|
||||
|
|
|
@ -996,7 +996,7 @@ func (e *Encoder) getEncFn(rtid uintptr, rt reflect.Type, checkFastpath, checkCo
|
|||
fn = &(e.s[len(e.s)-1]).fn
|
||||
}
|
||||
|
||||
ti := getTypeInfo(rtid, rt)
|
||||
ti := e.h.getTypeInfo(rtid, rt)
|
||||
fi := &(fn.i)
|
||||
fi.e = e
|
||||
fi.ti = ti
|
||||
|
|
|
@ -144,6 +144,7 @@ type genRunner struct {
|
|||
xs string // top level variable/constant suffix
|
||||
hn string // fn helper type name
|
||||
|
||||
ti *TypeInfos
|
||||
// rr *rand.Rand // random generator for file-specific types
|
||||
}
|
||||
|
||||
|
@ -151,7 +152,7 @@ type genRunner struct {
|
|||
// type passed. All the types must be in the same package.
|
||||
//
|
||||
// Library users: *DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.*
|
||||
func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, typ ...reflect.Type) {
|
||||
func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeInfos, typ ...reflect.Type) {
|
||||
if len(typ) == 0 {
|
||||
return
|
||||
}
|
||||
|
@ -168,6 +169,10 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, typ ...ref
|
|||
ts: []reflect.Type{},
|
||||
bp: genImportPath(typ[0]),
|
||||
xs: uid,
|
||||
ti: ti, //TODO: make it configurable
|
||||
}
|
||||
if x.ti == nil {
|
||||
x.ti = defTypeInfos
|
||||
}
|
||||
if x.xs == "" {
|
||||
rr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
|
@ -756,7 +761,7 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
|
|||
// replicate code in kStruct i.e. for each field, deref type to non-pointer, and call x.enc on it
|
||||
|
||||
// if t === type currently running selfer on, do for all
|
||||
ti := getTypeInfo(rtid, t)
|
||||
ti := x.ti.get(rtid, t)
|
||||
i := x.varsfx()
|
||||
sepVarname := genTempVarPfx + "sep" + i
|
||||
numfieldsvar := genTempVarPfx + "q" + i
|
||||
|
@ -1328,7 +1333,7 @@ func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type)
|
|||
}
|
||||
|
||||
func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintptr, t reflect.Type) {
|
||||
ti := getTypeInfo(rtid, t)
|
||||
ti := x.ti.get(rtid, t)
|
||||
tisfi := ti.sfip // always use sequence from file. decStruct expects same thing.
|
||||
x.line("switch (" + kName + ") {")
|
||||
for _, si := range tisfi {
|
||||
|
@ -1426,7 +1431,7 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref
|
|||
func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid uintptr, t reflect.Type) {
|
||||
tpfx := genTempVarPfx
|
||||
i := x.varsfx()
|
||||
ti := getTypeInfo(rtid, t)
|
||||
ti := x.ti.get(rtid, t)
|
||||
tisfi := ti.sfip // always use sequence from file. decStruct expects same thing.
|
||||
x.linef("var %sj%s int", tpfx, i)
|
||||
x.linef("var %sb%s bool", tpfx, i) // break
|
||||
|
|
|
@ -212,9 +212,6 @@ var (
|
|||
bigen = binary.BigEndian
|
||||
structInfoFieldName = "_struct"
|
||||
|
||||
cachedTypeInfo = make(map[uintptr]*typeInfo, 64)
|
||||
cachedTypeInfoMutex sync.RWMutex
|
||||
|
||||
// mapStrIntfTyp = reflect.TypeOf(map[string]interface{}(nil))
|
||||
intfSliceTyp = reflect.TypeOf([]interface{}(nil))
|
||||
intfTyp = intfSliceTyp.Elem()
|
||||
|
@ -256,6 +253,8 @@ var (
|
|||
noFieldNameToStructFieldInfoErr = errors.New("no field name passed to parseStructFieldInfo")
|
||||
)
|
||||
|
||||
var defTypeInfos = NewTypeInfos([]string{"codec", "json"})
|
||||
|
||||
// Selfer defines methods by which a value can encode or decode itself.
|
||||
//
|
||||
// Any type which implements Selfer will be able to encode or decode itself.
|
||||
|
@ -281,6 +280,11 @@ type MapBySlice interface {
|
|||
//
|
||||
// BasicHandle encapsulates the common options and extension functions.
|
||||
type BasicHandle struct {
|
||||
// TypeInfos is used to get the type info for any type.
|
||||
//
|
||||
// If not configure, the default TypeInfos is used, which uses struct tag keys: codec, json
|
||||
TypeInfos *TypeInfos
|
||||
|
||||
extHandle
|
||||
EncodeOptions
|
||||
DecodeOptions
|
||||
|
@ -290,6 +294,13 @@ func (x *BasicHandle) getBasicHandle() *BasicHandle {
|
|||
return x
|
||||
}
|
||||
|
||||
func (x *BasicHandle) getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
|
||||
if x.TypeInfos != nil {
|
||||
return x.TypeInfos.get(rtid, rt)
|
||||
}
|
||||
return defTypeInfos.get(rtid, rt)
|
||||
}
|
||||
|
||||
// Handle is the interface for a specific encoding format.
|
||||
//
|
||||
// Typically, a Handle is pre-configured before first time use,
|
||||
|
@ -695,28 +706,48 @@ func (ti *typeInfo) indexForEncName(name string) int {
|
|||
return -1
|
||||
}
|
||||
|
||||
func getStructTag(t reflect.StructTag) (s string) {
|
||||
// TypeInfos caches typeInfo for each type on first inspection.
|
||||
//
|
||||
// It is configured with a set of tag keys, which are used to get
|
||||
// configuration for the type.
|
||||
type TypeInfos struct {
|
||||
infos map[uintptr]*typeInfo
|
||||
mu sync.RWMutex
|
||||
tags []string
|
||||
}
|
||||
|
||||
// NewTypeInfos creates a TypeInfos given a set of struct tags keys.
|
||||
//
|
||||
// This allows users customize the struct tag keys which contain configuration
|
||||
// of their types.
|
||||
func NewTypeInfos(tags []string) *TypeInfos {
|
||||
return &TypeInfos{tags: tags, infos: make(map[uintptr]*typeInfo, 64)}
|
||||
}
|
||||
|
||||
func (x *TypeInfos) structTag(t reflect.StructTag) (s string) {
|
||||
// check for tags: codec, json, in that order.
|
||||
// this allows seamless support for many configured structs.
|
||||
s = t.Get("codec")
|
||||
if s == "" {
|
||||
s = t.Get("json")
|
||||
for _, x := range x.tags {
|
||||
s = t.Get(x)
|
||||
if s != "" {
|
||||
return s
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
|
||||
func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
|
||||
var ok bool
|
||||
cachedTypeInfoMutex.RLock()
|
||||
pti, ok = cachedTypeInfo[rtid]
|
||||
cachedTypeInfoMutex.RUnlock()
|
||||
x.mu.RLock()
|
||||
pti, ok = x.infos[rtid]
|
||||
x.mu.RUnlock()
|
||||
if ok {
|
||||
return
|
||||
}
|
||||
|
||||
cachedTypeInfoMutex.Lock()
|
||||
defer cachedTypeInfoMutex.Unlock()
|
||||
if pti, ok = cachedTypeInfo[rtid]; ok {
|
||||
x.mu.Lock()
|
||||
defer x.mu.Unlock()
|
||||
if pti, ok = x.infos[rtid]; ok {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -768,11 +799,11 @@ func getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
|
|||
if rt.Kind() == reflect.Struct {
|
||||
var siInfo *structFieldInfo
|
||||
if f, ok := rt.FieldByName(structInfoFieldName); ok {
|
||||
siInfo = parseStructFieldInfo(structInfoFieldName, getStructTag(f.Tag))
|
||||
siInfo = parseStructFieldInfo(structInfoFieldName, x.structTag(f.Tag))
|
||||
ti.toArray = siInfo.toArray
|
||||
}
|
||||
sfip := make([]*structFieldInfo, 0, rt.NumField())
|
||||
rgetTypeInfo(rt, nil, make(map[string]bool, 16), &sfip, siInfo)
|
||||
x.rget(rt, nil, make(map[string]bool, 16), &sfip, siInfo)
|
||||
|
||||
ti.sfip = make([]*structFieldInfo, len(sfip))
|
||||
ti.sfi = make([]*structFieldInfo, len(sfip))
|
||||
|
@ -781,11 +812,11 @@ func getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
|
|||
copy(ti.sfi, sfip)
|
||||
}
|
||||
// sfi = sfip
|
||||
cachedTypeInfo[rtid] = pti
|
||||
x.infos[rtid] = pti
|
||||
return
|
||||
}
|
||||
|
||||
func rgetTypeInfo(rt reflect.Type, indexstack []int, fnameToHastag map[string]bool,
|
||||
func (x *TypeInfos) rget(rt reflect.Type, indexstack []int, fnameToHastag map[string]bool,
|
||||
sfi *[]*structFieldInfo, siInfo *structFieldInfo,
|
||||
) {
|
||||
for j := 0; j < rt.NumField(); j++ {
|
||||
|
@ -794,7 +825,7 @@ func rgetTypeInfo(rt reflect.Type, indexstack []int, fnameToHastag map[string]bo
|
|||
if tk := f.Type.Kind(); tk == reflect.Func {
|
||||
continue
|
||||
}
|
||||
stag := getStructTag(f.Tag)
|
||||
stag := x.structTag(f.Tag)
|
||||
if stag == "-" {
|
||||
continue
|
||||
}
|
||||
|
@ -825,7 +856,7 @@ func rgetTypeInfo(rt reflect.Type, indexstack []int, fnameToHastag map[string]bo
|
|||
copy(indexstack2, indexstack)
|
||||
indexstack2[len(indexstack)] = j
|
||||
// indexstack2 := append(append(make([]int, 0, len(indexstack)+4), indexstack...), j)
|
||||
rgetTypeInfo(ft, indexstack2, fnameToHastag, sfi, siInfo)
|
||||
x.rget(ft, indexstack2, fnameToHastag, sfi, siInfo)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ _codegenerators() {
|
|||
then
|
||||
true && \
|
||||
echo "codecgen - !unsafe ... " && \
|
||||
codecgen -rt codecgen -t 'x,codecgen,!unsafe' -o values_codecgen${zsfx} -d 1978 $zfin && \
|
||||
codecgen -rt codecgen -t 'x,codecgen,!unsafe' -o values_codecgen${zsfx} -d 1978 $zfin && \
|
||||
echo "codecgen - unsafe ... " && \
|
||||
codecgen -u -rt codecgen -t 'x,codecgen,unsafe' -o values_codecgen_unsafe${zsfx} -d 1978 $zfin && \
|
||||
echo "msgp ... " && \
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
_ "github.com/lib/pq"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
_ "github.com/lib/pq"
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"fmt"
|
||||
"hash"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"crypto/sha256"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package uuid
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGenerateUUID(t *testing.T) {
|
||||
prev := GenerateUUID()
|
||||
for i := 0; i < 100; i++ {
|
||||
id := GenerateUUID()
|
||||
if prev == id {
|
||||
t.Fatalf("Should get a new ID!")
|
||||
}
|
||||
|
||||
matched, err := regexp.MatchString(
|
||||
"[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}", id)
|
||||
if !matched || err != nil {
|
||||
t.Fatalf("expected match %s %v %s", id, matched, err)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/vault/audit"
|
||||
"github.com/hashicorp/vault/helper/salt"
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"github.com/hashicorp/vault/audit"
|
||||
"github.com/hashicorp/vault/helper/mlock"
|
||||
"github.com/hashicorp/vault/helper/pgpkeys"
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/physical"
|
||||
"github.com/hashicorp/vault/shamir"
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/otto/helper/uuid"
|
||||
"github.com/hashicorp/vault/audit"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/physical"
|
||||
)
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
)
|
||||
|
||||
// mockRollback returns a mock rollback manager
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/vault/helper/salt"
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/helper/uuid"
|
||||
"github.com/hashicorp/uuid"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue