-Gnahz
-Google Inc.
-griffin_stewie
-Guz Alexander
-Hanno Hecker
-Hari haran
-haya14busa
-Huy Tr
-huydx
-i2bskn
-Isao Jonas
-isqua
-Jameel Haffejee
-Jan Kosecki
-Jeremy Morris
-Jihoon Chung
-Jimmi Dyson
-Joe Tsai
-John Barton
-John Engelman
-jpbelanger-mtl
-Juan Basso
-Julien Rostand
-Justin Abrahms
-jzhoucliqr
-Katrina Owen
-Keita Urashima
-Kevin Burke
-Konrad Malawski
-Kookheon Kwon
-Krzysztof Kowalczyk
-Kshitij Saraogi
-kyokomi
-Lucas Alcantara
-Luke Evers
-Luke Kysow
-Luke Roberts
-Luke Young
-Maksim Zhylinski
-Martin-Louis Bright
-Mat Geist
-Matt Brender
-Matt Landis
-Maxime Bury
-Michael Tiller
-Michał Glapa
-Nathan VanBenschoten
-Neil O'Toole
-Nick Miyake
-Nick Spragg
-Nikhita Raghunath
-Noah Zoschke
-ns-cweber
-Ondřej Kupka
-Panagiotis Moustafellos
-Parker Moore
-Pavel Shtanko
-Petr Shevtsov
-Pierre Carrier
-Piotr Zurek
-Quinn Slack
-Rackspace US, Inc.
-RaviTeja Pothana
-rc1140
-Red Hat, Inc.
-Rob Figueiredo
-Ronak Jain
-Ruben Vereecken
-Ryan Lower
-Sahil Dua
-saisi
-Sam Minnée
-Sander van Harmelen
-Sarasa Kisaragi
-Sean Wang
-Sebastian Mandrean
-Sebastian Mæland Pedersen
-Sevki
-Shawn Catanzarite
-Shawn Smith
-sona-tar
-SoundCloud, Ltd.
-Stian Eikeland
-Thomas Bruyelle
-Timothée Peignier
-Trey Tacon
-ttacon
-Varadarajan Aravamudhan
-Victor Castell
-Victor Vrantchan
-Vlad Ungureanu
-Will Maier
-William Bailey
-Yann Malet
-Yannick Utard
-Yicheng Qin
-Yumikiyo Osanai
-Zach Latta
diff --git a/vendor/github.com/google/go-github/LICENSE b/vendor/github.com/google/go-github/LICENSE
deleted file mode 100644
index 53d5374a..00000000
--- a/vendor/github.com/google/go-github/LICENSE
+++ /dev/null
@@ -1,341 +0,0 @@
-Copyright (c) 2013 The go-github AUTHORS. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-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.
-
-----------
-
-Some documentation is taken from the GitHub Developer site
-, which is available under the following Creative
-Commons Attribution 3.0 License. This applies only to the go-github source
-code and would not apply to any compiled binaries.
-
-THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
-COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
-COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
-AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
-
-BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
-TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
-BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
-CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
-CONDITIONS.
-
-1. Definitions
-
- a. "Adaptation" means a work based upon the Work, or upon the Work and
- other pre-existing works, such as a translation, adaptation,
- derivative work, arrangement of music or other alterations of a
- literary or artistic work, or phonogram or performance and includes
- cinematographic adaptations or any other form in which the Work may be
- recast, transformed, or adapted including in any form recognizably
- derived from the original, except that a work that constitutes a
- Collection will not be considered an Adaptation for the purpose of
- this License. For the avoidance of doubt, where the Work is a musical
- work, performance or phonogram, the synchronization of the Work in
- timed-relation with a moving image ("synching") will be considered an
- Adaptation for the purpose of this License.
- b. "Collection" means a collection of literary or artistic works, such as
- encyclopedias and anthologies, or performances, phonograms or
- broadcasts, or other works or subject matter other than works listed
- in Section 1(f) below, which, by reason of the selection and
- arrangement of their contents, constitute intellectual creations, in
- which the Work is included in its entirety in unmodified form along
- with one or more other contributions, each constituting separate and
- independent works in themselves, which together are assembled into a
- collective whole. A work that constitutes a Collection will not be
- considered an Adaptation (as defined above) for the purposes of this
- License.
- c. "Distribute" means to make available to the public the original and
- copies of the Work or Adaptation, as appropriate, through sale or
- other transfer of ownership.
- d. "Licensor" means the individual, individuals, entity or entities that
- offer(s) the Work under the terms of this License.
- e. "Original Author" means, in the case of a literary or artistic work,
- the individual, individuals, entity or entities who created the Work
- or if no individual or entity can be identified, the publisher; and in
- addition (i) in the case of a performance the actors, singers,
- musicians, dancers, and other persons who act, sing, deliver, declaim,
- play in, interpret or otherwise perform literary or artistic works or
- expressions of folklore; (ii) in the case of a phonogram the producer
- being the person or legal entity who first fixes the sounds of a
- performance or other sounds; and, (iii) in the case of broadcasts, the
- organization that transmits the broadcast.
- f. "Work" means the literary and/or artistic work offered under the terms
- of this License including without limitation any production in the
- literary, scientific and artistic domain, whatever may be the mode or
- form of its expression including digital form, such as a book,
- pamphlet and other writing; a lecture, address, sermon or other work
- of the same nature; a dramatic or dramatico-musical work; a
- choreographic work or entertainment in dumb show; a musical
- composition with or without words; a cinematographic work to which are
- assimilated works expressed by a process analogous to cinematography;
- a work of drawing, painting, architecture, sculpture, engraving or
- lithography; a photographic work to which are assimilated works
- expressed by a process analogous to photography; a work of applied
- art; an illustration, map, plan, sketch or three-dimensional work
- relative to geography, topography, architecture or science; a
- performance; a broadcast; a phonogram; a compilation of data to the
- extent it is protected as a copyrightable work; or a work performed by
- a variety or circus performer to the extent it is not otherwise
- considered a literary or artistic work.
- g. "You" means an individual or entity exercising rights under this
- License who has not previously violated the terms of this License with
- respect to the Work, or who has received express permission from the
- Licensor to exercise rights under this License despite a previous
- violation.
- h. "Publicly Perform" means to perform public recitations of the Work and
- to communicate to the public those public recitations, by any means or
- process, including by wire or wireless means or public digital
- performances; to make available to the public Works in such a way that
- members of the public may access these Works from a place and at a
- place individually chosen by them; to perform the Work to the public
- by any means or process and the communication to the public of the
- performances of the Work, including by public digital performance; to
- broadcast and rebroadcast the Work by any means including signs,
- sounds or images.
- i. "Reproduce" means to make copies of the Work by any means including
- without limitation by sound or visual recordings and the right of
- fixation and reproducing fixations of the Work, including storage of a
- protected performance or phonogram in digital form or other electronic
- medium.
-
-2. Fair Dealing Rights. Nothing in this License is intended to reduce,
-limit, or restrict any uses free from copyright or rights arising from
-limitations or exceptions that are provided for in connection with the
-copyright protection under copyright law or other applicable laws.
-
-3. License Grant. Subject to the terms and conditions of this License,
-Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
-perpetual (for the duration of the applicable copyright) license to
-exercise the rights in the Work as stated below:
-
- a. to Reproduce the Work, to incorporate the Work into one or more
- Collections, and to Reproduce the Work as incorporated in the
- Collections;
- b. to create and Reproduce Adaptations provided that any such Adaptation,
- including any translation in any medium, takes reasonable steps to
- clearly label, demarcate or otherwise identify that changes were made
- to the original Work. For example, a translation could be marked "The
- original work was translated from English to Spanish," or a
- modification could indicate "The original work has been modified.";
- c. to Distribute and Publicly Perform the Work including as incorporated
- in Collections; and,
- d. to Distribute and Publicly Perform Adaptations.
- e. For the avoidance of doubt:
-
- i. Non-waivable Compulsory License Schemes. In those jurisdictions in
- which the right to collect royalties through any statutory or
- compulsory licensing scheme cannot be waived, the Licensor
- reserves the exclusive right to collect such royalties for any
- exercise by You of the rights granted under this License;
- ii. Waivable Compulsory License Schemes. In those jurisdictions in
- which the right to collect royalties through any statutory or
- compulsory licensing scheme can be waived, the Licensor waives the
- exclusive right to collect such royalties for any exercise by You
- of the rights granted under this License; and,
- iii. Voluntary License Schemes. The Licensor waives the right to
- collect royalties, whether individually or, in the event that the
- Licensor is a member of a collecting society that administers
- voluntary licensing schemes, via that society, from any exercise
- by You of the rights granted under this License.
-
-The above rights may be exercised in all media and formats whether now
-known or hereafter devised. The above rights include the right to make
-such modifications as are technically necessary to exercise the rights in
-other media and formats. Subject to Section 8(f), all rights not expressly
-granted by Licensor are hereby reserved.
-
-4. Restrictions. The license granted in Section 3 above is expressly made
-subject to and limited by the following restrictions:
-
- a. You may Distribute or Publicly Perform the Work only under the terms
- of this License. You must include a copy of, or the Uniform Resource
- Identifier (URI) for, this License with every copy of the Work You
- Distribute or Publicly Perform. You may not offer or impose any terms
- on the Work that restrict the terms of this License or the ability of
- the recipient of the Work to exercise the rights granted to that
- recipient under the terms of the License. You may not sublicense the
- Work. You must keep intact all notices that refer to this License and
- to the disclaimer of warranties with every copy of the Work You
- Distribute or Publicly Perform. When You Distribute or Publicly
- Perform the Work, You may not impose any effective technological
- measures on the Work that restrict the ability of a recipient of the
- Work from You to exercise the rights granted to that recipient under
- the terms of the License. This Section 4(a) applies to the Work as
- incorporated in a Collection, but this does not require the Collection
- apart from the Work itself to be made subject to the terms of this
- License. If You create a Collection, upon notice from any Licensor You
- must, to the extent practicable, remove from the Collection any credit
- as required by Section 4(b), as requested. If You create an
- Adaptation, upon notice from any Licensor You must, to the extent
- practicable, remove from the Adaptation any credit as required by
- Section 4(b), as requested.
- b. If You Distribute, or Publicly Perform the Work or any Adaptations or
- Collections, You must, unless a request has been made pursuant to
- Section 4(a), keep intact all copyright notices for the Work and
- provide, reasonable to the medium or means You are utilizing: (i) the
- name of the Original Author (or pseudonym, if applicable) if supplied,
- and/or if the Original Author and/or Licensor designate another party
- or parties (e.g., a sponsor institute, publishing entity, journal) for
- attribution ("Attribution Parties") in Licensor's copyright notice,
- terms of service or by other reasonable means, the name of such party
- or parties; (ii) the title of the Work if supplied; (iii) to the
- extent reasonably practicable, the URI, if any, that Licensor
- specifies to be associated with the Work, unless such URI does not
- refer to the copyright notice or licensing information for the Work;
- and (iv) , consistent with Section 3(b), in the case of an Adaptation,
- a credit identifying the use of the Work in the Adaptation (e.g.,
- "French translation of the Work by Original Author," or "Screenplay
- based on original Work by Original Author"). The credit required by
- this Section 4 (b) may be implemented in any reasonable manner;
- provided, however, that in the case of a Adaptation or Collection, at
- a minimum such credit will appear, if a credit for all contributing
- authors of the Adaptation or Collection appears, then as part of these
- credits and in a manner at least as prominent as the credits for the
- other contributing authors. For the avoidance of doubt, You may only
- use the credit required by this Section for the purpose of attribution
- in the manner set out above and, by exercising Your rights under this
- License, You may not implicitly or explicitly assert or imply any
- connection with, sponsorship or endorsement by the Original Author,
- Licensor and/or Attribution Parties, as appropriate, of You or Your
- use of the Work, without the separate, express prior written
- permission of the Original Author, Licensor and/or Attribution
- Parties.
- c. Except as otherwise agreed in writing by the Licensor or as may be
- otherwise permitted by applicable law, if You Reproduce, Distribute or
- Publicly Perform the Work either by itself or as part of any
- Adaptations or Collections, You must not distort, mutilate, modify or
- take other derogatory action in relation to the Work which would be
- prejudicial to the Original Author's honor or reputation. Licensor
- agrees that in those jurisdictions (e.g. Japan), in which any exercise
- of the right granted in Section 3(b) of this License (the right to
- make Adaptations) would be deemed to be a distortion, mutilation,
- modification or other derogatory action prejudicial to the Original
- Author's honor and reputation, the Licensor will waive or not assert,
- as appropriate, this Section, to the fullest extent permitted by the
- applicable national law, to enable You to reasonably exercise Your
- right under Section 3(b) of this License (right to make Adaptations)
- but not otherwise.
-
-5. Representations, Warranties and Disclaimer
-
-UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
-OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
-KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
-INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
-FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
-LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
-WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
-OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
-
-6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
-LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
-ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
-ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-7. Termination
-
- a. This License and the rights granted hereunder will terminate
- automatically upon any breach by You of the terms of this License.
- Individuals or entities who have received Adaptations or Collections
- from You under this License, however, will not have their licenses
- terminated provided such individuals or entities remain in full
- compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
- survive any termination of this License.
- b. Subject to the above terms and conditions, the license granted here is
- perpetual (for the duration of the applicable copyright in the Work).
- Notwithstanding the above, Licensor reserves the right to release the
- Work under different license terms or to stop distributing the Work at
- any time; provided, however that any such election will not serve to
- withdraw this License (or any other license that has been, or is
- required to be, granted under the terms of this License), and this
- License will continue in full force and effect unless terminated as
- stated above.
-
-8. Miscellaneous
-
- a. Each time You Distribute or Publicly Perform the Work or a Collection,
- the Licensor offers to the recipient a license to the Work on the same
- terms and conditions as the license granted to You under this License.
- b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
- offers to the recipient a license to the original Work on the same
- terms and conditions as the license granted to You under this License.
- c. If any provision of this License is invalid or unenforceable under
- applicable law, it shall not affect the validity or enforceability of
- the remainder of the terms of this License, and without further action
- by the parties to this agreement, such provision shall be reformed to
- the minimum extent necessary to make such provision valid and
- enforceable.
- d. No term or provision of this License shall be deemed waived and no
- breach consented to unless such waiver or consent shall be in writing
- and signed by the party to be charged with such waiver or consent.
- e. This License constitutes the entire agreement between the parties with
- respect to the Work licensed here. There are no understandings,
- agreements or representations with respect to the Work not specified
- here. Licensor shall not be bound by any additional provisions that
- may appear in any communication from You. This License may not be
- modified without the mutual written agreement of the Licensor and You.
- f. The rights granted under, and the subject matter referenced, in this
- License were drafted utilizing the terminology of the Berne Convention
- for the Protection of Literary and Artistic Works (as amended on
- September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
- Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
- and the Universal Copyright Convention (as revised on July 24, 1971).
- These rights and subject matter take effect in the relevant
- jurisdiction in which the License terms are sought to be enforced
- according to the corresponding provisions of the implementation of
- those treaty provisions in the applicable national law. If the
- standard suite of rights granted under applicable copyright law
- includes additional rights not granted under this License, such
- additional rights are deemed to be included in the License; this
- License is not intended to restrict the license of any rights under
- applicable law.
-
-
-Creative Commons Notice
-
- Creative Commons is not a party to this License, and makes no warranty
- whatsoever in connection with the Work. Creative Commons will not be
- liable to You or any party on any legal theory for any damages
- whatsoever, including without limitation any general, special,
- incidental or consequential damages arising in connection to this
- license. Notwithstanding the foregoing two (2) sentences, if Creative
- Commons has expressly identified itself as the Licensor hereunder, it
- shall have all rights and obligations of Licensor.
-
- Except for the limited purpose of indicating to the public that the
- Work is licensed under the CCPL, Creative Commons does not authorize
- the use by either party of the trademark "Creative Commons" or any
- related trademark or logo of Creative Commons without the prior
- written consent of Creative Commons. Any permitted use will be in
- compliance with Creative Commons' then-current trademark usage
- guidelines, as may be published on its website or otherwise made
- available upon request from time to time. For the avoidance of doubt,
- this trademark restriction does not form part of this License.
-
- Creative Commons may be contacted at http://creativecommons.org/.
diff --git a/vendor/github.com/google/go-github/github/activity.go b/vendor/github.com/google/go-github/github/activity.go
deleted file mode 100644
index d6c992c7..00000000
--- a/vendor/github.com/google/go-github/github/activity.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import "context"
-
-// ActivityService handles communication with the activity related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/
-type ActivityService service
-
-// FeedLink represents a link to a related resource.
-type FeedLink struct {
- HRef *string `json:"href,omitempty"`
- Type *string `json:"type,omitempty"`
-}
-
-// Feeds represents timeline resources in Atom format.
-type Feeds struct {
- TimelineURL *string `json:"timeline_url,omitempty"`
- UserURL *string `json:"user_url,omitempty"`
- CurrentUserPublicURL *string `json:"current_user_public_url,omitempty"`
- CurrentUserURL *string `json:"current_user_url,omitempty"`
- CurrentUserActorURL *string `json:"current_user_actor_url,omitempty"`
- CurrentUserOrganizationURL *string `json:"current_user_organization_url,omitempty"`
- CurrentUserOrganizationURLs []string `json:"current_user_organization_urls,omitempty"`
- Links *struct {
- Timeline *FeedLink `json:"timeline,omitempty"`
- User *FeedLink `json:"user,omitempty"`
- CurrentUserPublic *FeedLink `json:"current_user_public,omitempty"`
- CurrentUser *FeedLink `json:"current_user,omitempty"`
- CurrentUserActor *FeedLink `json:"current_user_actor,omitempty"`
- CurrentUserOrganization *FeedLink `json:"current_user_organization,omitempty"`
- CurrentUserOrganizations []FeedLink `json:"current_user_organizations,omitempty"`
- } `json:"_links,omitempty"`
-}
-
-// ListFeeds lists all the feeds available to the authenticated user.
-//
-// GitHub provides several timeline resources in Atom format:
-// Timeline: The GitHub global public timeline
-// User: The public timeline for any user, using URI template
-// Current user public: The public timeline for the authenticated user
-// Current user: The private timeline for the authenticated user
-// Current user actor: The private timeline for activity created by the
-// authenticated user
-// Current user organizations: The private timeline for the organizations
-// the authenticated user is a member of.
-//
-// Note: Private feeds are only returned when authenticating via Basic Auth
-// since current feed URIs use the older, non revocable auth tokens.
-func (s *ActivityService) ListFeeds(ctx context.Context) (*Feeds, *Response, error) {
- req, err := s.client.NewRequest("GET", "feeds", nil)
- if err != nil {
- return nil, nil, err
- }
-
- f := &Feeds{}
- resp, err := s.client.Do(ctx, req, f)
- if err != nil {
- return nil, resp, err
- }
-
- return f, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/activity_events.go b/vendor/github.com/google/go-github/github/activity_events.go
deleted file mode 100644
index f337fcd2..00000000
--- a/vendor/github.com/google/go-github/github/activity_events.go
+++ /dev/null
@@ -1,324 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "time"
-)
-
-// Event represents a GitHub event.
-type Event struct {
- Type *string `json:"type,omitempty"`
- Public *bool `json:"public,omitempty"`
- RawPayload *json.RawMessage `json:"payload,omitempty"`
- Repo *Repository `json:"repo,omitempty"`
- Actor *User `json:"actor,omitempty"`
- Org *Organization `json:"org,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- ID *string `json:"id,omitempty"`
-}
-
-func (e Event) String() string {
- return Stringify(e)
-}
-
-// ParsePayload parses the event payload. For recognized event types,
-// a value of the corresponding struct type will be returned.
-func (e *Event) ParsePayload() (payload interface{}, err error) {
- switch *e.Type {
- case "CommitCommentEvent":
- payload = &CommitCommentEvent{}
- case "CreateEvent":
- payload = &CreateEvent{}
- case "DeleteEvent":
- payload = &DeleteEvent{}
- case "DeploymentEvent":
- payload = &DeploymentEvent{}
- case "DeploymentStatusEvent":
- payload = &DeploymentStatusEvent{}
- case "ForkEvent":
- payload = &ForkEvent{}
- case "GollumEvent":
- payload = &GollumEvent{}
- case "InstallationEvent":
- payload = &InstallationEvent{}
- case "InstallationRepositoriesEvent":
- payload = &InstallationRepositoriesEvent{}
- case "IssueCommentEvent":
- payload = &IssueCommentEvent{}
- case "IssuesEvent":
- payload = &IssuesEvent{}
- case "LabelEvent":
- payload = &LabelEvent{}
- case "MarketplacePurchaseEvent":
- payload = &MarketplacePurchaseEvent{}
- case "MemberEvent":
- payload = &MemberEvent{}
- case "MembershipEvent":
- payload = &MembershipEvent{}
- case "MilestoneEvent":
- payload = &MilestoneEvent{}
- case "OrganizationEvent":
- payload = &OrganizationEvent{}
- case "OrgBlockEvent":
- payload = &OrgBlockEvent{}
- case "PageBuildEvent":
- payload = &PageBuildEvent{}
- case "PingEvent":
- payload = &PingEvent{}
- case "ProjectEvent":
- payload = &ProjectEvent{}
- case "ProjectCardEvent":
- payload = &ProjectCardEvent{}
- case "ProjectColumnEvent":
- payload = &ProjectColumnEvent{}
- case "PublicEvent":
- payload = &PublicEvent{}
- case "PullRequestEvent":
- payload = &PullRequestEvent{}
- case "PullRequestReviewEvent":
- payload = &PullRequestReviewEvent{}
- case "PullRequestReviewCommentEvent":
- payload = &PullRequestReviewCommentEvent{}
- case "PushEvent":
- payload = &PushEvent{}
- case "ReleaseEvent":
- payload = &ReleaseEvent{}
- case "RepositoryEvent":
- payload = &RepositoryEvent{}
- case "StatusEvent":
- payload = &StatusEvent{}
- case "TeamEvent":
- payload = &TeamEvent{}
- case "TeamAddEvent":
- payload = &TeamAddEvent{}
- case "WatchEvent":
- payload = &WatchEvent{}
- }
- err = json.Unmarshal(*e.RawPayload, &payload)
- return payload, err
-}
-
-// Payload returns the parsed event payload. For recognized event types,
-// a value of the corresponding struct type will be returned.
-//
-// Deprecated: Use ParsePayload instead, which returns an error
-// rather than panics if JSON unmarshaling raw payload fails.
-func (e *Event) Payload() (payload interface{}) {
- var err error
- payload, err = e.ParsePayload()
- if err != nil {
- panic(err)
- }
- return payload
-}
-
-// ListEvents drinks from the firehose of all public events across GitHub.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events
-func (s *ActivityService) ListEvents(ctx context.Context, opt *ListOptions) ([]*Event, *Response, error) {
- u, err := addOptions("events", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*Event
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// ListRepositoryEvents lists events for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/#list-repository-events
-func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/events", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*Event
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// ListIssueEventsForRepository lists issue events for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
-func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*IssueEvent
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// ListEventsForRepoNetwork lists public events for a network of repositories.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
-func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
- u := fmt.Sprintf("networks/%v/%v/events", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*Event
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// ListEventsForOrganization lists public events for an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
-func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opt *ListOptions) ([]*Event, *Response, error) {
- u := fmt.Sprintf("orgs/%v/events", org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*Event
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is
-// true, only public events will be returned.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
-func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) {
- var u string
- if publicOnly {
- u = fmt.Sprintf("users/%v/events/public", user)
- } else {
- u = fmt.Sprintf("users/%v/events", user)
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*Event
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// ListEventsReceivedByUser lists the events received by a user. If publicOnly is
-// true, only public events will be returned.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
-func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) {
- var u string
- if publicOnly {
- u = fmt.Sprintf("users/%v/received_events/public", user)
- } else {
- u = fmt.Sprintf("users/%v/received_events", user)
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*Event
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// ListUserEventsForOrganization provides the user’s organization dashboard. You
-// must be authenticated as the user to view this.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-for-an-organization
-func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opt *ListOptions) ([]*Event, *Response, error) {
- u := fmt.Sprintf("users/%v/events/orgs/%v", user, org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*Event
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/activity_notifications.go b/vendor/github.com/google/go-github/github/activity_notifications.go
deleted file mode 100644
index 45c8b2ae..00000000
--- a/vendor/github.com/google/go-github/github/activity_notifications.go
+++ /dev/null
@@ -1,223 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// Notification identifies a GitHub notification for a user.
-type Notification struct {
- ID *string `json:"id,omitempty"`
- Repository *Repository `json:"repository,omitempty"`
- Subject *NotificationSubject `json:"subject,omitempty"`
-
- // Reason identifies the event that triggered the notification.
- //
- // GitHub API docs: https://developer.github.com/v3/activity/notifications/#notification-reasons
- Reason *string `json:"reason,omitempty"`
-
- Unread *bool `json:"unread,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- LastReadAt *time.Time `json:"last_read_at,omitempty"`
- URL *string `json:"url,omitempty"`
-}
-
-// NotificationSubject identifies the subject of a notification.
-type NotificationSubject struct {
- Title *string `json:"title,omitempty"`
- URL *string `json:"url,omitempty"`
- LatestCommentURL *string `json:"latest_comment_url,omitempty"`
- Type *string `json:"type,omitempty"`
-}
-
-// NotificationListOptions specifies the optional parameters to the
-// ActivityService.ListNotifications method.
-type NotificationListOptions struct {
- All bool `url:"all,omitempty"`
- Participating bool `url:"participating,omitempty"`
- Since time.Time `url:"since,omitempty"`
- Before time.Time `url:"before,omitempty"`
-
- ListOptions
-}
-
-// ListNotifications lists all notifications for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications
-func (s *ActivityService) ListNotifications(ctx context.Context, opt *NotificationListOptions) ([]*Notification, *Response, error) {
- u := fmt.Sprintf("notifications")
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var notifications []*Notification
- resp, err := s.client.Do(ctx, req, ¬ifications)
- if err != nil {
- return nil, resp, err
- }
-
- return notifications, resp, nil
-}
-
-// ListRepositoryNotifications lists all notifications in a given repository
-// for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
-func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opt *NotificationListOptions) ([]*Notification, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var notifications []*Notification
- resp, err := s.client.Do(ctx, req, ¬ifications)
- if err != nil {
- return nil, resp, err
- }
-
- return notifications, resp, nil
-}
-
-type markReadOptions struct {
- LastReadAt time.Time `json:"last_read_at,omitempty"`
-}
-
-// MarkNotificationsRead marks all notifications up to lastRead as read.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-as-read
-func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead time.Time) (*Response, error) {
- opts := &markReadOptions{
- LastReadAt: lastRead,
- }
- req, err := s.client.NewRequest("PUT", "notifications", opts)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// MarkRepositoryNotificationsRead marks all notifications up to lastRead in
-// the specified repository as read.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
-func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead time.Time) (*Response, error) {
- opts := &markReadOptions{
- LastReadAt: lastRead,
- }
- u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo)
- req, err := s.client.NewRequest("PUT", u, opts)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// GetThread gets the specified notification thread.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#view-a-single-thread
-func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) {
- u := fmt.Sprintf("notifications/threads/%v", id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- notification := new(Notification)
- resp, err := s.client.Do(ctx, req, notification)
- if err != nil {
- return nil, resp, err
- }
-
- return notification, resp, nil
-}
-
-// MarkThreadRead marks the specified thread as read.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
-func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) {
- u := fmt.Sprintf("notifications/threads/%v", id)
-
- req, err := s.client.NewRequest("PATCH", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// GetThreadSubscription checks to see if the authenticated user is subscribed
-// to a thread.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription
-func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) {
- u := fmt.Sprintf("notifications/threads/%v/subscription", id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- sub := new(Subscription)
- resp, err := s.client.Do(ctx, req, sub)
- if err != nil {
- return nil, resp, err
- }
-
- return sub, resp, nil
-}
-
-// SetThreadSubscription sets the subscription for the specified thread for the
-// authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription
-func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) {
- u := fmt.Sprintf("notifications/threads/%v/subscription", id)
-
- req, err := s.client.NewRequest("PUT", u, subscription)
- if err != nil {
- return nil, nil, err
- }
-
- sub := new(Subscription)
- resp, err := s.client.Do(ctx, req, sub)
- if err != nil {
- return nil, resp, err
- }
-
- return sub, resp, nil
-}
-
-// DeleteThreadSubscription deletes the subscription for the specified thread
-// for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription
-func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) {
- u := fmt.Sprintf("notifications/threads/%v/subscription", id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/activity_star.go b/vendor/github.com/google/go-github/github/activity_star.go
deleted file mode 100644
index d5b06712..00000000
--- a/vendor/github.com/google/go-github/github/activity_star.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// StarredRepository is returned by ListStarred.
-type StarredRepository struct {
- StarredAt *Timestamp `json:"starred_at,omitempty"`
- Repository *Repository `json:"repo,omitempty"`
-}
-
-// Stargazer represents a user that has starred a repository.
-type Stargazer struct {
- StarredAt *Timestamp `json:"starred_at,omitempty"`
- User *User `json:"user,omitempty"`
-}
-
-// ListStargazers lists people who have starred the specified repo.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-stargazers
-func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Stargazer, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeStarringPreview)
-
- var stargazers []*Stargazer
- resp, err := s.client.Do(ctx, req, &stargazers)
- if err != nil {
- return nil, resp, err
- }
-
- return stargazers, resp, nil
-}
-
-// ActivityListStarredOptions specifies the optional parameters to the
-// ActivityService.ListStarred method.
-type ActivityListStarredOptions struct {
- // How to sort the repository list. Possible values are: created, updated,
- // pushed, full_name. Default is "full_name".
- Sort string `url:"sort,omitempty"`
-
- // Direction in which to sort repositories. Possible values are: asc, desc.
- // Default is "asc" when sort is "full_name", otherwise default is "desc".
- Direction string `url:"direction,omitempty"`
-
- ListOptions
-}
-
-// ListStarred lists all the repos starred by a user. Passing the empty string
-// will list the starred repositories for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
-func (s *ActivityService) ListStarred(ctx context.Context, user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/starred", user)
- } else {
- u = "user/starred"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeStarringPreview)
-
- var repos []*StarredRepository
- resp, err := s.client.Do(ctx, req, &repos)
- if err != nil {
- return nil, resp, err
- }
-
- return repos, resp, nil
-}
-
-// IsStarred checks if a repository is starred by authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository
-func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) {
- u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
- resp, err := s.client.Do(ctx, req, nil)
- starred, err := parseBoolResponse(err)
- return starred, resp, err
-}
-
-// Star a repository as the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/starring/#star-a-repository
-func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) {
- u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// Unstar a repository as the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/starring/#unstar-a-repository
-func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) {
- u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/activity_watching.go b/vendor/github.com/google/go-github/github/activity_watching.go
deleted file mode 100644
index c749ca86..00000000
--- a/vendor/github.com/google/go-github/github/activity_watching.go
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Subscription identifies a repository or thread subscription.
-type Subscription struct {
- Subscribed *bool `json:"subscribed,omitempty"`
- Ignored *bool `json:"ignored,omitempty"`
- Reason *string `json:"reason,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- URL *string `json:"url,omitempty"`
-
- // only populated for repository subscriptions
- RepositoryURL *string `json:"repository_url,omitempty"`
-
- // only populated for thread subscriptions
- ThreadURL *string `json:"thread_url,omitempty"`
-}
-
-// ListWatchers lists watchers of a particular repo.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/watching/#list-watchers
-func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var watchers []*User
- resp, err := s.client.Do(ctx, req, &watchers)
- if err != nil {
- return nil, resp, err
- }
-
- return watchers, resp, nil
-}
-
-// ListWatched lists the repositories the specified user is watching. Passing
-// the empty string will fetch watched repos for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
-func (s *ActivityService) ListWatched(ctx context.Context, user string, opt *ListOptions) ([]*Repository, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/subscriptions", user)
- } else {
- u = "user/subscriptions"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var watched []*Repository
- resp, err := s.client.Do(ctx, req, &watched)
- if err != nil {
- return nil, resp, err
- }
-
- return watched, resp, nil
-}
-
-// GetRepositorySubscription returns the subscription for the specified
-// repository for the authenticated user. If the authenticated user is not
-// watching the repository, a nil Subscription is returned.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/watching/#get-a-repository-subscription
-func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- sub := new(Subscription)
- resp, err := s.client.Do(ctx, req, sub)
- if err != nil {
- // if it's just a 404, don't return that as an error
- _, err = parseBoolResponse(err)
- return nil, resp, err
- }
-
- return sub, resp, nil
-}
-
-// SetRepositorySubscription sets the subscription for the specified repository
-// for the authenticated user.
-//
-// To watch a repository, set subscription.Subscribed to true.
-// To ignore notifications made within a repository, set subscription.Ignored to true.
-// To stop watching a repository, use DeleteRepositorySubscription.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/watching/#set-a-repository-subscription
-func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
-
- req, err := s.client.NewRequest("PUT", u, subscription)
- if err != nil {
- return nil, nil, err
- }
-
- sub := new(Subscription)
- resp, err := s.client.Do(ctx, req, sub)
- if err != nil {
- return nil, resp, err
- }
-
- return sub, resp, nil
-}
-
-// DeleteRepositorySubscription deletes the subscription for the specified
-// repository for the authenticated user.
-//
-// This is used to stop watching a repository. To control whether or not to
-// receive notifications from a repository, use SetRepositorySubscription.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription
-func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) {
- u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/admin.go b/vendor/github.com/google/go-github/github/admin.go
deleted file mode 100644
index 2d96733a..00000000
--- a/vendor/github.com/google/go-github/github/admin.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// AdminService handles communication with the admin related methods of the
-// GitHub API. These API routes are normally only accessible for GitHub
-// Enterprise installations.
-//
-// GitHub API docs: https://developer.github.com/v3/enterprise/
-type AdminService service
-
-// TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group.
-type TeamLDAPMapping struct {
- ID *int64 `json:"id,omitempty"`
- LDAPDN *string `json:"ldap_dn,omitempty"`
- URL *string `json:"url,omitempty"`
- Name *string `json:"name,omitempty"`
- Slug *string `json:"slug,omitempty"`
- Description *string `json:"description,omitempty"`
- Privacy *string `json:"privacy,omitempty"`
- Permission *string `json:"permission,omitempty"`
-
- MembersURL *string `json:"members_url,omitempty"`
- RepositoriesURL *string `json:"repositories_url,omitempty"`
-}
-
-func (m TeamLDAPMapping) String() string {
- return Stringify(m)
-}
-
-// UserLDAPMapping represents the mapping between a GitHub user and an LDAP user.
-type UserLDAPMapping struct {
- ID *int64 `json:"id,omitempty"`
- LDAPDN *string `json:"ldap_dn,omitempty"`
- Login *string `json:"login,omitempty"`
- AvatarURL *string `json:"avatar_url,omitempty"`
- GravatarID *string `json:"gravatar_id,omitempty"`
- Type *string `json:"type,omitempty"`
- SiteAdmin *bool `json:"site_admin,omitempty"`
-
- URL *string `json:"url,omitempty"`
- EventsURL *string `json:"events_url,omitempty"`
- FollowingURL *string `json:"following_url,omitempty"`
- FollowersURL *string `json:"followers_url,omitempty"`
- GistsURL *string `json:"gists_url,omitempty"`
- OrganizationsURL *string `json:"organizations_url,omitempty"`
- ReceivedEventsURL *string `json:"received_events_url,omitempty"`
- ReposURL *string `json:"repos_url,omitempty"`
- StarredURL *string `json:"starred_url,omitempty"`
- SubscriptionsURL *string `json:"subscriptions_url,omitempty"`
-}
-
-func (m UserLDAPMapping) String() string {
- return Stringify(m)
-}
-
-// UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user.
-//
-// GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user
-func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) {
- u := fmt.Sprintf("admin/ldap/users/%v/mapping", user)
- req, err := s.client.NewRequest("PATCH", u, mapping)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(UserLDAPMapping)
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group.
-//
-// GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team
-func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) {
- u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team)
- req, err := s.client.NewRequest("PATCH", u, mapping)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(TeamLDAPMapping)
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/admin_stats.go b/vendor/github.com/google/go-github/github/admin_stats.go
deleted file mode 100644
index 1550d250..00000000
--- a/vendor/github.com/google/go-github/github/admin_stats.go
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// AdminStats represents a variety of stats of a Github Enterprise
-// installation.
-type AdminStats struct {
- Issues *IssueStats `json:"issues,omitempty"`
- Hooks *HookStats `json:"hooks,omitempty"`
- Milestones *MilestoneStats `json:"milestones,omitempty"`
- Orgs *OrgStats `json:"orgs,omitempty"`
- Comments *CommentStats `json:"comments,omitempty"`
- Pages *PageStats `json:"pages,omitempty"`
- Users *UserStats `json:"users,omitempty"`
- Gists *GistStats `json:"gists,omitempty"`
- Pulls *PullStats `json:"pulls,omitempty"`
- Repos *RepoStats `json:"repos,omitempty"`
-}
-
-func (s AdminStats) String() string {
- return Stringify(s)
-}
-
-// IssueStats represents the number of total, open and closed issues.
-type IssueStats struct {
- TotalIssues *int `json:"total_issues,omitempty"`
- OpenIssues *int `json:"open_issues,omitempty"`
- ClosedIssues *int `json:"closed_issues,omitempty"`
-}
-
-func (s IssueStats) String() string {
- return Stringify(s)
-}
-
-// HookStats represents the number of total, active and inactive hooks.
-type HookStats struct {
- TotalHooks *int `json:"total_hooks,omitempty"`
- ActiveHooks *int `json:"active_hooks,omitempty"`
- InactiveHooks *int `json:"inactive_hooks,omitempty"`
-}
-
-func (s HookStats) String() string {
- return Stringify(s)
-}
-
-// MilestoneStats represents the number of total, open and close milestones.
-type MilestoneStats struct {
- TotalMilestones *int `json:"total_milestones,omitempty"`
- OpenMilestones *int `json:"open_milestones,omitempty"`
- ClosedMilestones *int `json:"closed_milestones,omitempty"`
-}
-
-func (s MilestoneStats) String() string {
- return Stringify(s)
-}
-
-// OrgStats represents the number of total, disabled organizations and the team
-// and team member count.
-type OrgStats struct {
- TotalOrgs *int `json:"total_orgs,omitempty"`
- DisabledOrgs *int `json:"disabled_orgs,omitempty"`
- TotalTeams *int `json:"total_teams,omitempty"`
- TotalTeamMembers *int `json:"total_team_members,omitempty"`
-}
-
-func (s OrgStats) String() string {
- return Stringify(s)
-}
-
-// CommentStats represents the number of total comments on commits, gists, issues
-// and pull requests.
-type CommentStats struct {
- TotalCommitComments *int `json:"total_commit_comments,omitempty"`
- TotalGistComments *int `json:"total_gist_comments,omitempty"`
- TotalIssueComments *int `json:"total_issue_comments,omitempty"`
- TotalPullRequestComments *int `json:"total_pull_request_comments,omitempty"`
-}
-
-func (s CommentStats) String() string {
- return Stringify(s)
-}
-
-// PageStats represents the total number of github pages.
-type PageStats struct {
- TotalPages *int `json:"total_pages,omitempty"`
-}
-
-func (s PageStats) String() string {
- return Stringify(s)
-}
-
-// UserStats represents the number of total, admin and suspended users.
-type UserStats struct {
- TotalUsers *int `json:"total_users,omitempty"`
- AdminUsers *int `json:"admin_users,omitempty"`
- SuspendedUsers *int `json:"suspended_users,omitempty"`
-}
-
-func (s UserStats) String() string {
- return Stringify(s)
-}
-
-//GistStats represents the number of total, private and public gists.
-type GistStats struct {
- TotalGists *int `json:"total_gists,omitempty"`
- PrivateGists *int `json:"private_gists,omitempty"`
- PublicGists *int `json:"public_gists,omitempty"`
-}
-
-func (s GistStats) String() string {
- return Stringify(s)
-}
-
-// PullStats represents the number of total, merged, mergable and unmergeable
-// pull-requests.
-type PullStats struct {
- TotalPulls *int `json:"total_pulls,omitempty"`
- MergedPulls *int `json:"merged_pulls,omitempty"`
- MergablePulls *int `json:"mergeable_pulls,omitempty"`
- UnmergablePulls *int `json:"unmergeable_pulls,omitempty"`
-}
-
-func (s PullStats) String() string {
- return Stringify(s)
-}
-
-// RepoStats represents the number of total, root, fork, organization repositories
-// together with the total number of pushes and wikis.
-type RepoStats struct {
- TotalRepos *int `json:"total_repos,omitempty"`
- RootRepos *int `json:"root_repos,omitempty"`
- ForkRepos *int `json:"fork_repos,omitempty"`
- OrgRepos *int `json:"org_repos,omitempty"`
- TotalPushes *int `json:"total_pushes,omitempty"`
- TotalWikis *int `json:"total_wikis,omitempty"`
-}
-
-func (s RepoStats) String() string {
- return Stringify(s)
-}
-
-// GetAdminStats returns a variety of metrics about a Github Enterprise
-// installation.
-//
-// Please note that this is only available to site administrators,
-// otherwise it will error with a 404 not found (instead of 401 or 403).
-//
-// GitHub API docs: https://developer.github.com/v3/enterprise-admin/admin_stats/
-func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) {
- u := fmt.Sprintf("enterprise/stats/all")
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(AdminStats)
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/apps.go b/vendor/github.com/google/go-github/github/apps.go
deleted file mode 100644
index 740642e6..00000000
--- a/vendor/github.com/google/go-github/github/apps.go
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// AppsService provides access to the installation related functions
-// in the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/
-type AppsService service
-
-// App represents a GitHub App.
-type App struct {
- ID *int64 `json:"id,omitempty"`
- Owner *User `json:"owner,omitempty"`
- Name *string `json:"name,omitempty"`
- Description *string `json:"description,omitempty"`
- ExternalURL *string `json:"external_url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
-}
-
-// InstallationToken represents an installation token.
-type InstallationToken struct {
- Token *string `json:"token,omitempty"`
- ExpiresAt *time.Time `json:"expires_at,omitempty"`
-}
-
-// Get a single GitHub App. Passing the empty string will get
-// the authenticated GitHub App.
-//
-// Note: appSlug is just the URL-friendly name of your GitHub App.
-// You can find this on the settings page for your GitHub App
-// (e.g., https://github.com/settings/apps/:app_slug).
-//
-// GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-github-app
-func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, error) {
- var u string
- if appSlug != "" {
- u = fmt.Sprintf("apps/%v", appSlug)
- } else {
- u = "app"
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- app := new(App)
- resp, err := s.client.Do(ctx, req, app)
- if err != nil {
- return nil, resp, err
- }
-
- return app, resp, nil
-}
-
-// ListInstallations lists the installations that the current GitHub App has.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/#find-installations
-func (s *AppsService) ListInstallations(ctx context.Context, opt *ListOptions) ([]*Installation, *Response, error) {
- u, err := addOptions("app/installations", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- var i []*Installation
- resp, err := s.client.Do(ctx, req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, nil
-}
-
-// GetInstallation returns the specified installation.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-installation
-func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) {
- u := fmt.Sprintf("app/installations/%v", id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- i := new(Installation)
- resp, err := s.client.Do(ctx, req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, nil
-}
-
-// ListUserInstallations lists installations that are accessible to the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/#list-installations-for-user
-func (s *AppsService) ListUserInstallations(ctx context.Context, opt *ListOptions) ([]*Installation, *Response, error) {
- u, err := addOptions("user/installations", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- var i struct {
- Installations []*Installation `json:"installations"`
- }
- resp, err := s.client.Do(ctx, req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i.Installations, resp, nil
-}
-
-// CreateInstallationToken creates a new installation token.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/#create-a-new-installation-token
-func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64) (*InstallationToken, *Response, error) {
- u := fmt.Sprintf("installations/%v/access_tokens", id)
-
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- t := new(InstallationToken)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/apps_installation.go b/vendor/github.com/google/go-github/github/apps_installation.go
deleted file mode 100644
index af85cb87..00000000
--- a/vendor/github.com/google/go-github/github/apps_installation.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Installation represents a GitHub Apps installation.
-type Installation struct {
- ID *int64 `json:"id,omitempty"`
- Account *User `json:"account,omitempty"`
- AccessTokensURL *string `json:"access_tokens_url,omitempty"`
- RepositoriesURL *string `json:"repositories_url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
-}
-
-func (i Installation) String() string {
- return Stringify(i)
-}
-
-// ListRepos lists the repositories that are accessible to the authenticated installation.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories
-func (s *AppsService) ListRepos(ctx context.Context, opt *ListOptions) ([]*Repository, *Response, error) {
- u, err := addOptions("installation/repositories", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- var r struct {
- Repositories []*Repository `json:"repositories"`
- }
- resp, err := s.client.Do(ctx, req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r.Repositories, resp, nil
-}
-
-// ListUserRepos lists repositories that are accessible
-// to the authenticated user for an installation.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation
-func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opt *ListOptions) ([]*Repository, *Response, error) {
- u := fmt.Sprintf("user/installations/%v/repositories", id)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIntegrationPreview)
-
- var r struct {
- Repositories []*Repository `json:"repositories"`
- }
- resp, err := s.client.Do(ctx, req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r.Repositories, resp, nil
-}
-
-// AddRepository adds a single repository to an installation.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/installations/#add-repository-to-installation
-func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) {
- u := fmt.Sprintf("apps/installations/%v/repositories/%v", instID, repoID)
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Repository)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// RemoveRepository removes a single repository from an installation.
-//
-// GitHub docs: https://developer.github.com/v3/apps/installations/#remove-repository-from-installation
-func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) {
- u := fmt.Sprintf("apps/installations/%v/repositories/%v", instID, repoID)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/apps_marketplace.go b/vendor/github.com/google/go-github/github/apps_marketplace.go
deleted file mode 100644
index 089cdbf7..00000000
--- a/vendor/github.com/google/go-github/github/apps_marketplace.go
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// MarketplaceService handles communication with the marketplace related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/marketplace/
-type MarketplaceService struct {
- client *Client
- // Stubbed controls whether endpoints that return stubbed data are used
- // instead of production endpoints. Stubbed data is fake data that's useful
- // for testing your GitHub Apps. Stubbed data is hard-coded and will not
- // change based on actual subscriptions.
- //
- // GitHub API docs: https://developer.github.com/v3/apps/marketplace/
- Stubbed bool
-}
-
-// MarketplacePlan represents a GitHub Apps Marketplace Listing Plan.
-type MarketplacePlan struct {
- URL *string `json:"url,omitempty"`
- AccountsURL *string `json:"accounts_url,omitempty"`
- ID *int64 `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Description *string `json:"description,omitempty"`
- MonthlyPriceInCents *int `json:"monthly_price_in_cents,omitempty"`
- YearlyPriceInCents *int `json:"yearly_price_in_cents,omitempty"`
- PriceModel *string `json:"price_model,omitempty"`
- UnitName *string `json:"unit_name,omitempty"`
- Bullets *[]string `json:"bullets,omitempty"`
-}
-
-// MarketplacePurchase represents a GitHub Apps Marketplace Purchase.
-type MarketplacePurchase struct {
- BillingCycle *string `json:"billing_cycle,omitempty"`
- NextBillingDate *string `json:"next_billing_date,omitempty"`
- UnitCount *int `json:"unit_count,omitempty"`
- Plan *MarketplacePlan `json:"plan,omitempty"`
- Account *MarketplacePlanAccount `json:"account,omitempty"`
-}
-
-// MarketplacePlanAccount represents a GitHub Account (user or organization) on a specific plan.
-type MarketplacePlanAccount struct {
- URL *string `json:"url,omitempty"`
- Type *string `json:"type,omitempty"`
- ID *int64 `json:"id,omitempty"`
- Login *string `json:"login,omitempty"`
- Email *string `json:"email,omitempty"`
- OrganizationBillingEmail *string `json:"organization_billing_email,omitempty"`
- MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"`
-}
-
-// ListPlans lists all plans for your Marketplace listing.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#list-all-plans-for-your-marketplace-listing
-func (s *MarketplaceService) ListPlans(ctx context.Context, opt *ListOptions) ([]*MarketplacePlan, *Response, error) {
- uri := s.marketplaceURI("plans")
- u, err := addOptions(uri, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMarketplacePreview)
-
- var plans []*MarketplacePlan
- resp, err := s.client.Do(ctx, req, &plans)
- if err != nil {
- return nil, resp, err
- }
-
- return plans, resp, nil
-}
-
-// ListPlanAccountsForPlan lists all GitHub accounts (user or organization) on a specific plan.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#list-all-github-accounts-user-or-organization-on-a-specific-plan
-func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID int64, opt *ListOptions) ([]*MarketplacePlanAccount, *Response, error) {
- uri := s.marketplaceURI(fmt.Sprintf("plans/%v/accounts", planID))
- u, err := addOptions(uri, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMarketplacePreview)
-
- var accounts []*MarketplacePlanAccount
- resp, err := s.client.Do(ctx, req, &accounts)
- if err != nil {
- return nil, resp, err
- }
-
- return accounts, resp, nil
-}
-
-// ListPlanAccountsForAccount lists all GitHub accounts (user or organization) associated with an account.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#check-if-a-github-account-is-associated-with-any-marketplace-listing
-func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, accountID int64, opt *ListOptions) ([]*MarketplacePlanAccount, *Response, error) {
- uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID))
- u, err := addOptions(uri, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMarketplacePreview)
-
- var accounts []*MarketplacePlanAccount
- resp, err := s.client.Do(ctx, req, &accounts)
- if err != nil {
- return nil, resp, err
- }
-
- return accounts, resp, nil
-}
-
-// ListMarketplacePurchasesForUser lists all GitHub marketplace purchases made by a user.
-//
-// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#get-a-users-marketplace-purchases
-func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context, opt *ListOptions) ([]*MarketplacePurchase, *Response, error) {
- uri := "user/marketplace_purchases"
- if s.Stubbed {
- uri = "user/marketplace_purchases/stubbed"
- }
-
- u, err := addOptions(uri, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMarketplacePreview)
-
- var purchases []*MarketplacePurchase
- resp, err := s.client.Do(ctx, req, &purchases)
- if err != nil {
- return nil, resp, err
- }
-
- return purchases, resp, nil
-}
-
-func (s *MarketplaceService) marketplaceURI(endpoint string) string {
- url := "marketplace_listing"
- if s.Stubbed {
- url = "marketplace_listing/stubbed"
- }
- return url + "/" + endpoint
-}
diff --git a/vendor/github.com/google/go-github/github/authorizations.go b/vendor/github.com/google/go-github/github/authorizations.go
deleted file mode 100644
index 190205b0..00000000
--- a/vendor/github.com/google/go-github/github/authorizations.go
+++ /dev/null
@@ -1,435 +0,0 @@
-// Copyright 2015 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Scope models a GitHub authorization scope.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth/#scopes
-type Scope string
-
-// This is the set of scopes for GitHub API V3
-const (
- ScopeNone Scope = "(no scope)" // REVISIT: is this actually returned, or just a documentation artifact?
- ScopeUser Scope = "user"
- ScopeUserEmail Scope = "user:email"
- ScopeUserFollow Scope = "user:follow"
- ScopePublicRepo Scope = "public_repo"
- ScopeRepo Scope = "repo"
- ScopeRepoDeployment Scope = "repo_deployment"
- ScopeRepoStatus Scope = "repo:status"
- ScopeDeleteRepo Scope = "delete_repo"
- ScopeNotifications Scope = "notifications"
- ScopeGist Scope = "gist"
- ScopeReadRepoHook Scope = "read:repo_hook"
- ScopeWriteRepoHook Scope = "write:repo_hook"
- ScopeAdminRepoHook Scope = "admin:repo_hook"
- ScopeAdminOrgHook Scope = "admin:org_hook"
- ScopeReadOrg Scope = "read:org"
- ScopeWriteOrg Scope = "write:org"
- ScopeAdminOrg Scope = "admin:org"
- ScopeReadPublicKey Scope = "read:public_key"
- ScopeWritePublicKey Scope = "write:public_key"
- ScopeAdminPublicKey Scope = "admin:public_key"
- ScopeReadGPGKey Scope = "read:gpg_key"
- ScopeWriteGPGKey Scope = "write:gpg_key"
- ScopeAdminGPGKey Scope = "admin:gpg_key"
-)
-
-// AuthorizationsService handles communication with the authorization related
-// methods of the GitHub API.
-//
-// This service requires HTTP Basic Authentication; it cannot be accessed using
-// an OAuth token.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/
-type AuthorizationsService service
-
-// Authorization represents an individual GitHub authorization.
-type Authorization struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- Scopes []Scope `json:"scopes,omitempty"`
- Token *string `json:"token,omitempty"`
- TokenLastEight *string `json:"token_last_eight,omitempty"`
- HashedToken *string `json:"hashed_token,omitempty"`
- App *AuthorizationApp `json:"app,omitempty"`
- Note *string `json:"note,omitempty"`
- NoteURL *string `json:"note_url,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- Fingerprint *string `json:"fingerprint,omitempty"`
-
- // User is only populated by the Check and Reset methods.
- User *User `json:"user,omitempty"`
-}
-
-func (a Authorization) String() string {
- return Stringify(a)
-}
-
-// AuthorizationApp represents an individual GitHub app (in the context of authorization).
-type AuthorizationApp struct {
- URL *string `json:"url,omitempty"`
- Name *string `json:"name,omitempty"`
- ClientID *string `json:"client_id,omitempty"`
-}
-
-func (a AuthorizationApp) String() string {
- return Stringify(a)
-}
-
-// Grant represents an OAuth application that has been granted access to an account.
-type Grant struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- App *AuthorizationApp `json:"app,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- Scopes []string `json:"scopes,omitempty"`
-}
-
-func (g Grant) String() string {
- return Stringify(g)
-}
-
-// AuthorizationRequest represents a request to create an authorization.
-type AuthorizationRequest struct {
- Scopes []Scope `json:"scopes,omitempty"`
- Note *string `json:"note,omitempty"`
- NoteURL *string `json:"note_url,omitempty"`
- ClientID *string `json:"client_id,omitempty"`
- ClientSecret *string `json:"client_secret,omitempty"`
- Fingerprint *string `json:"fingerprint,omitempty"`
-}
-
-func (a AuthorizationRequest) String() string {
- return Stringify(a)
-}
-
-// AuthorizationUpdateRequest represents a request to update an authorization.
-//
-// Note that for any one update, you must only provide one of the "scopes"
-// fields. That is, you may provide only one of "Scopes", or "AddScopes", or
-// "RemoveScopes".
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization
-type AuthorizationUpdateRequest struct {
- Scopes []string `json:"scopes,omitempty"`
- AddScopes []string `json:"add_scopes,omitempty"`
- RemoveScopes []string `json:"remove_scopes,omitempty"`
- Note *string `json:"note,omitempty"`
- NoteURL *string `json:"note_url,omitempty"`
- Fingerprint *string `json:"fingerprint,omitempty"`
-}
-
-func (a AuthorizationUpdateRequest) String() string {
- return Stringify(a)
-}
-
-// List the authorizations for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations
-func (s *AuthorizationsService) List(ctx context.Context, opt *ListOptions) ([]*Authorization, *Response, error) {
- u := "authorizations"
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var auths []*Authorization
- resp, err := s.client.Do(ctx, req, &auths)
- if err != nil {
- return nil, resp, err
- }
- return auths, resp, nil
-}
-
-// Get a single authorization.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-authorization
-func (s *AuthorizationsService) Get(ctx context.Context, id int64) (*Authorization, *Response, error) {
- u := fmt.Sprintf("authorizations/%d", id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(Authorization)
- resp, err := s.client.Do(ctx, req, a)
- if err != nil {
- return nil, resp, err
- }
- return a, resp, nil
-}
-
-// Create a new authorization for the specified OAuth application.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
-func (s *AuthorizationsService) Create(ctx context.Context, auth *AuthorizationRequest) (*Authorization, *Response, error) {
- u := "authorizations"
-
- req, err := s.client.NewRequest("POST", u, auth)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(Authorization)
- resp, err := s.client.Do(ctx, req, a)
- if err != nil {
- return nil, resp, err
- }
- return a, resp, nil
-}
-
-// GetOrCreateForApp creates a new authorization for the specified OAuth
-// application, only if an authorization for that application doesn’t already
-// exist for the user.
-//
-// If a new token is created, the HTTP status code will be "201 Created", and
-// the returned Authorization.Token field will be populated. If an existing
-// token is returned, the status code will be "200 OK" and the
-// Authorization.Token field will be empty.
-//
-// clientID is the OAuth Client ID with which to create the token.
-//
-// GitHub API docs:
-// https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app
-// https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app-and-fingerprint
-func (s *AuthorizationsService) GetOrCreateForApp(ctx context.Context, clientID string, auth *AuthorizationRequest) (*Authorization, *Response, error) {
- var u string
- if auth.Fingerprint == nil || *auth.Fingerprint == "" {
- u = fmt.Sprintf("authorizations/clients/%v", clientID)
- } else {
- u = fmt.Sprintf("authorizations/clients/%v/%v", clientID, *auth.Fingerprint)
- }
-
- req, err := s.client.NewRequest("PUT", u, auth)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(Authorization)
- resp, err := s.client.Do(ctx, req, a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, nil
-}
-
-// Edit a single authorization.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization
-func (s *AuthorizationsService) Edit(ctx context.Context, id int64, auth *AuthorizationUpdateRequest) (*Authorization, *Response, error) {
- u := fmt.Sprintf("authorizations/%d", id)
-
- req, err := s.client.NewRequest("PATCH", u, auth)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(Authorization)
- resp, err := s.client.Do(ctx, req, a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, nil
-}
-
-// Delete a single authorization.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization
-func (s *AuthorizationsService) Delete(ctx context.Context, id int64) (*Response, error) {
- u := fmt.Sprintf("authorizations/%d", id)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// Check if an OAuth token is valid for a specific app.
-//
-// Note that this operation requires the use of BasicAuth, but where the
-// username is the OAuth application clientID, and the password is its
-// clientSecret. Invalid tokens will return a 404 Not Found.
-//
-// The returned Authorization.User field will be populated.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#check-an-authorization
-func (s *AuthorizationsService) Check(ctx context.Context, clientID string, token string) (*Authorization, *Response, error) {
- u := fmt.Sprintf("applications/%v/tokens/%v", clientID, token)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(Authorization)
- resp, err := s.client.Do(ctx, req, a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, nil
-}
-
-// Reset is used to reset a valid OAuth token without end user involvement.
-// Applications must save the "token" property in the response, because changes
-// take effect immediately.
-//
-// Note that this operation requires the use of BasicAuth, but where the
-// username is the OAuth application clientID, and the password is its
-// clientSecret. Invalid tokens will return a 404 Not Found.
-//
-// The returned Authorization.User field will be populated.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization
-func (s *AuthorizationsService) Reset(ctx context.Context, clientID string, token string) (*Authorization, *Response, error) {
- u := fmt.Sprintf("applications/%v/tokens/%v", clientID, token)
-
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(Authorization)
- resp, err := s.client.Do(ctx, req, a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, nil
-}
-
-// Revoke an authorization for an application.
-//
-// Note that this operation requires the use of BasicAuth, but where the
-// username is the OAuth application clientID, and the password is its
-// clientSecret. Invalid tokens will return a 404 Not Found.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application
-func (s *AuthorizationsService) Revoke(ctx context.Context, clientID string, token string) (*Response, error) {
- u := fmt.Sprintf("applications/%v/tokens/%v", clientID, token)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ListGrants lists the set of OAuth applications that have been granted
-// access to a user's account. This will return one entry for each application
-// that has been granted access to the account, regardless of the number of
-// tokens an application has generated for the user.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-grants
-func (s *AuthorizationsService) ListGrants(ctx context.Context, opt *ListOptions) ([]*Grant, *Response, error) {
- u, err := addOptions("applications/grants", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- grants := []*Grant{}
- resp, err := s.client.Do(ctx, req, &grants)
- if err != nil {
- return nil, resp, err
- }
-
- return grants, resp, nil
-}
-
-// GetGrant gets a single OAuth application grant.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-grant
-func (s *AuthorizationsService) GetGrant(ctx context.Context, id int64) (*Grant, *Response, error) {
- u := fmt.Sprintf("applications/grants/%d", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- grant := new(Grant)
- resp, err := s.client.Do(ctx, req, grant)
- if err != nil {
- return nil, resp, err
- }
-
- return grant, resp, nil
-}
-
-// DeleteGrant deletes an OAuth application grant. Deleting an application's
-// grant will also delete all OAuth tokens associated with the application for
-// the user.
-//
-// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-a-grant
-func (s *AuthorizationsService) DeleteGrant(ctx context.Context, id int64) (*Response, error) {
- u := fmt.Sprintf("applications/grants/%d", id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// CreateImpersonation creates an impersonation OAuth token.
-//
-// This requires admin permissions. With the returned Authorization.Token
-// you can e.g. create or delete a user's public SSH key. NOTE: creating a
-// new token automatically revokes an existing one.
-//
-// GitHub API docs: https://developer.github.com/enterprise/2.5/v3/users/administration/#create-an-impersonation-oauth-token
-func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) {
- u := fmt.Sprintf("admin/users/%v/authorizations", username)
- req, err := s.client.NewRequest("POST", u, authReq)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(Authorization)
- resp, err := s.client.Do(ctx, req, a)
- if err != nil {
- return nil, resp, err
- }
- return a, resp, nil
-}
-
-// DeleteImpersonation deletes an impersonation OAuth token.
-//
-// NOTE: there can be only one at a time.
-//
-// GitHub API docs: https://developer.github.com/enterprise/2.5/v3/users/administration/#delete-an-impersonation-oauth-token
-func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) {
- u := fmt.Sprintf("admin/users/%v/authorizations", username)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/doc.go b/vendor/github.com/google/go-github/github/doc.go
deleted file mode 100644
index 4ba03cb3..00000000
--- a/vendor/github.com/google/go-github/github/doc.go
+++ /dev/null
@@ -1,191 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package github provides a client for using the GitHub API.
-
-Usage:
-
- import "github.com/google/go-github/github"
-
-Construct a new GitHub client, then use the various services on the client to
-access different parts of the GitHub API. For example:
-
- client := github.NewClient(nil)
-
- // list all organizations for user "willnorris"
- orgs, _, err := client.Organizations.List(ctx, "willnorris", nil)
-
-Some API methods have optional parameters that can be passed. For example:
-
- client := github.NewClient(nil)
-
- // list public repositories for org "github"
- opt := &github.RepositoryListByOrgOptions{Type: "public"}
- repos, _, err := client.Repositories.ListByOrg(ctx, "github", opt)
-
-The services of a client divide the API into logical chunks and correspond to
-the structure of the GitHub API documentation at
-https://developer.github.com/v3/.
-
-Authentication
-
-The go-github library does not directly handle authentication. Instead, when
-creating a new client, pass an http.Client that can handle authentication for
-you. The easiest and recommended way to do this is using the golang.org/x/oauth2
-library, but you can always use any other library that provides an http.Client.
-If you have an OAuth2 access token (for example, a personal API token), you can
-use it with the oauth2 library using:
-
- import "golang.org/x/oauth2"
-
- func main() {
- ctx := context.Background()
- ts := oauth2.StaticTokenSource(
- &oauth2.Token{AccessToken: "... your access token ..."},
- )
- tc := oauth2.NewClient(ctx, ts)
-
- client := github.NewClient(tc)
-
- // list all repositories for the authenticated user
- repos, _, err := client.Repositories.List(ctx, "", nil)
- }
-
-Note that when using an authenticated Client, all calls made by the client will
-include the specified OAuth token. Therefore, authenticated clients should
-almost never be shared between different users.
-
-See the oauth2 docs for complete instructions on using that library.
-
-For API methods that require HTTP Basic Authentication, use the
-BasicAuthTransport.
-
-GitHub Apps authentication can be provided by the
-https://github.com/bradleyfalzon/ghinstallation package.
-
- import "github.com/bradleyfalzon/ghinstallation"
-
- func main() {
- // Wrap the shared transport for use with the integration ID 1 authenticating with installation ID 99.
- itr, err := ghinstallation.NewKeyFromFile(http.DefaultTransport, 1, 99, "2016-10-19.private-key.pem")
- if err != nil {
- // Handle error.
- }
-
- // Use installation transport with client
- client := github.NewClient(&http.Client{Transport: itr})
-
- // Use client...
- }
-
-Rate Limiting
-
-GitHub imposes a rate limit on all API clients. Unauthenticated clients are
-limited to 60 requests per hour, while authenticated clients can make up to
-5,000 requests per hour. The Search API has a custom rate limit. Unauthenticated
-clients are limited to 10 requests per minute, while authenticated clients
-can make up to 30 requests per minute. To receive the higher rate limit when
-making calls that are not issued on behalf of a user,
-use UnauthenticatedRateLimitedTransport.
-
-The returned Response.Rate value contains the rate limit information
-from the most recent API call. If a recent enough response isn't
-available, you can use RateLimits to fetch the most up-to-date rate
-limit data for the client.
-
-To detect an API rate limit error, you can check if its type is *github.RateLimitError:
-
- repos, _, err := client.Repositories.List(ctx, "", nil)
- if _, ok := err.(*github.RateLimitError); ok {
- log.Println("hit rate limit")
- }
-
-Learn more about GitHub rate limiting at
-https://developer.github.com/v3/#rate-limiting.
-
-Accepted Status
-
-Some endpoints may return a 202 Accepted status code, meaning that the
-information required is not yet ready and was scheduled to be gathered on
-the GitHub side. Methods known to behave like this are documented specifying
-this behavior.
-
-To detect this condition of error, you can check if its type is
-*github.AcceptedError:
-
- stats, _, err := client.Repositories.ListContributorsStats(ctx, org, repo)
- if _, ok := err.(*github.AcceptedError); ok {
- log.Println("scheduled on GitHub side")
- }
-
-Conditional Requests
-
-The GitHub API has good support for conditional requests which will help
-prevent you from burning through your rate limit, as well as help speed up your
-application. go-github does not handle conditional requests directly, but is
-instead designed to work with a caching http.Transport. We recommend using
-https://github.com/gregjones/httpcache for that.
-
-Learn more about GitHub conditional requests at
-https://developer.github.com/v3/#conditional-requests.
-
-Creating and Updating Resources
-
-All structs for GitHub resources use pointer values for all non-repeated fields.
-This allows distinguishing between unset fields and those set to a zero-value.
-Helper functions have been provided to easily create these pointers for string,
-bool, and int values. For example:
-
- // create a new private repository named "foo"
- repo := &github.Repository{
- Name: github.String("foo"),
- Private: github.Bool(true),
- }
- client.Repositories.Create(ctx, "", repo)
-
-Users who have worked with protocol buffers should find this pattern familiar.
-
-Pagination
-
-All requests for resource collections (repos, pull requests, issues, etc.)
-support pagination. Pagination options are described in the
-github.ListOptions struct and passed to the list methods directly or as an
-embedded type of a more specific list options struct (for example
-github.PullRequestListOptions). Pages information is available via the
-github.Response struct.
-
- client := github.NewClient(nil)
-
- opt := &github.RepositoryListByOrgOptions{
- ListOptions: github.ListOptions{PerPage: 10},
- }
- // get all pages of results
- var allRepos []*github.Repository
- for {
- repos, resp, err := client.Repositories.ListByOrg(ctx, "github", opt)
- if err != nil {
- return err
- }
- allRepos = append(allRepos, repos...)
- if resp.NextPage == 0 {
- break
- }
- opt.Page = resp.NextPage
- }
-
-Google App Engine
-
-Go on App Engine Classic (which as of this writing uses Go 1.6) can not use
-the "context" import and still relies on "golang.org/x/net/context".
-As a result, if you wish to continue to use "go-github" on App Engine Classic,
-you will need to rewrite all the "context" imports using the following command:
-
- gofmt -w -r '"context" -> "golang.org/x/net/context"' *.go
-
-See "with_appengine.go" for more details.
-
-*/
-package github
diff --git a/vendor/github.com/google/go-github/github/event_types.go b/vendor/github.com/google/go-github/github/event_types.go
deleted file mode 100644
index 046ba513..00000000
--- a/vendor/github.com/google/go-github/github/event_types.go
+++ /dev/null
@@ -1,748 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// These event types are shared between the Events API and used as Webhook payloads.
-
-package github
-
-// CommitCommentEvent is triggered when a commit comment is created.
-// The Webhook event name is "commit_comment".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#commitcommentevent
-type CommitCommentEvent struct {
- Comment *RepositoryComment `json:"comment,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Action *string `json:"action,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// CreateEvent represents a created repository, branch, or tag.
-// The Webhook event name is "create".
-//
-// Note: webhooks will not receive this event for created repositories.
-// Additionally, webhooks will not receive this event for tags if more
-// than three tags are pushed at once.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#createevent
-type CreateEvent struct {
- Ref *string `json:"ref,omitempty"`
- // RefType is the object that was created. Possible values are: "repository", "branch", "tag".
- RefType *string `json:"ref_type,omitempty"`
- MasterBranch *string `json:"master_branch,omitempty"`
- Description *string `json:"description,omitempty"`
-
- // The following fields are only populated by Webhook events.
- PusherType *string `json:"pusher_type,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// DeleteEvent represents a deleted branch or tag.
-// The Webhook event name is "delete".
-//
-// Note: webhooks will not receive this event for tags if more than three tags
-// are deleted at once.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deleteevent
-type DeleteEvent struct {
- Ref *string `json:"ref,omitempty"`
- // RefType is the object that was deleted. Possible values are: "branch", "tag".
- RefType *string `json:"ref_type,omitempty"`
-
- // The following fields are only populated by Webhook events.
- PusherType *string `json:"pusher_type,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// DeploymentEvent represents a deployment.
-// The Webhook event name is "deployment".
-//
-// Events of this type are not visible in timelines, they are only used to trigger hooks.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentevent
-type DeploymentEvent struct {
- Deployment *Deployment `json:"deployment,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// DeploymentStatusEvent represents a deployment status.
-// The Webhook event name is "deployment_status".
-//
-// Events of this type are not visible in timelines, they are only used to trigger hooks.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentstatusevent
-type DeploymentStatusEvent struct {
- Deployment *Deployment `json:"deployment,omitempty"`
- DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// ForkEvent is triggered when a user forks a repository.
-// The Webhook event name is "fork".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#forkevent
-type ForkEvent struct {
- // Forkee is the created repository.
- Forkee *Repository `json:"forkee,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// Page represents a single Wiki page.
-type Page struct {
- PageName *string `json:"page_name,omitempty"`
- Title *string `json:"title,omitempty"`
- Summary *string `json:"summary,omitempty"`
- Action *string `json:"action,omitempty"`
- SHA *string `json:"sha,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
-}
-
-// GollumEvent is triggered when a Wiki page is created or updated.
-// The Webhook event name is "gollum".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#gollumevent
-type GollumEvent struct {
- Pages []*Page `json:"pages,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// EditChange represents the changes when an issue, pull request, or comment has
-// been edited.
-type EditChange struct {
- Title *struct {
- From *string `json:"from,omitempty"`
- } `json:"title,omitempty"`
- Body *struct {
- From *string `json:"from,omitempty"`
- } `json:"body,omitempty"`
-}
-
-// ProjectChange represents the changes when a project has been edited.
-type ProjectChange struct {
- Name *struct {
- From *string `json:"from,omitempty"`
- } `json:"name,omitempty"`
- Body *struct {
- From *string `json:"from,omitempty"`
- } `json:"body,omitempty"`
-}
-
-// ProjectCardChange represents the changes when a project card has been edited.
-type ProjectCardChange struct {
- Note *struct {
- From *string `json:"from,omitempty"`
- } `json:"note,omitempty"`
-}
-
-// ProjectColumnChange represents the changes when a project column has been edited.
-type ProjectColumnChange struct {
- Name *struct {
- From *string `json:"from,omitempty"`
- } `json:"name,omitempty"`
-}
-
-// TeamChange represents the changes when a team has been edited.
-type TeamChange struct {
- Description *struct {
- From *string `json:"from,omitempty"`
- } `json:"description,omitempty"`
- Name *struct {
- From *string `json:"from,omitempty"`
- } `json:"name,omitempty"`
- Privacy *struct {
- From *string `json:"from,omitempty"`
- } `json:"privacy,omitempty"`
- Repository *struct {
- Permissions *struct {
- From *struct {
- Admin *bool `json:"admin,omitempty"`
- Pull *bool `json:"pull,omitempty"`
- Push *bool `json:"push,omitempty"`
- } `json:"from,omitempty"`
- } `json:"permissions,omitempty"`
- } `json:"repository,omitempty"`
-}
-
-// InstallationEvent is triggered when a GitHub App has been installed or uninstalled.
-// The Webhook event name is "installation".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationevent
-type InstallationEvent struct {
- // The action that was performed. Can be either "created" or "deleted".
- Action *string `json:"action,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// InstallationRepositoriesEvent is triggered when a repository is added or
-// removed from an installation. The Webhook event name is "installation_repositories".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationrepositoriesevent
-type InstallationRepositoriesEvent struct {
- // The action that was performed. Can be either "added" or "removed".
- Action *string `json:"action,omitempty"`
- RepositoriesAdded []*Repository `json:"repositories_added,omitempty"`
- RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"`
- RepositorySelection *string `json:"repository_selection,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// IssueCommentEvent is triggered when an issue comment is created on an issue
-// or pull request.
-// The Webhook event name is "issue_comment".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuecommentevent
-type IssueCommentEvent struct {
- // Action is the action that was performed on the comment.
- // Possible values are: "created", "edited", "deleted".
- Action *string `json:"action,omitempty"`
- Issue *Issue `json:"issue,omitempty"`
- Comment *IssueComment `json:"comment,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// IssuesEvent is triggered when an issue is assigned, unassigned, labeled,
-// unlabeled, opened, closed, or reopened.
-// The Webhook event name is "issues".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuesevent
-type IssuesEvent struct {
- // Action is the action that was performed. Possible values are: "assigned",
- // "unassigned", "labeled", "unlabeled", "opened", "closed", "reopened", "edited".
- Action *string `json:"action,omitempty"`
- Issue *Issue `json:"issue,omitempty"`
- Assignee *User `json:"assignee,omitempty"`
- Label *Label `json:"label,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// LabelEvent is triggered when a repository's label is created, edited, or deleted.
-// The Webhook event name is "label"
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#labelevent
-type LabelEvent struct {
- // Action is the action that was performed. Possible values are:
- // "created", "edited", "deleted"
- Action *string `json:"action,omitempty"`
- Label *Label `json:"label,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Org *Organization `json:"organization,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes
-// their GitHub Marketplace plan.
-// Webhook event name "marketplace_purchase".
-//
-// Github API docs: https://developer.github.com/v3/activity/events/types/#marketplacepurchaseevent
-type MarketplacePurchaseEvent struct {
- // Action is the action that was performed. Possible values are:
- // "purchased", "cancelled", "changed".
- Action *string `json:"action,omitempty"`
-
- // The following fields are only populated by Webhook events.
- EffectiveDate *Timestamp `json:"effective_date,omitempty"`
- MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"`
- PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// MemberEvent is triggered when a user is added as a collaborator to a repository.
-// The Webhook event name is "member".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#memberevent
-type MemberEvent struct {
- // Action is the action that was performed. Possible value is: "added".
- Action *string `json:"action,omitempty"`
- Member *User `json:"member,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// MembershipEvent is triggered when a user is added or removed from a team.
-// The Webhook event name is "membership".
-//
-// Events of this type are not visible in timelines, they are only used to
-// trigger organization webhooks.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#membershipevent
-type MembershipEvent struct {
- // Action is the action that was performed. Possible values are: "added", "removed".
- Action *string `json:"action,omitempty"`
- // Scope is the scope of the membership. Possible value is: "team".
- Scope *string `json:"scope,omitempty"`
- Member *User `json:"member,omitempty"`
- Team *Team `json:"team,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
-// The Webhook event name is "milestone".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#milestoneevent
-type MilestoneEvent struct {
- // Action is the action that was performed. Possible values are:
- // "created", "closed", "opened", "edited", "deleted"
- Action *string `json:"action,omitempty"`
- Milestone *Milestone `json:"milestone,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Org *Organization `json:"organization,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// OrganizationEvent is triggered when a user is added, removed, or invited to an organization.
-// Events of this type are not visible in timelines. These events are only used to trigger organization hooks.
-// Webhook event name is "organization".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#organizationevent
-type OrganizationEvent struct {
- // Action is the action that was performed.
- // Can be one of "member_added", "member_removed", or "member_invited".
- Action *string `json:"action,omitempty"`
-
- // Invitaion is the invitation for the user or email if the action is "member_invited".
- Invitation *Invitation `json:"invitation,omitempty"`
-
- // Membership is the membership between the user and the organization.
- // Not present when the action is "member_invited".
- Membership *Membership `json:"membership,omitempty"`
-
- Organization *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// OrgBlockEvent is triggered when an organization blocks or unblocks a user.
-// The Webhook event name is "org_block".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#orgblockevent
-type OrgBlockEvent struct {
- // Action is the action that was performed.
- // Can be "blocked" or "unblocked".
- Action *string `json:"action,omitempty"`
- BlockedUser *User `json:"blocked_user,omitempty"`
- Organization *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// PageBuildEvent represents an attempted build of a GitHub Pages site, whether
-// successful or not.
-// The Webhook event name is "page_build".
-//
-// This event is triggered on push to a GitHub Pages enabled branch (gh-pages
-// for project pages, master for user and organization pages).
-//
-// Events of this type are not visible in timelines, they are only used to trigger hooks.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pagebuildevent
-type PageBuildEvent struct {
- Build *PagesBuild `json:"build,omitempty"`
-
- // The following fields are only populated by Webhook events.
- ID *int64 `json:"id,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// PingEvent is triggered when a Webhook is added to GitHub.
-//
-// GitHub API docs: https://developer.github.com/webhooks/#ping-event
-type PingEvent struct {
- // Random string of GitHub zen.
- Zen *string `json:"zen,omitempty"`
- // The ID of the webhook that triggered the ping.
- HookID *int64 `json:"hook_id,omitempty"`
- // The webhook configuration.
- Hook *Hook `json:"hook,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// ProjectEvent is triggered when project is created, modified or deleted.
-// The webhook event name is "project".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectevent
-type ProjectEvent struct {
- Action *string `json:"action,omitempty"`
- Changes *ProjectChange `json:"changes,omitempty"`
- Project *Project `json:"project,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted.
-// The webhook event name is "project_card".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectcardevent
-type ProjectCardEvent struct {
- Action *string `json:"action,omitempty"`
- Changes *ProjectCardChange `json:"changes,omitempty"`
- AfterID *int64 `json:"after_id,omitempty"`
- ProjectCard *ProjectCard `json:"project_card,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted.
-// The webhook event name is "project_column".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectcolumnevent
-type ProjectColumnEvent struct {
- Action *string `json:"action,omitempty"`
- Changes *ProjectColumnChange `json:"changes,omitempty"`
- AfterID *int64 `json:"after_id,omitempty"`
- ProjectColumn *ProjectColumn `json:"project_column,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// PublicEvent is triggered when a private repository is open sourced.
-// According to GitHub: "Without a doubt: the best GitHub event."
-// The Webhook event name is "public".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#publicevent
-type PublicEvent struct {
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// PullRequestEvent is triggered when a pull request is assigned, unassigned,
-// labeled, unlabeled, opened, closed, reopened, or synchronized.
-// The Webhook event name is "pull_request".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestevent
-type PullRequestEvent struct {
- // Action is the action that was performed. Possible values are:
- // "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled",
- // "opened", "closed", "reopened", "synchronize", "edited".
- // If the action is "closed" and the merged key is false,
- // the pull request was closed with unmerged commits. If the action is "closed"
- // and the merged key is true, the pull request was merged.
- Action *string `json:"action,omitempty"`
- Number *int `json:"number,omitempty"`
- PullRequest *PullRequest `json:"pull_request,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- RequestedReviewers []*User `json:"requested_reviewers,omitempty"` // Populated in "review_requested", "review_request_removed" event deliveries.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// PullRequestReviewEvent is triggered when a review is submitted on a pull
-// request.
-// The Webhook event name is "pull_request_review".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent
-type PullRequestReviewEvent struct {
- // Action is always "submitted".
- Action *string `json:"action,omitempty"`
- Review *PullRequestReview `json:"review,omitempty"`
- PullRequest *PullRequest `json:"pull_request,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-
- // The following field is only present when the webhook is triggered on
- // a repository belonging to an organization.
- Organization *Organization `json:"organization,omitempty"`
-}
-
-// PullRequestReviewCommentEvent is triggered when a comment is created on a
-// portion of the unified diff of a pull request.
-// The Webhook event name is "pull_request_review_comment".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent
-type PullRequestReviewCommentEvent struct {
- // Action is the action that was performed on the comment.
- // Possible values are: "created", "edited", "deleted".
- Action *string `json:"action,omitempty"`
- PullRequest *PullRequest `json:"pull_request,omitempty"`
- Comment *PullRequestComment `json:"comment,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// PushEvent represents a git push to a GitHub repository.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pushevent
-type PushEvent struct {
- PushID *int64 `json:"push_id,omitempty"`
- Head *string `json:"head,omitempty"`
- Ref *string `json:"ref,omitempty"`
- Size *int `json:"size,omitempty"`
- Commits []PushEventCommit `json:"commits,omitempty"`
- Before *string `json:"before,omitempty"`
- DistinctSize *int `json:"distinct_size,omitempty"`
-
- // The following fields are only populated by Webhook events.
- After *string `json:"after,omitempty"`
- Created *bool `json:"created,omitempty"`
- Deleted *bool `json:"deleted,omitempty"`
- Forced *bool `json:"forced,omitempty"`
- BaseRef *string `json:"base_ref,omitempty"`
- Compare *string `json:"compare,omitempty"`
- Repo *PushEventRepository `json:"repository,omitempty"`
- HeadCommit *PushEventCommit `json:"head_commit,omitempty"`
- Pusher *User `json:"pusher,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-func (p PushEvent) String() string {
- return Stringify(p)
-}
-
-// PushEventCommit represents a git commit in a GitHub PushEvent.
-type PushEventCommit struct {
- Message *string `json:"message,omitempty"`
- Author *CommitAuthor `json:"author,omitempty"`
- URL *string `json:"url,omitempty"`
- Distinct *bool `json:"distinct,omitempty"`
-
- // The following fields are only populated by Events API.
- SHA *string `json:"sha,omitempty"`
-
- // The following fields are only populated by Webhook events.
- ID *string `json:"id,omitempty"`
- TreeID *string `json:"tree_id,omitempty"`
- Timestamp *Timestamp `json:"timestamp,omitempty"`
- Committer *CommitAuthor `json:"committer,omitempty"`
- Added []string `json:"added,omitempty"`
- Removed []string `json:"removed,omitempty"`
- Modified []string `json:"modified,omitempty"`
-}
-
-func (p PushEventCommit) String() string {
- return Stringify(p)
-}
-
-// PushEventRepository represents the repo object in a PushEvent payload.
-type PushEventRepository struct {
- ID *int64 `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- FullName *string `json:"full_name,omitempty"`
- Owner *PushEventRepoOwner `json:"owner,omitempty"`
- Private *bool `json:"private,omitempty"`
- Description *string `json:"description,omitempty"`
- Fork *bool `json:"fork,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- PushedAt *Timestamp `json:"pushed_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- Homepage *string `json:"homepage,omitempty"`
- Size *int `json:"size,omitempty"`
- StargazersCount *int `json:"stargazers_count,omitempty"`
- WatchersCount *int `json:"watchers_count,omitempty"`
- Language *string `json:"language,omitempty"`
- HasIssues *bool `json:"has_issues,omitempty"`
- HasDownloads *bool `json:"has_downloads,omitempty"`
- HasWiki *bool `json:"has_wiki,omitempty"`
- HasPages *bool `json:"has_pages,omitempty"`
- ForksCount *int `json:"forks_count,omitempty"`
- OpenIssuesCount *int `json:"open_issues_count,omitempty"`
- DefaultBranch *string `json:"default_branch,omitempty"`
- MasterBranch *string `json:"master_branch,omitempty"`
- Organization *string `json:"organization,omitempty"`
- URL *string `json:"url,omitempty"`
- ArchiveURL *string `json:"archive_url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- StatusesURL *string `json:"statuses_url,omitempty"`
- GitURL *string `json:"git_url,omitempty"`
- SSHURL *string `json:"ssh_url,omitempty"`
- CloneURL *string `json:"clone_url,omitempty"`
- SVNURL *string `json:"svn_url,omitempty"`
-}
-
-// PushEventRepoOwner is a basic representation of user/org in a PushEvent payload.
-type PushEventRepoOwner struct {
- Name *string `json:"name,omitempty"`
- Email *string `json:"email,omitempty"`
-}
-
-// ReleaseEvent is triggered when a release is published.
-// The Webhook event name is "release".
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#releaseevent
-type ReleaseEvent struct {
- // Action is the action that was performed. Possible value is: "published".
- Action *string `json:"action,omitempty"`
- Release *RepositoryRelease `json:"release,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// RepositoryEvent is triggered when a repository is created.
-// The Webhook event name is "repository".
-//
-// Events of this type are not visible in timelines, they are only used to
-// trigger organization webhooks.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#repositoryevent
-type RepositoryEvent struct {
- // Action is the action that was performed. Possible values are: "created", "deleted",
- // "publicized", "privatized".
- Action *string `json:"action,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// StatusEvent is triggered when the status of a Git commit changes.
-// The Webhook event name is "status".
-//
-// Events of this type are not visible in timelines, they are only used to
-// trigger hooks.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#statusevent
-type StatusEvent struct {
- SHA *string `json:"sha,omitempty"`
- // State is the new state. Possible values are: "pending", "success", "failure", "error".
- State *string `json:"state,omitempty"`
- Description *string `json:"description,omitempty"`
- TargetURL *string `json:"target_url,omitempty"`
- Branches []*Branch `json:"branches,omitempty"`
-
- // The following fields are only populated by Webhook events.
- ID *int64 `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Context *string `json:"context,omitempty"`
- Commit *RepositoryCommit `json:"commit,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// TeamEvent is triggered when an organization's team is created, modified or deleted.
-// The Webhook event name is "team".
-//
-// Events of this type are not visible in timelines. These events are only used
-// to trigger hooks.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#teamevent
-type TeamEvent struct {
- Action *string `json:"action,omitempty"`
- Team *Team `json:"team,omitempty"`
- Changes *TeamChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// TeamAddEvent is triggered when a repository is added to a team.
-// The Webhook event name is "team_add".
-//
-// Events of this type are not visible in timelines. These events are only used
-// to trigger hooks.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#teamaddevent
-type TeamAddEvent struct {
- Team *Team `json:"team,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
-
-// WatchEvent is related to starring a repository, not watching. See this API
-// blog post for an explanation: https://developer.github.com/changes/2012-09-05-watcher-api/
-//
-// The event’s actor is the user who starred a repository, and the event’s
-// repository is the repository that was starred.
-//
-// GitHub API docs: https://developer.github.com/v3/activity/events/types/#watchevent
-type WatchEvent struct {
- // Action is the action that was performed. Possible value is: "started".
- Action *string `json:"action,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
-}
diff --git a/vendor/github.com/google/go-github/github/gen-accessors.go b/vendor/github.com/google/go-github/github/gen-accessors.go
deleted file mode 100644
index fe92206f..00000000
--- a/vendor/github.com/google/go-github/github/gen-accessors.go
+++ /dev/null
@@ -1,332 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-// gen-accessors generates accessor methods for structs with pointer fields.
-//
-// It is meant to be used by the go-github authors in conjunction with the
-// go generate tool before sending a commit to GitHub.
-package main
-
-import (
- "bytes"
- "flag"
- "fmt"
- "go/ast"
- "go/format"
- "go/parser"
- "go/token"
- "io/ioutil"
- "log"
- "os"
- "sort"
- "strings"
- "text/template"
-)
-
-const (
- fileSuffix = "-accessors.go"
-)
-
-var (
- verbose = flag.Bool("v", false, "Print verbose log messages")
-
- sourceTmpl = template.Must(template.New("source").Parse(source))
-
- // blacklistStructMethod lists "struct.method" combos to skip.
- blacklistStructMethod = map[string]bool{
- "RepositoryContent.GetContent": true,
- "Client.GetBaseURL": true,
- "Client.GetUploadURL": true,
- "ErrorResponse.GetResponse": true,
- "RateLimitError.GetResponse": true,
- "AbuseRateLimitError.GetResponse": true,
- }
- // blacklistStruct lists structs to skip.
- blacklistStruct = map[string]bool{
- "Client": true,
- }
-)
-
-func logf(fmt string, args ...interface{}) {
- if *verbose {
- log.Printf(fmt, args...)
- }
-}
-
-func main() {
- flag.Parse()
- fset := token.NewFileSet()
-
- pkgs, err := parser.ParseDir(fset, ".", sourceFilter, 0)
- if err != nil {
- log.Fatal(err)
- return
- }
-
- for pkgName, pkg := range pkgs {
- t := &templateData{
- filename: pkgName + fileSuffix,
- Year: 2017,
- Package: pkgName,
- Imports: map[string]string{},
- }
- for filename, f := range pkg.Files {
- logf("Processing %v...", filename)
- if err := t.processAST(f); err != nil {
- log.Fatal(err)
- }
- }
- if err := t.dump(); err != nil {
- log.Fatal(err)
- }
- }
- logf("Done.")
-}
-
-func (t *templateData) processAST(f *ast.File) error {
- for _, decl := range f.Decls {
- gd, ok := decl.(*ast.GenDecl)
- if !ok {
- continue
- }
- for _, spec := range gd.Specs {
- ts, ok := spec.(*ast.TypeSpec)
- if !ok {
- continue
- }
- // Skip unexported identifiers.
- if !ts.Name.IsExported() {
- logf("Struct %v is unexported; skipping.", ts.Name)
- continue
- }
- // Check if the struct is blacklisted.
- if blacklistStruct[ts.Name.Name] {
- logf("Struct %v is blacklisted; skipping.", ts.Name)
- continue
- }
- st, ok := ts.Type.(*ast.StructType)
- if !ok {
- continue
- }
- for _, field := range st.Fields.List {
- se, ok := field.Type.(*ast.StarExpr)
- if len(field.Names) == 0 || !ok {
- continue
- }
-
- fieldName := field.Names[0]
- // Skip unexported identifiers.
- if !fieldName.IsExported() {
- logf("Field %v is unexported; skipping.", fieldName)
- continue
- }
- // Check if "struct.method" is blacklisted.
- if key := fmt.Sprintf("%v.Get%v", ts.Name, fieldName); blacklistStructMethod[key] {
- logf("Method %v is blacklisted; skipping.", key)
- continue
- }
-
- switch x := se.X.(type) {
- case *ast.ArrayType:
- t.addArrayType(x, ts.Name.String(), fieldName.String())
- case *ast.Ident:
- t.addIdent(x, ts.Name.String(), fieldName.String())
- case *ast.MapType:
- t.addMapType(x, ts.Name.String(), fieldName.String())
- case *ast.SelectorExpr:
- t.addSelectorExpr(x, ts.Name.String(), fieldName.String())
- default:
- logf("processAST: type %q, field %q, unknown %T: %+v", ts.Name, fieldName, x, x)
- }
- }
- }
- }
- return nil
-}
-
-func sourceFilter(fi os.FileInfo) bool {
- return !strings.HasSuffix(fi.Name(), "_test.go") && !strings.HasSuffix(fi.Name(), fileSuffix)
-}
-
-func (t *templateData) dump() error {
- if len(t.Getters) == 0 {
- logf("No getters for %v; skipping.", t.filename)
- return nil
- }
-
- // Sort getters by ReceiverType.FieldName.
- sort.Sort(byName(t.Getters))
-
- var buf bytes.Buffer
- if err := sourceTmpl.Execute(&buf, t); err != nil {
- return err
- }
- clean, err := format.Source(buf.Bytes())
- if err != nil {
- return err
- }
-
- logf("Writing %v...", t.filename)
- return ioutil.WriteFile(t.filename, clean, 0644)
-}
-
-func newGetter(receiverType, fieldName, fieldType, zeroValue string, namedStruct bool) *getter {
- return &getter{
- sortVal: strings.ToLower(receiverType) + "." + strings.ToLower(fieldName),
- ReceiverVar: strings.ToLower(receiverType[:1]),
- ReceiverType: receiverType,
- FieldName: fieldName,
- FieldType: fieldType,
- ZeroValue: zeroValue,
- NamedStruct: namedStruct,
- }
-}
-
-func (t *templateData) addArrayType(x *ast.ArrayType, receiverType, fieldName string) {
- var eltType string
- switch elt := x.Elt.(type) {
- case *ast.Ident:
- eltType = elt.String()
- default:
- logf("addArrayType: type %q, field %q: unknown elt type: %T %+v; skipping.", receiverType, fieldName, elt, elt)
- return
- }
-
- t.Getters = append(t.Getters, newGetter(receiverType, fieldName, "[]"+eltType, "nil", false))
-}
-
-func (t *templateData) addIdent(x *ast.Ident, receiverType, fieldName string) {
- var zeroValue string
- var namedStruct = false
- switch x.String() {
- case "int", "int64":
- zeroValue = "0"
- case "string":
- zeroValue = `""`
- case "bool":
- zeroValue = "false"
- case "Timestamp":
- zeroValue = "Timestamp{}"
- default:
- zeroValue = "nil"
- namedStruct = true
- }
-
- t.Getters = append(t.Getters, newGetter(receiverType, fieldName, x.String(), zeroValue, namedStruct))
-}
-
-func (t *templateData) addMapType(x *ast.MapType, receiverType, fieldName string) {
- var keyType string
- switch key := x.Key.(type) {
- case *ast.Ident:
- keyType = key.String()
- default:
- logf("addMapType: type %q, field %q: unknown key type: %T %+v; skipping.", receiverType, fieldName, key, key)
- return
- }
-
- var valueType string
- switch value := x.Value.(type) {
- case *ast.Ident:
- valueType = value.String()
- default:
- logf("addMapType: type %q, field %q: unknown value type: %T %+v; skipping.", receiverType, fieldName, value, value)
- return
- }
-
- fieldType := fmt.Sprintf("map[%v]%v", keyType, valueType)
- zeroValue := fmt.Sprintf("map[%v]%v{}", keyType, valueType)
- t.Getters = append(t.Getters, newGetter(receiverType, fieldName, fieldType, zeroValue, false))
-}
-
-func (t *templateData) addSelectorExpr(x *ast.SelectorExpr, receiverType, fieldName string) {
- if strings.ToLower(fieldName[:1]) == fieldName[:1] { // Non-exported field.
- return
- }
-
- var xX string
- if xx, ok := x.X.(*ast.Ident); ok {
- xX = xx.String()
- }
-
- switch xX {
- case "time", "json":
- if xX == "json" {
- t.Imports["encoding/json"] = "encoding/json"
- } else {
- t.Imports[xX] = xX
- }
- fieldType := fmt.Sprintf("%v.%v", xX, x.Sel.Name)
- zeroValue := fmt.Sprintf("%v.%v{}", xX, x.Sel.Name)
- if xX == "time" && x.Sel.Name == "Duration" {
- zeroValue = "0"
- }
- t.Getters = append(t.Getters, newGetter(receiverType, fieldName, fieldType, zeroValue, false))
- default:
- logf("addSelectorExpr: xX %q, type %q, field %q: unknown x=%+v; skipping.", xX, receiverType, fieldName, x)
- }
-}
-
-type templateData struct {
- filename string
- Year int
- Package string
- Imports map[string]string
- Getters []*getter
-}
-
-type getter struct {
- sortVal string // Lower-case version of "ReceiverType.FieldName".
- ReceiverVar string // The one-letter variable name to match the ReceiverType.
- ReceiverType string
- FieldName string
- FieldType string
- ZeroValue string
- NamedStruct bool // Getter for named struct.
-}
-
-type byName []*getter
-
-func (b byName) Len() int { return len(b) }
-func (b byName) Less(i, j int) bool { return b[i].sortVal < b[j].sortVal }
-func (b byName) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
-
-const source = `// Copyright {{.Year}} The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Code generated by gen-accessors; DO NOT EDIT.
-
-package {{.Package}}
-{{with .Imports}}
-import (
- {{- range . -}}
- "{{.}}"
- {{end -}}
-)
-{{end}}
-{{range .Getters}}
-{{if .NamedStruct}}
-// Get{{.FieldName}} returns the {{.FieldName}} field.
-func ({{.ReceiverVar}} *{{.ReceiverType}}) Get{{.FieldName}}() *{{.FieldType}} {
- if {{.ReceiverVar}} == nil {
- return {{.ZeroValue}}
- }
- return {{.ReceiverVar}}.{{.FieldName}}
-}
-{{else}}
-// Get{{.FieldName}} returns the {{.FieldName}} field if it's non-nil, zero value otherwise.
-func ({{.ReceiverVar}} *{{.ReceiverType}}) Get{{.FieldName}}() {{.FieldType}} {
- if {{.ReceiverVar}} == nil || {{.ReceiverVar}}.{{.FieldName}} == nil {
- return {{.ZeroValue}}
- }
- return *{{.ReceiverVar}}.{{.FieldName}}
-}
-{{end}}
-{{end}}
-`
diff --git a/vendor/github.com/google/go-github/github/gists.go b/vendor/github.com/google/go-github/github/gists.go
deleted file mode 100644
index 9108b642..00000000
--- a/vendor/github.com/google/go-github/github/gists.go
+++ /dev/null
@@ -1,388 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// GistsService handles communication with the Gist related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/
-type GistsService service
-
-// Gist represents a GitHub's gist.
-type Gist struct {
- ID *string `json:"id,omitempty"`
- Description *string `json:"description,omitempty"`
- Public *bool `json:"public,omitempty"`
- Owner *User `json:"owner,omitempty"`
- Files map[GistFilename]GistFile `json:"files,omitempty"`
- Comments *int `json:"comments,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- GitPullURL *string `json:"git_pull_url,omitempty"`
- GitPushURL *string `json:"git_push_url,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-func (g Gist) String() string {
- return Stringify(g)
-}
-
-// GistFilename represents filename on a gist.
-type GistFilename string
-
-// GistFile represents a file on a gist.
-type GistFile struct {
- Size *int `json:"size,omitempty"`
- Filename *string `json:"filename,omitempty"`
- Language *string `json:"language,omitempty"`
- Type *string `json:"type,omitempty"`
- RawURL *string `json:"raw_url,omitempty"`
- Content *string `json:"content,omitempty"`
-}
-
-func (g GistFile) String() string {
- return Stringify(g)
-}
-
-// GistCommit represents a commit on a gist.
-type GistCommit struct {
- URL *string `json:"url,omitempty"`
- Version *string `json:"version,omitempty"`
- User *User `json:"user,omitempty"`
- ChangeStatus *CommitStats `json:"change_status,omitempty"`
- CommittedAt *Timestamp `json:"committed_at,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-func (gc GistCommit) String() string {
- return Stringify(gc)
-}
-
-// GistFork represents a fork of a gist.
-type GistFork struct {
- URL *string `json:"url,omitempty"`
- User *User `json:"user,omitempty"`
- ID *string `json:"id,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-func (gf GistFork) String() string {
- return Stringify(gf)
-}
-
-// GistListOptions specifies the optional parameters to the
-// GistsService.List, GistsService.ListAll, and GistsService.ListStarred methods.
-type GistListOptions struct {
- // Since filters Gists by time.
- Since time.Time `url:"since,omitempty"`
-
- ListOptions
-}
-
-// List gists for a user. Passing the empty string will list
-// all public gists if called anonymously. However, if the call
-// is authenticated, it will returns all gists for the authenticated
-// user.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#list-gists
-func (s *GistsService) List(ctx context.Context, user string, opt *GistListOptions) ([]*Gist, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/gists", user)
- } else {
- u = "gists"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var gists []*Gist
- resp, err := s.client.Do(ctx, req, &gists)
- if err != nil {
- return nil, resp, err
- }
-
- return gists, resp, nil
-}
-
-// ListAll lists all public gists.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#list-gists
-func (s *GistsService) ListAll(ctx context.Context, opt *GistListOptions) ([]*Gist, *Response, error) {
- u, err := addOptions("gists/public", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var gists []*Gist
- resp, err := s.client.Do(ctx, req, &gists)
- if err != nil {
- return nil, resp, err
- }
-
- return gists, resp, nil
-}
-
-// ListStarred lists starred gists of authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#list-gists
-func (s *GistsService) ListStarred(ctx context.Context, opt *GistListOptions) ([]*Gist, *Response, error) {
- u, err := addOptions("gists/starred", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var gists []*Gist
- resp, err := s.client.Do(ctx, req, &gists)
- if err != nil {
- return nil, resp, err
- }
-
- return gists, resp, nil
-}
-
-// Get a single gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#get-a-single-gist
-func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, error) {
- u := fmt.Sprintf("gists/%v", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- gist := new(Gist)
- resp, err := s.client.Do(ctx, req, gist)
- if err != nil {
- return nil, resp, err
- }
-
- return gist, resp, nil
-}
-
-// GetRevision gets a specific revision of a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
-func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, *Response, error) {
- u := fmt.Sprintf("gists/%v/%v", id, sha)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- gist := new(Gist)
- resp, err := s.client.Do(ctx, req, gist)
- if err != nil {
- return nil, resp, err
- }
-
- return gist, resp, nil
-}
-
-// Create a gist for authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#create-a-gist
-func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) {
- u := "gists"
- req, err := s.client.NewRequest("POST", u, gist)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- g := new(Gist)
- resp, err := s.client.Do(ctx, req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, nil
-}
-
-// Edit a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#edit-a-gist
-func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) {
- u := fmt.Sprintf("gists/%v", id)
- req, err := s.client.NewRequest("PATCH", u, gist)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- g := new(Gist)
- resp, err := s.client.Do(ctx, req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, nil
-}
-
-// ListCommits lists commits of a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#list-gist-commits
-func (s *GistsService) ListCommits(ctx context.Context, id string, opt *ListOptions) ([]*GistCommit, *Response, error) {
- u := fmt.Sprintf("gists/%v/commits", id)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var gistCommits []*GistCommit
- resp, err := s.client.Do(ctx, req, &gistCommits)
- if err != nil {
- return nil, resp, err
- }
-
- return gistCommits, resp, nil
-}
-
-// Delete a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#delete-a-gist
-func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) {
- u := fmt.Sprintf("gists/%v", id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// Star a gist on behalf of authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#star-a-gist
-func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) {
- u := fmt.Sprintf("gists/%v/star", id)
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// Unstar a gist on a behalf of authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#unstar-a-gist
-func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) {
- u := fmt.Sprintf("gists/%v/star", id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// IsStarred checks if a gist is starred by authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#check-if-a-gist-is-starred
-func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Response, error) {
- u := fmt.Sprintf("gists/%v/star", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
- resp, err := s.client.Do(ctx, req, nil)
- starred, err := parseBoolResponse(err)
- return starred, resp, err
-}
-
-// Fork a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#fork-a-gist
-func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, error) {
- u := fmt.Sprintf("gists/%v/forks", id)
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- g := new(Gist)
- resp, err := s.client.Do(ctx, req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, nil
-}
-
-// ListForks lists forks of a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/#list-gist-forks
-func (s *GistsService) ListForks(ctx context.Context, id string) ([]*GistFork, *Response, error) {
- u := fmt.Sprintf("gists/%v/forks", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var gistForks []*GistFork
- resp, err := s.client.Do(ctx, req, &gistForks)
- if err != nil {
- return nil, resp, err
- }
-
- return gistForks, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/gists_comments.go b/vendor/github.com/google/go-github/github/gists_comments.go
deleted file mode 100644
index d5322e3d..00000000
--- a/vendor/github.com/google/go-github/github/gists_comments.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// GistComment represents a Gist comment.
-type GistComment struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- Body *string `json:"body,omitempty"`
- User *User `json:"user,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
-}
-
-func (g GistComment) String() string {
- return Stringify(g)
-}
-
-// ListComments lists all comments for a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
-func (s *GistsService) ListComments(ctx context.Context, gistID string, opt *ListOptions) ([]*GistComment, *Response, error) {
- u := fmt.Sprintf("gists/%v/comments", gistID)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var comments []*GistComment
- resp, err := s.client.Do(ctx, req, &comments)
- if err != nil {
- return nil, resp, err
- }
-
- return comments, resp, nil
-}
-
-// GetComment retrieves a single comment from a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/comments/#get-a-single-comment
-func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error) {
- u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(GistComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// CreateComment creates a comment for a gist.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/comments/#create-a-comment
-func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) {
- u := fmt.Sprintf("gists/%v/comments", gistID)
- req, err := s.client.NewRequest("POST", u, comment)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(GistComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// EditComment edits an existing gist comment.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/comments/#edit-a-comment
-func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) {
- u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
- req, err := s.client.NewRequest("PATCH", u, comment)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(GistComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// DeleteComment deletes a gist comment.
-//
-// GitHub API docs: https://developer.github.com/v3/gists/comments/#delete-a-comment
-func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) {
- u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/git.go b/vendor/github.com/google/go-github/github/git.go
deleted file mode 100644
index 1ce47437..00000000
--- a/vendor/github.com/google/go-github/github/git.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-// GitService handles communication with the git data related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/git/
-type GitService service
diff --git a/vendor/github.com/google/go-github/github/git_blobs.go b/vendor/github.com/google/go-github/github/git_blobs.go
deleted file mode 100644
index 9d8fd27b..00000000
--- a/vendor/github.com/google/go-github/github/git_blobs.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Blob represents a blob object.
-type Blob struct {
- Content *string `json:"content,omitempty"`
- Encoding *string `json:"encoding,omitempty"`
- SHA *string `json:"sha,omitempty"`
- Size *int `json:"size,omitempty"`
- URL *string `json:"url,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-// GetBlob fetchs a blob from a repo given a SHA.
-//
-// GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob
-func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- blob := new(Blob)
- resp, err := s.client.Do(ctx, req, blob)
- return blob, resp, err
-}
-
-// CreateBlob creates a blob object.
-//
-// GitHub API docs: https://developer.github.com/v3/git/blobs/#create-a-blob
-func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo)
- req, err := s.client.NewRequest("POST", u, blob)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- t := new(Blob)
- resp, err := s.client.Do(ctx, req, t)
- return t, resp, err
-}
diff --git a/vendor/github.com/google/go-github/github/git_commits.go b/vendor/github.com/google/go-github/github/git_commits.go
deleted file mode 100644
index 29882569..00000000
--- a/vendor/github.com/google/go-github/github/git_commits.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "strings"
- "time"
-)
-
-// SignatureVerification represents GPG signature verification.
-type SignatureVerification struct {
- Verified *bool `json:"verified,omitempty"`
- Reason *string `json:"reason,omitempty"`
- Signature *string `json:"signature,omitempty"`
- Payload *string `json:"payload,omitempty"`
-}
-
-// Commit represents a GitHub commit.
-type Commit struct {
- SHA *string `json:"sha,omitempty"`
- Author *CommitAuthor `json:"author,omitempty"`
- Committer *CommitAuthor `json:"committer,omitempty"`
- Message *string `json:"message,omitempty"`
- Tree *Tree `json:"tree,omitempty"`
- Parents []Commit `json:"parents,omitempty"`
- Stats *CommitStats `json:"stats,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- URL *string `json:"url,omitempty"`
- Verification *SignatureVerification `json:"verification,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-
- // CommentCount is the number of GitHub comments on the commit. This
- // is only populated for requests that fetch GitHub data like
- // Pulls.ListCommits, Repositories.ListCommits, etc.
- CommentCount *int `json:"comment_count,omitempty"`
-}
-
-func (c Commit) String() string {
- return Stringify(c)
-}
-
-// CommitAuthor represents the author or committer of a commit. The commit
-// author may not correspond to a GitHub User.
-type CommitAuthor struct {
- Date *time.Time `json:"date,omitempty"`
- Name *string `json:"name,omitempty"`
- Email *string `json:"email,omitempty"`
-
- // The following fields are only populated by Webhook events.
- Login *string `json:"username,omitempty"` // Renamed for go-github consistency.
-}
-
-func (c CommitAuthor) String() string {
- return Stringify(c)
-}
-
-// GetCommit fetchs the Commit object for a given SHA.
-//
-// GitHub API docs: https://developer.github.com/v3/git/commits/#get-a-commit
-func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeGitSigningPreview, mediaTypeGraphQLNodeIDPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- c := new(Commit)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// createCommit represents the body of a CreateCommit request.
-type createCommit struct {
- Author *CommitAuthor `json:"author,omitempty"`
- Committer *CommitAuthor `json:"committer,omitempty"`
- Message *string `json:"message,omitempty"`
- Tree *string `json:"tree,omitempty"`
- Parents []string `json:"parents,omitempty"`
-}
-
-// CreateCommit creates a new commit in a repository.
-// commit must not be nil.
-//
-// The commit.Committer is optional and will be filled with the commit.Author
-// data if omitted. If the commit.Author is omitted, it will be filled in with
-// the authenticated user’s information and the current date.
-//
-// GitHub API docs: https://developer.github.com/v3/git/commits/#create-a-commit
-func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit) (*Commit, *Response, error) {
- if commit == nil {
- return nil, nil, fmt.Errorf("commit must be provided")
- }
-
- u := fmt.Sprintf("repos/%v/%v/git/commits", owner, repo)
-
- parents := make([]string, len(commit.Parents))
- for i, parent := range commit.Parents {
- parents[i] = *parent.SHA
- }
-
- body := &createCommit{
- Author: commit.Author,
- Committer: commit.Committer,
- Message: commit.Message,
- Parents: parents,
- }
- if commit.Tree != nil {
- body.Tree = commit.Tree.SHA
- }
-
- req, err := s.client.NewRequest("POST", u, body)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- c := new(Commit)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/git_refs.go b/vendor/github.com/google/go-github/github/git_refs.go
deleted file mode 100644
index 0947d866..00000000
--- a/vendor/github.com/google/go-github/github/git_refs.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "strings"
-)
-
-// Reference represents a GitHub reference.
-type Reference struct {
- Ref *string `json:"ref"`
- URL *string `json:"url"`
- Object *GitObject `json:"object"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-func (r Reference) String() string {
- return Stringify(r)
-}
-
-// GitObject represents a Git object.
-type GitObject struct {
- Type *string `json:"type"`
- SHA *string `json:"sha"`
- URL *string `json:"url"`
-}
-
-func (o GitObject) String() string {
- return Stringify(o)
-}
-
-// createRefRequest represents the payload for creating a reference.
-type createRefRequest struct {
- Ref *string `json:"ref"`
- SHA *string `json:"sha"`
-}
-
-// updateRefRequest represents the payload for updating a reference.
-type updateRefRequest struct {
- SHA *string `json:"sha"`
- Force *bool `json:"force"`
-}
-
-// GetRef fetches a single Reference object for a given Git ref.
-// If there is no exact match, GetRef will return an error.
-//
-// Note: The GitHub API can return multiple matches.
-// If you wish to use this functionality please use the GetRefs() method.
-//
-// GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference
-func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) {
- ref = strings.TrimPrefix(ref, "refs/")
- u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- r := new(Reference)
- resp, err := s.client.Do(ctx, req, r)
- if _, ok := err.(*json.UnmarshalTypeError); ok {
- // Multiple refs, means there wasn't an exact match.
- return nil, resp, errors.New("no exact match found for this ref")
- } else if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// GetRefs fetches a slice of Reference objects for a given Git ref.
-// If there is an exact match, only that ref is returned.
-// If there is no exact match, GitHub returns all refs that start with ref.
-// If returned error is nil, there will be at least 1 ref returned.
-// For example:
-//
-// "heads/featureA" -> ["refs/heads/featureA"] // Exact match, single ref is returned.
-// "heads/feature" -> ["refs/heads/featureA", "refs/heads/featureB"] // All refs that start with ref.
-// "heads/notexist" -> [] // Returns an error.
-//
-// GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference
-func (s *GitService) GetRefs(ctx context.Context, owner string, repo string, ref string) ([]*Reference, *Response, error) {
- ref = strings.TrimPrefix(ref, "refs/")
- u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var rawJSON json.RawMessage
- resp, err := s.client.Do(ctx, req, &rawJSON)
- if err != nil {
- return nil, resp, err
- }
-
- // Prioritize the most common case: a single returned ref.
- r := new(Reference)
- singleUnmarshalError := json.Unmarshal(rawJSON, r)
- if singleUnmarshalError == nil {
- return []*Reference{r}, resp, nil
- }
-
- // Attempt to unmarshal multiple refs.
- var rs []*Reference
- multipleUnmarshalError := json.Unmarshal(rawJSON, &rs)
- if multipleUnmarshalError == nil {
- if len(rs) == 0 {
- return nil, resp, fmt.Errorf("unexpected response from GitHub API: an array of refs with length 0")
- }
- return rs, resp, nil
- }
-
- return nil, resp, fmt.Errorf("unmarshalling failed for both single and multiple refs: %s and %s", singleUnmarshalError, multipleUnmarshalError)
-}
-
-// ReferenceListOptions specifies optional parameters to the
-// GitService.ListRefs method.
-type ReferenceListOptions struct {
- Type string `url:"-"`
-
- ListOptions
-}
-
-// ListRefs lists all refs in a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/git/refs/#get-all-references
-func (s *GitService) ListRefs(ctx context.Context, owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) {
- var u string
- if opt != nil && opt.Type != "" {
- u = fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, opt.Type)
- } else {
- u = fmt.Sprintf("repos/%v/%v/git/refs", owner, repo)
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var rs []*Reference
- resp, err := s.client.Do(ctx, req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, nil
-}
-
-// CreateRef creates a new ref in a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/git/refs/#create-a-reference
-func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo)
- req, err := s.client.NewRequest("POST", u, &createRefRequest{
- // back-compat with previous behavior that didn't require 'refs/' prefix
- Ref: String("refs/" + strings.TrimPrefix(*ref.Ref, "refs/")),
- SHA: ref.Object.SHA,
- })
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- r := new(Reference)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// UpdateRef updates an existing ref in a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/git/refs/#update-a-reference
-func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
- refPath := strings.TrimPrefix(*ref.Ref, "refs/")
- u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refPath)
- req, err := s.client.NewRequest("PATCH", u, &updateRefRequest{
- SHA: ref.Object.SHA,
- Force: &force,
- })
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- r := new(Reference)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// DeleteRef deletes a ref from a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/git/refs/#delete-a-reference
-func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) {
- ref = strings.TrimPrefix(ref, "refs/")
- u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/git_tags.go b/vendor/github.com/google/go-github/github/git_tags.go
deleted file mode 100644
index f3822ffa..00000000
--- a/vendor/github.com/google/go-github/github/git_tags.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "strings"
-)
-
-// Tag represents a tag object.
-type Tag struct {
- Tag *string `json:"tag,omitempty"`
- SHA *string `json:"sha,omitempty"`
- URL *string `json:"url,omitempty"`
- Message *string `json:"message,omitempty"`
- Tagger *CommitAuthor `json:"tagger,omitempty"`
- Object *GitObject `json:"object,omitempty"`
- Verification *SignatureVerification `json:"verification,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-// createTagRequest represents the body of a CreateTag request. This is mostly
-// identical to Tag with the exception that the object SHA and Type are
-// top-level fields, rather than being nested inside a JSON object.
-type createTagRequest struct {
- Tag *string `json:"tag,omitempty"`
- Message *string `json:"message,omitempty"`
- Object *string `json:"object,omitempty"`
- Type *string `json:"type,omitempty"`
- Tagger *CommitAuthor `json:"tagger,omitempty"`
-}
-
-// GetTag fetchs a tag from a repo given a SHA.
-//
-// GitHub API docs: https://developer.github.com/v3/git/tags/#get-a-tag
-func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeGitSigningPreview, mediaTypeGraphQLNodeIDPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- tag := new(Tag)
- resp, err := s.client.Do(ctx, req, tag)
- return tag, resp, err
-}
-
-// CreateTag creates a tag object.
-//
-// GitHub API docs: https://developer.github.com/v3/git/tags/#create-a-tag-object
-func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo)
-
- // convert Tag into a createTagRequest
- tagRequest := &createTagRequest{
- Tag: tag.Tag,
- Message: tag.Message,
- Tagger: tag.Tagger,
- }
- if tag.Object != nil {
- tagRequest.Object = tag.Object.SHA
- tagRequest.Type = tag.Object.Type
- }
-
- req, err := s.client.NewRequest("POST", u, tagRequest)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- t := new(Tag)
- resp, err := s.client.Do(ctx, req, t)
- return t, resp, err
-}
diff --git a/vendor/github.com/google/go-github/github/git_trees.go b/vendor/github.com/google/go-github/github/git_trees.go
deleted file mode 100644
index 4d6809a8..00000000
--- a/vendor/github.com/google/go-github/github/git_trees.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Tree represents a GitHub tree.
-type Tree struct {
- SHA *string `json:"sha,omitempty"`
- Entries []TreeEntry `json:"tree,omitempty"`
-}
-
-func (t Tree) String() string {
- return Stringify(t)
-}
-
-// TreeEntry represents the contents of a tree structure. TreeEntry can
-// represent either a blob, a commit (in the case of a submodule), or another
-// tree.
-type TreeEntry struct {
- SHA *string `json:"sha,omitempty"`
- Path *string `json:"path,omitempty"`
- Mode *string `json:"mode,omitempty"`
- Type *string `json:"type,omitempty"`
- Size *int `json:"size,omitempty"`
- Content *string `json:"content,omitempty"`
- URL *string `json:"url,omitempty"`
-}
-
-func (t TreeEntry) String() string {
- return Stringify(t)
-}
-
-// GetTree fetches the Tree object for a given sha hash from a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/git/trees/#get-a-tree
-func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha)
- if recursive {
- u += "?recursive=1"
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(Tree)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, nil
-}
-
-// createTree represents the body of a CreateTree request.
-type createTree struct {
- BaseTree string `json:"base_tree,omitempty"`
- Entries []TreeEntry `json:"tree"`
-}
-
-// CreateTree creates a new tree in a repository. If both a tree and a nested
-// path modifying that tree are specified, it will overwrite the contents of
-// that tree with the new path contents and write a new tree out.
-//
-// GitHub API docs: https://developer.github.com/v3/git/trees/#create-a-tree
-func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo)
-
- body := &createTree{
- BaseTree: baseTree,
- Entries: entries,
- }
- req, err := s.client.NewRequest("POST", u, body)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(Tree)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/github-accessors.go b/vendor/github.com/google/go-github/github/github-accessors.go
deleted file mode 100644
index 30b76739..00000000
--- a/vendor/github.com/google/go-github/github/github-accessors.go
+++ /dev/null
@@ -1,10429 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Code generated by gen-accessors; DO NOT EDIT.
-
-package github
-
-import (
- "encoding/json"
- "time"
-)
-
-// GetRetryAfter returns the RetryAfter field if it's non-nil, zero value otherwise.
-func (a *AbuseRateLimitError) GetRetryAfter() time.Duration {
- if a == nil || a.RetryAfter == nil {
- return 0
- }
- return *a.RetryAfter
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (a *AdminEnforcement) GetURL() string {
- if a == nil || a.URL == nil {
- return ""
- }
- return *a.URL
-}
-
-// GetComments returns the Comments field.
-func (a *AdminStats) GetComments() *CommentStats {
- if a == nil {
- return nil
- }
- return a.Comments
-}
-
-// GetGists returns the Gists field.
-func (a *AdminStats) GetGists() *GistStats {
- if a == nil {
- return nil
- }
- return a.Gists
-}
-
-// GetHooks returns the Hooks field.
-func (a *AdminStats) GetHooks() *HookStats {
- if a == nil {
- return nil
- }
- return a.Hooks
-}
-
-// GetIssues returns the Issues field.
-func (a *AdminStats) GetIssues() *IssueStats {
- if a == nil {
- return nil
- }
- return a.Issues
-}
-
-// GetMilestones returns the Milestones field.
-func (a *AdminStats) GetMilestones() *MilestoneStats {
- if a == nil {
- return nil
- }
- return a.Milestones
-}
-
-// GetOrgs returns the Orgs field.
-func (a *AdminStats) GetOrgs() *OrgStats {
- if a == nil {
- return nil
- }
- return a.Orgs
-}
-
-// GetPages returns the Pages field.
-func (a *AdminStats) GetPages() *PageStats {
- if a == nil {
- return nil
- }
- return a.Pages
-}
-
-// GetPulls returns the Pulls field.
-func (a *AdminStats) GetPulls() *PullStats {
- if a == nil {
- return nil
- }
- return a.Pulls
-}
-
-// GetRepos returns the Repos field.
-func (a *AdminStats) GetRepos() *RepoStats {
- if a == nil {
- return nil
- }
- return a.Repos
-}
-
-// GetUsers returns the Users field.
-func (a *AdminStats) GetUsers() *UserStats {
- if a == nil {
- return nil
- }
- return a.Users
-}
-
-// GetVerifiablePasswordAuthentication returns the VerifiablePasswordAuthentication field if it's non-nil, zero value otherwise.
-func (a *APIMeta) GetVerifiablePasswordAuthentication() bool {
- if a == nil || a.VerifiablePasswordAuthentication == nil {
- return false
- }
- return *a.VerifiablePasswordAuthentication
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (a *App) GetCreatedAt() time.Time {
- if a == nil || a.CreatedAt == nil {
- return time.Time{}
- }
- return *a.CreatedAt
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (a *App) GetDescription() string {
- if a == nil || a.Description == nil {
- return ""
- }
- return *a.Description
-}
-
-// GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise.
-func (a *App) GetExternalURL() string {
- if a == nil || a.ExternalURL == nil {
- return ""
- }
- return *a.ExternalURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (a *App) GetHTMLURL() string {
- if a == nil || a.HTMLURL == nil {
- return ""
- }
- return *a.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (a *App) GetID() int64 {
- if a == nil || a.ID == nil {
- return 0
- }
- return *a.ID
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (a *App) GetName() string {
- if a == nil || a.Name == nil {
- return ""
- }
- return *a.Name
-}
-
-// GetOwner returns the Owner field.
-func (a *App) GetOwner() *User {
- if a == nil {
- return nil
- }
- return a.Owner
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (a *App) GetUpdatedAt() time.Time {
- if a == nil || a.UpdatedAt == nil {
- return time.Time{}
- }
- return *a.UpdatedAt
-}
-
-// GetApp returns the App field.
-func (a *Authorization) GetApp() *AuthorizationApp {
- if a == nil {
- return nil
- }
- return a.App
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetCreatedAt() Timestamp {
- if a == nil || a.CreatedAt == nil {
- return Timestamp{}
- }
- return *a.CreatedAt
-}
-
-// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetFingerprint() string {
- if a == nil || a.Fingerprint == nil {
- return ""
- }
- return *a.Fingerprint
-}
-
-// GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetHashedToken() string {
- if a == nil || a.HashedToken == nil {
- return ""
- }
- return *a.HashedToken
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetID() int64 {
- if a == nil || a.ID == nil {
- return 0
- }
- return *a.ID
-}
-
-// GetNote returns the Note field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetNote() string {
- if a == nil || a.Note == nil {
- return ""
- }
- return *a.Note
-}
-
-// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetNoteURL() string {
- if a == nil || a.NoteURL == nil {
- return ""
- }
- return *a.NoteURL
-}
-
-// GetToken returns the Token field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetToken() string {
- if a == nil || a.Token == nil {
- return ""
- }
- return *a.Token
-}
-
-// GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetTokenLastEight() string {
- if a == nil || a.TokenLastEight == nil {
- return ""
- }
- return *a.TokenLastEight
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetUpdatedAt() Timestamp {
- if a == nil || a.UpdatedAt == nil {
- return Timestamp{}
- }
- return *a.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (a *Authorization) GetURL() string {
- if a == nil || a.URL == nil {
- return ""
- }
- return *a.URL
-}
-
-// GetUser returns the User field.
-func (a *Authorization) GetUser() *User {
- if a == nil {
- return nil
- }
- return a.User
-}
-
-// GetClientID returns the ClientID field if it's non-nil, zero value otherwise.
-func (a *AuthorizationApp) GetClientID() string {
- if a == nil || a.ClientID == nil {
- return ""
- }
- return *a.ClientID
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (a *AuthorizationApp) GetName() string {
- if a == nil || a.Name == nil {
- return ""
- }
- return *a.Name
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (a *AuthorizationApp) GetURL() string {
- if a == nil || a.URL == nil {
- return ""
- }
- return *a.URL
-}
-
-// GetClientID returns the ClientID field if it's non-nil, zero value otherwise.
-func (a *AuthorizationRequest) GetClientID() string {
- if a == nil || a.ClientID == nil {
- return ""
- }
- return *a.ClientID
-}
-
-// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise.
-func (a *AuthorizationRequest) GetClientSecret() string {
- if a == nil || a.ClientSecret == nil {
- return ""
- }
- return *a.ClientSecret
-}
-
-// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.
-func (a *AuthorizationRequest) GetFingerprint() string {
- if a == nil || a.Fingerprint == nil {
- return ""
- }
- return *a.Fingerprint
-}
-
-// GetNote returns the Note field if it's non-nil, zero value otherwise.
-func (a *AuthorizationRequest) GetNote() string {
- if a == nil || a.Note == nil {
- return ""
- }
- return *a.Note
-}
-
-// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.
-func (a *AuthorizationRequest) GetNoteURL() string {
- if a == nil || a.NoteURL == nil {
- return ""
- }
- return *a.NoteURL
-}
-
-// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.
-func (a *AuthorizationUpdateRequest) GetFingerprint() string {
- if a == nil || a.Fingerprint == nil {
- return ""
- }
- return *a.Fingerprint
-}
-
-// GetNote returns the Note field if it's non-nil, zero value otherwise.
-func (a *AuthorizationUpdateRequest) GetNote() string {
- if a == nil || a.Note == nil {
- return ""
- }
- return *a.Note
-}
-
-// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.
-func (a *AuthorizationUpdateRequest) GetNoteURL() string {
- if a == nil || a.NoteURL == nil {
- return ""
- }
- return *a.NoteURL
-}
-
-// GetContent returns the Content field if it's non-nil, zero value otherwise.
-func (b *Blob) GetContent() string {
- if b == nil || b.Content == nil {
- return ""
- }
- return *b.Content
-}
-
-// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise.
-func (b *Blob) GetEncoding() string {
- if b == nil || b.Encoding == nil {
- return ""
- }
- return *b.Encoding
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (b *Blob) GetNodeID() string {
- if b == nil || b.NodeID == nil {
- return ""
- }
- return *b.NodeID
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (b *Blob) GetSHA() string {
- if b == nil || b.SHA == nil {
- return ""
- }
- return *b.SHA
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (b *Blob) GetSize() int {
- if b == nil || b.Size == nil {
- return 0
- }
- return *b.Size
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (b *Blob) GetURL() string {
- if b == nil || b.URL == nil {
- return ""
- }
- return *b.URL
-}
-
-// GetCommit returns the Commit field.
-func (b *Branch) GetCommit() *RepositoryCommit {
- if b == nil {
- return nil
- }
- return b.Commit
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (b *Branch) GetName() string {
- if b == nil || b.Name == nil {
- return ""
- }
- return *b.Name
-}
-
-// GetProtected returns the Protected field if it's non-nil, zero value otherwise.
-func (b *Branch) GetProtected() bool {
- if b == nil || b.Protected == nil {
- return false
- }
- return *b.Protected
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (c *CodeOfConduct) GetBody() string {
- if c == nil || c.Body == nil {
- return ""
- }
- return *c.Body
-}
-
-// GetKey returns the Key field if it's non-nil, zero value otherwise.
-func (c *CodeOfConduct) GetKey() string {
- if c == nil || c.Key == nil {
- return ""
- }
- return *c.Key
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (c *CodeOfConduct) GetName() string {
- if c == nil || c.Name == nil {
- return ""
- }
- return *c.Name
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (c *CodeOfConduct) GetURL() string {
- if c == nil || c.URL == nil {
- return ""
- }
- return *c.URL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (c *CodeResult) GetHTMLURL() string {
- if c == nil || c.HTMLURL == nil {
- return ""
- }
- return *c.HTMLURL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (c *CodeResult) GetName() string {
- if c == nil || c.Name == nil {
- return ""
- }
- return *c.Name
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (c *CodeResult) GetPath() string {
- if c == nil || c.Path == nil {
- return ""
- }
- return *c.Path
-}
-
-// GetRepository returns the Repository field.
-func (c *CodeResult) GetRepository() *Repository {
- if c == nil {
- return nil
- }
- return c.Repository
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (c *CodeResult) GetSHA() string {
- if c == nil || c.SHA == nil {
- return ""
- }
- return *c.SHA
-}
-
-// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
-func (c *CodeSearchResult) GetIncompleteResults() bool {
- if c == nil || c.IncompleteResults == nil {
- return false
- }
- return *c.IncompleteResults
-}
-
-// GetTotal returns the Total field if it's non-nil, zero value otherwise.
-func (c *CodeSearchResult) GetTotal() int {
- if c == nil || c.Total == nil {
- return 0
- }
- return *c.Total
-}
-
-// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise.
-func (c *CombinedStatus) GetCommitURL() string {
- if c == nil || c.CommitURL == nil {
- return ""
- }
- return *c.CommitURL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (c *CombinedStatus) GetName() string {
- if c == nil || c.Name == nil {
- return ""
- }
- return *c.Name
-}
-
-// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
-func (c *CombinedStatus) GetRepositoryURL() string {
- if c == nil || c.RepositoryURL == nil {
- return ""
- }
- return *c.RepositoryURL
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (c *CombinedStatus) GetSHA() string {
- if c == nil || c.SHA == nil {
- return ""
- }
- return *c.SHA
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (c *CombinedStatus) GetState() string {
- if c == nil || c.State == nil {
- return ""
- }
- return *c.State
-}
-
-// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
-func (c *CombinedStatus) GetTotalCount() int {
- if c == nil || c.TotalCount == nil {
- return 0
- }
- return *c.TotalCount
-}
-
-// GetTotalCommitComments returns the TotalCommitComments field if it's non-nil, zero value otherwise.
-func (c *CommentStats) GetTotalCommitComments() int {
- if c == nil || c.TotalCommitComments == nil {
- return 0
- }
- return *c.TotalCommitComments
-}
-
-// GetTotalGistComments returns the TotalGistComments field if it's non-nil, zero value otherwise.
-func (c *CommentStats) GetTotalGistComments() int {
- if c == nil || c.TotalGistComments == nil {
- return 0
- }
- return *c.TotalGistComments
-}
-
-// GetTotalIssueComments returns the TotalIssueComments field if it's non-nil, zero value otherwise.
-func (c *CommentStats) GetTotalIssueComments() int {
- if c == nil || c.TotalIssueComments == nil {
- return 0
- }
- return *c.TotalIssueComments
-}
-
-// GetTotalPullRequestComments returns the TotalPullRequestComments field if it's non-nil, zero value otherwise.
-func (c *CommentStats) GetTotalPullRequestComments() int {
- if c == nil || c.TotalPullRequestComments == nil {
- return 0
- }
- return *c.TotalPullRequestComments
-}
-
-// GetAuthor returns the Author field.
-func (c *Commit) GetAuthor() *CommitAuthor {
- if c == nil {
- return nil
- }
- return c.Author
-}
-
-// GetCommentCount returns the CommentCount field if it's non-nil, zero value otherwise.
-func (c *Commit) GetCommentCount() int {
- if c == nil || c.CommentCount == nil {
- return 0
- }
- return *c.CommentCount
-}
-
-// GetCommitter returns the Committer field.
-func (c *Commit) GetCommitter() *CommitAuthor {
- if c == nil {
- return nil
- }
- return c.Committer
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (c *Commit) GetHTMLURL() string {
- if c == nil || c.HTMLURL == nil {
- return ""
- }
- return *c.HTMLURL
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (c *Commit) GetMessage() string {
- if c == nil || c.Message == nil {
- return ""
- }
- return *c.Message
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (c *Commit) GetNodeID() string {
- if c == nil || c.NodeID == nil {
- return ""
- }
- return *c.NodeID
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (c *Commit) GetSHA() string {
- if c == nil || c.SHA == nil {
- return ""
- }
- return *c.SHA
-}
-
-// GetStats returns the Stats field.
-func (c *Commit) GetStats() *CommitStats {
- if c == nil {
- return nil
- }
- return c.Stats
-}
-
-// GetTree returns the Tree field.
-func (c *Commit) GetTree() *Tree {
- if c == nil {
- return nil
- }
- return c.Tree
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (c *Commit) GetURL() string {
- if c == nil || c.URL == nil {
- return ""
- }
- return *c.URL
-}
-
-// GetVerification returns the Verification field.
-func (c *Commit) GetVerification() *SignatureVerification {
- if c == nil {
- return nil
- }
- return c.Verification
-}
-
-// GetDate returns the Date field if it's non-nil, zero value otherwise.
-func (c *CommitAuthor) GetDate() time.Time {
- if c == nil || c.Date == nil {
- return time.Time{}
- }
- return *c.Date
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (c *CommitAuthor) GetEmail() string {
- if c == nil || c.Email == nil {
- return ""
- }
- return *c.Email
-}
-
-// GetLogin returns the Login field if it's non-nil, zero value otherwise.
-func (c *CommitAuthor) GetLogin() string {
- if c == nil || c.Login == nil {
- return ""
- }
- return *c.Login
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (c *CommitAuthor) GetName() string {
- if c == nil || c.Name == nil {
- return ""
- }
- return *c.Name
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (c *CommitCommentEvent) GetAction() string {
- if c == nil || c.Action == nil {
- return ""
- }
- return *c.Action
-}
-
-// GetComment returns the Comment field.
-func (c *CommitCommentEvent) GetComment() *RepositoryComment {
- if c == nil {
- return nil
- }
- return c.Comment
-}
-
-// GetInstallation returns the Installation field.
-func (c *CommitCommentEvent) GetInstallation() *Installation {
- if c == nil {
- return nil
- }
- return c.Installation
-}
-
-// GetRepo returns the Repo field.
-func (c *CommitCommentEvent) GetRepo() *Repository {
- if c == nil {
- return nil
- }
- return c.Repo
-}
-
-// GetSender returns the Sender field.
-func (c *CommitCommentEvent) GetSender() *User {
- if c == nil {
- return nil
- }
- return c.Sender
-}
-
-// GetAdditions returns the Additions field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetAdditions() int {
- if c == nil || c.Additions == nil {
- return 0
- }
- return *c.Additions
-}
-
-// GetBlobURL returns the BlobURL field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetBlobURL() string {
- if c == nil || c.BlobURL == nil {
- return ""
- }
- return *c.BlobURL
-}
-
-// GetChanges returns the Changes field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetChanges() int {
- if c == nil || c.Changes == nil {
- return 0
- }
- return *c.Changes
-}
-
-// GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetContentsURL() string {
- if c == nil || c.ContentsURL == nil {
- return ""
- }
- return *c.ContentsURL
-}
-
-// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetDeletions() int {
- if c == nil || c.Deletions == nil {
- return 0
- }
- return *c.Deletions
-}
-
-// GetFilename returns the Filename field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetFilename() string {
- if c == nil || c.Filename == nil {
- return ""
- }
- return *c.Filename
-}
-
-// GetPatch returns the Patch field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetPatch() string {
- if c == nil || c.Patch == nil {
- return ""
- }
- return *c.Patch
-}
-
-// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetRawURL() string {
- if c == nil || c.RawURL == nil {
- return ""
- }
- return *c.RawURL
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetSHA() string {
- if c == nil || c.SHA == nil {
- return ""
- }
- return *c.SHA
-}
-
-// GetStatus returns the Status field if it's non-nil, zero value otherwise.
-func (c *CommitFile) GetStatus() string {
- if c == nil || c.Status == nil {
- return ""
- }
- return *c.Status
-}
-
-// GetAuthor returns the Author field.
-func (c *CommitResult) GetAuthor() *User {
- if c == nil {
- return nil
- }
- return c.Author
-}
-
-// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise.
-func (c *CommitResult) GetCommentsURL() string {
- if c == nil || c.CommentsURL == nil {
- return ""
- }
- return *c.CommentsURL
-}
-
-// GetCommit returns the Commit field.
-func (c *CommitResult) GetCommit() *Commit {
- if c == nil {
- return nil
- }
- return c.Commit
-}
-
-// GetCommitter returns the Committer field.
-func (c *CommitResult) GetCommitter() *User {
- if c == nil {
- return nil
- }
- return c.Committer
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (c *CommitResult) GetHTMLURL() string {
- if c == nil || c.HTMLURL == nil {
- return ""
- }
- return *c.HTMLURL
-}
-
-// GetRepository returns the Repository field.
-func (c *CommitResult) GetRepository() *Repository {
- if c == nil {
- return nil
- }
- return c.Repository
-}
-
-// GetScore returns the Score field.
-func (c *CommitResult) GetScore() *float64 {
- if c == nil {
- return nil
- }
- return c.Score
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (c *CommitResult) GetSHA() string {
- if c == nil || c.SHA == nil {
- return ""
- }
- return *c.SHA
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (c *CommitResult) GetURL() string {
- if c == nil || c.URL == nil {
- return ""
- }
- return *c.URL
-}
-
-// GetAheadBy returns the AheadBy field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetAheadBy() int {
- if c == nil || c.AheadBy == nil {
- return 0
- }
- return *c.AheadBy
-}
-
-// GetBaseCommit returns the BaseCommit field.
-func (c *CommitsComparison) GetBaseCommit() *RepositoryCommit {
- if c == nil {
- return nil
- }
- return c.BaseCommit
-}
-
-// GetBehindBy returns the BehindBy field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetBehindBy() int {
- if c == nil || c.BehindBy == nil {
- return 0
- }
- return *c.BehindBy
-}
-
-// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetDiffURL() string {
- if c == nil || c.DiffURL == nil {
- return ""
- }
- return *c.DiffURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetHTMLURL() string {
- if c == nil || c.HTMLURL == nil {
- return ""
- }
- return *c.HTMLURL
-}
-
-// GetMergeBaseCommit returns the MergeBaseCommit field.
-func (c *CommitsComparison) GetMergeBaseCommit() *RepositoryCommit {
- if c == nil {
- return nil
- }
- return c.MergeBaseCommit
-}
-
-// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetPatchURL() string {
- if c == nil || c.PatchURL == nil {
- return ""
- }
- return *c.PatchURL
-}
-
-// GetPermalinkURL returns the PermalinkURL field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetPermalinkURL() string {
- if c == nil || c.PermalinkURL == nil {
- return ""
- }
- return *c.PermalinkURL
-}
-
-// GetStatus returns the Status field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetStatus() string {
- if c == nil || c.Status == nil {
- return ""
- }
- return *c.Status
-}
-
-// GetTotalCommits returns the TotalCommits field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetTotalCommits() int {
- if c == nil || c.TotalCommits == nil {
- return 0
- }
- return *c.TotalCommits
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (c *CommitsComparison) GetURL() string {
- if c == nil || c.URL == nil {
- return ""
- }
- return *c.URL
-}
-
-// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
-func (c *CommitsSearchResult) GetIncompleteResults() bool {
- if c == nil || c.IncompleteResults == nil {
- return false
- }
- return *c.IncompleteResults
-}
-
-// GetTotal returns the Total field if it's non-nil, zero value otherwise.
-func (c *CommitsSearchResult) GetTotal() int {
- if c == nil || c.Total == nil {
- return 0
- }
- return *c.Total
-}
-
-// GetAdditions returns the Additions field if it's non-nil, zero value otherwise.
-func (c *CommitStats) GetAdditions() int {
- if c == nil || c.Additions == nil {
- return 0
- }
- return *c.Additions
-}
-
-// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise.
-func (c *CommitStats) GetDeletions() int {
- if c == nil || c.Deletions == nil {
- return 0
- }
- return *c.Deletions
-}
-
-// GetTotal returns the Total field if it's non-nil, zero value otherwise.
-func (c *CommitStats) GetTotal() int {
- if c == nil || c.Total == nil {
- return 0
- }
- return *c.Total
-}
-
-// GetCodeOfConduct returns the CodeOfConduct field.
-func (c *CommunityHealthFiles) GetCodeOfConduct() *Metric {
- if c == nil {
- return nil
- }
- return c.CodeOfConduct
-}
-
-// GetContributing returns the Contributing field.
-func (c *CommunityHealthFiles) GetContributing() *Metric {
- if c == nil {
- return nil
- }
- return c.Contributing
-}
-
-// GetLicense returns the License field.
-func (c *CommunityHealthFiles) GetLicense() *Metric {
- if c == nil {
- return nil
- }
- return c.License
-}
-
-// GetReadme returns the Readme field.
-func (c *CommunityHealthFiles) GetReadme() *Metric {
- if c == nil {
- return nil
- }
- return c.Readme
-}
-
-// GetFiles returns the Files field.
-func (c *CommunityHealthMetrics) GetFiles() *CommunityHealthFiles {
- if c == nil {
- return nil
- }
- return c.Files
-}
-
-// GetHealthPercentage returns the HealthPercentage field if it's non-nil, zero value otherwise.
-func (c *CommunityHealthMetrics) GetHealthPercentage() int {
- if c == nil || c.HealthPercentage == nil {
- return 0
- }
- return *c.HealthPercentage
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (c *CommunityHealthMetrics) GetUpdatedAt() time.Time {
- if c == nil || c.UpdatedAt == nil {
- return time.Time{}
- }
- return *c.UpdatedAt
-}
-
-// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetAvatarURL() string {
- if c == nil || c.AvatarURL == nil {
- return ""
- }
- return *c.AvatarURL
-}
-
-// GetContributions returns the Contributions field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetContributions() int {
- if c == nil || c.Contributions == nil {
- return 0
- }
- return *c.Contributions
-}
-
-// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetEventsURL() string {
- if c == nil || c.EventsURL == nil {
- return ""
- }
- return *c.EventsURL
-}
-
-// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetFollowersURL() string {
- if c == nil || c.FollowersURL == nil {
- return ""
- }
- return *c.FollowersURL
-}
-
-// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetFollowingURL() string {
- if c == nil || c.FollowingURL == nil {
- return ""
- }
- return *c.FollowingURL
-}
-
-// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetGistsURL() string {
- if c == nil || c.GistsURL == nil {
- return ""
- }
- return *c.GistsURL
-}
-
-// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetGravatarID() string {
- if c == nil || c.GravatarID == nil {
- return ""
- }
- return *c.GravatarID
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetHTMLURL() string {
- if c == nil || c.HTMLURL == nil {
- return ""
- }
- return *c.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetID() int64 {
- if c == nil || c.ID == nil {
- return 0
- }
- return *c.ID
-}
-
-// GetLogin returns the Login field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetLogin() string {
- if c == nil || c.Login == nil {
- return ""
- }
- return *c.Login
-}
-
-// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetOrganizationsURL() string {
- if c == nil || c.OrganizationsURL == nil {
- return ""
- }
- return *c.OrganizationsURL
-}
-
-// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetReceivedEventsURL() string {
- if c == nil || c.ReceivedEventsURL == nil {
- return ""
- }
- return *c.ReceivedEventsURL
-}
-
-// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetReposURL() string {
- if c == nil || c.ReposURL == nil {
- return ""
- }
- return *c.ReposURL
-}
-
-// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetSiteAdmin() bool {
- if c == nil || c.SiteAdmin == nil {
- return false
- }
- return *c.SiteAdmin
-}
-
-// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetStarredURL() string {
- if c == nil || c.StarredURL == nil {
- return ""
- }
- return *c.StarredURL
-}
-
-// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetSubscriptionsURL() string {
- if c == nil || c.SubscriptionsURL == nil {
- return ""
- }
- return *c.SubscriptionsURL
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetType() string {
- if c == nil || c.Type == nil {
- return ""
- }
- return *c.Type
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (c *Contributor) GetURL() string {
- if c == nil || c.URL == nil {
- return ""
- }
- return *c.URL
-}
-
-// GetAuthor returns the Author field.
-func (c *ContributorStats) GetAuthor() *Contributor {
- if c == nil {
- return nil
- }
- return c.Author
-}
-
-// GetTotal returns the Total field if it's non-nil, zero value otherwise.
-func (c *ContributorStats) GetTotal() int {
- if c == nil || c.Total == nil {
- return 0
- }
- return *c.Total
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (c *CreateEvent) GetDescription() string {
- if c == nil || c.Description == nil {
- return ""
- }
- return *c.Description
-}
-
-// GetInstallation returns the Installation field.
-func (c *CreateEvent) GetInstallation() *Installation {
- if c == nil {
- return nil
- }
- return c.Installation
-}
-
-// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise.
-func (c *CreateEvent) GetMasterBranch() string {
- if c == nil || c.MasterBranch == nil {
- return ""
- }
- return *c.MasterBranch
-}
-
-// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise.
-func (c *CreateEvent) GetPusherType() string {
- if c == nil || c.PusherType == nil {
- return ""
- }
- return *c.PusherType
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (c *CreateEvent) GetRef() string {
- if c == nil || c.Ref == nil {
- return ""
- }
- return *c.Ref
-}
-
-// GetRefType returns the RefType field if it's non-nil, zero value otherwise.
-func (c *CreateEvent) GetRefType() string {
- if c == nil || c.RefType == nil {
- return ""
- }
- return *c.RefType
-}
-
-// GetRepo returns the Repo field.
-func (c *CreateEvent) GetRepo() *Repository {
- if c == nil {
- return nil
- }
- return c.Repo
-}
-
-// GetSender returns the Sender field.
-func (c *CreateEvent) GetSender() *User {
- if c == nil {
- return nil
- }
- return c.Sender
-}
-
-// GetInstallation returns the Installation field.
-func (d *DeleteEvent) GetInstallation() *Installation {
- if d == nil {
- return nil
- }
- return d.Installation
-}
-
-// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise.
-func (d *DeleteEvent) GetPusherType() string {
- if d == nil || d.PusherType == nil {
- return ""
- }
- return *d.PusherType
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (d *DeleteEvent) GetRef() string {
- if d == nil || d.Ref == nil {
- return ""
- }
- return *d.Ref
-}
-
-// GetRefType returns the RefType field if it's non-nil, zero value otherwise.
-func (d *DeleteEvent) GetRefType() string {
- if d == nil || d.RefType == nil {
- return ""
- }
- return *d.RefType
-}
-
-// GetRepo returns the Repo field.
-func (d *DeleteEvent) GetRepo() *Repository {
- if d == nil {
- return nil
- }
- return d.Repo
-}
-
-// GetSender returns the Sender field.
-func (d *DeleteEvent) GetSender() *User {
- if d == nil {
- return nil
- }
- return d.Sender
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetCreatedAt() Timestamp {
- if d == nil || d.CreatedAt == nil {
- return Timestamp{}
- }
- return *d.CreatedAt
-}
-
-// GetCreator returns the Creator field.
-func (d *Deployment) GetCreator() *User {
- if d == nil {
- return nil
- }
- return d.Creator
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetDescription() string {
- if d == nil || d.Description == nil {
- return ""
- }
- return *d.Description
-}
-
-// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetEnvironment() string {
- if d == nil || d.Environment == nil {
- return ""
- }
- return *d.Environment
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetID() int64 {
- if d == nil || d.ID == nil {
- return 0
- }
- return *d.ID
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetNodeID() string {
- if d == nil || d.NodeID == nil {
- return ""
- }
- return *d.NodeID
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetRef() string {
- if d == nil || d.Ref == nil {
- return ""
- }
- return *d.Ref
-}
-
-// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetRepositoryURL() string {
- if d == nil || d.RepositoryURL == nil {
- return ""
- }
- return *d.RepositoryURL
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetSHA() string {
- if d == nil || d.SHA == nil {
- return ""
- }
- return *d.SHA
-}
-
-// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetStatusesURL() string {
- if d == nil || d.StatusesURL == nil {
- return ""
- }
- return *d.StatusesURL
-}
-
-// GetTask returns the Task field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetTask() string {
- if d == nil || d.Task == nil {
- return ""
- }
- return *d.Task
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetUpdatedAt() Timestamp {
- if d == nil || d.UpdatedAt == nil {
- return Timestamp{}
- }
- return *d.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (d *Deployment) GetURL() string {
- if d == nil || d.URL == nil {
- return ""
- }
- return *d.URL
-}
-
-// GetDeployment returns the Deployment field.
-func (d *DeploymentEvent) GetDeployment() *Deployment {
- if d == nil {
- return nil
- }
- return d.Deployment
-}
-
-// GetInstallation returns the Installation field.
-func (d *DeploymentEvent) GetInstallation() *Installation {
- if d == nil {
- return nil
- }
- return d.Installation
-}
-
-// GetRepo returns the Repo field.
-func (d *DeploymentEvent) GetRepo() *Repository {
- if d == nil {
- return nil
- }
- return d.Repo
-}
-
-// GetSender returns the Sender field.
-func (d *DeploymentEvent) GetSender() *User {
- if d == nil {
- return nil
- }
- return d.Sender
-}
-
-// GetAutoMerge returns the AutoMerge field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetAutoMerge() bool {
- if d == nil || d.AutoMerge == nil {
- return false
- }
- return *d.AutoMerge
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetDescription() string {
- if d == nil || d.Description == nil {
- return ""
- }
- return *d.Description
-}
-
-// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetEnvironment() string {
- if d == nil || d.Environment == nil {
- return ""
- }
- return *d.Environment
-}
-
-// GetPayload returns the Payload field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetPayload() string {
- if d == nil || d.Payload == nil {
- return ""
- }
- return *d.Payload
-}
-
-// GetProductionEnvironment returns the ProductionEnvironment field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetProductionEnvironment() bool {
- if d == nil || d.ProductionEnvironment == nil {
- return false
- }
- return *d.ProductionEnvironment
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetRef() string {
- if d == nil || d.Ref == nil {
- return ""
- }
- return *d.Ref
-}
-
-// GetRequiredContexts returns the RequiredContexts field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetRequiredContexts() []string {
- if d == nil || d.RequiredContexts == nil {
- return nil
- }
- return *d.RequiredContexts
-}
-
-// GetTask returns the Task field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetTask() string {
- if d == nil || d.Task == nil {
- return ""
- }
- return *d.Task
-}
-
-// GetTransientEnvironment returns the TransientEnvironment field if it's non-nil, zero value otherwise.
-func (d *DeploymentRequest) GetTransientEnvironment() bool {
- if d == nil || d.TransientEnvironment == nil {
- return false
- }
- return *d.TransientEnvironment
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetCreatedAt() Timestamp {
- if d == nil || d.CreatedAt == nil {
- return Timestamp{}
- }
- return *d.CreatedAt
-}
-
-// GetCreator returns the Creator field.
-func (d *DeploymentStatus) GetCreator() *User {
- if d == nil {
- return nil
- }
- return d.Creator
-}
-
-// GetDeploymentURL returns the DeploymentURL field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetDeploymentURL() string {
- if d == nil || d.DeploymentURL == nil {
- return ""
- }
- return *d.DeploymentURL
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetDescription() string {
- if d == nil || d.Description == nil {
- return ""
- }
- return *d.Description
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetID() int64 {
- if d == nil || d.ID == nil {
- return 0
- }
- return *d.ID
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetNodeID() string {
- if d == nil || d.NodeID == nil {
- return ""
- }
- return *d.NodeID
-}
-
-// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetRepositoryURL() string {
- if d == nil || d.RepositoryURL == nil {
- return ""
- }
- return *d.RepositoryURL
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetState() string {
- if d == nil || d.State == nil {
- return ""
- }
- return *d.State
-}
-
-// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetTargetURL() string {
- if d == nil || d.TargetURL == nil {
- return ""
- }
- return *d.TargetURL
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatus) GetUpdatedAt() Timestamp {
- if d == nil || d.UpdatedAt == nil {
- return Timestamp{}
- }
- return *d.UpdatedAt
-}
-
-// GetDeployment returns the Deployment field.
-func (d *DeploymentStatusEvent) GetDeployment() *Deployment {
- if d == nil {
- return nil
- }
- return d.Deployment
-}
-
-// GetDeploymentStatus returns the DeploymentStatus field.
-func (d *DeploymentStatusEvent) GetDeploymentStatus() *DeploymentStatus {
- if d == nil {
- return nil
- }
- return d.DeploymentStatus
-}
-
-// GetInstallation returns the Installation field.
-func (d *DeploymentStatusEvent) GetInstallation() *Installation {
- if d == nil {
- return nil
- }
- return d.Installation
-}
-
-// GetRepo returns the Repo field.
-func (d *DeploymentStatusEvent) GetRepo() *Repository {
- if d == nil {
- return nil
- }
- return d.Repo
-}
-
-// GetSender returns the Sender field.
-func (d *DeploymentStatusEvent) GetSender() *User {
- if d == nil {
- return nil
- }
- return d.Sender
-}
-
-// GetAutoInactive returns the AutoInactive field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatusRequest) GetAutoInactive() bool {
- if d == nil || d.AutoInactive == nil {
- return false
- }
- return *d.AutoInactive
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatusRequest) GetDescription() string {
- if d == nil || d.Description == nil {
- return ""
- }
- return *d.Description
-}
-
-// GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatusRequest) GetEnvironmentURL() string {
- if d == nil || d.EnvironmentURL == nil {
- return ""
- }
- return *d.EnvironmentURL
-}
-
-// GetLogURL returns the LogURL field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatusRequest) GetLogURL() string {
- if d == nil || d.LogURL == nil {
- return ""
- }
- return *d.LogURL
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (d *DeploymentStatusRequest) GetState() string {
- if d == nil || d.State == nil {
- return ""
- }
- return *d.State
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (d *DraftReviewComment) GetBody() string {
- if d == nil || d.Body == nil {
- return ""
- }
- return *d.Body
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (d *DraftReviewComment) GetPath() string {
- if d == nil || d.Path == nil {
- return ""
- }
- return *d.Path
-}
-
-// GetPosition returns the Position field if it's non-nil, zero value otherwise.
-func (d *DraftReviewComment) GetPosition() int {
- if d == nil || d.Position == nil {
- return 0
- }
- return *d.Position
-}
-
-// GetActor returns the Actor field.
-func (e *Event) GetActor() *User {
- if e == nil {
- return nil
- }
- return e.Actor
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (e *Event) GetCreatedAt() time.Time {
- if e == nil || e.CreatedAt == nil {
- return time.Time{}
- }
- return *e.CreatedAt
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (e *Event) GetID() string {
- if e == nil || e.ID == nil {
- return ""
- }
- return *e.ID
-}
-
-// GetOrg returns the Org field.
-func (e *Event) GetOrg() *Organization {
- if e == nil {
- return nil
- }
- return e.Org
-}
-
-// GetPublic returns the Public field if it's non-nil, zero value otherwise.
-func (e *Event) GetPublic() bool {
- if e == nil || e.Public == nil {
- return false
- }
- return *e.Public
-}
-
-// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise.
-func (e *Event) GetRawPayload() json.RawMessage {
- if e == nil || e.RawPayload == nil {
- return json.RawMessage{}
- }
- return *e.RawPayload
-}
-
-// GetRepo returns the Repo field.
-func (e *Event) GetRepo() *Repository {
- if e == nil {
- return nil
- }
- return e.Repo
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (e *Event) GetType() string {
- if e == nil || e.Type == nil {
- return ""
- }
- return *e.Type
-}
-
-// GetHRef returns the HRef field if it's non-nil, zero value otherwise.
-func (f *FeedLink) GetHRef() string {
- if f == nil || f.HRef == nil {
- return ""
- }
- return *f.HRef
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (f *FeedLink) GetType() string {
- if f == nil || f.Type == nil {
- return ""
- }
- return *f.Type
-}
-
-// GetCurrentUserActorURL returns the CurrentUserActorURL field if it's non-nil, zero value otherwise.
-func (f *Feeds) GetCurrentUserActorURL() string {
- if f == nil || f.CurrentUserActorURL == nil {
- return ""
- }
- return *f.CurrentUserActorURL
-}
-
-// GetCurrentUserOrganizationURL returns the CurrentUserOrganizationURL field if it's non-nil, zero value otherwise.
-func (f *Feeds) GetCurrentUserOrganizationURL() string {
- if f == nil || f.CurrentUserOrganizationURL == nil {
- return ""
- }
- return *f.CurrentUserOrganizationURL
-}
-
-// GetCurrentUserPublicURL returns the CurrentUserPublicURL field if it's non-nil, zero value otherwise.
-func (f *Feeds) GetCurrentUserPublicURL() string {
- if f == nil || f.CurrentUserPublicURL == nil {
- return ""
- }
- return *f.CurrentUserPublicURL
-}
-
-// GetCurrentUserURL returns the CurrentUserURL field if it's non-nil, zero value otherwise.
-func (f *Feeds) GetCurrentUserURL() string {
- if f == nil || f.CurrentUserURL == nil {
- return ""
- }
- return *f.CurrentUserURL
-}
-
-// GetTimelineURL returns the TimelineURL field if it's non-nil, zero value otherwise.
-func (f *Feeds) GetTimelineURL() string {
- if f == nil || f.TimelineURL == nil {
- return ""
- }
- return *f.TimelineURL
-}
-
-// GetUserURL returns the UserURL field if it's non-nil, zero value otherwise.
-func (f *Feeds) GetUserURL() string {
- if f == nil || f.UserURL == nil {
- return ""
- }
- return *f.UserURL
-}
-
-// GetForkee returns the Forkee field.
-func (f *ForkEvent) GetForkee() *Repository {
- if f == nil {
- return nil
- }
- return f.Forkee
-}
-
-// GetInstallation returns the Installation field.
-func (f *ForkEvent) GetInstallation() *Installation {
- if f == nil {
- return nil
- }
- return f.Installation
-}
-
-// GetRepo returns the Repo field.
-func (f *ForkEvent) GetRepo() *Repository {
- if f == nil {
- return nil
- }
- return f.Repo
-}
-
-// GetSender returns the Sender field.
-func (f *ForkEvent) GetSender() *User {
- if f == nil {
- return nil
- }
- return f.Sender
-}
-
-// GetComments returns the Comments field if it's non-nil, zero value otherwise.
-func (g *Gist) GetComments() int {
- if g == nil || g.Comments == nil {
- return 0
- }
- return *g.Comments
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (g *Gist) GetCreatedAt() time.Time {
- if g == nil || g.CreatedAt == nil {
- return time.Time{}
- }
- return *g.CreatedAt
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (g *Gist) GetDescription() string {
- if g == nil || g.Description == nil {
- return ""
- }
- return *g.Description
-}
-
-// GetGitPullURL returns the GitPullURL field if it's non-nil, zero value otherwise.
-func (g *Gist) GetGitPullURL() string {
- if g == nil || g.GitPullURL == nil {
- return ""
- }
- return *g.GitPullURL
-}
-
-// GetGitPushURL returns the GitPushURL field if it's non-nil, zero value otherwise.
-func (g *Gist) GetGitPushURL() string {
- if g == nil || g.GitPushURL == nil {
- return ""
- }
- return *g.GitPushURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (g *Gist) GetHTMLURL() string {
- if g == nil || g.HTMLURL == nil {
- return ""
- }
- return *g.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (g *Gist) GetID() string {
- if g == nil || g.ID == nil {
- return ""
- }
- return *g.ID
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (g *Gist) GetNodeID() string {
- if g == nil || g.NodeID == nil {
- return ""
- }
- return *g.NodeID
-}
-
-// GetOwner returns the Owner field.
-func (g *Gist) GetOwner() *User {
- if g == nil {
- return nil
- }
- return g.Owner
-}
-
-// GetPublic returns the Public field if it's non-nil, zero value otherwise.
-func (g *Gist) GetPublic() bool {
- if g == nil || g.Public == nil {
- return false
- }
- return *g.Public
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (g *Gist) GetUpdatedAt() time.Time {
- if g == nil || g.UpdatedAt == nil {
- return time.Time{}
- }
- return *g.UpdatedAt
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (g *GistComment) GetBody() string {
- if g == nil || g.Body == nil {
- return ""
- }
- return *g.Body
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (g *GistComment) GetCreatedAt() time.Time {
- if g == nil || g.CreatedAt == nil {
- return time.Time{}
- }
- return *g.CreatedAt
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (g *GistComment) GetID() int64 {
- if g == nil || g.ID == nil {
- return 0
- }
- return *g.ID
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (g *GistComment) GetURL() string {
- if g == nil || g.URL == nil {
- return ""
- }
- return *g.URL
-}
-
-// GetUser returns the User field.
-func (g *GistComment) GetUser() *User {
- if g == nil {
- return nil
- }
- return g.User
-}
-
-// GetChangeStatus returns the ChangeStatus field.
-func (g *GistCommit) GetChangeStatus() *CommitStats {
- if g == nil {
- return nil
- }
- return g.ChangeStatus
-}
-
-// GetCommittedAt returns the CommittedAt field if it's non-nil, zero value otherwise.
-func (g *GistCommit) GetCommittedAt() Timestamp {
- if g == nil || g.CommittedAt == nil {
- return Timestamp{}
- }
- return *g.CommittedAt
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (g *GistCommit) GetNodeID() string {
- if g == nil || g.NodeID == nil {
- return ""
- }
- return *g.NodeID
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (g *GistCommit) GetURL() string {
- if g == nil || g.URL == nil {
- return ""
- }
- return *g.URL
-}
-
-// GetUser returns the User field.
-func (g *GistCommit) GetUser() *User {
- if g == nil {
- return nil
- }
- return g.User
-}
-
-// GetVersion returns the Version field if it's non-nil, zero value otherwise.
-func (g *GistCommit) GetVersion() string {
- if g == nil || g.Version == nil {
- return ""
- }
- return *g.Version
-}
-
-// GetContent returns the Content field if it's non-nil, zero value otherwise.
-func (g *GistFile) GetContent() string {
- if g == nil || g.Content == nil {
- return ""
- }
- return *g.Content
-}
-
-// GetFilename returns the Filename field if it's non-nil, zero value otherwise.
-func (g *GistFile) GetFilename() string {
- if g == nil || g.Filename == nil {
- return ""
- }
- return *g.Filename
-}
-
-// GetLanguage returns the Language field if it's non-nil, zero value otherwise.
-func (g *GistFile) GetLanguage() string {
- if g == nil || g.Language == nil {
- return ""
- }
- return *g.Language
-}
-
-// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise.
-func (g *GistFile) GetRawURL() string {
- if g == nil || g.RawURL == nil {
- return ""
- }
- return *g.RawURL
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (g *GistFile) GetSize() int {
- if g == nil || g.Size == nil {
- return 0
- }
- return *g.Size
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (g *GistFile) GetType() string {
- if g == nil || g.Type == nil {
- return ""
- }
- return *g.Type
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (g *GistFork) GetCreatedAt() Timestamp {
- if g == nil || g.CreatedAt == nil {
- return Timestamp{}
- }
- return *g.CreatedAt
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (g *GistFork) GetID() string {
- if g == nil || g.ID == nil {
- return ""
- }
- return *g.ID
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (g *GistFork) GetNodeID() string {
- if g == nil || g.NodeID == nil {
- return ""
- }
- return *g.NodeID
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (g *GistFork) GetUpdatedAt() Timestamp {
- if g == nil || g.UpdatedAt == nil {
- return Timestamp{}
- }
- return *g.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (g *GistFork) GetURL() string {
- if g == nil || g.URL == nil {
- return ""
- }
- return *g.URL
-}
-
-// GetUser returns the User field.
-func (g *GistFork) GetUser() *User {
- if g == nil {
- return nil
- }
- return g.User
-}
-
-// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise.
-func (g *GistStats) GetPrivateGists() int {
- if g == nil || g.PrivateGists == nil {
- return 0
- }
- return *g.PrivateGists
-}
-
-// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise.
-func (g *GistStats) GetPublicGists() int {
- if g == nil || g.PublicGists == nil {
- return 0
- }
- return *g.PublicGists
-}
-
-// GetTotalGists returns the TotalGists field if it's non-nil, zero value otherwise.
-func (g *GistStats) GetTotalGists() int {
- if g == nil || g.TotalGists == nil {
- return 0
- }
- return *g.TotalGists
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (g *Gitignore) GetName() string {
- if g == nil || g.Name == nil {
- return ""
- }
- return *g.Name
-}
-
-// GetSource returns the Source field if it's non-nil, zero value otherwise.
-func (g *Gitignore) GetSource() string {
- if g == nil || g.Source == nil {
- return ""
- }
- return *g.Source
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (g *GitObject) GetSHA() string {
- if g == nil || g.SHA == nil {
- return ""
- }
- return *g.SHA
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (g *GitObject) GetType() string {
- if g == nil || g.Type == nil {
- return ""
- }
- return *g.Type
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (g *GitObject) GetURL() string {
- if g == nil || g.URL == nil {
- return ""
- }
- return *g.URL
-}
-
-// GetInstallation returns the Installation field.
-func (g *GollumEvent) GetInstallation() *Installation {
- if g == nil {
- return nil
- }
- return g.Installation
-}
-
-// GetRepo returns the Repo field.
-func (g *GollumEvent) GetRepo() *Repository {
- if g == nil {
- return nil
- }
- return g.Repo
-}
-
-// GetSender returns the Sender field.
-func (g *GollumEvent) GetSender() *User {
- if g == nil {
- return nil
- }
- return g.Sender
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (g *GPGEmail) GetEmail() string {
- if g == nil || g.Email == nil {
- return ""
- }
- return *g.Email
-}
-
-// GetVerified returns the Verified field if it's non-nil, zero value otherwise.
-func (g *GPGEmail) GetVerified() bool {
- if g == nil || g.Verified == nil {
- return false
- }
- return *g.Verified
-}
-
-// GetCanCertify returns the CanCertify field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetCanCertify() bool {
- if g == nil || g.CanCertify == nil {
- return false
- }
- return *g.CanCertify
-}
-
-// GetCanEncryptComms returns the CanEncryptComms field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetCanEncryptComms() bool {
- if g == nil || g.CanEncryptComms == nil {
- return false
- }
- return *g.CanEncryptComms
-}
-
-// GetCanEncryptStorage returns the CanEncryptStorage field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetCanEncryptStorage() bool {
- if g == nil || g.CanEncryptStorage == nil {
- return false
- }
- return *g.CanEncryptStorage
-}
-
-// GetCanSign returns the CanSign field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetCanSign() bool {
- if g == nil || g.CanSign == nil {
- return false
- }
- return *g.CanSign
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetCreatedAt() time.Time {
- if g == nil || g.CreatedAt == nil {
- return time.Time{}
- }
- return *g.CreatedAt
-}
-
-// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetExpiresAt() time.Time {
- if g == nil || g.ExpiresAt == nil {
- return time.Time{}
- }
- return *g.ExpiresAt
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetID() int64 {
- if g == nil || g.ID == nil {
- return 0
- }
- return *g.ID
-}
-
-// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetKeyID() string {
- if g == nil || g.KeyID == nil {
- return ""
- }
- return *g.KeyID
-}
-
-// GetPrimaryKeyID returns the PrimaryKeyID field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetPrimaryKeyID() int64 {
- if g == nil || g.PrimaryKeyID == nil {
- return 0
- }
- return *g.PrimaryKeyID
-}
-
-// GetPublicKey returns the PublicKey field if it's non-nil, zero value otherwise.
-func (g *GPGKey) GetPublicKey() string {
- if g == nil || g.PublicKey == nil {
- return ""
- }
- return *g.PublicKey
-}
-
-// GetApp returns the App field.
-func (g *Grant) GetApp() *AuthorizationApp {
- if g == nil {
- return nil
- }
- return g.App
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (g *Grant) GetCreatedAt() Timestamp {
- if g == nil || g.CreatedAt == nil {
- return Timestamp{}
- }
- return *g.CreatedAt
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (g *Grant) GetID() int64 {
- if g == nil || g.ID == nil {
- return 0
- }
- return *g.ID
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (g *Grant) GetUpdatedAt() Timestamp {
- if g == nil || g.UpdatedAt == nil {
- return Timestamp{}
- }
- return *g.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (g *Grant) GetURL() string {
- if g == nil || g.URL == nil {
- return ""
- }
- return *g.URL
-}
-
-// GetActive returns the Active field if it's non-nil, zero value otherwise.
-func (h *Hook) GetActive() bool {
- if h == nil || h.Active == nil {
- return false
- }
- return *h.Active
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (h *Hook) GetCreatedAt() time.Time {
- if h == nil || h.CreatedAt == nil {
- return time.Time{}
- }
- return *h.CreatedAt
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (h *Hook) GetID() int64 {
- if h == nil || h.ID == nil {
- return 0
- }
- return *h.ID
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (h *Hook) GetName() string {
- if h == nil || h.Name == nil {
- return ""
- }
- return *h.Name
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (h *Hook) GetUpdatedAt() time.Time {
- if h == nil || h.UpdatedAt == nil {
- return time.Time{}
- }
- return *h.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (h *Hook) GetURL() string {
- if h == nil || h.URL == nil {
- return ""
- }
- return *h.URL
-}
-
-// GetActiveHooks returns the ActiveHooks field if it's non-nil, zero value otherwise.
-func (h *HookStats) GetActiveHooks() int {
- if h == nil || h.ActiveHooks == nil {
- return 0
- }
- return *h.ActiveHooks
-}
-
-// GetInactiveHooks returns the InactiveHooks field if it's non-nil, zero value otherwise.
-func (h *HookStats) GetInactiveHooks() int {
- if h == nil || h.InactiveHooks == nil {
- return 0
- }
- return *h.InactiveHooks
-}
-
-// GetTotalHooks returns the TotalHooks field if it's non-nil, zero value otherwise.
-func (h *HookStats) GetTotalHooks() int {
- if h == nil || h.TotalHooks == nil {
- return 0
- }
- return *h.TotalHooks
-}
-
-// GetAuthorsCount returns the AuthorsCount field if it's non-nil, zero value otherwise.
-func (i *Import) GetAuthorsCount() int {
- if i == nil || i.AuthorsCount == nil {
- return 0
- }
- return *i.AuthorsCount
-}
-
-// GetAuthorsURL returns the AuthorsURL field if it's non-nil, zero value otherwise.
-func (i *Import) GetAuthorsURL() string {
- if i == nil || i.AuthorsURL == nil {
- return ""
- }
- return *i.AuthorsURL
-}
-
-// GetCommitCount returns the CommitCount field if it's non-nil, zero value otherwise.
-func (i *Import) GetCommitCount() int {
- if i == nil || i.CommitCount == nil {
- return 0
- }
- return *i.CommitCount
-}
-
-// GetFailedStep returns the FailedStep field if it's non-nil, zero value otherwise.
-func (i *Import) GetFailedStep() string {
- if i == nil || i.FailedStep == nil {
- return ""
- }
- return *i.FailedStep
-}
-
-// GetHasLargeFiles returns the HasLargeFiles field if it's non-nil, zero value otherwise.
-func (i *Import) GetHasLargeFiles() bool {
- if i == nil || i.HasLargeFiles == nil {
- return false
- }
- return *i.HasLargeFiles
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (i *Import) GetHTMLURL() string {
- if i == nil || i.HTMLURL == nil {
- return ""
- }
- return *i.HTMLURL
-}
-
-// GetHumanName returns the HumanName field if it's non-nil, zero value otherwise.
-func (i *Import) GetHumanName() string {
- if i == nil || i.HumanName == nil {
- return ""
- }
- return *i.HumanName
-}
-
-// GetLargeFilesCount returns the LargeFilesCount field if it's non-nil, zero value otherwise.
-func (i *Import) GetLargeFilesCount() int {
- if i == nil || i.LargeFilesCount == nil {
- return 0
- }
- return *i.LargeFilesCount
-}
-
-// GetLargeFilesSize returns the LargeFilesSize field if it's non-nil, zero value otherwise.
-func (i *Import) GetLargeFilesSize() int {
- if i == nil || i.LargeFilesSize == nil {
- return 0
- }
- return *i.LargeFilesSize
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (i *Import) GetMessage() string {
- if i == nil || i.Message == nil {
- return ""
- }
- return *i.Message
-}
-
-// GetPercent returns the Percent field if it's non-nil, zero value otherwise.
-func (i *Import) GetPercent() int {
- if i == nil || i.Percent == nil {
- return 0
- }
- return *i.Percent
-}
-
-// GetPushPercent returns the PushPercent field if it's non-nil, zero value otherwise.
-func (i *Import) GetPushPercent() int {
- if i == nil || i.PushPercent == nil {
- return 0
- }
- return *i.PushPercent
-}
-
-// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
-func (i *Import) GetRepositoryURL() string {
- if i == nil || i.RepositoryURL == nil {
- return ""
- }
- return *i.RepositoryURL
-}
-
-// GetStatus returns the Status field if it's non-nil, zero value otherwise.
-func (i *Import) GetStatus() string {
- if i == nil || i.Status == nil {
- return ""
- }
- return *i.Status
-}
-
-// GetStatusText returns the StatusText field if it's non-nil, zero value otherwise.
-func (i *Import) GetStatusText() string {
- if i == nil || i.StatusText == nil {
- return ""
- }
- return *i.StatusText
-}
-
-// GetTFVCProject returns the TFVCProject field if it's non-nil, zero value otherwise.
-func (i *Import) GetTFVCProject() string {
- if i == nil || i.TFVCProject == nil {
- return ""
- }
- return *i.TFVCProject
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (i *Import) GetURL() string {
- if i == nil || i.URL == nil {
- return ""
- }
- return *i.URL
-}
-
-// GetUseLFS returns the UseLFS field if it's non-nil, zero value otherwise.
-func (i *Import) GetUseLFS() string {
- if i == nil || i.UseLFS == nil {
- return ""
- }
- return *i.UseLFS
-}
-
-// GetVCS returns the VCS field if it's non-nil, zero value otherwise.
-func (i *Import) GetVCS() string {
- if i == nil || i.VCS == nil {
- return ""
- }
- return *i.VCS
-}
-
-// GetVCSPassword returns the VCSPassword field if it's non-nil, zero value otherwise.
-func (i *Import) GetVCSPassword() string {
- if i == nil || i.VCSPassword == nil {
- return ""
- }
- return *i.VCSPassword
-}
-
-// GetVCSURL returns the VCSURL field if it's non-nil, zero value otherwise.
-func (i *Import) GetVCSURL() string {
- if i == nil || i.VCSURL == nil {
- return ""
- }
- return *i.VCSURL
-}
-
-// GetVCSUsername returns the VCSUsername field if it's non-nil, zero value otherwise.
-func (i *Import) GetVCSUsername() string {
- if i == nil || i.VCSUsername == nil {
- return ""
- }
- return *i.VCSUsername
-}
-
-// GetAccessTokensURL returns the AccessTokensURL field if it's non-nil, zero value otherwise.
-func (i *Installation) GetAccessTokensURL() string {
- if i == nil || i.AccessTokensURL == nil {
- return ""
- }
- return *i.AccessTokensURL
-}
-
-// GetAccount returns the Account field.
-func (i *Installation) GetAccount() *User {
- if i == nil {
- return nil
- }
- return i.Account
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (i *Installation) GetHTMLURL() string {
- if i == nil || i.HTMLURL == nil {
- return ""
- }
- return *i.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (i *Installation) GetID() int64 {
- if i == nil || i.ID == nil {
- return 0
- }
- return *i.ID
-}
-
-// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise.
-func (i *Installation) GetRepositoriesURL() string {
- if i == nil || i.RepositoriesURL == nil {
- return ""
- }
- return *i.RepositoriesURL
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (i *InstallationEvent) GetAction() string {
- if i == nil || i.Action == nil {
- return ""
- }
- return *i.Action
-}
-
-// GetInstallation returns the Installation field.
-func (i *InstallationEvent) GetInstallation() *Installation {
- if i == nil {
- return nil
- }
- return i.Installation
-}
-
-// GetSender returns the Sender field.
-func (i *InstallationEvent) GetSender() *User {
- if i == nil {
- return nil
- }
- return i.Sender
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (i *InstallationRepositoriesEvent) GetAction() string {
- if i == nil || i.Action == nil {
- return ""
- }
- return *i.Action
-}
-
-// GetInstallation returns the Installation field.
-func (i *InstallationRepositoriesEvent) GetInstallation() *Installation {
- if i == nil {
- return nil
- }
- return i.Installation
-}
-
-// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise.
-func (i *InstallationRepositoriesEvent) GetRepositorySelection() string {
- if i == nil || i.RepositorySelection == nil {
- return ""
- }
- return *i.RepositorySelection
-}
-
-// GetSender returns the Sender field.
-func (i *InstallationRepositoriesEvent) GetSender() *User {
- if i == nil {
- return nil
- }
- return i.Sender
-}
-
-// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise.
-func (i *InstallationToken) GetExpiresAt() time.Time {
- if i == nil || i.ExpiresAt == nil {
- return time.Time{}
- }
- return *i.ExpiresAt
-}
-
-// GetToken returns the Token field if it's non-nil, zero value otherwise.
-func (i *InstallationToken) GetToken() string {
- if i == nil || i.Token == nil {
- return ""
- }
- return *i.Token
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (i *Invitation) GetCreatedAt() time.Time {
- if i == nil || i.CreatedAt == nil {
- return time.Time{}
- }
- return *i.CreatedAt
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (i *Invitation) GetEmail() string {
- if i == nil || i.Email == nil {
- return ""
- }
- return *i.Email
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (i *Invitation) GetID() int64 {
- if i == nil || i.ID == nil {
- return 0
- }
- return *i.ID
-}
-
-// GetInviter returns the Inviter field.
-func (i *Invitation) GetInviter() *User {
- if i == nil {
- return nil
- }
- return i.Inviter
-}
-
-// GetLogin returns the Login field if it's non-nil, zero value otherwise.
-func (i *Invitation) GetLogin() string {
- if i == nil || i.Login == nil {
- return ""
- }
- return *i.Login
-}
-
-// GetRole returns the Role field if it's non-nil, zero value otherwise.
-func (i *Invitation) GetRole() string {
- if i == nil || i.Role == nil {
- return ""
- }
- return *i.Role
-}
-
-// GetAssignee returns the Assignee field.
-func (i *Issue) GetAssignee() *User {
- if i == nil {
- return nil
- }
- return i.Assignee
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (i *Issue) GetBody() string {
- if i == nil || i.Body == nil {
- return ""
- }
- return *i.Body
-}
-
-// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise.
-func (i *Issue) GetClosedAt() time.Time {
- if i == nil || i.ClosedAt == nil {
- return time.Time{}
- }
- return *i.ClosedAt
-}
-
-// GetClosedBy returns the ClosedBy field.
-func (i *Issue) GetClosedBy() *User {
- if i == nil {
- return nil
- }
- return i.ClosedBy
-}
-
-// GetComments returns the Comments field if it's non-nil, zero value otherwise.
-func (i *Issue) GetComments() int {
- if i == nil || i.Comments == nil {
- return 0
- }
- return *i.Comments
-}
-
-// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise.
-func (i *Issue) GetCommentsURL() string {
- if i == nil || i.CommentsURL == nil {
- return ""
- }
- return *i.CommentsURL
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (i *Issue) GetCreatedAt() time.Time {
- if i == nil || i.CreatedAt == nil {
- return time.Time{}
- }
- return *i.CreatedAt
-}
-
-// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.
-func (i *Issue) GetEventsURL() string {
- if i == nil || i.EventsURL == nil {
- return ""
- }
- return *i.EventsURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (i *Issue) GetHTMLURL() string {
- if i == nil || i.HTMLURL == nil {
- return ""
- }
- return *i.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (i *Issue) GetID() int64 {
- if i == nil || i.ID == nil {
- return 0
- }
- return *i.ID
-}
-
-// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise.
-func (i *Issue) GetLabelsURL() string {
- if i == nil || i.LabelsURL == nil {
- return ""
- }
- return *i.LabelsURL
-}
-
-// GetLocked returns the Locked field if it's non-nil, zero value otherwise.
-func (i *Issue) GetLocked() bool {
- if i == nil || i.Locked == nil {
- return false
- }
- return *i.Locked
-}
-
-// GetMilestone returns the Milestone field.
-func (i *Issue) GetMilestone() *Milestone {
- if i == nil {
- return nil
- }
- return i.Milestone
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (i *Issue) GetNodeID() string {
- if i == nil || i.NodeID == nil {
- return ""
- }
- return *i.NodeID
-}
-
-// GetNumber returns the Number field if it's non-nil, zero value otherwise.
-func (i *Issue) GetNumber() int {
- if i == nil || i.Number == nil {
- return 0
- }
- return *i.Number
-}
-
-// GetPullRequestLinks returns the PullRequestLinks field.
-func (i *Issue) GetPullRequestLinks() *PullRequestLinks {
- if i == nil {
- return nil
- }
- return i.PullRequestLinks
-}
-
-// GetReactions returns the Reactions field.
-func (i *Issue) GetReactions() *Reactions {
- if i == nil {
- return nil
- }
- return i.Reactions
-}
-
-// GetRepository returns the Repository field.
-func (i *Issue) GetRepository() *Repository {
- if i == nil {
- return nil
- }
- return i.Repository
-}
-
-// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
-func (i *Issue) GetRepositoryURL() string {
- if i == nil || i.RepositoryURL == nil {
- return ""
- }
- return *i.RepositoryURL
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (i *Issue) GetState() string {
- if i == nil || i.State == nil {
- return ""
- }
- return *i.State
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (i *Issue) GetTitle() string {
- if i == nil || i.Title == nil {
- return ""
- }
- return *i.Title
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (i *Issue) GetUpdatedAt() time.Time {
- if i == nil || i.UpdatedAt == nil {
- return time.Time{}
- }
- return *i.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (i *Issue) GetURL() string {
- if i == nil || i.URL == nil {
- return ""
- }
- return *i.URL
-}
-
-// GetUser returns the User field.
-func (i *Issue) GetUser() *User {
- if i == nil {
- return nil
- }
- return i.User
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (i *IssueComment) GetBody() string {
- if i == nil || i.Body == nil {
- return ""
- }
- return *i.Body
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (i *IssueComment) GetCreatedAt() time.Time {
- if i == nil || i.CreatedAt == nil {
- return time.Time{}
- }
- return *i.CreatedAt
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (i *IssueComment) GetHTMLURL() string {
- if i == nil || i.HTMLURL == nil {
- return ""
- }
- return *i.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (i *IssueComment) GetID() int64 {
- if i == nil || i.ID == nil {
- return 0
- }
- return *i.ID
-}
-
-// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise.
-func (i *IssueComment) GetIssueURL() string {
- if i == nil || i.IssueURL == nil {
- return ""
- }
- return *i.IssueURL
-}
-
-// GetReactions returns the Reactions field.
-func (i *IssueComment) GetReactions() *Reactions {
- if i == nil {
- return nil
- }
- return i.Reactions
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (i *IssueComment) GetUpdatedAt() time.Time {
- if i == nil || i.UpdatedAt == nil {
- return time.Time{}
- }
- return *i.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (i *IssueComment) GetURL() string {
- if i == nil || i.URL == nil {
- return ""
- }
- return *i.URL
-}
-
-// GetUser returns the User field.
-func (i *IssueComment) GetUser() *User {
- if i == nil {
- return nil
- }
- return i.User
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (i *IssueCommentEvent) GetAction() string {
- if i == nil || i.Action == nil {
- return ""
- }
- return *i.Action
-}
-
-// GetChanges returns the Changes field.
-func (i *IssueCommentEvent) GetChanges() *EditChange {
- if i == nil {
- return nil
- }
- return i.Changes
-}
-
-// GetComment returns the Comment field.
-func (i *IssueCommentEvent) GetComment() *IssueComment {
- if i == nil {
- return nil
- }
- return i.Comment
-}
-
-// GetInstallation returns the Installation field.
-func (i *IssueCommentEvent) GetInstallation() *Installation {
- if i == nil {
- return nil
- }
- return i.Installation
-}
-
-// GetIssue returns the Issue field.
-func (i *IssueCommentEvent) GetIssue() *Issue {
- if i == nil {
- return nil
- }
- return i.Issue
-}
-
-// GetRepo returns the Repo field.
-func (i *IssueCommentEvent) GetRepo() *Repository {
- if i == nil {
- return nil
- }
- return i.Repo
-}
-
-// GetSender returns the Sender field.
-func (i *IssueCommentEvent) GetSender() *User {
- if i == nil {
- return nil
- }
- return i.Sender
-}
-
-// GetActor returns the Actor field.
-func (i *IssueEvent) GetActor() *User {
- if i == nil {
- return nil
- }
- return i.Actor
-}
-
-// GetAssignee returns the Assignee field.
-func (i *IssueEvent) GetAssignee() *User {
- if i == nil {
- return nil
- }
- return i.Assignee
-}
-
-// GetAssigner returns the Assigner field.
-func (i *IssueEvent) GetAssigner() *User {
- if i == nil {
- return nil
- }
- return i.Assigner
-}
-
-// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise.
-func (i *IssueEvent) GetCommitID() string {
- if i == nil || i.CommitID == nil {
- return ""
- }
- return *i.CommitID
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (i *IssueEvent) GetCreatedAt() time.Time {
- if i == nil || i.CreatedAt == nil {
- return time.Time{}
- }
- return *i.CreatedAt
-}
-
-// GetEvent returns the Event field if it's non-nil, zero value otherwise.
-func (i *IssueEvent) GetEvent() string {
- if i == nil || i.Event == nil {
- return ""
- }
- return *i.Event
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (i *IssueEvent) GetID() int64 {
- if i == nil || i.ID == nil {
- return 0
- }
- return *i.ID
-}
-
-// GetIssue returns the Issue field.
-func (i *IssueEvent) GetIssue() *Issue {
- if i == nil {
- return nil
- }
- return i.Issue
-}
-
-// GetLabel returns the Label field.
-func (i *IssueEvent) GetLabel() *Label {
- if i == nil {
- return nil
- }
- return i.Label
-}
-
-// GetMilestone returns the Milestone field.
-func (i *IssueEvent) GetMilestone() *Milestone {
- if i == nil {
- return nil
- }
- return i.Milestone
-}
-
-// GetRename returns the Rename field.
-func (i *IssueEvent) GetRename() *Rename {
- if i == nil {
- return nil
- }
- return i.Rename
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (i *IssueEvent) GetURL() string {
- if i == nil || i.URL == nil {
- return ""
- }
- return *i.URL
-}
-
-// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise.
-func (i *IssueRequest) GetAssignee() string {
- if i == nil || i.Assignee == nil {
- return ""
- }
- return *i.Assignee
-}
-
-// GetAssignees returns the Assignees field if it's non-nil, zero value otherwise.
-func (i *IssueRequest) GetAssignees() []string {
- if i == nil || i.Assignees == nil {
- return nil
- }
- return *i.Assignees
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (i *IssueRequest) GetBody() string {
- if i == nil || i.Body == nil {
- return ""
- }
- return *i.Body
-}
-
-// GetLabels returns the Labels field if it's non-nil, zero value otherwise.
-func (i *IssueRequest) GetLabels() []string {
- if i == nil || i.Labels == nil {
- return nil
- }
- return *i.Labels
-}
-
-// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise.
-func (i *IssueRequest) GetMilestone() int {
- if i == nil || i.Milestone == nil {
- return 0
- }
- return *i.Milestone
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (i *IssueRequest) GetState() string {
- if i == nil || i.State == nil {
- return ""
- }
- return *i.State
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (i *IssueRequest) GetTitle() string {
- if i == nil || i.Title == nil {
- return ""
- }
- return *i.Title
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (i *IssuesEvent) GetAction() string {
- if i == nil || i.Action == nil {
- return ""
- }
- return *i.Action
-}
-
-// GetAssignee returns the Assignee field.
-func (i *IssuesEvent) GetAssignee() *User {
- if i == nil {
- return nil
- }
- return i.Assignee
-}
-
-// GetChanges returns the Changes field.
-func (i *IssuesEvent) GetChanges() *EditChange {
- if i == nil {
- return nil
- }
- return i.Changes
-}
-
-// GetInstallation returns the Installation field.
-func (i *IssuesEvent) GetInstallation() *Installation {
- if i == nil {
- return nil
- }
- return i.Installation
-}
-
-// GetIssue returns the Issue field.
-func (i *IssuesEvent) GetIssue() *Issue {
- if i == nil {
- return nil
- }
- return i.Issue
-}
-
-// GetLabel returns the Label field.
-func (i *IssuesEvent) GetLabel() *Label {
- if i == nil {
- return nil
- }
- return i.Label
-}
-
-// GetRepo returns the Repo field.
-func (i *IssuesEvent) GetRepo() *Repository {
- if i == nil {
- return nil
- }
- return i.Repo
-}
-
-// GetSender returns the Sender field.
-func (i *IssuesEvent) GetSender() *User {
- if i == nil {
- return nil
- }
- return i.Sender
-}
-
-// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
-func (i *IssuesSearchResult) GetIncompleteResults() bool {
- if i == nil || i.IncompleteResults == nil {
- return false
- }
- return *i.IncompleteResults
-}
-
-// GetTotal returns the Total field if it's non-nil, zero value otherwise.
-func (i *IssuesSearchResult) GetTotal() int {
- if i == nil || i.Total == nil {
- return 0
- }
- return *i.Total
-}
-
-// GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise.
-func (i *IssueStats) GetClosedIssues() int {
- if i == nil || i.ClosedIssues == nil {
- return 0
- }
- return *i.ClosedIssues
-}
-
-// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise.
-func (i *IssueStats) GetOpenIssues() int {
- if i == nil || i.OpenIssues == nil {
- return 0
- }
- return *i.OpenIssues
-}
-
-// GetTotalIssues returns the TotalIssues field if it's non-nil, zero value otherwise.
-func (i *IssueStats) GetTotalIssues() int {
- if i == nil || i.TotalIssues == nil {
- return 0
- }
- return *i.TotalIssues
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (k *Key) GetID() int64 {
- if k == nil || k.ID == nil {
- return 0
- }
- return *k.ID
-}
-
-// GetKey returns the Key field if it's non-nil, zero value otherwise.
-func (k *Key) GetKey() string {
- if k == nil || k.Key == nil {
- return ""
- }
- return *k.Key
-}
-
-// GetReadOnly returns the ReadOnly field if it's non-nil, zero value otherwise.
-func (k *Key) GetReadOnly() bool {
- if k == nil || k.ReadOnly == nil {
- return false
- }
- return *k.ReadOnly
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (k *Key) GetTitle() string {
- if k == nil || k.Title == nil {
- return ""
- }
- return *k.Title
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (k *Key) GetURL() string {
- if k == nil || k.URL == nil {
- return ""
- }
- return *k.URL
-}
-
-// GetColor returns the Color field if it's non-nil, zero value otherwise.
-func (l *Label) GetColor() string {
- if l == nil || l.Color == nil {
- return ""
- }
- return *l.Color
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (l *Label) GetID() int64 {
- if l == nil || l.ID == nil {
- return 0
- }
- return *l.ID
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (l *Label) GetName() string {
- if l == nil || l.Name == nil {
- return ""
- }
- return *l.Name
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (l *Label) GetNodeID() string {
- if l == nil || l.NodeID == nil {
- return ""
- }
- return *l.NodeID
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (l *Label) GetURL() string {
- if l == nil || l.URL == nil {
- return ""
- }
- return *l.URL
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (l *LabelEvent) GetAction() string {
- if l == nil || l.Action == nil {
- return ""
- }
- return *l.Action
-}
-
-// GetChanges returns the Changes field.
-func (l *LabelEvent) GetChanges() *EditChange {
- if l == nil {
- return nil
- }
- return l.Changes
-}
-
-// GetInstallation returns the Installation field.
-func (l *LabelEvent) GetInstallation() *Installation {
- if l == nil {
- return nil
- }
- return l.Installation
-}
-
-// GetLabel returns the Label field.
-func (l *LabelEvent) GetLabel() *Label {
- if l == nil {
- return nil
- }
- return l.Label
-}
-
-// GetOrg returns the Org field.
-func (l *LabelEvent) GetOrg() *Organization {
- if l == nil {
- return nil
- }
- return l.Org
-}
-
-// GetRepo returns the Repo field.
-func (l *LabelEvent) GetRepo() *Repository {
- if l == nil {
- return nil
- }
- return l.Repo
-}
-
-// GetOID returns the OID field if it's non-nil, zero value otherwise.
-func (l *LargeFile) GetOID() string {
- if l == nil || l.OID == nil {
- return ""
- }
- return *l.OID
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (l *LargeFile) GetPath() string {
- if l == nil || l.Path == nil {
- return ""
- }
- return *l.Path
-}
-
-// GetRefName returns the RefName field if it's non-nil, zero value otherwise.
-func (l *LargeFile) GetRefName() string {
- if l == nil || l.RefName == nil {
- return ""
- }
- return *l.RefName
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (l *LargeFile) GetSize() int {
- if l == nil || l.Size == nil {
- return 0
- }
- return *l.Size
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (l *License) GetBody() string {
- if l == nil || l.Body == nil {
- return ""
- }
- return *l.Body
-}
-
-// GetConditions returns the Conditions field if it's non-nil, zero value otherwise.
-func (l *License) GetConditions() []string {
- if l == nil || l.Conditions == nil {
- return nil
- }
- return *l.Conditions
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (l *License) GetDescription() string {
- if l == nil || l.Description == nil {
- return ""
- }
- return *l.Description
-}
-
-// GetFeatured returns the Featured field if it's non-nil, zero value otherwise.
-func (l *License) GetFeatured() bool {
- if l == nil || l.Featured == nil {
- return false
- }
- return *l.Featured
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (l *License) GetHTMLURL() string {
- if l == nil || l.HTMLURL == nil {
- return ""
- }
- return *l.HTMLURL
-}
-
-// GetImplementation returns the Implementation field if it's non-nil, zero value otherwise.
-func (l *License) GetImplementation() string {
- if l == nil || l.Implementation == nil {
- return ""
- }
- return *l.Implementation
-}
-
-// GetKey returns the Key field if it's non-nil, zero value otherwise.
-func (l *License) GetKey() string {
- if l == nil || l.Key == nil {
- return ""
- }
- return *l.Key
-}
-
-// GetLimitations returns the Limitations field if it's non-nil, zero value otherwise.
-func (l *License) GetLimitations() []string {
- if l == nil || l.Limitations == nil {
- return nil
- }
- return *l.Limitations
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (l *License) GetName() string {
- if l == nil || l.Name == nil {
- return ""
- }
- return *l.Name
-}
-
-// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise.
-func (l *License) GetPermissions() []string {
- if l == nil || l.Permissions == nil {
- return nil
- }
- return *l.Permissions
-}
-
-// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise.
-func (l *License) GetSPDXID() string {
- if l == nil || l.SPDXID == nil {
- return ""
- }
- return *l.SPDXID
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (l *License) GetURL() string {
- if l == nil || l.URL == nil {
- return ""
- }
- return *l.URL
-}
-
-// GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetAccountsURL() string {
- if m == nil || m.AccountsURL == nil {
- return ""
- }
- return *m.AccountsURL
-}
-
-// GetBullets returns the Bullets field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetBullets() []string {
- if m == nil || m.Bullets == nil {
- return nil
- }
- return *m.Bullets
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetDescription() string {
- if m == nil || m.Description == nil {
- return ""
- }
- return *m.Description
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetID() int64 {
- if m == nil || m.ID == nil {
- return 0
- }
- return *m.ID
-}
-
-// GetMonthlyPriceInCents returns the MonthlyPriceInCents field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetMonthlyPriceInCents() int {
- if m == nil || m.MonthlyPriceInCents == nil {
- return 0
- }
- return *m.MonthlyPriceInCents
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetName() string {
- if m == nil || m.Name == nil {
- return ""
- }
- return *m.Name
-}
-
-// GetPriceModel returns the PriceModel field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetPriceModel() string {
- if m == nil || m.PriceModel == nil {
- return ""
- }
- return *m.PriceModel
-}
-
-// GetUnitName returns the UnitName field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetUnitName() string {
- if m == nil || m.UnitName == nil {
- return ""
- }
- return *m.UnitName
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetURL() string {
- if m == nil || m.URL == nil {
- return ""
- }
- return *m.URL
-}
-
-// GetYearlyPriceInCents returns the YearlyPriceInCents field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlan) GetYearlyPriceInCents() int {
- if m == nil || m.YearlyPriceInCents == nil {
- return 0
- }
- return *m.YearlyPriceInCents
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlanAccount) GetEmail() string {
- if m == nil || m.Email == nil {
- return ""
- }
- return *m.Email
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlanAccount) GetID() int64 {
- if m == nil || m.ID == nil {
- return 0
- }
- return *m.ID
-}
-
-// GetLogin returns the Login field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlanAccount) GetLogin() string {
- if m == nil || m.Login == nil {
- return ""
- }
- return *m.Login
-}
-
-// GetMarketplacePurchase returns the MarketplacePurchase field.
-func (m *MarketplacePlanAccount) GetMarketplacePurchase() *MarketplacePurchase {
- if m == nil {
- return nil
- }
- return m.MarketplacePurchase
-}
-
-// GetOrganizationBillingEmail returns the OrganizationBillingEmail field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlanAccount) GetOrganizationBillingEmail() string {
- if m == nil || m.OrganizationBillingEmail == nil {
- return ""
- }
- return *m.OrganizationBillingEmail
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlanAccount) GetType() string {
- if m == nil || m.Type == nil {
- return ""
- }
- return *m.Type
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (m *MarketplacePlanAccount) GetURL() string {
- if m == nil || m.URL == nil {
- return ""
- }
- return *m.URL
-}
-
-// GetAccount returns the Account field.
-func (m *MarketplacePurchase) GetAccount() *MarketplacePlanAccount {
- if m == nil {
- return nil
- }
- return m.Account
-}
-
-// GetBillingCycle returns the BillingCycle field if it's non-nil, zero value otherwise.
-func (m *MarketplacePurchase) GetBillingCycle() string {
- if m == nil || m.BillingCycle == nil {
- return ""
- }
- return *m.BillingCycle
-}
-
-// GetNextBillingDate returns the NextBillingDate field if it's non-nil, zero value otherwise.
-func (m *MarketplacePurchase) GetNextBillingDate() string {
- if m == nil || m.NextBillingDate == nil {
- return ""
- }
- return *m.NextBillingDate
-}
-
-// GetPlan returns the Plan field.
-func (m *MarketplacePurchase) GetPlan() *MarketplacePlan {
- if m == nil {
- return nil
- }
- return m.Plan
-}
-
-// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise.
-func (m *MarketplacePurchase) GetUnitCount() int {
- if m == nil || m.UnitCount == nil {
- return 0
- }
- return *m.UnitCount
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (m *MarketplacePurchaseEvent) GetAction() string {
- if m == nil || m.Action == nil {
- return ""
- }
- return *m.Action
-}
-
-// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise.
-func (m *MarketplacePurchaseEvent) GetEffectiveDate() Timestamp {
- if m == nil || m.EffectiveDate == nil {
- return Timestamp{}
- }
- return *m.EffectiveDate
-}
-
-// GetInstallation returns the Installation field.
-func (m *MarketplacePurchaseEvent) GetInstallation() *Installation {
- if m == nil {
- return nil
- }
- return m.Installation
-}
-
-// GetMarketplacePurchase returns the MarketplacePurchase field.
-func (m *MarketplacePurchaseEvent) GetMarketplacePurchase() *MarketplacePurchase {
- if m == nil {
- return nil
- }
- return m.MarketplacePurchase
-}
-
-// GetPreviousMarketplacePurchase returns the PreviousMarketplacePurchase field.
-func (m *MarketplacePurchaseEvent) GetPreviousMarketplacePurchase() *MarketplacePurchase {
- if m == nil {
- return nil
- }
- return m.PreviousMarketplacePurchase
-}
-
-// GetSender returns the Sender field.
-func (m *MarketplacePurchaseEvent) GetSender() *User {
- if m == nil {
- return nil
- }
- return m.Sender
-}
-
-// GetText returns the Text field if it's non-nil, zero value otherwise.
-func (m *Match) GetText() string {
- if m == nil || m.Text == nil {
- return ""
- }
- return *m.Text
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (m *MemberEvent) GetAction() string {
- if m == nil || m.Action == nil {
- return ""
- }
- return *m.Action
-}
-
-// GetInstallation returns the Installation field.
-func (m *MemberEvent) GetInstallation() *Installation {
- if m == nil {
- return nil
- }
- return m.Installation
-}
-
-// GetMember returns the Member field.
-func (m *MemberEvent) GetMember() *User {
- if m == nil {
- return nil
- }
- return m.Member
-}
-
-// GetRepo returns the Repo field.
-func (m *MemberEvent) GetRepo() *Repository {
- if m == nil {
- return nil
- }
- return m.Repo
-}
-
-// GetSender returns the Sender field.
-func (m *MemberEvent) GetSender() *User {
- if m == nil {
- return nil
- }
- return m.Sender
-}
-
-// GetOrganization returns the Organization field.
-func (m *Membership) GetOrganization() *Organization {
- if m == nil {
- return nil
- }
- return m.Organization
-}
-
-// GetOrganizationURL returns the OrganizationURL field if it's non-nil, zero value otherwise.
-func (m *Membership) GetOrganizationURL() string {
- if m == nil || m.OrganizationURL == nil {
- return ""
- }
- return *m.OrganizationURL
-}
-
-// GetRole returns the Role field if it's non-nil, zero value otherwise.
-func (m *Membership) GetRole() string {
- if m == nil || m.Role == nil {
- return ""
- }
- return *m.Role
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (m *Membership) GetState() string {
- if m == nil || m.State == nil {
- return ""
- }
- return *m.State
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (m *Membership) GetURL() string {
- if m == nil || m.URL == nil {
- return ""
- }
- return *m.URL
-}
-
-// GetUser returns the User field.
-func (m *Membership) GetUser() *User {
- if m == nil {
- return nil
- }
- return m.User
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (m *MembershipEvent) GetAction() string {
- if m == nil || m.Action == nil {
- return ""
- }
- return *m.Action
-}
-
-// GetInstallation returns the Installation field.
-func (m *MembershipEvent) GetInstallation() *Installation {
- if m == nil {
- return nil
- }
- return m.Installation
-}
-
-// GetMember returns the Member field.
-func (m *MembershipEvent) GetMember() *User {
- if m == nil {
- return nil
- }
- return m.Member
-}
-
-// GetOrg returns the Org field.
-func (m *MembershipEvent) GetOrg() *Organization {
- if m == nil {
- return nil
- }
- return m.Org
-}
-
-// GetScope returns the Scope field if it's non-nil, zero value otherwise.
-func (m *MembershipEvent) GetScope() string {
- if m == nil || m.Scope == nil {
- return ""
- }
- return *m.Scope
-}
-
-// GetSender returns the Sender field.
-func (m *MembershipEvent) GetSender() *User {
- if m == nil {
- return nil
- }
- return m.Sender
-}
-
-// GetTeam returns the Team field.
-func (m *MembershipEvent) GetTeam() *Team {
- if m == nil {
- return nil
- }
- return m.Team
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (m *Metric) GetHTMLURL() string {
- if m == nil || m.HTMLURL == nil {
- return ""
- }
- return *m.HTMLURL
-}
-
-// GetKey returns the Key field if it's non-nil, zero value otherwise.
-func (m *Metric) GetKey() string {
- if m == nil || m.Key == nil {
- return ""
- }
- return *m.Key
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (m *Metric) GetName() string {
- if m == nil || m.Name == nil {
- return ""
- }
- return *m.Name
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (m *Metric) GetURL() string {
- if m == nil || m.URL == nil {
- return ""
- }
- return *m.URL
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (m *Migration) GetCreatedAt() string {
- if m == nil || m.CreatedAt == nil {
- return ""
- }
- return *m.CreatedAt
-}
-
-// GetExcludeAttachments returns the ExcludeAttachments field if it's non-nil, zero value otherwise.
-func (m *Migration) GetExcludeAttachments() bool {
- if m == nil || m.ExcludeAttachments == nil {
- return false
- }
- return *m.ExcludeAttachments
-}
-
-// GetGUID returns the GUID field if it's non-nil, zero value otherwise.
-func (m *Migration) GetGUID() string {
- if m == nil || m.GUID == nil {
- return ""
- }
- return *m.GUID
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (m *Migration) GetID() int64 {
- if m == nil || m.ID == nil {
- return 0
- }
- return *m.ID
-}
-
-// GetLockRepositories returns the LockRepositories field if it's non-nil, zero value otherwise.
-func (m *Migration) GetLockRepositories() bool {
- if m == nil || m.LockRepositories == nil {
- return false
- }
- return *m.LockRepositories
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (m *Migration) GetState() string {
- if m == nil || m.State == nil {
- return ""
- }
- return *m.State
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (m *Migration) GetUpdatedAt() string {
- if m == nil || m.UpdatedAt == nil {
- return ""
- }
- return *m.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (m *Migration) GetURL() string {
- if m == nil || m.URL == nil {
- return ""
- }
- return *m.URL
-}
-
-// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetClosedAt() time.Time {
- if m == nil || m.ClosedAt == nil {
- return time.Time{}
- }
- return *m.ClosedAt
-}
-
-// GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetClosedIssues() int {
- if m == nil || m.ClosedIssues == nil {
- return 0
- }
- return *m.ClosedIssues
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetCreatedAt() time.Time {
- if m == nil || m.CreatedAt == nil {
- return time.Time{}
- }
- return *m.CreatedAt
-}
-
-// GetCreator returns the Creator field.
-func (m *Milestone) GetCreator() *User {
- if m == nil {
- return nil
- }
- return m.Creator
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetDescription() string {
- if m == nil || m.Description == nil {
- return ""
- }
- return *m.Description
-}
-
-// GetDueOn returns the DueOn field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetDueOn() time.Time {
- if m == nil || m.DueOn == nil {
- return time.Time{}
- }
- return *m.DueOn
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetHTMLURL() string {
- if m == nil || m.HTMLURL == nil {
- return ""
- }
- return *m.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetID() int64 {
- if m == nil || m.ID == nil {
- return 0
- }
- return *m.ID
-}
-
-// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetLabelsURL() string {
- if m == nil || m.LabelsURL == nil {
- return ""
- }
- return *m.LabelsURL
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetNodeID() string {
- if m == nil || m.NodeID == nil {
- return ""
- }
- return *m.NodeID
-}
-
-// GetNumber returns the Number field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetNumber() int {
- if m == nil || m.Number == nil {
- return 0
- }
- return *m.Number
-}
-
-// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetOpenIssues() int {
- if m == nil || m.OpenIssues == nil {
- return 0
- }
- return *m.OpenIssues
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetState() string {
- if m == nil || m.State == nil {
- return ""
- }
- return *m.State
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetTitle() string {
- if m == nil || m.Title == nil {
- return ""
- }
- return *m.Title
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetUpdatedAt() time.Time {
- if m == nil || m.UpdatedAt == nil {
- return time.Time{}
- }
- return *m.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (m *Milestone) GetURL() string {
- if m == nil || m.URL == nil {
- return ""
- }
- return *m.URL
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (m *MilestoneEvent) GetAction() string {
- if m == nil || m.Action == nil {
- return ""
- }
- return *m.Action
-}
-
-// GetChanges returns the Changes field.
-func (m *MilestoneEvent) GetChanges() *EditChange {
- if m == nil {
- return nil
- }
- return m.Changes
-}
-
-// GetInstallation returns the Installation field.
-func (m *MilestoneEvent) GetInstallation() *Installation {
- if m == nil {
- return nil
- }
- return m.Installation
-}
-
-// GetMilestone returns the Milestone field.
-func (m *MilestoneEvent) GetMilestone() *Milestone {
- if m == nil {
- return nil
- }
- return m.Milestone
-}
-
-// GetOrg returns the Org field.
-func (m *MilestoneEvent) GetOrg() *Organization {
- if m == nil {
- return nil
- }
- return m.Org
-}
-
-// GetRepo returns the Repo field.
-func (m *MilestoneEvent) GetRepo() *Repository {
- if m == nil {
- return nil
- }
- return m.Repo
-}
-
-// GetSender returns the Sender field.
-func (m *MilestoneEvent) GetSender() *User {
- if m == nil {
- return nil
- }
- return m.Sender
-}
-
-// GetClosedMilestones returns the ClosedMilestones field if it's non-nil, zero value otherwise.
-func (m *MilestoneStats) GetClosedMilestones() int {
- if m == nil || m.ClosedMilestones == nil {
- return 0
- }
- return *m.ClosedMilestones
-}
-
-// GetOpenMilestones returns the OpenMilestones field if it's non-nil, zero value otherwise.
-func (m *MilestoneStats) GetOpenMilestones() int {
- if m == nil || m.OpenMilestones == nil {
- return 0
- }
- return *m.OpenMilestones
-}
-
-// GetTotalMilestones returns the TotalMilestones field if it's non-nil, zero value otherwise.
-func (m *MilestoneStats) GetTotalMilestones() int {
- if m == nil || m.TotalMilestones == nil {
- return 0
- }
- return *m.TotalMilestones
-}
-
-// GetBase returns the Base field if it's non-nil, zero value otherwise.
-func (n *NewPullRequest) GetBase() string {
- if n == nil || n.Base == nil {
- return ""
- }
- return *n.Base
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (n *NewPullRequest) GetBody() string {
- if n == nil || n.Body == nil {
- return ""
- }
- return *n.Body
-}
-
-// GetHead returns the Head field if it's non-nil, zero value otherwise.
-func (n *NewPullRequest) GetHead() string {
- if n == nil || n.Head == nil {
- return ""
- }
- return *n.Head
-}
-
-// GetIssue returns the Issue field if it's non-nil, zero value otherwise.
-func (n *NewPullRequest) GetIssue() int {
- if n == nil || n.Issue == nil {
- return 0
- }
- return *n.Issue
-}
-
-// GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise.
-func (n *NewPullRequest) GetMaintainerCanModify() bool {
- if n == nil || n.MaintainerCanModify == nil {
- return false
- }
- return *n.MaintainerCanModify
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (n *NewPullRequest) GetTitle() string {
- if n == nil || n.Title == nil {
- return ""
- }
- return *n.Title
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (n *NewTeam) GetDescription() string {
- if n == nil || n.Description == nil {
- return ""
- }
- return *n.Description
-}
-
-// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise.
-func (n *NewTeam) GetLDAPDN() string {
- if n == nil || n.LDAPDN == nil {
- return ""
- }
- return *n.LDAPDN
-}
-
-// GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise.
-func (n *NewTeam) GetParentTeamID() int64 {
- if n == nil || n.ParentTeamID == nil {
- return 0
- }
- return *n.ParentTeamID
-}
-
-// GetPermission returns the Permission field if it's non-nil, zero value otherwise.
-func (n *NewTeam) GetPermission() string {
- if n == nil || n.Permission == nil {
- return ""
- }
- return *n.Permission
-}
-
-// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise.
-func (n *NewTeam) GetPrivacy() string {
- if n == nil || n.Privacy == nil {
- return ""
- }
- return *n.Privacy
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (n *Notification) GetID() string {
- if n == nil || n.ID == nil {
- return ""
- }
- return *n.ID
-}
-
-// GetLastReadAt returns the LastReadAt field if it's non-nil, zero value otherwise.
-func (n *Notification) GetLastReadAt() time.Time {
- if n == nil || n.LastReadAt == nil {
- return time.Time{}
- }
- return *n.LastReadAt
-}
-
-// GetReason returns the Reason field if it's non-nil, zero value otherwise.
-func (n *Notification) GetReason() string {
- if n == nil || n.Reason == nil {
- return ""
- }
- return *n.Reason
-}
-
-// GetRepository returns the Repository field.
-func (n *Notification) GetRepository() *Repository {
- if n == nil {
- return nil
- }
- return n.Repository
-}
-
-// GetSubject returns the Subject field.
-func (n *Notification) GetSubject() *NotificationSubject {
- if n == nil {
- return nil
- }
- return n.Subject
-}
-
-// GetUnread returns the Unread field if it's non-nil, zero value otherwise.
-func (n *Notification) GetUnread() bool {
- if n == nil || n.Unread == nil {
- return false
- }
- return *n.Unread
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (n *Notification) GetUpdatedAt() time.Time {
- if n == nil || n.UpdatedAt == nil {
- return time.Time{}
- }
- return *n.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (n *Notification) GetURL() string {
- if n == nil || n.URL == nil {
- return ""
- }
- return *n.URL
-}
-
-// GetLatestCommentURL returns the LatestCommentURL field if it's non-nil, zero value otherwise.
-func (n *NotificationSubject) GetLatestCommentURL() string {
- if n == nil || n.LatestCommentURL == nil {
- return ""
- }
- return *n.LatestCommentURL
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (n *NotificationSubject) GetTitle() string {
- if n == nil || n.Title == nil {
- return ""
- }
- return *n.Title
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (n *NotificationSubject) GetType() string {
- if n == nil || n.Type == nil {
- return ""
- }
- return *n.Type
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (n *NotificationSubject) GetURL() string {
- if n == nil || n.URL == nil {
- return ""
- }
- return *n.URL
-}
-
-// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetAvatarURL() string {
- if o == nil || o.AvatarURL == nil {
- return ""
- }
- return *o.AvatarURL
-}
-
-// GetBillingEmail returns the BillingEmail field if it's non-nil, zero value otherwise.
-func (o *Organization) GetBillingEmail() string {
- if o == nil || o.BillingEmail == nil {
- return ""
- }
- return *o.BillingEmail
-}
-
-// GetBlog returns the Blog field if it's non-nil, zero value otherwise.
-func (o *Organization) GetBlog() string {
- if o == nil || o.Blog == nil {
- return ""
- }
- return *o.Blog
-}
-
-// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise.
-func (o *Organization) GetCollaborators() int {
- if o == nil || o.Collaborators == nil {
- return 0
- }
- return *o.Collaborators
-}
-
-// GetCompany returns the Company field if it's non-nil, zero value otherwise.
-func (o *Organization) GetCompany() string {
- if o == nil || o.Company == nil {
- return ""
- }
- return *o.Company
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (o *Organization) GetCreatedAt() time.Time {
- if o == nil || o.CreatedAt == nil {
- return time.Time{}
- }
- return *o.CreatedAt
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (o *Organization) GetDescription() string {
- if o == nil || o.Description == nil {
- return ""
- }
- return *o.Description
-}
-
-// GetDiskUsage returns the DiskUsage field if it's non-nil, zero value otherwise.
-func (o *Organization) GetDiskUsage() int {
- if o == nil || o.DiskUsage == nil {
- return 0
- }
- return *o.DiskUsage
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (o *Organization) GetEmail() string {
- if o == nil || o.Email == nil {
- return ""
- }
- return *o.Email
-}
-
-// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetEventsURL() string {
- if o == nil || o.EventsURL == nil {
- return ""
- }
- return *o.EventsURL
-}
-
-// GetFollowers returns the Followers field if it's non-nil, zero value otherwise.
-func (o *Organization) GetFollowers() int {
- if o == nil || o.Followers == nil {
- return 0
- }
- return *o.Followers
-}
-
-// GetFollowing returns the Following field if it's non-nil, zero value otherwise.
-func (o *Organization) GetFollowing() int {
- if o == nil || o.Following == nil {
- return 0
- }
- return *o.Following
-}
-
-// GetHooksURL returns the HooksURL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetHooksURL() string {
- if o == nil || o.HooksURL == nil {
- return ""
- }
- return *o.HooksURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetHTMLURL() string {
- if o == nil || o.HTMLURL == nil {
- return ""
- }
- return *o.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (o *Organization) GetID() int64 {
- if o == nil || o.ID == nil {
- return 0
- }
- return *o.ID
-}
-
-// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetIssuesURL() string {
- if o == nil || o.IssuesURL == nil {
- return ""
- }
- return *o.IssuesURL
-}
-
-// GetLocation returns the Location field if it's non-nil, zero value otherwise.
-func (o *Organization) GetLocation() string {
- if o == nil || o.Location == nil {
- return ""
- }
- return *o.Location
-}
-
-// GetLogin returns the Login field if it's non-nil, zero value otherwise.
-func (o *Organization) GetLogin() string {
- if o == nil || o.Login == nil {
- return ""
- }
- return *o.Login
-}
-
-// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetMembersURL() string {
- if o == nil || o.MembersURL == nil {
- return ""
- }
- return *o.MembersURL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (o *Organization) GetName() string {
- if o == nil || o.Name == nil {
- return ""
- }
- return *o.Name
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (o *Organization) GetNodeID() string {
- if o == nil || o.NodeID == nil {
- return ""
- }
- return *o.NodeID
-}
-
-// GetOwnedPrivateRepos returns the OwnedPrivateRepos field if it's non-nil, zero value otherwise.
-func (o *Organization) GetOwnedPrivateRepos() int {
- if o == nil || o.OwnedPrivateRepos == nil {
- return 0
- }
- return *o.OwnedPrivateRepos
-}
-
-// GetPlan returns the Plan field.
-func (o *Organization) GetPlan() *Plan {
- if o == nil {
- return nil
- }
- return o.Plan
-}
-
-// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise.
-func (o *Organization) GetPrivateGists() int {
- if o == nil || o.PrivateGists == nil {
- return 0
- }
- return *o.PrivateGists
-}
-
-// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise.
-func (o *Organization) GetPublicGists() int {
- if o == nil || o.PublicGists == nil {
- return 0
- }
- return *o.PublicGists
-}
-
-// GetPublicMembersURL returns the PublicMembersURL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetPublicMembersURL() string {
- if o == nil || o.PublicMembersURL == nil {
- return ""
- }
- return *o.PublicMembersURL
-}
-
-// GetPublicRepos returns the PublicRepos field if it's non-nil, zero value otherwise.
-func (o *Organization) GetPublicRepos() int {
- if o == nil || o.PublicRepos == nil {
- return 0
- }
- return *o.PublicRepos
-}
-
-// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetReposURL() string {
- if o == nil || o.ReposURL == nil {
- return ""
- }
- return *o.ReposURL
-}
-
-// GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise.
-func (o *Organization) GetTotalPrivateRepos() int {
- if o == nil || o.TotalPrivateRepos == nil {
- return 0
- }
- return *o.TotalPrivateRepos
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (o *Organization) GetType() string {
- if o == nil || o.Type == nil {
- return ""
- }
- return *o.Type
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (o *Organization) GetUpdatedAt() time.Time {
- if o == nil || o.UpdatedAt == nil {
- return time.Time{}
- }
- return *o.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (o *Organization) GetURL() string {
- if o == nil || o.URL == nil {
- return ""
- }
- return *o.URL
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (o *OrganizationEvent) GetAction() string {
- if o == nil || o.Action == nil {
- return ""
- }
- return *o.Action
-}
-
-// GetInstallation returns the Installation field.
-func (o *OrganizationEvent) GetInstallation() *Installation {
- if o == nil {
- return nil
- }
- return o.Installation
-}
-
-// GetInvitation returns the Invitation field.
-func (o *OrganizationEvent) GetInvitation() *Invitation {
- if o == nil {
- return nil
- }
- return o.Invitation
-}
-
-// GetMembership returns the Membership field.
-func (o *OrganizationEvent) GetMembership() *Membership {
- if o == nil {
- return nil
- }
- return o.Membership
-}
-
-// GetOrganization returns the Organization field.
-func (o *OrganizationEvent) GetOrganization() *Organization {
- if o == nil {
- return nil
- }
- return o.Organization
-}
-
-// GetSender returns the Sender field.
-func (o *OrganizationEvent) GetSender() *User {
- if o == nil {
- return nil
- }
- return o.Sender
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (o *OrgBlockEvent) GetAction() string {
- if o == nil || o.Action == nil {
- return ""
- }
- return *o.Action
-}
-
-// GetBlockedUser returns the BlockedUser field.
-func (o *OrgBlockEvent) GetBlockedUser() *User {
- if o == nil {
- return nil
- }
- return o.BlockedUser
-}
-
-// GetInstallation returns the Installation field.
-func (o *OrgBlockEvent) GetInstallation() *Installation {
- if o == nil {
- return nil
- }
- return o.Installation
-}
-
-// GetOrganization returns the Organization field.
-func (o *OrgBlockEvent) GetOrganization() *Organization {
- if o == nil {
- return nil
- }
- return o.Organization
-}
-
-// GetSender returns the Sender field.
-func (o *OrgBlockEvent) GetSender() *User {
- if o == nil {
- return nil
- }
- return o.Sender
-}
-
-// GetDisabledOrgs returns the DisabledOrgs field if it's non-nil, zero value otherwise.
-func (o *OrgStats) GetDisabledOrgs() int {
- if o == nil || o.DisabledOrgs == nil {
- return 0
- }
- return *o.DisabledOrgs
-}
-
-// GetTotalOrgs returns the TotalOrgs field if it's non-nil, zero value otherwise.
-func (o *OrgStats) GetTotalOrgs() int {
- if o == nil || o.TotalOrgs == nil {
- return 0
- }
- return *o.TotalOrgs
-}
-
-// GetTotalTeamMembers returns the TotalTeamMembers field if it's non-nil, zero value otherwise.
-func (o *OrgStats) GetTotalTeamMembers() int {
- if o == nil || o.TotalTeamMembers == nil {
- return 0
- }
- return *o.TotalTeamMembers
-}
-
-// GetTotalTeams returns the TotalTeams field if it's non-nil, zero value otherwise.
-func (o *OrgStats) GetTotalTeams() int {
- if o == nil || o.TotalTeams == nil {
- return 0
- }
- return *o.TotalTeams
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (p *Page) GetAction() string {
- if p == nil || p.Action == nil {
- return ""
- }
- return *p.Action
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (p *Page) GetHTMLURL() string {
- if p == nil || p.HTMLURL == nil {
- return ""
- }
- return *p.HTMLURL
-}
-
-// GetPageName returns the PageName field if it's non-nil, zero value otherwise.
-func (p *Page) GetPageName() string {
- if p == nil || p.PageName == nil {
- return ""
- }
- return *p.PageName
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (p *Page) GetSHA() string {
- if p == nil || p.SHA == nil {
- return ""
- }
- return *p.SHA
-}
-
-// GetSummary returns the Summary field if it's non-nil, zero value otherwise.
-func (p *Page) GetSummary() string {
- if p == nil || p.Summary == nil {
- return ""
- }
- return *p.Summary
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (p *Page) GetTitle() string {
- if p == nil || p.Title == nil {
- return ""
- }
- return *p.Title
-}
-
-// GetBuild returns the Build field.
-func (p *PageBuildEvent) GetBuild() *PagesBuild {
- if p == nil {
- return nil
- }
- return p.Build
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *PageBuildEvent) GetID() int64 {
- if p == nil || p.ID == nil {
- return 0
- }
- return *p.ID
-}
-
-// GetInstallation returns the Installation field.
-func (p *PageBuildEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetRepo returns the Repo field.
-func (p *PageBuildEvent) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSender returns the Sender field.
-func (p *PageBuildEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetCNAME returns the CNAME field if it's non-nil, zero value otherwise.
-func (p *Pages) GetCNAME() string {
- if p == nil || p.CNAME == nil {
- return ""
- }
- return *p.CNAME
-}
-
-// GetCustom404 returns the Custom404 field if it's non-nil, zero value otherwise.
-func (p *Pages) GetCustom404() bool {
- if p == nil || p.Custom404 == nil {
- return false
- }
- return *p.Custom404
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (p *Pages) GetHTMLURL() string {
- if p == nil || p.HTMLURL == nil {
- return ""
- }
- return *p.HTMLURL
-}
-
-// GetStatus returns the Status field if it's non-nil, zero value otherwise.
-func (p *Pages) GetStatus() string {
- if p == nil || p.Status == nil {
- return ""
- }
- return *p.Status
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *Pages) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetCommit returns the Commit field if it's non-nil, zero value otherwise.
-func (p *PagesBuild) GetCommit() string {
- if p == nil || p.Commit == nil {
- return ""
- }
- return *p.Commit
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (p *PagesBuild) GetCreatedAt() Timestamp {
- if p == nil || p.CreatedAt == nil {
- return Timestamp{}
- }
- return *p.CreatedAt
-}
-
-// GetDuration returns the Duration field if it's non-nil, zero value otherwise.
-func (p *PagesBuild) GetDuration() int {
- if p == nil || p.Duration == nil {
- return 0
- }
- return *p.Duration
-}
-
-// GetError returns the Error field.
-func (p *PagesBuild) GetError() *PagesError {
- if p == nil {
- return nil
- }
- return p.Error
-}
-
-// GetPusher returns the Pusher field.
-func (p *PagesBuild) GetPusher() *User {
- if p == nil {
- return nil
- }
- return p.Pusher
-}
-
-// GetStatus returns the Status field if it's non-nil, zero value otherwise.
-func (p *PagesBuild) GetStatus() string {
- if p == nil || p.Status == nil {
- return ""
- }
- return *p.Status
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (p *PagesBuild) GetUpdatedAt() Timestamp {
- if p == nil || p.UpdatedAt == nil {
- return Timestamp{}
- }
- return *p.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *PagesBuild) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (p *PagesError) GetMessage() string {
- if p == nil || p.Message == nil {
- return ""
- }
- return *p.Message
-}
-
-// GetTotalPages returns the TotalPages field if it's non-nil, zero value otherwise.
-func (p *PageStats) GetTotalPages() int {
- if p == nil || p.TotalPages == nil {
- return 0
- }
- return *p.TotalPages
-}
-
-// GetHook returns the Hook field.
-func (p *PingEvent) GetHook() *Hook {
- if p == nil {
- return nil
- }
- return p.Hook
-}
-
-// GetHookID returns the HookID field if it's non-nil, zero value otherwise.
-func (p *PingEvent) GetHookID() int64 {
- if p == nil || p.HookID == nil {
- return 0
- }
- return *p.HookID
-}
-
-// GetInstallation returns the Installation field.
-func (p *PingEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetZen returns the Zen field if it's non-nil, zero value otherwise.
-func (p *PingEvent) GetZen() string {
- if p == nil || p.Zen == nil {
- return ""
- }
- return *p.Zen
-}
-
-// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise.
-func (p *Plan) GetCollaborators() int {
- if p == nil || p.Collaborators == nil {
- return 0
- }
- return *p.Collaborators
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (p *Plan) GetName() string {
- if p == nil || p.Name == nil {
- return ""
- }
- return *p.Name
-}
-
-// GetPrivateRepos returns the PrivateRepos field if it's non-nil, zero value otherwise.
-func (p *Plan) GetPrivateRepos() int {
- if p == nil || p.PrivateRepos == nil {
- return 0
- }
- return *p.PrivateRepos
-}
-
-// GetSpace returns the Space field if it's non-nil, zero value otherwise.
-func (p *Plan) GetSpace() int {
- if p == nil || p.Space == nil {
- return 0
- }
- return *p.Space
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (p *Project) GetBody() string {
- if p == nil || p.Body == nil {
- return ""
- }
- return *p.Body
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (p *Project) GetCreatedAt() Timestamp {
- if p == nil || p.CreatedAt == nil {
- return Timestamp{}
- }
- return *p.CreatedAt
-}
-
-// GetCreator returns the Creator field.
-func (p *Project) GetCreator() *User {
- if p == nil {
- return nil
- }
- return p.Creator
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *Project) GetID() int64 {
- if p == nil || p.ID == nil {
- return 0
- }
- return *p.ID
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (p *Project) GetName() string {
- if p == nil || p.Name == nil {
- return ""
- }
- return *p.Name
-}
-
-// GetNumber returns the Number field if it's non-nil, zero value otherwise.
-func (p *Project) GetNumber() int {
- if p == nil || p.Number == nil {
- return 0
- }
- return *p.Number
-}
-
-// GetOwnerURL returns the OwnerURL field if it's non-nil, zero value otherwise.
-func (p *Project) GetOwnerURL() string {
- if p == nil || p.OwnerURL == nil {
- return ""
- }
- return *p.OwnerURL
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (p *Project) GetUpdatedAt() Timestamp {
- if p == nil || p.UpdatedAt == nil {
- return Timestamp{}
- }
- return *p.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *Project) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetColumnID returns the ColumnID field if it's non-nil, zero value otherwise.
-func (p *ProjectCard) GetColumnID() int64 {
- if p == nil || p.ColumnID == nil {
- return 0
- }
- return *p.ColumnID
-}
-
-// GetColumnURL returns the ColumnURL field if it's non-nil, zero value otherwise.
-func (p *ProjectCard) GetColumnURL() string {
- if p == nil || p.ColumnURL == nil {
- return ""
- }
- return *p.ColumnURL
-}
-
-// GetContentURL returns the ContentURL field if it's non-nil, zero value otherwise.
-func (p *ProjectCard) GetContentURL() string {
- if p == nil || p.ContentURL == nil {
- return ""
- }
- return *p.ContentURL
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (p *ProjectCard) GetCreatedAt() Timestamp {
- if p == nil || p.CreatedAt == nil {
- return Timestamp{}
- }
- return *p.CreatedAt
-}
-
-// GetCreator returns the Creator field.
-func (p *ProjectCard) GetCreator() *User {
- if p == nil {
- return nil
- }
- return p.Creator
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *ProjectCard) GetID() int64 {
- if p == nil || p.ID == nil {
- return 0
- }
- return *p.ID
-}
-
-// GetNote returns the Note field if it's non-nil, zero value otherwise.
-func (p *ProjectCard) GetNote() string {
- if p == nil || p.Note == nil {
- return ""
- }
- return *p.Note
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (p *ProjectCard) GetUpdatedAt() Timestamp {
- if p == nil || p.UpdatedAt == nil {
- return Timestamp{}
- }
- return *p.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *ProjectCard) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (p *ProjectCardEvent) GetAction() string {
- if p == nil || p.Action == nil {
- return ""
- }
- return *p.Action
-}
-
-// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise.
-func (p *ProjectCardEvent) GetAfterID() int64 {
- if p == nil || p.AfterID == nil {
- return 0
- }
- return *p.AfterID
-}
-
-// GetChanges returns the Changes field.
-func (p *ProjectCardEvent) GetChanges() *ProjectCardChange {
- if p == nil {
- return nil
- }
- return p.Changes
-}
-
-// GetInstallation returns the Installation field.
-func (p *ProjectCardEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetOrg returns the Org field.
-func (p *ProjectCardEvent) GetOrg() *Organization {
- if p == nil {
- return nil
- }
- return p.Org
-}
-
-// GetProjectCard returns the ProjectCard field.
-func (p *ProjectCardEvent) GetProjectCard() *ProjectCard {
- if p == nil {
- return nil
- }
- return p.ProjectCard
-}
-
-// GetRepo returns the Repo field.
-func (p *ProjectCardEvent) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSender returns the Sender field.
-func (p *ProjectCardEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (p *ProjectColumn) GetCreatedAt() Timestamp {
- if p == nil || p.CreatedAt == nil {
- return Timestamp{}
- }
- return *p.CreatedAt
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *ProjectColumn) GetID() int64 {
- if p == nil || p.ID == nil {
- return 0
- }
- return *p.ID
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (p *ProjectColumn) GetName() string {
- if p == nil || p.Name == nil {
- return ""
- }
- return *p.Name
-}
-
-// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise.
-func (p *ProjectColumn) GetProjectURL() string {
- if p == nil || p.ProjectURL == nil {
- return ""
- }
- return *p.ProjectURL
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (p *ProjectColumn) GetUpdatedAt() Timestamp {
- if p == nil || p.UpdatedAt == nil {
- return Timestamp{}
- }
- return *p.UpdatedAt
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (p *ProjectColumnEvent) GetAction() string {
- if p == nil || p.Action == nil {
- return ""
- }
- return *p.Action
-}
-
-// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise.
-func (p *ProjectColumnEvent) GetAfterID() int64 {
- if p == nil || p.AfterID == nil {
- return 0
- }
- return *p.AfterID
-}
-
-// GetChanges returns the Changes field.
-func (p *ProjectColumnEvent) GetChanges() *ProjectColumnChange {
- if p == nil {
- return nil
- }
- return p.Changes
-}
-
-// GetInstallation returns the Installation field.
-func (p *ProjectColumnEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetOrg returns the Org field.
-func (p *ProjectColumnEvent) GetOrg() *Organization {
- if p == nil {
- return nil
- }
- return p.Org
-}
-
-// GetProjectColumn returns the ProjectColumn field.
-func (p *ProjectColumnEvent) GetProjectColumn() *ProjectColumn {
- if p == nil {
- return nil
- }
- return p.ProjectColumn
-}
-
-// GetRepo returns the Repo field.
-func (p *ProjectColumnEvent) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSender returns the Sender field.
-func (p *ProjectColumnEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (p *ProjectEvent) GetAction() string {
- if p == nil || p.Action == nil {
- return ""
- }
- return *p.Action
-}
-
-// GetChanges returns the Changes field.
-func (p *ProjectEvent) GetChanges() *ProjectChange {
- if p == nil {
- return nil
- }
- return p.Changes
-}
-
-// GetInstallation returns the Installation field.
-func (p *ProjectEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetOrg returns the Org field.
-func (p *ProjectEvent) GetOrg() *Organization {
- if p == nil {
- return nil
- }
- return p.Org
-}
-
-// GetProject returns the Project field.
-func (p *ProjectEvent) GetProject() *Project {
- if p == nil {
- return nil
- }
- return p.Project
-}
-
-// GetRepo returns the Repo field.
-func (p *ProjectEvent) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSender returns the Sender field.
-func (p *ProjectEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetEnforceAdmins returns the EnforceAdmins field.
-func (p *Protection) GetEnforceAdmins() *AdminEnforcement {
- if p == nil {
- return nil
- }
- return p.EnforceAdmins
-}
-
-// GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field.
-func (p *Protection) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcement {
- if p == nil {
- return nil
- }
- return p.RequiredPullRequestReviews
-}
-
-// GetRequiredStatusChecks returns the RequiredStatusChecks field.
-func (p *Protection) GetRequiredStatusChecks() *RequiredStatusChecks {
- if p == nil {
- return nil
- }
- return p.RequiredStatusChecks
-}
-
-// GetRestrictions returns the Restrictions field.
-func (p *Protection) GetRestrictions() *BranchRestrictions {
- if p == nil {
- return nil
- }
- return p.Restrictions
-}
-
-// GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field.
-func (p *ProtectionRequest) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcementRequest {
- if p == nil {
- return nil
- }
- return p.RequiredPullRequestReviews
-}
-
-// GetRequiredStatusChecks returns the RequiredStatusChecks field.
-func (p *ProtectionRequest) GetRequiredStatusChecks() *RequiredStatusChecks {
- if p == nil {
- return nil
- }
- return p.RequiredStatusChecks
-}
-
-// GetRestrictions returns the Restrictions field.
-func (p *ProtectionRequest) GetRestrictions() *BranchRestrictionsRequest {
- if p == nil {
- return nil
- }
- return p.Restrictions
-}
-
-// GetInstallation returns the Installation field.
-func (p *PublicEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetRepo returns the Repo field.
-func (p *PublicEvent) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSender returns the Sender field.
-func (p *PublicEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetAdditions returns the Additions field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetAdditions() int {
- if p == nil || p.Additions == nil {
- return 0
- }
- return *p.Additions
-}
-
-// GetAssignee returns the Assignee field.
-func (p *PullRequest) GetAssignee() *User {
- if p == nil {
- return nil
- }
- return p.Assignee
-}
-
-// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetAuthorAssociation() string {
- if p == nil || p.AuthorAssociation == nil {
- return ""
- }
- return *p.AuthorAssociation
-}
-
-// GetBase returns the Base field.
-func (p *PullRequest) GetBase() *PullRequestBranch {
- if p == nil {
- return nil
- }
- return p.Base
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetBody() string {
- if p == nil || p.Body == nil {
- return ""
- }
- return *p.Body
-}
-
-// GetChangedFiles returns the ChangedFiles field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetChangedFiles() int {
- if p == nil || p.ChangedFiles == nil {
- return 0
- }
- return *p.ChangedFiles
-}
-
-// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetClosedAt() time.Time {
- if p == nil || p.ClosedAt == nil {
- return time.Time{}
- }
- return *p.ClosedAt
-}
-
-// GetComments returns the Comments field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetComments() int {
- if p == nil || p.Comments == nil {
- return 0
- }
- return *p.Comments
-}
-
-// GetCommits returns the Commits field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetCommits() int {
- if p == nil || p.Commits == nil {
- return 0
- }
- return *p.Commits
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetCreatedAt() time.Time {
- if p == nil || p.CreatedAt == nil {
- return time.Time{}
- }
- return *p.CreatedAt
-}
-
-// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetDeletions() int {
- if p == nil || p.Deletions == nil {
- return 0
- }
- return *p.Deletions
-}
-
-// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetDiffURL() string {
- if p == nil || p.DiffURL == nil {
- return ""
- }
- return *p.DiffURL
-}
-
-// GetHead returns the Head field.
-func (p *PullRequest) GetHead() *PullRequestBranch {
- if p == nil {
- return nil
- }
- return p.Head
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetHTMLURL() string {
- if p == nil || p.HTMLURL == nil {
- return ""
- }
- return *p.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetID() int64 {
- if p == nil || p.ID == nil {
- return 0
- }
- return *p.ID
-}
-
-// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetIssueURL() string {
- if p == nil || p.IssueURL == nil {
- return ""
- }
- return *p.IssueURL
-}
-
-// GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetMaintainerCanModify() bool {
- if p == nil || p.MaintainerCanModify == nil {
- return false
- }
- return *p.MaintainerCanModify
-}
-
-// GetMergeable returns the Mergeable field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetMergeable() bool {
- if p == nil || p.Mergeable == nil {
- return false
- }
- return *p.Mergeable
-}
-
-// GetMergeableState returns the MergeableState field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetMergeableState() string {
- if p == nil || p.MergeableState == nil {
- return ""
- }
- return *p.MergeableState
-}
-
-// GetMergeCommitSHA returns the MergeCommitSHA field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetMergeCommitSHA() string {
- if p == nil || p.MergeCommitSHA == nil {
- return ""
- }
- return *p.MergeCommitSHA
-}
-
-// GetMerged returns the Merged field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetMerged() bool {
- if p == nil || p.Merged == nil {
- return false
- }
- return *p.Merged
-}
-
-// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetMergedAt() time.Time {
- if p == nil || p.MergedAt == nil {
- return time.Time{}
- }
- return *p.MergedAt
-}
-
-// GetMergedBy returns the MergedBy field.
-func (p *PullRequest) GetMergedBy() *User {
- if p == nil {
- return nil
- }
- return p.MergedBy
-}
-
-// GetMilestone returns the Milestone field.
-func (p *PullRequest) GetMilestone() *Milestone {
- if p == nil {
- return nil
- }
- return p.Milestone
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetNodeID() string {
- if p == nil || p.NodeID == nil {
- return ""
- }
- return *p.NodeID
-}
-
-// GetNumber returns the Number field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetNumber() int {
- if p == nil || p.Number == nil {
- return 0
- }
- return *p.Number
-}
-
-// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetPatchURL() string {
- if p == nil || p.PatchURL == nil {
- return ""
- }
- return *p.PatchURL
-}
-
-// GetReviewCommentsURL returns the ReviewCommentsURL field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetReviewCommentsURL() string {
- if p == nil || p.ReviewCommentsURL == nil {
- return ""
- }
- return *p.ReviewCommentsURL
-}
-
-// GetReviewCommentURL returns the ReviewCommentURL field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetReviewCommentURL() string {
- if p == nil || p.ReviewCommentURL == nil {
- return ""
- }
- return *p.ReviewCommentURL
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetState() string {
- if p == nil || p.State == nil {
- return ""
- }
- return *p.State
-}
-
-// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetStatusesURL() string {
- if p == nil || p.StatusesURL == nil {
- return ""
- }
- return *p.StatusesURL
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetTitle() string {
- if p == nil || p.Title == nil {
- return ""
- }
- return *p.Title
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetUpdatedAt() time.Time {
- if p == nil || p.UpdatedAt == nil {
- return time.Time{}
- }
- return *p.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *PullRequest) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetUser returns the User field.
-func (p *PullRequest) GetUser() *User {
- if p == nil {
- return nil
- }
- return p.User
-}
-
-// GetLabel returns the Label field if it's non-nil, zero value otherwise.
-func (p *PullRequestBranch) GetLabel() string {
- if p == nil || p.Label == nil {
- return ""
- }
- return *p.Label
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (p *PullRequestBranch) GetRef() string {
- if p == nil || p.Ref == nil {
- return ""
- }
- return *p.Ref
-}
-
-// GetRepo returns the Repo field.
-func (p *PullRequestBranch) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (p *PullRequestBranch) GetSHA() string {
- if p == nil || p.SHA == nil {
- return ""
- }
- return *p.SHA
-}
-
-// GetUser returns the User field.
-func (p *PullRequestBranch) GetUser() *User {
- if p == nil {
- return nil
- }
- return p.User
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetBody() string {
- if p == nil || p.Body == nil {
- return ""
- }
- return *p.Body
-}
-
-// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetCommitID() string {
- if p == nil || p.CommitID == nil {
- return ""
- }
- return *p.CommitID
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetCreatedAt() time.Time {
- if p == nil || p.CreatedAt == nil {
- return time.Time{}
- }
- return *p.CreatedAt
-}
-
-// GetDiffHunk returns the DiffHunk field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetDiffHunk() string {
- if p == nil || p.DiffHunk == nil {
- return ""
- }
- return *p.DiffHunk
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetHTMLURL() string {
- if p == nil || p.HTMLURL == nil {
- return ""
- }
- return *p.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetID() int64 {
- if p == nil || p.ID == nil {
- return 0
- }
- return *p.ID
-}
-
-// GetInReplyTo returns the InReplyTo field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetInReplyTo() int64 {
- if p == nil || p.InReplyTo == nil {
- return 0
- }
- return *p.InReplyTo
-}
-
-// GetOriginalCommitID returns the OriginalCommitID field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetOriginalCommitID() string {
- if p == nil || p.OriginalCommitID == nil {
- return ""
- }
- return *p.OriginalCommitID
-}
-
-// GetOriginalPosition returns the OriginalPosition field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetOriginalPosition() int {
- if p == nil || p.OriginalPosition == nil {
- return 0
- }
- return *p.OriginalPosition
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetPath() string {
- if p == nil || p.Path == nil {
- return ""
- }
- return *p.Path
-}
-
-// GetPosition returns the Position field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetPosition() int {
- if p == nil || p.Position == nil {
- return 0
- }
- return *p.Position
-}
-
-// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetPullRequestURL() string {
- if p == nil || p.PullRequestURL == nil {
- return ""
- }
- return *p.PullRequestURL
-}
-
-// GetReactions returns the Reactions field.
-func (p *PullRequestComment) GetReactions() *Reactions {
- if p == nil {
- return nil
- }
- return p.Reactions
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetUpdatedAt() time.Time {
- if p == nil || p.UpdatedAt == nil {
- return time.Time{}
- }
- return *p.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *PullRequestComment) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetUser returns the User field.
-func (p *PullRequestComment) GetUser() *User {
- if p == nil {
- return nil
- }
- return p.User
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (p *PullRequestEvent) GetAction() string {
- if p == nil || p.Action == nil {
- return ""
- }
- return *p.Action
-}
-
-// GetChanges returns the Changes field.
-func (p *PullRequestEvent) GetChanges() *EditChange {
- if p == nil {
- return nil
- }
- return p.Changes
-}
-
-// GetInstallation returns the Installation field.
-func (p *PullRequestEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetNumber returns the Number field if it's non-nil, zero value otherwise.
-func (p *PullRequestEvent) GetNumber() int {
- if p == nil || p.Number == nil {
- return 0
- }
- return *p.Number
-}
-
-// GetPullRequest returns the PullRequest field.
-func (p *PullRequestEvent) GetPullRequest() *PullRequest {
- if p == nil {
- return nil
- }
- return p.PullRequest
-}
-
-// GetRepo returns the Repo field.
-func (p *PullRequestEvent) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSender returns the Sender field.
-func (p *PullRequestEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise.
-func (p *PullRequestLinks) GetDiffURL() string {
- if p == nil || p.DiffURL == nil {
- return ""
- }
- return *p.DiffURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (p *PullRequestLinks) GetHTMLURL() string {
- if p == nil || p.HTMLURL == nil {
- return ""
- }
- return *p.HTMLURL
-}
-
-// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise.
-func (p *PullRequestLinks) GetPatchURL() string {
- if p == nil || p.PatchURL == nil {
- return ""
- }
- return *p.PatchURL
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *PullRequestLinks) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetMerged returns the Merged field if it's non-nil, zero value otherwise.
-func (p *PullRequestMergeResult) GetMerged() bool {
- if p == nil || p.Merged == nil {
- return false
- }
- return *p.Merged
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (p *PullRequestMergeResult) GetMessage() string {
- if p == nil || p.Message == nil {
- return ""
- }
- return *p.Message
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (p *PullRequestMergeResult) GetSHA() string {
- if p == nil || p.SHA == nil {
- return ""
- }
- return *p.SHA
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (p *PullRequestReview) GetBody() string {
- if p == nil || p.Body == nil {
- return ""
- }
- return *p.Body
-}
-
-// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise.
-func (p *PullRequestReview) GetCommitID() string {
- if p == nil || p.CommitID == nil {
- return ""
- }
- return *p.CommitID
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (p *PullRequestReview) GetHTMLURL() string {
- if p == nil || p.HTMLURL == nil {
- return ""
- }
- return *p.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *PullRequestReview) GetID() int64 {
- if p == nil || p.ID == nil {
- return 0
- }
- return *p.ID
-}
-
-// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise.
-func (p *PullRequestReview) GetPullRequestURL() string {
- if p == nil || p.PullRequestURL == nil {
- return ""
- }
- return *p.PullRequestURL
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (p *PullRequestReview) GetState() string {
- if p == nil || p.State == nil {
- return ""
- }
- return *p.State
-}
-
-// GetSubmittedAt returns the SubmittedAt field if it's non-nil, zero value otherwise.
-func (p *PullRequestReview) GetSubmittedAt() time.Time {
- if p == nil || p.SubmittedAt == nil {
- return time.Time{}
- }
- return *p.SubmittedAt
-}
-
-// GetUser returns the User field.
-func (p *PullRequestReview) GetUser() *User {
- if p == nil {
- return nil
- }
- return p.User
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (p *PullRequestReviewCommentEvent) GetAction() string {
- if p == nil || p.Action == nil {
- return ""
- }
- return *p.Action
-}
-
-// GetChanges returns the Changes field.
-func (p *PullRequestReviewCommentEvent) GetChanges() *EditChange {
- if p == nil {
- return nil
- }
- return p.Changes
-}
-
-// GetComment returns the Comment field.
-func (p *PullRequestReviewCommentEvent) GetComment() *PullRequestComment {
- if p == nil {
- return nil
- }
- return p.Comment
-}
-
-// GetInstallation returns the Installation field.
-func (p *PullRequestReviewCommentEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetPullRequest returns the PullRequest field.
-func (p *PullRequestReviewCommentEvent) GetPullRequest() *PullRequest {
- if p == nil {
- return nil
- }
- return p.PullRequest
-}
-
-// GetRepo returns the Repo field.
-func (p *PullRequestReviewCommentEvent) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSender returns the Sender field.
-func (p *PullRequestReviewCommentEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (p *PullRequestReviewDismissalRequest) GetMessage() string {
- if p == nil || p.Message == nil {
- return ""
- }
- return *p.Message
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (p *PullRequestReviewEvent) GetAction() string {
- if p == nil || p.Action == nil {
- return ""
- }
- return *p.Action
-}
-
-// GetInstallation returns the Installation field.
-func (p *PullRequestReviewEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetOrganization returns the Organization field.
-func (p *PullRequestReviewEvent) GetOrganization() *Organization {
- if p == nil {
- return nil
- }
- return p.Organization
-}
-
-// GetPullRequest returns the PullRequest field.
-func (p *PullRequestReviewEvent) GetPullRequest() *PullRequest {
- if p == nil {
- return nil
- }
- return p.PullRequest
-}
-
-// GetRepo returns the Repo field.
-func (p *PullRequestReviewEvent) GetRepo() *Repository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetReview returns the Review field.
-func (p *PullRequestReviewEvent) GetReview() *PullRequestReview {
- if p == nil {
- return nil
- }
- return p.Review
-}
-
-// GetSender returns the Sender field.
-func (p *PullRequestReviewEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (p *PullRequestReviewRequest) GetBody() string {
- if p == nil || p.Body == nil {
- return ""
- }
- return *p.Body
-}
-
-// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise.
-func (p *PullRequestReviewRequest) GetCommitID() string {
- if p == nil || p.CommitID == nil {
- return ""
- }
- return *p.CommitID
-}
-
-// GetEvent returns the Event field if it's non-nil, zero value otherwise.
-func (p *PullRequestReviewRequest) GetEvent() string {
- if p == nil || p.Event == nil {
- return ""
- }
- return *p.Event
-}
-
-// GetDismissalRestrictionsRequest returns the DismissalRestrictionsRequest field.
-func (p *PullRequestReviewsEnforcementRequest) GetDismissalRestrictionsRequest() *DismissalRestrictionsRequest {
- if p == nil {
- return nil
- }
- return p.DismissalRestrictionsRequest
-}
-
-// GetDismissalRestrictionsRequest returns the DismissalRestrictionsRequest field.
-func (p *PullRequestReviewsEnforcementUpdate) GetDismissalRestrictionsRequest() *DismissalRestrictionsRequest {
- if p == nil {
- return nil
- }
- return p.DismissalRestrictionsRequest
-}
-
-// GetDismissStaleReviews returns the DismissStaleReviews field if it's non-nil, zero value otherwise.
-func (p *PullRequestReviewsEnforcementUpdate) GetDismissStaleReviews() bool {
- if p == nil || p.DismissStaleReviews == nil {
- return false
- }
- return *p.DismissStaleReviews
-}
-
-// GetMergablePulls returns the MergablePulls field if it's non-nil, zero value otherwise.
-func (p *PullStats) GetMergablePulls() int {
- if p == nil || p.MergablePulls == nil {
- return 0
- }
- return *p.MergablePulls
-}
-
-// GetMergedPulls returns the MergedPulls field if it's non-nil, zero value otherwise.
-func (p *PullStats) GetMergedPulls() int {
- if p == nil || p.MergedPulls == nil {
- return 0
- }
- return *p.MergedPulls
-}
-
-// GetTotalPulls returns the TotalPulls field if it's non-nil, zero value otherwise.
-func (p *PullStats) GetTotalPulls() int {
- if p == nil || p.TotalPulls == nil {
- return 0
- }
- return *p.TotalPulls
-}
-
-// GetUnmergablePulls returns the UnmergablePulls field if it's non-nil, zero value otherwise.
-func (p *PullStats) GetUnmergablePulls() int {
- if p == nil || p.UnmergablePulls == nil {
- return 0
- }
- return *p.UnmergablePulls
-}
-
-// GetCommits returns the Commits field if it's non-nil, zero value otherwise.
-func (p *PunchCard) GetCommits() int {
- if p == nil || p.Commits == nil {
- return 0
- }
- return *p.Commits
-}
-
-// GetDay returns the Day field if it's non-nil, zero value otherwise.
-func (p *PunchCard) GetDay() int {
- if p == nil || p.Day == nil {
- return 0
- }
- return *p.Day
-}
-
-// GetHour returns the Hour field if it's non-nil, zero value otherwise.
-func (p *PunchCard) GetHour() int {
- if p == nil || p.Hour == nil {
- return 0
- }
- return *p.Hour
-}
-
-// GetAfter returns the After field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetAfter() string {
- if p == nil || p.After == nil {
- return ""
- }
- return *p.After
-}
-
-// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetBaseRef() string {
- if p == nil || p.BaseRef == nil {
- return ""
- }
- return *p.BaseRef
-}
-
-// GetBefore returns the Before field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetBefore() string {
- if p == nil || p.Before == nil {
- return ""
- }
- return *p.Before
-}
-
-// GetCompare returns the Compare field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetCompare() string {
- if p == nil || p.Compare == nil {
- return ""
- }
- return *p.Compare
-}
-
-// GetCreated returns the Created field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetCreated() bool {
- if p == nil || p.Created == nil {
- return false
- }
- return *p.Created
-}
-
-// GetDeleted returns the Deleted field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetDeleted() bool {
- if p == nil || p.Deleted == nil {
- return false
- }
- return *p.Deleted
-}
-
-// GetDistinctSize returns the DistinctSize field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetDistinctSize() int {
- if p == nil || p.DistinctSize == nil {
- return 0
- }
- return *p.DistinctSize
-}
-
-// GetForced returns the Forced field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetForced() bool {
- if p == nil || p.Forced == nil {
- return false
- }
- return *p.Forced
-}
-
-// GetHead returns the Head field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetHead() string {
- if p == nil || p.Head == nil {
- return ""
- }
- return *p.Head
-}
-
-// GetHeadCommit returns the HeadCommit field.
-func (p *PushEvent) GetHeadCommit() *PushEventCommit {
- if p == nil {
- return nil
- }
- return p.HeadCommit
-}
-
-// GetInstallation returns the Installation field.
-func (p *PushEvent) GetInstallation() *Installation {
- if p == nil {
- return nil
- }
- return p.Installation
-}
-
-// GetPusher returns the Pusher field.
-func (p *PushEvent) GetPusher() *User {
- if p == nil {
- return nil
- }
- return p.Pusher
-}
-
-// GetPushID returns the PushID field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetPushID() int64 {
- if p == nil || p.PushID == nil {
- return 0
- }
- return *p.PushID
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetRef() string {
- if p == nil || p.Ref == nil {
- return ""
- }
- return *p.Ref
-}
-
-// GetRepo returns the Repo field.
-func (p *PushEvent) GetRepo() *PushEventRepository {
- if p == nil {
- return nil
- }
- return p.Repo
-}
-
-// GetSender returns the Sender field.
-func (p *PushEvent) GetSender() *User {
- if p == nil {
- return nil
- }
- return p.Sender
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (p *PushEvent) GetSize() int {
- if p == nil || p.Size == nil {
- return 0
- }
- return *p.Size
-}
-
-// GetAuthor returns the Author field.
-func (p *PushEventCommit) GetAuthor() *CommitAuthor {
- if p == nil {
- return nil
- }
- return p.Author
-}
-
-// GetCommitter returns the Committer field.
-func (p *PushEventCommit) GetCommitter() *CommitAuthor {
- if p == nil {
- return nil
- }
- return p.Committer
-}
-
-// GetDistinct returns the Distinct field if it's non-nil, zero value otherwise.
-func (p *PushEventCommit) GetDistinct() bool {
- if p == nil || p.Distinct == nil {
- return false
- }
- return *p.Distinct
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *PushEventCommit) GetID() string {
- if p == nil || p.ID == nil {
- return ""
- }
- return *p.ID
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (p *PushEventCommit) GetMessage() string {
- if p == nil || p.Message == nil {
- return ""
- }
- return *p.Message
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (p *PushEventCommit) GetSHA() string {
- if p == nil || p.SHA == nil {
- return ""
- }
- return *p.SHA
-}
-
-// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise.
-func (p *PushEventCommit) GetTimestamp() Timestamp {
- if p == nil || p.Timestamp == nil {
- return Timestamp{}
- }
- return *p.Timestamp
-}
-
-// GetTreeID returns the TreeID field if it's non-nil, zero value otherwise.
-func (p *PushEventCommit) GetTreeID() string {
- if p == nil || p.TreeID == nil {
- return ""
- }
- return *p.TreeID
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *PushEventCommit) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (p *PushEventRepoOwner) GetEmail() string {
- if p == nil || p.Email == nil {
- return ""
- }
- return *p.Email
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (p *PushEventRepoOwner) GetName() string {
- if p == nil || p.Name == nil {
- return ""
- }
- return *p.Name
-}
-
-// GetArchiveURL returns the ArchiveURL field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetArchiveURL() string {
- if p == nil || p.ArchiveURL == nil {
- return ""
- }
- return *p.ArchiveURL
-}
-
-// GetCloneURL returns the CloneURL field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetCloneURL() string {
- if p == nil || p.CloneURL == nil {
- return ""
- }
- return *p.CloneURL
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetCreatedAt() Timestamp {
- if p == nil || p.CreatedAt == nil {
- return Timestamp{}
- }
- return *p.CreatedAt
-}
-
-// GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetDefaultBranch() string {
- if p == nil || p.DefaultBranch == nil {
- return ""
- }
- return *p.DefaultBranch
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetDescription() string {
- if p == nil || p.Description == nil {
- return ""
- }
- return *p.Description
-}
-
-// GetFork returns the Fork field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetFork() bool {
- if p == nil || p.Fork == nil {
- return false
- }
- return *p.Fork
-}
-
-// GetForksCount returns the ForksCount field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetForksCount() int {
- if p == nil || p.ForksCount == nil {
- return 0
- }
- return *p.ForksCount
-}
-
-// GetFullName returns the FullName field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetFullName() string {
- if p == nil || p.FullName == nil {
- return ""
- }
- return *p.FullName
-}
-
-// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetGitURL() string {
- if p == nil || p.GitURL == nil {
- return ""
- }
- return *p.GitURL
-}
-
-// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetHasDownloads() bool {
- if p == nil || p.HasDownloads == nil {
- return false
- }
- return *p.HasDownloads
-}
-
-// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetHasIssues() bool {
- if p == nil || p.HasIssues == nil {
- return false
- }
- return *p.HasIssues
-}
-
-// GetHasPages returns the HasPages field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetHasPages() bool {
- if p == nil || p.HasPages == nil {
- return false
- }
- return *p.HasPages
-}
-
-// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetHasWiki() bool {
- if p == nil || p.HasWiki == nil {
- return false
- }
- return *p.HasWiki
-}
-
-// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetHomepage() string {
- if p == nil || p.Homepage == nil {
- return ""
- }
- return *p.Homepage
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetHTMLURL() string {
- if p == nil || p.HTMLURL == nil {
- return ""
- }
- return *p.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetID() int64 {
- if p == nil || p.ID == nil {
- return 0
- }
- return *p.ID
-}
-
-// GetLanguage returns the Language field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetLanguage() string {
- if p == nil || p.Language == nil {
- return ""
- }
- return *p.Language
-}
-
-// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetMasterBranch() string {
- if p == nil || p.MasterBranch == nil {
- return ""
- }
- return *p.MasterBranch
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetName() string {
- if p == nil || p.Name == nil {
- return ""
- }
- return *p.Name
-}
-
-// GetOpenIssuesCount returns the OpenIssuesCount field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetOpenIssuesCount() int {
- if p == nil || p.OpenIssuesCount == nil {
- return 0
- }
- return *p.OpenIssuesCount
-}
-
-// GetOrganization returns the Organization field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetOrganization() string {
- if p == nil || p.Organization == nil {
- return ""
- }
- return *p.Organization
-}
-
-// GetOwner returns the Owner field.
-func (p *PushEventRepository) GetOwner() *PushEventRepoOwner {
- if p == nil {
- return nil
- }
- return p.Owner
-}
-
-// GetPrivate returns the Private field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetPrivate() bool {
- if p == nil || p.Private == nil {
- return false
- }
- return *p.Private
-}
-
-// GetPushedAt returns the PushedAt field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetPushedAt() Timestamp {
- if p == nil || p.PushedAt == nil {
- return Timestamp{}
- }
- return *p.PushedAt
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetSize() int {
- if p == nil || p.Size == nil {
- return 0
- }
- return *p.Size
-}
-
-// GetSSHURL returns the SSHURL field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetSSHURL() string {
- if p == nil || p.SSHURL == nil {
- return ""
- }
- return *p.SSHURL
-}
-
-// GetStargazersCount returns the StargazersCount field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetStargazersCount() int {
- if p == nil || p.StargazersCount == nil {
- return 0
- }
- return *p.StargazersCount
-}
-
-// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetStatusesURL() string {
- if p == nil || p.StatusesURL == nil {
- return ""
- }
- return *p.StatusesURL
-}
-
-// GetSVNURL returns the SVNURL field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetSVNURL() string {
- if p == nil || p.SVNURL == nil {
- return ""
- }
- return *p.SVNURL
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetUpdatedAt() Timestamp {
- if p == nil || p.UpdatedAt == nil {
- return Timestamp{}
- }
- return *p.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetURL() string {
- if p == nil || p.URL == nil {
- return ""
- }
- return *p.URL
-}
-
-// GetWatchersCount returns the WatchersCount field if it's non-nil, zero value otherwise.
-func (p *PushEventRepository) GetWatchersCount() int {
- if p == nil || p.WatchersCount == nil {
- return 0
- }
- return *p.WatchersCount
-}
-
-// GetCore returns the Core field.
-func (r *RateLimits) GetCore() *Rate {
- if r == nil {
- return nil
- }
- return r.Core
-}
-
-// GetSearch returns the Search field.
-func (r *RateLimits) GetSearch() *Rate {
- if r == nil {
- return nil
- }
- return r.Search
-}
-
-// GetContent returns the Content field if it's non-nil, zero value otherwise.
-func (r *Reaction) GetContent() string {
- if r == nil || r.Content == nil {
- return ""
- }
- return *r.Content
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (r *Reaction) GetID() int64 {
- if r == nil || r.ID == nil {
- return 0
- }
- return *r.ID
-}
-
-// GetUser returns the User field.
-func (r *Reaction) GetUser() *User {
- if r == nil {
- return nil
- }
- return r.User
-}
-
-// GetConfused returns the Confused field if it's non-nil, zero value otherwise.
-func (r *Reactions) GetConfused() int {
- if r == nil || r.Confused == nil {
- return 0
- }
- return *r.Confused
-}
-
-// GetHeart returns the Heart field if it's non-nil, zero value otherwise.
-func (r *Reactions) GetHeart() int {
- if r == nil || r.Heart == nil {
- return 0
- }
- return *r.Heart
-}
-
-// GetHooray returns the Hooray field if it's non-nil, zero value otherwise.
-func (r *Reactions) GetHooray() int {
- if r == nil || r.Hooray == nil {
- return 0
- }
- return *r.Hooray
-}
-
-// GetLaugh returns the Laugh field if it's non-nil, zero value otherwise.
-func (r *Reactions) GetLaugh() int {
- if r == nil || r.Laugh == nil {
- return 0
- }
- return *r.Laugh
-}
-
-// GetMinusOne returns the MinusOne field if it's non-nil, zero value otherwise.
-func (r *Reactions) GetMinusOne() int {
- if r == nil || r.MinusOne == nil {
- return 0
- }
- return *r.MinusOne
-}
-
-// GetPlusOne returns the PlusOne field if it's non-nil, zero value otherwise.
-func (r *Reactions) GetPlusOne() int {
- if r == nil || r.PlusOne == nil {
- return 0
- }
- return *r.PlusOne
-}
-
-// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
-func (r *Reactions) GetTotalCount() int {
- if r == nil || r.TotalCount == nil {
- return 0
- }
- return *r.TotalCount
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *Reactions) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (r *Reference) GetNodeID() string {
- if r == nil || r.NodeID == nil {
- return ""
- }
- return *r.NodeID
-}
-
-// GetObject returns the Object field.
-func (r *Reference) GetObject() *GitObject {
- if r == nil {
- return nil
- }
- return r.Object
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (r *Reference) GetRef() string {
- if r == nil || r.Ref == nil {
- return ""
- }
- return *r.Ref
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *Reference) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetBrowserDownloadURL returns the BrowserDownloadURL field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetBrowserDownloadURL() string {
- if r == nil || r.BrowserDownloadURL == nil {
- return ""
- }
- return *r.BrowserDownloadURL
-}
-
-// GetContentType returns the ContentType field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetContentType() string {
- if r == nil || r.ContentType == nil {
- return ""
- }
- return *r.ContentType
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetCreatedAt() Timestamp {
- if r == nil || r.CreatedAt == nil {
- return Timestamp{}
- }
- return *r.CreatedAt
-}
-
-// GetDownloadCount returns the DownloadCount field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetDownloadCount() int {
- if r == nil || r.DownloadCount == nil {
- return 0
- }
- return *r.DownloadCount
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetID() int64 {
- if r == nil || r.ID == nil {
- return 0
- }
- return *r.ID
-}
-
-// GetLabel returns the Label field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetLabel() string {
- if r == nil || r.Label == nil {
- return ""
- }
- return *r.Label
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetName() string {
- if r == nil || r.Name == nil {
- return ""
- }
- return *r.Name
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetSize() int {
- if r == nil || r.Size == nil {
- return 0
- }
- return *r.Size
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetState() string {
- if r == nil || r.State == nil {
- return ""
- }
- return *r.State
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetUpdatedAt() Timestamp {
- if r == nil || r.UpdatedAt == nil {
- return Timestamp{}
- }
- return *r.UpdatedAt
-}
-
-// GetUploader returns the Uploader field.
-func (r *ReleaseAsset) GetUploader() *User {
- if r == nil {
- return nil
- }
- return r.Uploader
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *ReleaseAsset) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (r *ReleaseEvent) GetAction() string {
- if r == nil || r.Action == nil {
- return ""
- }
- return *r.Action
-}
-
-// GetInstallation returns the Installation field.
-func (r *ReleaseEvent) GetInstallation() *Installation {
- if r == nil {
- return nil
- }
- return r.Installation
-}
-
-// GetRelease returns the Release field.
-func (r *ReleaseEvent) GetRelease() *RepositoryRelease {
- if r == nil {
- return nil
- }
- return r.Release
-}
-
-// GetRepo returns the Repo field.
-func (r *ReleaseEvent) GetRepo() *Repository {
- if r == nil {
- return nil
- }
- return r.Repo
-}
-
-// GetSender returns the Sender field.
-func (r *ReleaseEvent) GetSender() *User {
- if r == nil {
- return nil
- }
- return r.Sender
-}
-
-// GetFrom returns the From field if it's non-nil, zero value otherwise.
-func (r *Rename) GetFrom() string {
- if r == nil || r.From == nil {
- return ""
- }
- return *r.From
-}
-
-// GetTo returns the To field if it's non-nil, zero value otherwise.
-func (r *Rename) GetTo() string {
- if r == nil || r.To == nil {
- return ""
- }
- return *r.To
-}
-
-// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
-func (r *RepositoriesSearchResult) GetIncompleteResults() bool {
- if r == nil || r.IncompleteResults == nil {
- return false
- }
- return *r.IncompleteResults
-}
-
-// GetTotal returns the Total field if it's non-nil, zero value otherwise.
-func (r *RepositoriesSearchResult) GetTotal() int {
- if r == nil || r.Total == nil {
- return 0
- }
- return *r.Total
-}
-
-// GetAllowMergeCommit returns the AllowMergeCommit field if it's non-nil, zero value otherwise.
-func (r *Repository) GetAllowMergeCommit() bool {
- if r == nil || r.AllowMergeCommit == nil {
- return false
- }
- return *r.AllowMergeCommit
-}
-
-// GetAllowRebaseMerge returns the AllowRebaseMerge field if it's non-nil, zero value otherwise.
-func (r *Repository) GetAllowRebaseMerge() bool {
- if r == nil || r.AllowRebaseMerge == nil {
- return false
- }
- return *r.AllowRebaseMerge
-}
-
-// GetAllowSquashMerge returns the AllowSquashMerge field if it's non-nil, zero value otherwise.
-func (r *Repository) GetAllowSquashMerge() bool {
- if r == nil || r.AllowSquashMerge == nil {
- return false
- }
- return *r.AllowSquashMerge
-}
-
-// GetArchived returns the Archived field if it's non-nil, zero value otherwise.
-func (r *Repository) GetArchived() bool {
- if r == nil || r.Archived == nil {
- return false
- }
- return *r.Archived
-}
-
-// GetArchiveURL returns the ArchiveURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetArchiveURL() string {
- if r == nil || r.ArchiveURL == nil {
- return ""
- }
- return *r.ArchiveURL
-}
-
-// GetAssigneesURL returns the AssigneesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetAssigneesURL() string {
- if r == nil || r.AssigneesURL == nil {
- return ""
- }
- return *r.AssigneesURL
-}
-
-// GetAutoInit returns the AutoInit field if it's non-nil, zero value otherwise.
-func (r *Repository) GetAutoInit() bool {
- if r == nil || r.AutoInit == nil {
- return false
- }
- return *r.AutoInit
-}
-
-// GetBlobsURL returns the BlobsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetBlobsURL() string {
- if r == nil || r.BlobsURL == nil {
- return ""
- }
- return *r.BlobsURL
-}
-
-// GetBranchesURL returns the BranchesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetBranchesURL() string {
- if r == nil || r.BranchesURL == nil {
- return ""
- }
- return *r.BranchesURL
-}
-
-// GetCloneURL returns the CloneURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetCloneURL() string {
- if r == nil || r.CloneURL == nil {
- return ""
- }
- return *r.CloneURL
-}
-
-// GetCodeOfConduct returns the CodeOfConduct field.
-func (r *Repository) GetCodeOfConduct() *CodeOfConduct {
- if r == nil {
- return nil
- }
- return r.CodeOfConduct
-}
-
-// GetCollaboratorsURL returns the CollaboratorsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetCollaboratorsURL() string {
- if r == nil || r.CollaboratorsURL == nil {
- return ""
- }
- return *r.CollaboratorsURL
-}
-
-// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetCommentsURL() string {
- if r == nil || r.CommentsURL == nil {
- return ""
- }
- return *r.CommentsURL
-}
-
-// GetCommitsURL returns the CommitsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetCommitsURL() string {
- if r == nil || r.CommitsURL == nil {
- return ""
- }
- return *r.CommitsURL
-}
-
-// GetCompareURL returns the CompareURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetCompareURL() string {
- if r == nil || r.CompareURL == nil {
- return ""
- }
- return *r.CompareURL
-}
-
-// GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetContentsURL() string {
- if r == nil || r.ContentsURL == nil {
- return ""
- }
- return *r.ContentsURL
-}
-
-// GetContributorsURL returns the ContributorsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetContributorsURL() string {
- if r == nil || r.ContributorsURL == nil {
- return ""
- }
- return *r.ContributorsURL
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (r *Repository) GetCreatedAt() Timestamp {
- if r == nil || r.CreatedAt == nil {
- return Timestamp{}
- }
- return *r.CreatedAt
-}
-
-// GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise.
-func (r *Repository) GetDefaultBranch() string {
- if r == nil || r.DefaultBranch == nil {
- return ""
- }
- return *r.DefaultBranch
-}
-
-// GetDeploymentsURL returns the DeploymentsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetDeploymentsURL() string {
- if r == nil || r.DeploymentsURL == nil {
- return ""
- }
- return *r.DeploymentsURL
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (r *Repository) GetDescription() string {
- if r == nil || r.Description == nil {
- return ""
- }
- return *r.Description
-}
-
-// GetDownloadsURL returns the DownloadsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetDownloadsURL() string {
- if r == nil || r.DownloadsURL == nil {
- return ""
- }
- return *r.DownloadsURL
-}
-
-// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetEventsURL() string {
- if r == nil || r.EventsURL == nil {
- return ""
- }
- return *r.EventsURL
-}
-
-// GetFork returns the Fork field if it's non-nil, zero value otherwise.
-func (r *Repository) GetFork() bool {
- if r == nil || r.Fork == nil {
- return false
- }
- return *r.Fork
-}
-
-// GetForksCount returns the ForksCount field if it's non-nil, zero value otherwise.
-func (r *Repository) GetForksCount() int {
- if r == nil || r.ForksCount == nil {
- return 0
- }
- return *r.ForksCount
-}
-
-// GetForksURL returns the ForksURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetForksURL() string {
- if r == nil || r.ForksURL == nil {
- return ""
- }
- return *r.ForksURL
-}
-
-// GetFullName returns the FullName field if it's non-nil, zero value otherwise.
-func (r *Repository) GetFullName() string {
- if r == nil || r.FullName == nil {
- return ""
- }
- return *r.FullName
-}
-
-// GetGitCommitsURL returns the GitCommitsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetGitCommitsURL() string {
- if r == nil || r.GitCommitsURL == nil {
- return ""
- }
- return *r.GitCommitsURL
-}
-
-// GetGitignoreTemplate returns the GitignoreTemplate field if it's non-nil, zero value otherwise.
-func (r *Repository) GetGitignoreTemplate() string {
- if r == nil || r.GitignoreTemplate == nil {
- return ""
- }
- return *r.GitignoreTemplate
-}
-
-// GetGitRefsURL returns the GitRefsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetGitRefsURL() string {
- if r == nil || r.GitRefsURL == nil {
- return ""
- }
- return *r.GitRefsURL
-}
-
-// GetGitTagsURL returns the GitTagsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetGitTagsURL() string {
- if r == nil || r.GitTagsURL == nil {
- return ""
- }
- return *r.GitTagsURL
-}
-
-// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetGitURL() string {
- if r == nil || r.GitURL == nil {
- return ""
- }
- return *r.GitURL
-}
-
-// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise.
-func (r *Repository) GetHasDownloads() bool {
- if r == nil || r.HasDownloads == nil {
- return false
- }
- return *r.HasDownloads
-}
-
-// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise.
-func (r *Repository) GetHasIssues() bool {
- if r == nil || r.HasIssues == nil {
- return false
- }
- return *r.HasIssues
-}
-
-// GetHasPages returns the HasPages field if it's non-nil, zero value otherwise.
-func (r *Repository) GetHasPages() bool {
- if r == nil || r.HasPages == nil {
- return false
- }
- return *r.HasPages
-}
-
-// GetHasProjects returns the HasProjects field if it's non-nil, zero value otherwise.
-func (r *Repository) GetHasProjects() bool {
- if r == nil || r.HasProjects == nil {
- return false
- }
- return *r.HasProjects
-}
-
-// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise.
-func (r *Repository) GetHasWiki() bool {
- if r == nil || r.HasWiki == nil {
- return false
- }
- return *r.HasWiki
-}
-
-// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise.
-func (r *Repository) GetHomepage() string {
- if r == nil || r.Homepage == nil {
- return ""
- }
- return *r.Homepage
-}
-
-// GetHooksURL returns the HooksURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetHooksURL() string {
- if r == nil || r.HooksURL == nil {
- return ""
- }
- return *r.HooksURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetHTMLURL() string {
- if r == nil || r.HTMLURL == nil {
- return ""
- }
- return *r.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (r *Repository) GetID() int64 {
- if r == nil || r.ID == nil {
- return 0
- }
- return *r.ID
-}
-
-// GetIssueCommentURL returns the IssueCommentURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetIssueCommentURL() string {
- if r == nil || r.IssueCommentURL == nil {
- return ""
- }
- return *r.IssueCommentURL
-}
-
-// GetIssueEventsURL returns the IssueEventsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetIssueEventsURL() string {
- if r == nil || r.IssueEventsURL == nil {
- return ""
- }
- return *r.IssueEventsURL
-}
-
-// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetIssuesURL() string {
- if r == nil || r.IssuesURL == nil {
- return ""
- }
- return *r.IssuesURL
-}
-
-// GetKeysURL returns the KeysURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetKeysURL() string {
- if r == nil || r.KeysURL == nil {
- return ""
- }
- return *r.KeysURL
-}
-
-// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetLabelsURL() string {
- if r == nil || r.LabelsURL == nil {
- return ""
- }
- return *r.LabelsURL
-}
-
-// GetLanguage returns the Language field if it's non-nil, zero value otherwise.
-func (r *Repository) GetLanguage() string {
- if r == nil || r.Language == nil {
- return ""
- }
- return *r.Language
-}
-
-// GetLanguagesURL returns the LanguagesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetLanguagesURL() string {
- if r == nil || r.LanguagesURL == nil {
- return ""
- }
- return *r.LanguagesURL
-}
-
-// GetLicense returns the License field.
-func (r *Repository) GetLicense() *License {
- if r == nil {
- return nil
- }
- return r.License
-}
-
-// GetLicenseTemplate returns the LicenseTemplate field if it's non-nil, zero value otherwise.
-func (r *Repository) GetLicenseTemplate() string {
- if r == nil || r.LicenseTemplate == nil {
- return ""
- }
- return *r.LicenseTemplate
-}
-
-// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise.
-func (r *Repository) GetMasterBranch() string {
- if r == nil || r.MasterBranch == nil {
- return ""
- }
- return *r.MasterBranch
-}
-
-// GetMergesURL returns the MergesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetMergesURL() string {
- if r == nil || r.MergesURL == nil {
- return ""
- }
- return *r.MergesURL
-}
-
-// GetMilestonesURL returns the MilestonesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetMilestonesURL() string {
- if r == nil || r.MilestonesURL == nil {
- return ""
- }
- return *r.MilestonesURL
-}
-
-// GetMirrorURL returns the MirrorURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetMirrorURL() string {
- if r == nil || r.MirrorURL == nil {
- return ""
- }
- return *r.MirrorURL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (r *Repository) GetName() string {
- if r == nil || r.Name == nil {
- return ""
- }
- return *r.Name
-}
-
-// GetNetworkCount returns the NetworkCount field if it's non-nil, zero value otherwise.
-func (r *Repository) GetNetworkCount() int {
- if r == nil || r.NetworkCount == nil {
- return 0
- }
- return *r.NetworkCount
-}
-
-// GetNotificationsURL returns the NotificationsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetNotificationsURL() string {
- if r == nil || r.NotificationsURL == nil {
- return ""
- }
- return *r.NotificationsURL
-}
-
-// GetOpenIssuesCount returns the OpenIssuesCount field if it's non-nil, zero value otherwise.
-func (r *Repository) GetOpenIssuesCount() int {
- if r == nil || r.OpenIssuesCount == nil {
- return 0
- }
- return *r.OpenIssuesCount
-}
-
-// GetOrganization returns the Organization field.
-func (r *Repository) GetOrganization() *Organization {
- if r == nil {
- return nil
- }
- return r.Organization
-}
-
-// GetOwner returns the Owner field.
-func (r *Repository) GetOwner() *User {
- if r == nil {
- return nil
- }
- return r.Owner
-}
-
-// GetParent returns the Parent field.
-func (r *Repository) GetParent() *Repository {
- if r == nil {
- return nil
- }
- return r.Parent
-}
-
-// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise.
-func (r *Repository) GetPermissions() map[string]bool {
- if r == nil || r.Permissions == nil {
- return map[string]bool{}
- }
- return *r.Permissions
-}
-
-// GetPrivate returns the Private field if it's non-nil, zero value otherwise.
-func (r *Repository) GetPrivate() bool {
- if r == nil || r.Private == nil {
- return false
- }
- return *r.Private
-}
-
-// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetPullsURL() string {
- if r == nil || r.PullsURL == nil {
- return ""
- }
- return *r.PullsURL
-}
-
-// GetPushedAt returns the PushedAt field if it's non-nil, zero value otherwise.
-func (r *Repository) GetPushedAt() Timestamp {
- if r == nil || r.PushedAt == nil {
- return Timestamp{}
- }
- return *r.PushedAt
-}
-
-// GetReleasesURL returns the ReleasesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetReleasesURL() string {
- if r == nil || r.ReleasesURL == nil {
- return ""
- }
- return *r.ReleasesURL
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (r *Repository) GetSize() int {
- if r == nil || r.Size == nil {
- return 0
- }
- return *r.Size
-}
-
-// GetSource returns the Source field.
-func (r *Repository) GetSource() *Repository {
- if r == nil {
- return nil
- }
- return r.Source
-}
-
-// GetSSHURL returns the SSHURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetSSHURL() string {
- if r == nil || r.SSHURL == nil {
- return ""
- }
- return *r.SSHURL
-}
-
-// GetStargazersCount returns the StargazersCount field if it's non-nil, zero value otherwise.
-func (r *Repository) GetStargazersCount() int {
- if r == nil || r.StargazersCount == nil {
- return 0
- }
- return *r.StargazersCount
-}
-
-// GetStargazersURL returns the StargazersURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetStargazersURL() string {
- if r == nil || r.StargazersURL == nil {
- return ""
- }
- return *r.StargazersURL
-}
-
-// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetStatusesURL() string {
- if r == nil || r.StatusesURL == nil {
- return ""
- }
- return *r.StatusesURL
-}
-
-// GetSubscribersCount returns the SubscribersCount field if it's non-nil, zero value otherwise.
-func (r *Repository) GetSubscribersCount() int {
- if r == nil || r.SubscribersCount == nil {
- return 0
- }
- return *r.SubscribersCount
-}
-
-// GetSubscribersURL returns the SubscribersURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetSubscribersURL() string {
- if r == nil || r.SubscribersURL == nil {
- return ""
- }
- return *r.SubscribersURL
-}
-
-// GetSubscriptionURL returns the SubscriptionURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetSubscriptionURL() string {
- if r == nil || r.SubscriptionURL == nil {
- return ""
- }
- return *r.SubscriptionURL
-}
-
-// GetSVNURL returns the SVNURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetSVNURL() string {
- if r == nil || r.SVNURL == nil {
- return ""
- }
- return *r.SVNURL
-}
-
-// GetTagsURL returns the TagsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetTagsURL() string {
- if r == nil || r.TagsURL == nil {
- return ""
- }
- return *r.TagsURL
-}
-
-// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise.
-func (r *Repository) GetTeamID() int64 {
- if r == nil || r.TeamID == nil {
- return 0
- }
- return *r.TeamID
-}
-
-// GetTeamsURL returns the TeamsURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetTeamsURL() string {
- if r == nil || r.TeamsURL == nil {
- return ""
- }
- return *r.TeamsURL
-}
-
-// GetTreesURL returns the TreesURL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetTreesURL() string {
- if r == nil || r.TreesURL == nil {
- return ""
- }
- return *r.TreesURL
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (r *Repository) GetUpdatedAt() Timestamp {
- if r == nil || r.UpdatedAt == nil {
- return Timestamp{}
- }
- return *r.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *Repository) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetWatchersCount returns the WatchersCount field if it's non-nil, zero value otherwise.
-func (r *Repository) GetWatchersCount() int {
- if r == nil || r.WatchersCount == nil {
- return 0
- }
- return *r.WatchersCount
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetBody() string {
- if r == nil || r.Body == nil {
- return ""
- }
- return *r.Body
-}
-
-// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetCommitID() string {
- if r == nil || r.CommitID == nil {
- return ""
- }
- return *r.CommitID
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetCreatedAt() time.Time {
- if r == nil || r.CreatedAt == nil {
- return time.Time{}
- }
- return *r.CreatedAt
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetHTMLURL() string {
- if r == nil || r.HTMLURL == nil {
- return ""
- }
- return *r.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetID() int64 {
- if r == nil || r.ID == nil {
- return 0
- }
- return *r.ID
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetPath() string {
- if r == nil || r.Path == nil {
- return ""
- }
- return *r.Path
-}
-
-// GetPosition returns the Position field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetPosition() int {
- if r == nil || r.Position == nil {
- return 0
- }
- return *r.Position
-}
-
-// GetReactions returns the Reactions field.
-func (r *RepositoryComment) GetReactions() *Reactions {
- if r == nil {
- return nil
- }
- return r.Reactions
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetUpdatedAt() time.Time {
- if r == nil || r.UpdatedAt == nil {
- return time.Time{}
- }
- return *r.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *RepositoryComment) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetUser returns the User field.
-func (r *RepositoryComment) GetUser() *User {
- if r == nil {
- return nil
- }
- return r.User
-}
-
-// GetAuthor returns the Author field.
-func (r *RepositoryCommit) GetAuthor() *User {
- if r == nil {
- return nil
- }
- return r.Author
-}
-
-// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryCommit) GetCommentsURL() string {
- if r == nil || r.CommentsURL == nil {
- return ""
- }
- return *r.CommentsURL
-}
-
-// GetCommit returns the Commit field.
-func (r *RepositoryCommit) GetCommit() *Commit {
- if r == nil {
- return nil
- }
- return r.Commit
-}
-
-// GetCommitter returns the Committer field.
-func (r *RepositoryCommit) GetCommitter() *User {
- if r == nil {
- return nil
- }
- return r.Committer
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryCommit) GetHTMLURL() string {
- if r == nil || r.HTMLURL == nil {
- return ""
- }
- return *r.HTMLURL
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (r *RepositoryCommit) GetSHA() string {
- if r == nil || r.SHA == nil {
- return ""
- }
- return *r.SHA
-}
-
-// GetStats returns the Stats field.
-func (r *RepositoryCommit) GetStats() *CommitStats {
- if r == nil {
- return nil
- }
- return r.Stats
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *RepositoryCommit) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetDownloadURL() string {
- if r == nil || r.DownloadURL == nil {
- return ""
- }
- return *r.DownloadURL
-}
-
-// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetEncoding() string {
- if r == nil || r.Encoding == nil {
- return ""
- }
- return *r.Encoding
-}
-
-// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetGitURL() string {
- if r == nil || r.GitURL == nil {
- return ""
- }
- return *r.GitURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetHTMLURL() string {
- if r == nil || r.HTMLURL == nil {
- return ""
- }
- return *r.HTMLURL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetName() string {
- if r == nil || r.Name == nil {
- return ""
- }
- return *r.Name
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetPath() string {
- if r == nil || r.Path == nil {
- return ""
- }
- return *r.Path
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetSHA() string {
- if r == nil || r.SHA == nil {
- return ""
- }
- return *r.SHA
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetSize() int {
- if r == nil || r.Size == nil {
- return 0
- }
- return *r.Size
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetType() string {
- if r == nil || r.Type == nil {
- return ""
- }
- return *r.Type
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *RepositoryContent) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetAuthor returns the Author field.
-func (r *RepositoryContentFileOptions) GetAuthor() *CommitAuthor {
- if r == nil {
- return nil
- }
- return r.Author
-}
-
-// GetBranch returns the Branch field if it's non-nil, zero value otherwise.
-func (r *RepositoryContentFileOptions) GetBranch() string {
- if r == nil || r.Branch == nil {
- return ""
- }
- return *r.Branch
-}
-
-// GetCommitter returns the Committer field.
-func (r *RepositoryContentFileOptions) GetCommitter() *CommitAuthor {
- if r == nil {
- return nil
- }
- return r.Committer
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (r *RepositoryContentFileOptions) GetMessage() string {
- if r == nil || r.Message == nil {
- return ""
- }
- return *r.Message
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (r *RepositoryContentFileOptions) GetSHA() string {
- if r == nil || r.SHA == nil {
- return ""
- }
- return *r.SHA
-}
-
-// GetContent returns the Content field.
-func (r *RepositoryContentResponse) GetContent() *RepositoryContent {
- if r == nil {
- return nil
- }
- return r.Content
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (r *RepositoryEvent) GetAction() string {
- if r == nil || r.Action == nil {
- return ""
- }
- return *r.Action
-}
-
-// GetInstallation returns the Installation field.
-func (r *RepositoryEvent) GetInstallation() *Installation {
- if r == nil {
- return nil
- }
- return r.Installation
-}
-
-// GetOrg returns the Org field.
-func (r *RepositoryEvent) GetOrg() *Organization {
- if r == nil {
- return nil
- }
- return r.Org
-}
-
-// GetRepo returns the Repo field.
-func (r *RepositoryEvent) GetRepo() *Repository {
- if r == nil {
- return nil
- }
- return r.Repo
-}
-
-// GetSender returns the Sender field.
-func (r *RepositoryEvent) GetSender() *User {
- if r == nil {
- return nil
- }
- return r.Sender
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (r *RepositoryInvitation) GetCreatedAt() Timestamp {
- if r == nil || r.CreatedAt == nil {
- return Timestamp{}
- }
- return *r.CreatedAt
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryInvitation) GetHTMLURL() string {
- if r == nil || r.HTMLURL == nil {
- return ""
- }
- return *r.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (r *RepositoryInvitation) GetID() int64 {
- if r == nil || r.ID == nil {
- return 0
- }
- return *r.ID
-}
-
-// GetInvitee returns the Invitee field.
-func (r *RepositoryInvitation) GetInvitee() *User {
- if r == nil {
- return nil
- }
- return r.Invitee
-}
-
-// GetInviter returns the Inviter field.
-func (r *RepositoryInvitation) GetInviter() *User {
- if r == nil {
- return nil
- }
- return r.Inviter
-}
-
-// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise.
-func (r *RepositoryInvitation) GetPermissions() string {
- if r == nil || r.Permissions == nil {
- return ""
- }
- return *r.Permissions
-}
-
-// GetRepo returns the Repo field.
-func (r *RepositoryInvitation) GetRepo() *Repository {
- if r == nil {
- return nil
- }
- return r.Repo
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *RepositoryInvitation) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetContent returns the Content field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetContent() string {
- if r == nil || r.Content == nil {
- return ""
- }
- return *r.Content
-}
-
-// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetDownloadURL() string {
- if r == nil || r.DownloadURL == nil {
- return ""
- }
- return *r.DownloadURL
-}
-
-// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetEncoding() string {
- if r == nil || r.Encoding == nil {
- return ""
- }
- return *r.Encoding
-}
-
-// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetGitURL() string {
- if r == nil || r.GitURL == nil {
- return ""
- }
- return *r.GitURL
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetHTMLURL() string {
- if r == nil || r.HTMLURL == nil {
- return ""
- }
- return *r.HTMLURL
-}
-
-// GetLicense returns the License field.
-func (r *RepositoryLicense) GetLicense() *License {
- if r == nil {
- return nil
- }
- return r.License
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetName() string {
- if r == nil || r.Name == nil {
- return ""
- }
- return *r.Name
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetPath() string {
- if r == nil || r.Path == nil {
- return ""
- }
- return *r.Path
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetSHA() string {
- if r == nil || r.SHA == nil {
- return ""
- }
- return *r.SHA
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetSize() int {
- if r == nil || r.Size == nil {
- return 0
- }
- return *r.Size
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetType() string {
- if r == nil || r.Type == nil {
- return ""
- }
- return *r.Type
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *RepositoryLicense) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetBase returns the Base field if it's non-nil, zero value otherwise.
-func (r *RepositoryMergeRequest) GetBase() string {
- if r == nil || r.Base == nil {
- return ""
- }
- return *r.Base
-}
-
-// GetCommitMessage returns the CommitMessage field if it's non-nil, zero value otherwise.
-func (r *RepositoryMergeRequest) GetCommitMessage() string {
- if r == nil || r.CommitMessage == nil {
- return ""
- }
- return *r.CommitMessage
-}
-
-// GetHead returns the Head field if it's non-nil, zero value otherwise.
-func (r *RepositoryMergeRequest) GetHead() string {
- if r == nil || r.Head == nil {
- return ""
- }
- return *r.Head
-}
-
-// GetPermission returns the Permission field if it's non-nil, zero value otherwise.
-func (r *RepositoryPermissionLevel) GetPermission() string {
- if r == nil || r.Permission == nil {
- return ""
- }
- return *r.Permission
-}
-
-// GetUser returns the User field.
-func (r *RepositoryPermissionLevel) GetUser() *User {
- if r == nil {
- return nil
- }
- return r.User
-}
-
-// GetAssetsURL returns the AssetsURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetAssetsURL() string {
- if r == nil || r.AssetsURL == nil {
- return ""
- }
- return *r.AssetsURL
-}
-
-// GetAuthor returns the Author field.
-func (r *RepositoryRelease) GetAuthor() *User {
- if r == nil {
- return nil
- }
- return r.Author
-}
-
-// GetBody returns the Body field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetBody() string {
- if r == nil || r.Body == nil {
- return ""
- }
- return *r.Body
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetCreatedAt() Timestamp {
- if r == nil || r.CreatedAt == nil {
- return Timestamp{}
- }
- return *r.CreatedAt
-}
-
-// GetDraft returns the Draft field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetDraft() bool {
- if r == nil || r.Draft == nil {
- return false
- }
- return *r.Draft
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetHTMLURL() string {
- if r == nil || r.HTMLURL == nil {
- return ""
- }
- return *r.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetID() int64 {
- if r == nil || r.ID == nil {
- return 0
- }
- return *r.ID
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetName() string {
- if r == nil || r.Name == nil {
- return ""
- }
- return *r.Name
-}
-
-// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetPrerelease() bool {
- if r == nil || r.Prerelease == nil {
- return false
- }
- return *r.Prerelease
-}
-
-// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetPublishedAt() Timestamp {
- if r == nil || r.PublishedAt == nil {
- return Timestamp{}
- }
- return *r.PublishedAt
-}
-
-// GetTagName returns the TagName field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetTagName() string {
- if r == nil || r.TagName == nil {
- return ""
- }
- return *r.TagName
-}
-
-// GetTarballURL returns the TarballURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetTarballURL() string {
- if r == nil || r.TarballURL == nil {
- return ""
- }
- return *r.TarballURL
-}
-
-// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetTargetCommitish() string {
- if r == nil || r.TargetCommitish == nil {
- return ""
- }
- return *r.TargetCommitish
-}
-
-// GetUploadURL returns the UploadURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetUploadURL() string {
- if r == nil || r.UploadURL == nil {
- return ""
- }
- return *r.UploadURL
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetZipballURL returns the ZipballURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryRelease) GetZipballURL() string {
- if r == nil || r.ZipballURL == nil {
- return ""
- }
- return *r.ZipballURL
-}
-
-// GetCommit returns the Commit field.
-func (r *RepositoryTag) GetCommit() *Commit {
- if r == nil {
- return nil
- }
- return r.Commit
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (r *RepositoryTag) GetName() string {
- if r == nil || r.Name == nil {
- return ""
- }
- return *r.Name
-}
-
-// GetTarballURL returns the TarballURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryTag) GetTarballURL() string {
- if r == nil || r.TarballURL == nil {
- return ""
- }
- return *r.TarballURL
-}
-
-// GetZipballURL returns the ZipballURL field if it's non-nil, zero value otherwise.
-func (r *RepositoryTag) GetZipballURL() string {
- if r == nil || r.ZipballURL == nil {
- return ""
- }
- return *r.ZipballURL
-}
-
-// GetForkRepos returns the ForkRepos field if it's non-nil, zero value otherwise.
-func (r *RepoStats) GetForkRepos() int {
- if r == nil || r.ForkRepos == nil {
- return 0
- }
- return *r.ForkRepos
-}
-
-// GetOrgRepos returns the OrgRepos field if it's non-nil, zero value otherwise.
-func (r *RepoStats) GetOrgRepos() int {
- if r == nil || r.OrgRepos == nil {
- return 0
- }
- return *r.OrgRepos
-}
-
-// GetRootRepos returns the RootRepos field if it's non-nil, zero value otherwise.
-func (r *RepoStats) GetRootRepos() int {
- if r == nil || r.RootRepos == nil {
- return 0
- }
- return *r.RootRepos
-}
-
-// GetTotalPushes returns the TotalPushes field if it's non-nil, zero value otherwise.
-func (r *RepoStats) GetTotalPushes() int {
- if r == nil || r.TotalPushes == nil {
- return 0
- }
- return *r.TotalPushes
-}
-
-// GetTotalRepos returns the TotalRepos field if it's non-nil, zero value otherwise.
-func (r *RepoStats) GetTotalRepos() int {
- if r == nil || r.TotalRepos == nil {
- return 0
- }
- return *r.TotalRepos
-}
-
-// GetTotalWikis returns the TotalWikis field if it's non-nil, zero value otherwise.
-func (r *RepoStats) GetTotalWikis() int {
- if r == nil || r.TotalWikis == nil {
- return 0
- }
- return *r.TotalWikis
-}
-
-// GetContext returns the Context field if it's non-nil, zero value otherwise.
-func (r *RepoStatus) GetContext() string {
- if r == nil || r.Context == nil {
- return ""
- }
- return *r.Context
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (r *RepoStatus) GetCreatedAt() time.Time {
- if r == nil || r.CreatedAt == nil {
- return time.Time{}
- }
- return *r.CreatedAt
-}
-
-// GetCreator returns the Creator field.
-func (r *RepoStatus) GetCreator() *User {
- if r == nil {
- return nil
- }
- return r.Creator
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (r *RepoStatus) GetDescription() string {
- if r == nil || r.Description == nil {
- return ""
- }
- return *r.Description
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (r *RepoStatus) GetID() int64 {
- if r == nil || r.ID == nil {
- return 0
- }
- return *r.ID
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (r *RepoStatus) GetState() string {
- if r == nil || r.State == nil {
- return ""
- }
- return *r.State
-}
-
-// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise.
-func (r *RepoStatus) GetTargetURL() string {
- if r == nil || r.TargetURL == nil {
- return ""
- }
- return *r.TargetURL
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (r *RepoStatus) GetUpdatedAt() time.Time {
- if r == nil || r.UpdatedAt == nil {
- return time.Time{}
- }
- return *r.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (r *RepoStatus) GetURL() string {
- if r == nil || r.URL == nil {
- return ""
- }
- return *r.URL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (s *ServiceHook) GetName() string {
- if s == nil || s.Name == nil {
- return ""
- }
- return *s.Name
-}
-
-// GetPayload returns the Payload field if it's non-nil, zero value otherwise.
-func (s *SignatureVerification) GetPayload() string {
- if s == nil || s.Payload == nil {
- return ""
- }
- return *s.Payload
-}
-
-// GetReason returns the Reason field if it's non-nil, zero value otherwise.
-func (s *SignatureVerification) GetReason() string {
- if s == nil || s.Reason == nil {
- return ""
- }
- return *s.Reason
-}
-
-// GetSignature returns the Signature field if it's non-nil, zero value otherwise.
-func (s *SignatureVerification) GetSignature() string {
- if s == nil || s.Signature == nil {
- return ""
- }
- return *s.Signature
-}
-
-// GetVerified returns the Verified field if it's non-nil, zero value otherwise.
-func (s *SignatureVerification) GetVerified() bool {
- if s == nil || s.Verified == nil {
- return false
- }
- return *s.Verified
-}
-
-// GetActor returns the Actor field.
-func (s *Source) GetActor() *User {
- if s == nil {
- return nil
- }
- return s.Actor
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (s *Source) GetID() int64 {
- if s == nil || s.ID == nil {
- return 0
- }
- return *s.ID
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (s *Source) GetURL() string {
- if s == nil || s.URL == nil {
- return ""
- }
- return *s.URL
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (s *SourceImportAuthor) GetEmail() string {
- if s == nil || s.Email == nil {
- return ""
- }
- return *s.Email
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (s *SourceImportAuthor) GetID() int64 {
- if s == nil || s.ID == nil {
- return 0
- }
- return *s.ID
-}
-
-// GetImportURL returns the ImportURL field if it's non-nil, zero value otherwise.
-func (s *SourceImportAuthor) GetImportURL() string {
- if s == nil || s.ImportURL == nil {
- return ""
- }
- return *s.ImportURL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (s *SourceImportAuthor) GetName() string {
- if s == nil || s.Name == nil {
- return ""
- }
- return *s.Name
-}
-
-// GetRemoteID returns the RemoteID field if it's non-nil, zero value otherwise.
-func (s *SourceImportAuthor) GetRemoteID() string {
- if s == nil || s.RemoteID == nil {
- return ""
- }
- return *s.RemoteID
-}
-
-// GetRemoteName returns the RemoteName field if it's non-nil, zero value otherwise.
-func (s *SourceImportAuthor) GetRemoteName() string {
- if s == nil || s.RemoteName == nil {
- return ""
- }
- return *s.RemoteName
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (s *SourceImportAuthor) GetURL() string {
- if s == nil || s.URL == nil {
- return ""
- }
- return *s.URL
-}
-
-// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise.
-func (s *Stargazer) GetStarredAt() Timestamp {
- if s == nil || s.StarredAt == nil {
- return Timestamp{}
- }
- return *s.StarredAt
-}
-
-// GetUser returns the User field.
-func (s *Stargazer) GetUser() *User {
- if s == nil {
- return nil
- }
- return s.User
-}
-
-// GetRepository returns the Repository field.
-func (s *StarredRepository) GetRepository() *Repository {
- if s == nil {
- return nil
- }
- return s.Repository
-}
-
-// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise.
-func (s *StarredRepository) GetStarredAt() Timestamp {
- if s == nil || s.StarredAt == nil {
- return Timestamp{}
- }
- return *s.StarredAt
-}
-
-// GetCommit returns the Commit field.
-func (s *StatusEvent) GetCommit() *RepositoryCommit {
- if s == nil {
- return nil
- }
- return s.Commit
-}
-
-// GetContext returns the Context field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetContext() string {
- if s == nil || s.Context == nil {
- return ""
- }
- return *s.Context
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetCreatedAt() Timestamp {
- if s == nil || s.CreatedAt == nil {
- return Timestamp{}
- }
- return *s.CreatedAt
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetDescription() string {
- if s == nil || s.Description == nil {
- return ""
- }
- return *s.Description
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetID() int64 {
- if s == nil || s.ID == nil {
- return 0
- }
- return *s.ID
-}
-
-// GetInstallation returns the Installation field.
-func (s *StatusEvent) GetInstallation() *Installation {
- if s == nil {
- return nil
- }
- return s.Installation
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetName() string {
- if s == nil || s.Name == nil {
- return ""
- }
- return *s.Name
-}
-
-// GetRepo returns the Repo field.
-func (s *StatusEvent) GetRepo() *Repository {
- if s == nil {
- return nil
- }
- return s.Repo
-}
-
-// GetSender returns the Sender field.
-func (s *StatusEvent) GetSender() *User {
- if s == nil {
- return nil
- }
- return s.Sender
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetSHA() string {
- if s == nil || s.SHA == nil {
- return ""
- }
- return *s.SHA
-}
-
-// GetState returns the State field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetState() string {
- if s == nil || s.State == nil {
- return ""
- }
- return *s.State
-}
-
-// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetTargetURL() string {
- if s == nil || s.TargetURL == nil {
- return ""
- }
- return *s.TargetURL
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (s *StatusEvent) GetUpdatedAt() Timestamp {
- if s == nil || s.UpdatedAt == nil {
- return Timestamp{}
- }
- return *s.UpdatedAt
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (s *Subscription) GetCreatedAt() Timestamp {
- if s == nil || s.CreatedAt == nil {
- return Timestamp{}
- }
- return *s.CreatedAt
-}
-
-// GetIgnored returns the Ignored field if it's non-nil, zero value otherwise.
-func (s *Subscription) GetIgnored() bool {
- if s == nil || s.Ignored == nil {
- return false
- }
- return *s.Ignored
-}
-
-// GetReason returns the Reason field if it's non-nil, zero value otherwise.
-func (s *Subscription) GetReason() string {
- if s == nil || s.Reason == nil {
- return ""
- }
- return *s.Reason
-}
-
-// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
-func (s *Subscription) GetRepositoryURL() string {
- if s == nil || s.RepositoryURL == nil {
- return ""
- }
- return *s.RepositoryURL
-}
-
-// GetSubscribed returns the Subscribed field if it's non-nil, zero value otherwise.
-func (s *Subscription) GetSubscribed() bool {
- if s == nil || s.Subscribed == nil {
- return false
- }
- return *s.Subscribed
-}
-
-// GetThreadURL returns the ThreadURL field if it's non-nil, zero value otherwise.
-func (s *Subscription) GetThreadURL() string {
- if s == nil || s.ThreadURL == nil {
- return ""
- }
- return *s.ThreadURL
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (s *Subscription) GetURL() string {
- if s == nil || s.URL == nil {
- return ""
- }
- return *s.URL
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (t *Tag) GetMessage() string {
- if t == nil || t.Message == nil {
- return ""
- }
- return *t.Message
-}
-
-// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
-func (t *Tag) GetNodeID() string {
- if t == nil || t.NodeID == nil {
- return ""
- }
- return *t.NodeID
-}
-
-// GetObject returns the Object field.
-func (t *Tag) GetObject() *GitObject {
- if t == nil {
- return nil
- }
- return t.Object
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (t *Tag) GetSHA() string {
- if t == nil || t.SHA == nil {
- return ""
- }
- return *t.SHA
-}
-
-// GetTag returns the Tag field if it's non-nil, zero value otherwise.
-func (t *Tag) GetTag() string {
- if t == nil || t.Tag == nil {
- return ""
- }
- return *t.Tag
-}
-
-// GetTagger returns the Tagger field.
-func (t *Tag) GetTagger() *CommitAuthor {
- if t == nil {
- return nil
- }
- return t.Tagger
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (t *Tag) GetURL() string {
- if t == nil || t.URL == nil {
- return ""
- }
- return *t.URL
-}
-
-// GetVerification returns the Verification field.
-func (t *Tag) GetVerification() *SignatureVerification {
- if t == nil {
- return nil
- }
- return t.Verification
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (t *Team) GetDescription() string {
- if t == nil || t.Description == nil {
- return ""
- }
- return *t.Description
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (t *Team) GetID() int64 {
- if t == nil || t.ID == nil {
- return 0
- }
- return *t.ID
-}
-
-// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise.
-func (t *Team) GetLDAPDN() string {
- if t == nil || t.LDAPDN == nil {
- return ""
- }
- return *t.LDAPDN
-}
-
-// GetMembersCount returns the MembersCount field if it's non-nil, zero value otherwise.
-func (t *Team) GetMembersCount() int {
- if t == nil || t.MembersCount == nil {
- return 0
- }
- return *t.MembersCount
-}
-
-// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise.
-func (t *Team) GetMembersURL() string {
- if t == nil || t.MembersURL == nil {
- return ""
- }
- return *t.MembersURL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (t *Team) GetName() string {
- if t == nil || t.Name == nil {
- return ""
- }
- return *t.Name
-}
-
-// GetOrganization returns the Organization field.
-func (t *Team) GetOrganization() *Organization {
- if t == nil {
- return nil
- }
- return t.Organization
-}
-
-// GetParent returns the Parent field.
-func (t *Team) GetParent() *Team {
- if t == nil {
- return nil
- }
- return t.Parent
-}
-
-// GetPermission returns the Permission field if it's non-nil, zero value otherwise.
-func (t *Team) GetPermission() string {
- if t == nil || t.Permission == nil {
- return ""
- }
- return *t.Permission
-}
-
-// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise.
-func (t *Team) GetPrivacy() string {
- if t == nil || t.Privacy == nil {
- return ""
- }
- return *t.Privacy
-}
-
-// GetReposCount returns the ReposCount field if it's non-nil, zero value otherwise.
-func (t *Team) GetReposCount() int {
- if t == nil || t.ReposCount == nil {
- return 0
- }
- return *t.ReposCount
-}
-
-// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise.
-func (t *Team) GetRepositoriesURL() string {
- if t == nil || t.RepositoriesURL == nil {
- return ""
- }
- return *t.RepositoriesURL
-}
-
-// GetSlug returns the Slug field if it's non-nil, zero value otherwise.
-func (t *Team) GetSlug() string {
- if t == nil || t.Slug == nil {
- return ""
- }
- return *t.Slug
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (t *Team) GetURL() string {
- if t == nil || t.URL == nil {
- return ""
- }
- return *t.URL
-}
-
-// GetInstallation returns the Installation field.
-func (t *TeamAddEvent) GetInstallation() *Installation {
- if t == nil {
- return nil
- }
- return t.Installation
-}
-
-// GetOrg returns the Org field.
-func (t *TeamAddEvent) GetOrg() *Organization {
- if t == nil {
- return nil
- }
- return t.Org
-}
-
-// GetRepo returns the Repo field.
-func (t *TeamAddEvent) GetRepo() *Repository {
- if t == nil {
- return nil
- }
- return t.Repo
-}
-
-// GetSender returns the Sender field.
-func (t *TeamAddEvent) GetSender() *User {
- if t == nil {
- return nil
- }
- return t.Sender
-}
-
-// GetTeam returns the Team field.
-func (t *TeamAddEvent) GetTeam() *Team {
- if t == nil {
- return nil
- }
- return t.Team
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (t *TeamEvent) GetAction() string {
- if t == nil || t.Action == nil {
- return ""
- }
- return *t.Action
-}
-
-// GetChanges returns the Changes field.
-func (t *TeamEvent) GetChanges() *TeamChange {
- if t == nil {
- return nil
- }
- return t.Changes
-}
-
-// GetInstallation returns the Installation field.
-func (t *TeamEvent) GetInstallation() *Installation {
- if t == nil {
- return nil
- }
- return t.Installation
-}
-
-// GetOrg returns the Org field.
-func (t *TeamEvent) GetOrg() *Organization {
- if t == nil {
- return nil
- }
- return t.Org
-}
-
-// GetRepo returns the Repo field.
-func (t *TeamEvent) GetRepo() *Repository {
- if t == nil {
- return nil
- }
- return t.Repo
-}
-
-// GetSender returns the Sender field.
-func (t *TeamEvent) GetSender() *User {
- if t == nil {
- return nil
- }
- return t.Sender
-}
-
-// GetTeam returns the Team field.
-func (t *TeamEvent) GetTeam() *Team {
- if t == nil {
- return nil
- }
- return t.Team
-}
-
-// GetDescription returns the Description field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetDescription() string {
- if t == nil || t.Description == nil {
- return ""
- }
- return *t.Description
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetID() int64 {
- if t == nil || t.ID == nil {
- return 0
- }
- return *t.ID
-}
-
-// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetLDAPDN() string {
- if t == nil || t.LDAPDN == nil {
- return ""
- }
- return *t.LDAPDN
-}
-
-// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetMembersURL() string {
- if t == nil || t.MembersURL == nil {
- return ""
- }
- return *t.MembersURL
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetName() string {
- if t == nil || t.Name == nil {
- return ""
- }
- return *t.Name
-}
-
-// GetPermission returns the Permission field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetPermission() string {
- if t == nil || t.Permission == nil {
- return ""
- }
- return *t.Permission
-}
-
-// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetPrivacy() string {
- if t == nil || t.Privacy == nil {
- return ""
- }
- return *t.Privacy
-}
-
-// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetRepositoriesURL() string {
- if t == nil || t.RepositoriesURL == nil {
- return ""
- }
- return *t.RepositoriesURL
-}
-
-// GetSlug returns the Slug field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetSlug() string {
- if t == nil || t.Slug == nil {
- return ""
- }
- return *t.Slug
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (t *TeamLDAPMapping) GetURL() string {
- if t == nil || t.URL == nil {
- return ""
- }
- return *t.URL
-}
-
-// GetFragment returns the Fragment field if it's non-nil, zero value otherwise.
-func (t *TextMatch) GetFragment() string {
- if t == nil || t.Fragment == nil {
- return ""
- }
- return *t.Fragment
-}
-
-// GetObjectType returns the ObjectType field if it's non-nil, zero value otherwise.
-func (t *TextMatch) GetObjectType() string {
- if t == nil || t.ObjectType == nil {
- return ""
- }
- return *t.ObjectType
-}
-
-// GetObjectURL returns the ObjectURL field if it's non-nil, zero value otherwise.
-func (t *TextMatch) GetObjectURL() string {
- if t == nil || t.ObjectURL == nil {
- return ""
- }
- return *t.ObjectURL
-}
-
-// GetProperty returns the Property field if it's non-nil, zero value otherwise.
-func (t *TextMatch) GetProperty() string {
- if t == nil || t.Property == nil {
- return ""
- }
- return *t.Property
-}
-
-// GetActor returns the Actor field.
-func (t *Timeline) GetActor() *User {
- if t == nil {
- return nil
- }
- return t.Actor
-}
-
-// GetAssignee returns the Assignee field.
-func (t *Timeline) GetAssignee() *User {
- if t == nil {
- return nil
- }
- return t.Assignee
-}
-
-// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise.
-func (t *Timeline) GetCommitID() string {
- if t == nil || t.CommitID == nil {
- return ""
- }
- return *t.CommitID
-}
-
-// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise.
-func (t *Timeline) GetCommitURL() string {
- if t == nil || t.CommitURL == nil {
- return ""
- }
- return *t.CommitURL
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (t *Timeline) GetCreatedAt() time.Time {
- if t == nil || t.CreatedAt == nil {
- return time.Time{}
- }
- return *t.CreatedAt
-}
-
-// GetEvent returns the Event field if it's non-nil, zero value otherwise.
-func (t *Timeline) GetEvent() string {
- if t == nil || t.Event == nil {
- return ""
- }
- return *t.Event
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (t *Timeline) GetID() int64 {
- if t == nil || t.ID == nil {
- return 0
- }
- return *t.ID
-}
-
-// GetLabel returns the Label field.
-func (t *Timeline) GetLabel() *Label {
- if t == nil {
- return nil
- }
- return t.Label
-}
-
-// GetMilestone returns the Milestone field.
-func (t *Timeline) GetMilestone() *Milestone {
- if t == nil {
- return nil
- }
- return t.Milestone
-}
-
-// GetRename returns the Rename field.
-func (t *Timeline) GetRename() *Rename {
- if t == nil {
- return nil
- }
- return t.Rename
-}
-
-// GetSource returns the Source field.
-func (t *Timeline) GetSource() *Source {
- if t == nil {
- return nil
- }
- return t.Source
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (t *Timeline) GetURL() string {
- if t == nil || t.URL == nil {
- return ""
- }
- return *t.URL
-}
-
-// GetCount returns the Count field if it's non-nil, zero value otherwise.
-func (t *TrafficClones) GetCount() int {
- if t == nil || t.Count == nil {
- return 0
- }
- return *t.Count
-}
-
-// GetUniques returns the Uniques field if it's non-nil, zero value otherwise.
-func (t *TrafficClones) GetUniques() int {
- if t == nil || t.Uniques == nil {
- return 0
- }
- return *t.Uniques
-}
-
-// GetCount returns the Count field if it's non-nil, zero value otherwise.
-func (t *TrafficData) GetCount() int {
- if t == nil || t.Count == nil {
- return 0
- }
- return *t.Count
-}
-
-// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise.
-func (t *TrafficData) GetTimestamp() Timestamp {
- if t == nil || t.Timestamp == nil {
- return Timestamp{}
- }
- return *t.Timestamp
-}
-
-// GetUniques returns the Uniques field if it's non-nil, zero value otherwise.
-func (t *TrafficData) GetUniques() int {
- if t == nil || t.Uniques == nil {
- return 0
- }
- return *t.Uniques
-}
-
-// GetCount returns the Count field if it's non-nil, zero value otherwise.
-func (t *TrafficPath) GetCount() int {
- if t == nil || t.Count == nil {
- return 0
- }
- return *t.Count
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (t *TrafficPath) GetPath() string {
- if t == nil || t.Path == nil {
- return ""
- }
- return *t.Path
-}
-
-// GetTitle returns the Title field if it's non-nil, zero value otherwise.
-func (t *TrafficPath) GetTitle() string {
- if t == nil || t.Title == nil {
- return ""
- }
- return *t.Title
-}
-
-// GetUniques returns the Uniques field if it's non-nil, zero value otherwise.
-func (t *TrafficPath) GetUniques() int {
- if t == nil || t.Uniques == nil {
- return 0
- }
- return *t.Uniques
-}
-
-// GetCount returns the Count field if it's non-nil, zero value otherwise.
-func (t *TrafficReferrer) GetCount() int {
- if t == nil || t.Count == nil {
- return 0
- }
- return *t.Count
-}
-
-// GetReferrer returns the Referrer field if it's non-nil, zero value otherwise.
-func (t *TrafficReferrer) GetReferrer() string {
- if t == nil || t.Referrer == nil {
- return ""
- }
- return *t.Referrer
-}
-
-// GetUniques returns the Uniques field if it's non-nil, zero value otherwise.
-func (t *TrafficReferrer) GetUniques() int {
- if t == nil || t.Uniques == nil {
- return 0
- }
- return *t.Uniques
-}
-
-// GetCount returns the Count field if it's non-nil, zero value otherwise.
-func (t *TrafficViews) GetCount() int {
- if t == nil || t.Count == nil {
- return 0
- }
- return *t.Count
-}
-
-// GetUniques returns the Uniques field if it's non-nil, zero value otherwise.
-func (t *TrafficViews) GetUniques() int {
- if t == nil || t.Uniques == nil {
- return 0
- }
- return *t.Uniques
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (t *Tree) GetSHA() string {
- if t == nil || t.SHA == nil {
- return ""
- }
- return *t.SHA
-}
-
-// GetContent returns the Content field if it's non-nil, zero value otherwise.
-func (t *TreeEntry) GetContent() string {
- if t == nil || t.Content == nil {
- return ""
- }
- return *t.Content
-}
-
-// GetMode returns the Mode field if it's non-nil, zero value otherwise.
-func (t *TreeEntry) GetMode() string {
- if t == nil || t.Mode == nil {
- return ""
- }
- return *t.Mode
-}
-
-// GetPath returns the Path field if it's non-nil, zero value otherwise.
-func (t *TreeEntry) GetPath() string {
- if t == nil || t.Path == nil {
- return ""
- }
- return *t.Path
-}
-
-// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
-func (t *TreeEntry) GetSHA() string {
- if t == nil || t.SHA == nil {
- return ""
- }
- return *t.SHA
-}
-
-// GetSize returns the Size field if it's non-nil, zero value otherwise.
-func (t *TreeEntry) GetSize() int {
- if t == nil || t.Size == nil {
- return 0
- }
- return *t.Size
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (t *TreeEntry) GetType() string {
- if t == nil || t.Type == nil {
- return ""
- }
- return *t.Type
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (t *TreeEntry) GetURL() string {
- if t == nil || t.URL == nil {
- return ""
- }
- return *t.URL
-}
-
-// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.
-func (u *User) GetAvatarURL() string {
- if u == nil || u.AvatarURL == nil {
- return ""
- }
- return *u.AvatarURL
-}
-
-// GetBio returns the Bio field if it's non-nil, zero value otherwise.
-func (u *User) GetBio() string {
- if u == nil || u.Bio == nil {
- return ""
- }
- return *u.Bio
-}
-
-// GetBlog returns the Blog field if it's non-nil, zero value otherwise.
-func (u *User) GetBlog() string {
- if u == nil || u.Blog == nil {
- return ""
- }
- return *u.Blog
-}
-
-// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise.
-func (u *User) GetCollaborators() int {
- if u == nil || u.Collaborators == nil {
- return 0
- }
- return *u.Collaborators
-}
-
-// GetCompany returns the Company field if it's non-nil, zero value otherwise.
-func (u *User) GetCompany() string {
- if u == nil || u.Company == nil {
- return ""
- }
- return *u.Company
-}
-
-// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
-func (u *User) GetCreatedAt() Timestamp {
- if u == nil || u.CreatedAt == nil {
- return Timestamp{}
- }
- return *u.CreatedAt
-}
-
-// GetDiskUsage returns the DiskUsage field if it's non-nil, zero value otherwise.
-func (u *User) GetDiskUsage() int {
- if u == nil || u.DiskUsage == nil {
- return 0
- }
- return *u.DiskUsage
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (u *User) GetEmail() string {
- if u == nil || u.Email == nil {
- return ""
- }
- return *u.Email
-}
-
-// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.
-func (u *User) GetEventsURL() string {
- if u == nil || u.EventsURL == nil {
- return ""
- }
- return *u.EventsURL
-}
-
-// GetFollowers returns the Followers field if it's non-nil, zero value otherwise.
-func (u *User) GetFollowers() int {
- if u == nil || u.Followers == nil {
- return 0
- }
- return *u.Followers
-}
-
-// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise.
-func (u *User) GetFollowersURL() string {
- if u == nil || u.FollowersURL == nil {
- return ""
- }
- return *u.FollowersURL
-}
-
-// GetFollowing returns the Following field if it's non-nil, zero value otherwise.
-func (u *User) GetFollowing() int {
- if u == nil || u.Following == nil {
- return 0
- }
- return *u.Following
-}
-
-// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise.
-func (u *User) GetFollowingURL() string {
- if u == nil || u.FollowingURL == nil {
- return ""
- }
- return *u.FollowingURL
-}
-
-// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise.
-func (u *User) GetGistsURL() string {
- if u == nil || u.GistsURL == nil {
- return ""
- }
- return *u.GistsURL
-}
-
-// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise.
-func (u *User) GetGravatarID() string {
- if u == nil || u.GravatarID == nil {
- return ""
- }
- return *u.GravatarID
-}
-
-// GetHireable returns the Hireable field if it's non-nil, zero value otherwise.
-func (u *User) GetHireable() bool {
- if u == nil || u.Hireable == nil {
- return false
- }
- return *u.Hireable
-}
-
-// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
-func (u *User) GetHTMLURL() string {
- if u == nil || u.HTMLURL == nil {
- return ""
- }
- return *u.HTMLURL
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (u *User) GetID() int64 {
- if u == nil || u.ID == nil {
- return 0
- }
- return *u.ID
-}
-
-// GetLocation returns the Location field if it's non-nil, zero value otherwise.
-func (u *User) GetLocation() string {
- if u == nil || u.Location == nil {
- return ""
- }
- return *u.Location
-}
-
-// GetLogin returns the Login field if it's non-nil, zero value otherwise.
-func (u *User) GetLogin() string {
- if u == nil || u.Login == nil {
- return ""
- }
- return *u.Login
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (u *User) GetName() string {
- if u == nil || u.Name == nil {
- return ""
- }
- return *u.Name
-}
-
-// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise.
-func (u *User) GetOrganizationsURL() string {
- if u == nil || u.OrganizationsURL == nil {
- return ""
- }
- return *u.OrganizationsURL
-}
-
-// GetOwnedPrivateRepos returns the OwnedPrivateRepos field if it's non-nil, zero value otherwise.
-func (u *User) GetOwnedPrivateRepos() int {
- if u == nil || u.OwnedPrivateRepos == nil {
- return 0
- }
- return *u.OwnedPrivateRepos
-}
-
-// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise.
-func (u *User) GetPermissions() map[string]bool {
- if u == nil || u.Permissions == nil {
- return map[string]bool{}
- }
- return *u.Permissions
-}
-
-// GetPlan returns the Plan field.
-func (u *User) GetPlan() *Plan {
- if u == nil {
- return nil
- }
- return u.Plan
-}
-
-// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise.
-func (u *User) GetPrivateGists() int {
- if u == nil || u.PrivateGists == nil {
- return 0
- }
- return *u.PrivateGists
-}
-
-// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise.
-func (u *User) GetPublicGists() int {
- if u == nil || u.PublicGists == nil {
- return 0
- }
- return *u.PublicGists
-}
-
-// GetPublicRepos returns the PublicRepos field if it's non-nil, zero value otherwise.
-func (u *User) GetPublicRepos() int {
- if u == nil || u.PublicRepos == nil {
- return 0
- }
- return *u.PublicRepos
-}
-
-// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise.
-func (u *User) GetReceivedEventsURL() string {
- if u == nil || u.ReceivedEventsURL == nil {
- return ""
- }
- return *u.ReceivedEventsURL
-}
-
-// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise.
-func (u *User) GetReposURL() string {
- if u == nil || u.ReposURL == nil {
- return ""
- }
- return *u.ReposURL
-}
-
-// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise.
-func (u *User) GetSiteAdmin() bool {
- if u == nil || u.SiteAdmin == nil {
- return false
- }
- return *u.SiteAdmin
-}
-
-// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise.
-func (u *User) GetStarredURL() string {
- if u == nil || u.StarredURL == nil {
- return ""
- }
- return *u.StarredURL
-}
-
-// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise.
-func (u *User) GetSubscriptionsURL() string {
- if u == nil || u.SubscriptionsURL == nil {
- return ""
- }
- return *u.SubscriptionsURL
-}
-
-// GetSuspendedAt returns the SuspendedAt field if it's non-nil, zero value otherwise.
-func (u *User) GetSuspendedAt() Timestamp {
- if u == nil || u.SuspendedAt == nil {
- return Timestamp{}
- }
- return *u.SuspendedAt
-}
-
-// GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise.
-func (u *User) GetTotalPrivateRepos() int {
- if u == nil || u.TotalPrivateRepos == nil {
- return 0
- }
- return *u.TotalPrivateRepos
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (u *User) GetType() string {
- if u == nil || u.Type == nil {
- return ""
- }
- return *u.Type
-}
-
-// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
-func (u *User) GetUpdatedAt() Timestamp {
- if u == nil || u.UpdatedAt == nil {
- return Timestamp{}
- }
- return *u.UpdatedAt
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (u *User) GetURL() string {
- if u == nil || u.URL == nil {
- return ""
- }
- return *u.URL
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (u *UserEmail) GetEmail() string {
- if u == nil || u.Email == nil {
- return ""
- }
- return *u.Email
-}
-
-// GetPrimary returns the Primary field if it's non-nil, zero value otherwise.
-func (u *UserEmail) GetPrimary() bool {
- if u == nil || u.Primary == nil {
- return false
- }
- return *u.Primary
-}
-
-// GetVerified returns the Verified field if it's non-nil, zero value otherwise.
-func (u *UserEmail) GetVerified() bool {
- if u == nil || u.Verified == nil {
- return false
- }
- return *u.Verified
-}
-
-// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetAvatarURL() string {
- if u == nil || u.AvatarURL == nil {
- return ""
- }
- return *u.AvatarURL
-}
-
-// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetEventsURL() string {
- if u == nil || u.EventsURL == nil {
- return ""
- }
- return *u.EventsURL
-}
-
-// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetFollowersURL() string {
- if u == nil || u.FollowersURL == nil {
- return ""
- }
- return *u.FollowersURL
-}
-
-// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetFollowingURL() string {
- if u == nil || u.FollowingURL == nil {
- return ""
- }
- return *u.FollowingURL
-}
-
-// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetGistsURL() string {
- if u == nil || u.GistsURL == nil {
- return ""
- }
- return *u.GistsURL
-}
-
-// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetGravatarID() string {
- if u == nil || u.GravatarID == nil {
- return ""
- }
- return *u.GravatarID
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetID() int64 {
- if u == nil || u.ID == nil {
- return 0
- }
- return *u.ID
-}
-
-// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetLDAPDN() string {
- if u == nil || u.LDAPDN == nil {
- return ""
- }
- return *u.LDAPDN
-}
-
-// GetLogin returns the Login field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetLogin() string {
- if u == nil || u.Login == nil {
- return ""
- }
- return *u.Login
-}
-
-// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetOrganizationsURL() string {
- if u == nil || u.OrganizationsURL == nil {
- return ""
- }
- return *u.OrganizationsURL
-}
-
-// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetReceivedEventsURL() string {
- if u == nil || u.ReceivedEventsURL == nil {
- return ""
- }
- return *u.ReceivedEventsURL
-}
-
-// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetReposURL() string {
- if u == nil || u.ReposURL == nil {
- return ""
- }
- return *u.ReposURL
-}
-
-// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetSiteAdmin() bool {
- if u == nil || u.SiteAdmin == nil {
- return false
- }
- return *u.SiteAdmin
-}
-
-// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetStarredURL() string {
- if u == nil || u.StarredURL == nil {
- return ""
- }
- return *u.StarredURL
-}
-
-// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetSubscriptionsURL() string {
- if u == nil || u.SubscriptionsURL == nil {
- return ""
- }
- return *u.SubscriptionsURL
-}
-
-// GetType returns the Type field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetType() string {
- if u == nil || u.Type == nil {
- return ""
- }
- return *u.Type
-}
-
-// GetURL returns the URL field if it's non-nil, zero value otherwise.
-func (u *UserLDAPMapping) GetURL() string {
- if u == nil || u.URL == nil {
- return ""
- }
- return *u.URL
-}
-
-// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
-func (u *UsersSearchResult) GetIncompleteResults() bool {
- if u == nil || u.IncompleteResults == nil {
- return false
- }
- return *u.IncompleteResults
-}
-
-// GetTotal returns the Total field if it's non-nil, zero value otherwise.
-func (u *UsersSearchResult) GetTotal() int {
- if u == nil || u.Total == nil {
- return 0
- }
- return *u.Total
-}
-
-// GetAdminUsers returns the AdminUsers field if it's non-nil, zero value otherwise.
-func (u *UserStats) GetAdminUsers() int {
- if u == nil || u.AdminUsers == nil {
- return 0
- }
- return *u.AdminUsers
-}
-
-// GetSuspendedUsers returns the SuspendedUsers field if it's non-nil, zero value otherwise.
-func (u *UserStats) GetSuspendedUsers() int {
- if u == nil || u.SuspendedUsers == nil {
- return 0
- }
- return *u.SuspendedUsers
-}
-
-// GetTotalUsers returns the TotalUsers field if it's non-nil, zero value otherwise.
-func (u *UserStats) GetTotalUsers() int {
- if u == nil || u.TotalUsers == nil {
- return 0
- }
- return *u.TotalUsers
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (w *WatchEvent) GetAction() string {
- if w == nil || w.Action == nil {
- return ""
- }
- return *w.Action
-}
-
-// GetInstallation returns the Installation field.
-func (w *WatchEvent) GetInstallation() *Installation {
- if w == nil {
- return nil
- }
- return w.Installation
-}
-
-// GetRepo returns the Repo field.
-func (w *WatchEvent) GetRepo() *Repository {
- if w == nil {
- return nil
- }
- return w.Repo
-}
-
-// GetSender returns the Sender field.
-func (w *WatchEvent) GetSender() *User {
- if w == nil {
- return nil
- }
- return w.Sender
-}
-
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetEmail() string {
- if w == nil || w.Email == nil {
- return ""
- }
- return *w.Email
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetName() string {
- if w == nil || w.Name == nil {
- return ""
- }
- return *w.Name
-}
-
-// GetUsername returns the Username field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetUsername() string {
- if w == nil || w.Username == nil {
- return ""
- }
- return *w.Username
-}
-
-// GetAuthor returns the Author field.
-func (w *WebHookCommit) GetAuthor() *WebHookAuthor {
- if w == nil {
- return nil
- }
- return w.Author
-}
-
-// GetCommitter returns the Committer field.
-func (w *WebHookCommit) GetCommitter() *WebHookAuthor {
- if w == nil {
- return nil
- }
- return w.Committer
-}
-
-// GetDistinct returns the Distinct field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetDistinct() bool {
- if w == nil || w.Distinct == nil {
- return false
- }
- return *w.Distinct
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetID() string {
- if w == nil || w.ID == nil {
- return ""
- }
- return *w.ID
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetMessage() string {
- if w == nil || w.Message == nil {
- return ""
- }
- return *w.Message
-}
-
-// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetTimestamp() time.Time {
- if w == nil || w.Timestamp == nil {
- return time.Time{}
- }
- return *w.Timestamp
-}
-
-// GetAfter returns the After field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetAfter() string {
- if w == nil || w.After == nil {
- return ""
- }
- return *w.After
-}
-
-// GetBefore returns the Before field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetBefore() string {
- if w == nil || w.Before == nil {
- return ""
- }
- return *w.Before
-}
-
-// GetCompare returns the Compare field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetCompare() string {
- if w == nil || w.Compare == nil {
- return ""
- }
- return *w.Compare
-}
-
-// GetCreated returns the Created field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetCreated() bool {
- if w == nil || w.Created == nil {
- return false
- }
- return *w.Created
-}
-
-// GetDeleted returns the Deleted field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetDeleted() bool {
- if w == nil || w.Deleted == nil {
- return false
- }
- return *w.Deleted
-}
-
-// GetForced returns the Forced field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetForced() bool {
- if w == nil || w.Forced == nil {
- return false
- }
- return *w.Forced
-}
-
-// GetHeadCommit returns the HeadCommit field.
-func (w *WebHookPayload) GetHeadCommit() *WebHookCommit {
- if w == nil {
- return nil
- }
- return w.HeadCommit
-}
-
-// GetPusher returns the Pusher field.
-func (w *WebHookPayload) GetPusher() *User {
- if w == nil {
- return nil
- }
- return w.Pusher
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetRef() string {
- if w == nil || w.Ref == nil {
- return ""
- }
- return *w.Ref
-}
-
-// GetRepo returns the Repo field.
-func (w *WebHookPayload) GetRepo() *Repository {
- if w == nil {
- return nil
- }
- return w.Repo
-}
-
-// GetSender returns the Sender field.
-func (w *WebHookPayload) GetSender() *User {
- if w == nil {
- return nil
- }
- return w.Sender
-}
-
-// GetTotal returns the Total field if it's non-nil, zero value otherwise.
-func (w *WeeklyCommitActivity) GetTotal() int {
- if w == nil || w.Total == nil {
- return 0
- }
- return *w.Total
-}
-
-// GetWeek returns the Week field if it's non-nil, zero value otherwise.
-func (w *WeeklyCommitActivity) GetWeek() Timestamp {
- if w == nil || w.Week == nil {
- return Timestamp{}
- }
- return *w.Week
-}
-
-// GetAdditions returns the Additions field if it's non-nil, zero value otherwise.
-func (w *WeeklyStats) GetAdditions() int {
- if w == nil || w.Additions == nil {
- return 0
- }
- return *w.Additions
-}
-
-// GetCommits returns the Commits field if it's non-nil, zero value otherwise.
-func (w *WeeklyStats) GetCommits() int {
- if w == nil || w.Commits == nil {
- return 0
- }
- return *w.Commits
-}
-
-// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise.
-func (w *WeeklyStats) GetDeletions() int {
- if w == nil || w.Deletions == nil {
- return 0
- }
- return *w.Deletions
-}
-
-// GetWeek returns the Week field if it's non-nil, zero value otherwise.
-func (w *WeeklyStats) GetWeek() Timestamp {
- if w == nil || w.Week == nil {
- return Timestamp{}
- }
- return *w.Week
-}
diff --git a/vendor/github.com/google/go-github/github/github.go b/vendor/github.com/google/go-github/github/github.go
deleted file mode 100644
index 08247226..00000000
--- a/vendor/github.com/google/go-github/github/github.go
+++ /dev/null
@@ -1,980 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:generate go run gen-accessors.go
-
-package github
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "reflect"
- "strconv"
- "strings"
- "sync"
- "time"
-
- "github.com/google/go-querystring/query"
-)
-
-const (
- libraryVersion = "15"
- defaultBaseURL = "https://api.github.com/"
- uploadBaseURL = "https://uploads.github.com/"
- userAgent = "go-github/" + libraryVersion
-
- headerRateLimit = "X-RateLimit-Limit"
- headerRateRemaining = "X-RateLimit-Remaining"
- headerRateReset = "X-RateLimit-Reset"
- headerOTP = "X-GitHub-OTP"
-
- mediaTypeV3 = "application/vnd.github.v3+json"
- defaultMediaType = "application/octet-stream"
- mediaTypeV3SHA = "application/vnd.github.v3.sha"
- mediaTypeV3Diff = "application/vnd.github.v3.diff"
- mediaTypeV3Patch = "application/vnd.github.v3.patch"
- mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json"
-
- // Media Type values to access preview APIs
-
- // https://developer.github.com/changes/2015-03-09-licenses-api/
- mediaTypeLicensesPreview = "application/vnd.github.drax-preview+json"
-
- // https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
- mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
-
- // https://developer.github.com/changes/2015-11-11-protected-branches-api/
- mediaTypeProtectedBranchesPreview = "application/vnd.github.loki-preview+json"
-
- // https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/
- mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
-
- // https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/
- mediaTypeDeploymentStatusPreview = "application/vnd.github.ant-man-preview+json"
-
- // https://developer.github.com/changes/2016-02-19-source-import-preview-api/
- mediaTypeImportPreview = "application/vnd.github.barred-rock-preview"
-
- // https://developer.github.com/changes/2016-05-12-reactions-api-preview/
- mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
-
- // https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
- mediaTypeGitSigningPreview = "application/vnd.github.cryptographer-preview+json"
-
- // https://developer.github.com/changes/2016-05-23-timeline-preview-api/
- mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json"
-
- // https://developer.github.com/changes/2016-06-14-repository-invitations/
- mediaTypeRepositoryInvitationsPreview = "application/vnd.github.swamp-thing-preview+json"
-
- // https://developer.github.com/changes/2016-07-06-github-pages-preiew-api/
- mediaTypePagesPreview = "application/vnd.github.mister-fantastic-preview+json"
-
- // https://developer.github.com/changes/2016-09-14-projects-api/
- mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
-
- // https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/
- mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json"
-
- // https://developer.github.com/changes/2017-01-05-commit-search-api/
- mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"
-
- // https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/
- mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json"
-
- // https://developer.github.com/changes/2017-02-09-community-health/
- mediaTypeRepositoryCommunityHealthMetricsPreview = "application/vnd.github.black-panther-preview+json"
-
- // https://developer.github.com/changes/2017-05-23-coc-api/
- mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
-
- // https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/
- mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json"
-
- // https://developer.github.com/changes/2017-07-26-team-review-request-thor-preview/
- mediaTypeTeamReviewPreview = "application/vnd.github.thor-preview+json"
-
- // https://developer.github.com/v3/apps/marketplace/
- mediaTypeMarketplacePreview = "application/vnd.github.valkyrie-preview+json"
-
- // https://developer.github.com/changes/2017-08-30-preview-nested-teams/
- mediaTypeNestedTeamsPreview = "application/vnd.github.hellcat-preview+json"
-
- // https://developer.github.com/changes/2017-11-09-repository-transfer-api-preview/
- mediaTypeRepositoryTransferPreview = "application/vnd.github.nightshade-preview+json"
-
- // https://developer.github.com/changes/2017-12-19-graphql-node-id/
- mediaTypeGraphQLNodeIDPreview = "application/vnd.github.jean-grey-preview+json"
-)
-
-// A Client manages communication with the GitHub API.
-type Client struct {
- clientMu sync.Mutex // clientMu protects the client during calls that modify the CheckRedirect func.
- client *http.Client // HTTP client used to communicate with the API.
-
- // Base URL for API requests. Defaults to the public GitHub API, but can be
- // set to a domain endpoint to use with GitHub Enterprise. BaseURL should
- // always be specified with a trailing slash.
- BaseURL *url.URL
-
- // Base URL for uploading files.
- UploadURL *url.URL
-
- // User agent used when communicating with the GitHub API.
- UserAgent string
-
- rateMu sync.Mutex
- rateLimits [categories]Rate // Rate limits for the client as determined by the most recent API calls.
-
- common service // Reuse a single struct instead of allocating one for each service on the heap.
-
- // Services used for talking to different parts of the GitHub API.
- Activity *ActivityService
- Admin *AdminService
- Apps *AppsService
- Authorizations *AuthorizationsService
- Gists *GistsService
- Git *GitService
- Gitignores *GitignoresService
- Issues *IssuesService
- Licenses *LicensesService
- Marketplace *MarketplaceService
- Migrations *MigrationService
- Organizations *OrganizationsService
- Projects *ProjectsService
- PullRequests *PullRequestsService
- Reactions *ReactionsService
- Repositories *RepositoriesService
- Search *SearchService
- Users *UsersService
-}
-
-type service struct {
- client *Client
-}
-
-// ListOptions specifies the optional parameters to various List methods that
-// support pagination.
-type ListOptions struct {
- // For paginated result sets, page of results to retrieve.
- Page int `url:"page,omitempty"`
-
- // For paginated result sets, the number of results to include per page.
- PerPage int `url:"per_page,omitempty"`
-}
-
-// UploadOptions specifies the parameters to methods that support uploads.
-type UploadOptions struct {
- Name string `url:"name,omitempty"`
-}
-
-// RawType represents type of raw format of a request instead of JSON.
-type RawType uint8
-
-const (
- // Diff format.
- Diff RawType = 1 + iota
- // Patch format.
- Patch
-)
-
-// RawOptions specifies parameters when user wants to get raw format of
-// a response instead of JSON.
-type RawOptions struct {
- Type RawType
-}
-
-// addOptions adds the parameters in opt as URL query parameters to s. opt
-// must be a struct whose fields may contain "url" tags.
-func addOptions(s string, opt interface{}) (string, error) {
- v := reflect.ValueOf(opt)
- if v.Kind() == reflect.Ptr && v.IsNil() {
- return s, nil
- }
-
- u, err := url.Parse(s)
- if err != nil {
- return s, err
- }
-
- qs, err := query.Values(opt)
- if err != nil {
- return s, err
- }
-
- u.RawQuery = qs.Encode()
- return u.String(), nil
-}
-
-// NewClient returns a new GitHub API client. If a nil httpClient is
-// provided, http.DefaultClient will be used. To use API methods which require
-// authentication, provide an http.Client that will perform the authentication
-// for you (such as that provided by the golang.org/x/oauth2 library).
-func NewClient(httpClient *http.Client) *Client {
- if httpClient == nil {
- httpClient = http.DefaultClient
- }
- baseURL, _ := url.Parse(defaultBaseURL)
- uploadURL, _ := url.Parse(uploadBaseURL)
-
- c := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent, UploadURL: uploadURL}
- c.common.client = c
- c.Activity = (*ActivityService)(&c.common)
- c.Admin = (*AdminService)(&c.common)
- c.Apps = (*AppsService)(&c.common)
- c.Authorizations = (*AuthorizationsService)(&c.common)
- c.Gists = (*GistsService)(&c.common)
- c.Git = (*GitService)(&c.common)
- c.Gitignores = (*GitignoresService)(&c.common)
- c.Issues = (*IssuesService)(&c.common)
- c.Licenses = (*LicensesService)(&c.common)
- c.Marketplace = &MarketplaceService{client: c}
- c.Migrations = (*MigrationService)(&c.common)
- c.Organizations = (*OrganizationsService)(&c.common)
- c.Projects = (*ProjectsService)(&c.common)
- c.PullRequests = (*PullRequestsService)(&c.common)
- c.Reactions = (*ReactionsService)(&c.common)
- c.Repositories = (*RepositoriesService)(&c.common)
- c.Search = (*SearchService)(&c.common)
- c.Users = (*UsersService)(&c.common)
- return c
-}
-
-// NewEnterpriseClient returns a new GitHub API client with provided
-// base URL and upload URL (often the same URL).
-// If either URL does not have a trailing slash, one is added automatically.
-// If a nil httpClient is provided, http.DefaultClient will be used.
-//
-// Note that NewEnterpriseClient is a convenience helper only;
-// its behavior is equivalent to using NewClient, followed by setting
-// the BaseURL and UploadURL fields.
-func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*Client, error) {
- baseEndpoint, err := url.Parse(baseURL)
- if err != nil {
- return nil, err
- }
- if !strings.HasSuffix(baseEndpoint.Path, "/") {
- baseEndpoint.Path += "/"
- }
-
- uploadEndpoint, err := url.Parse(uploadURL)
- if err != nil {
- return nil, err
- }
- if !strings.HasSuffix(uploadEndpoint.Path, "/") {
- uploadEndpoint.Path += "/"
- }
-
- c := NewClient(httpClient)
- c.BaseURL = baseEndpoint
- c.UploadURL = uploadEndpoint
- return c, nil
-}
-
-// NewRequest creates an API request. A relative URL can be provided in urlStr,
-// in which case it is resolved relative to the BaseURL of the Client.
-// Relative URLs should always be specified without a preceding slash. If
-// specified, the value pointed to by body is JSON encoded and included as the
-// request body.
-func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {
- if !strings.HasSuffix(c.BaseURL.Path, "/") {
- return nil, fmt.Errorf("BaseURL must have a trailing slash, but %q does not", c.BaseURL)
- }
- u, err := c.BaseURL.Parse(urlStr)
- if err != nil {
- return nil, err
- }
-
- var buf io.ReadWriter
- if body != nil {
- buf = new(bytes.Buffer)
- enc := json.NewEncoder(buf)
- enc.SetEscapeHTML(false)
- err := enc.Encode(body)
- if err != nil {
- return nil, err
- }
- }
-
- req, err := http.NewRequest(method, u.String(), buf)
- if err != nil {
- return nil, err
- }
-
- if body != nil {
- req.Header.Set("Content-Type", "application/json")
- }
- req.Header.Set("Accept", mediaTypeV3)
- if c.UserAgent != "" {
- req.Header.Set("User-Agent", c.UserAgent)
- }
- return req, nil
-}
-
-// NewUploadRequest creates an upload request. A relative URL can be provided in
-// urlStr, in which case it is resolved relative to the UploadURL of the Client.
-// Relative URLs should always be specified without a preceding slash.
-func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, mediaType string) (*http.Request, error) {
- if !strings.HasSuffix(c.UploadURL.Path, "/") {
- return nil, fmt.Errorf("UploadURL must have a trailing slash, but %q does not", c.UploadURL)
- }
- u, err := c.UploadURL.Parse(urlStr)
- if err != nil {
- return nil, err
- }
-
- req, err := http.NewRequest("POST", u.String(), reader)
- if err != nil {
- return nil, err
- }
- req.ContentLength = size
-
- if mediaType == "" {
- mediaType = defaultMediaType
- }
- req.Header.Set("Content-Type", mediaType)
- req.Header.Set("Accept", mediaTypeV3)
- req.Header.Set("User-Agent", c.UserAgent)
- return req, nil
-}
-
-// Response is a GitHub API response. This wraps the standard http.Response
-// returned from GitHub and provides convenient access to things like
-// pagination links.
-type Response struct {
- *http.Response
-
- // These fields provide the page values for paginating through a set of
- // results. Any or all of these may be set to the zero value for
- // responses that are not part of a paginated set, or for which there
- // are no additional pages.
-
- NextPage int
- PrevPage int
- FirstPage int
- LastPage int
-
- Rate
-}
-
-// newResponse creates a new Response for the provided http.Response.
-// r must not be nil.
-func newResponse(r *http.Response) *Response {
- response := &Response{Response: r}
- response.populatePageValues()
- response.Rate = parseRate(r)
- return response
-}
-
-// populatePageValues parses the HTTP Link response headers and populates the
-// various pagination link values in the Response.
-func (r *Response) populatePageValues() {
- if links, ok := r.Response.Header["Link"]; ok && len(links) > 0 {
- for _, link := range strings.Split(links[0], ",") {
- segments := strings.Split(strings.TrimSpace(link), ";")
-
- // link must at least have href and rel
- if len(segments) < 2 {
- continue
- }
-
- // ensure href is properly formatted
- if !strings.HasPrefix(segments[0], "<") || !strings.HasSuffix(segments[0], ">") {
- continue
- }
-
- // try to pull out page parameter
- url, err := url.Parse(segments[0][1 : len(segments[0])-1])
- if err != nil {
- continue
- }
- page := url.Query().Get("page")
- if page == "" {
- continue
- }
-
- for _, segment := range segments[1:] {
- switch strings.TrimSpace(segment) {
- case `rel="next"`:
- r.NextPage, _ = strconv.Atoi(page)
- case `rel="prev"`:
- r.PrevPage, _ = strconv.Atoi(page)
- case `rel="first"`:
- r.FirstPage, _ = strconv.Atoi(page)
- case `rel="last"`:
- r.LastPage, _ = strconv.Atoi(page)
- }
-
- }
- }
- }
-}
-
-// parseRate parses the rate related headers.
-func parseRate(r *http.Response) Rate {
- var rate Rate
- if limit := r.Header.Get(headerRateLimit); limit != "" {
- rate.Limit, _ = strconv.Atoi(limit)
- }
- if remaining := r.Header.Get(headerRateRemaining); remaining != "" {
- rate.Remaining, _ = strconv.Atoi(remaining)
- }
- if reset := r.Header.Get(headerRateReset); reset != "" {
- if v, _ := strconv.ParseInt(reset, 10, 64); v != 0 {
- rate.Reset = Timestamp{time.Unix(v, 0)}
- }
- }
- return rate
-}
-
-// Do sends an API request and returns the API response. The API response is
-// JSON decoded and stored in the value pointed to by v, or returned as an
-// error if an API error has occurred. If v implements the io.Writer
-// interface, the raw response body will be written to v, without attempting to
-// first decode it. If rate limit is exceeded and reset time is in the future,
-// Do returns *RateLimitError immediately without making a network API call.
-//
-// The provided ctx must be non-nil. If it is canceled or times out,
-// ctx.Err() will be returned.
-func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error) {
- req = withContext(ctx, req)
-
- rateLimitCategory := category(req.URL.Path)
-
- // If we've hit rate limit, don't make further requests before Reset time.
- if err := c.checkRateLimitBeforeDo(req, rateLimitCategory); err != nil {
- return &Response{
- Response: err.Response,
- Rate: err.Rate,
- }, err
- }
-
- resp, err := c.client.Do(req)
- if err != nil {
- // If we got an error, and the context has been canceled,
- // the context's error is probably more useful.
- select {
- case <-ctx.Done():
- return nil, ctx.Err()
- default:
- }
-
- // If the error type is *url.Error, sanitize its URL before returning.
- if e, ok := err.(*url.Error); ok {
- if url, err := url.Parse(e.URL); err == nil {
- e.URL = sanitizeURL(url).String()
- return nil, e
- }
- }
-
- return nil, err
- }
-
- defer func() {
- // Drain up to 512 bytes and close the body to let the Transport reuse the connection
- io.CopyN(ioutil.Discard, resp.Body, 512)
- resp.Body.Close()
- }()
-
- response := newResponse(resp)
-
- c.rateMu.Lock()
- c.rateLimits[rateLimitCategory] = response.Rate
- c.rateMu.Unlock()
-
- err = CheckResponse(resp)
- if err != nil {
- // even though there was an error, we still return the response
- // in case the caller wants to inspect it further
- return response, err
- }
-
- if v != nil {
- if w, ok := v.(io.Writer); ok {
- io.Copy(w, resp.Body)
- } else {
- err = json.NewDecoder(resp.Body).Decode(v)
- if err == io.EOF {
- err = nil // ignore EOF errors caused by empty response body
- }
- }
- }
-
- return response, err
-}
-
-// checkRateLimitBeforeDo does not make any network calls, but uses existing knowledge from
-// current client state in order to quickly check if *RateLimitError can be immediately returned
-// from Client.Do, and if so, returns it so that Client.Do can skip making a network API call unnecessarily.
-// Otherwise it returns nil, and Client.Do should proceed normally.
-func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rateLimitCategory) *RateLimitError {
- c.rateMu.Lock()
- rate := c.rateLimits[rateLimitCategory]
- c.rateMu.Unlock()
- if !rate.Reset.Time.IsZero() && rate.Remaining == 0 && time.Now().Before(rate.Reset.Time) {
- // Create a fake response.
- resp := &http.Response{
- Status: http.StatusText(http.StatusForbidden),
- StatusCode: http.StatusForbidden,
- Request: req,
- Header: make(http.Header),
- Body: ioutil.NopCloser(strings.NewReader("")),
- }
- return &RateLimitError{
- Rate: rate,
- Response: resp,
- Message: fmt.Sprintf("API rate limit of %v still exceeded until %v, not making remote request.", rate.Limit, rate.Reset.Time),
- }
- }
-
- return nil
-}
-
-/*
-An ErrorResponse reports one or more errors caused by an API request.
-
-GitHub API docs: https://developer.github.com/v3/#client-errors
-*/
-type ErrorResponse struct {
- Response *http.Response // HTTP response that caused this error
- Message string `json:"message"` // error message
- Errors []Error `json:"errors"` // more detail on individual errors
- // Block is only populated on certain types of errors such as code 451.
- // See https://developer.github.com/changes/2016-03-17-the-451-status-code-is-now-supported/
- // for more information.
- Block *struct {
- Reason string `json:"reason,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- } `json:"block,omitempty"`
- // Most errors will also include a documentation_url field pointing
- // to some content that might help you resolve the error, see
- // https://developer.github.com/v3/#client-errors
- DocumentationURL string `json:"documentation_url,omitempty"`
-}
-
-func (r *ErrorResponse) Error() string {
- return fmt.Sprintf("%v %v: %d %v %+v",
- r.Response.Request.Method, sanitizeURL(r.Response.Request.URL),
- r.Response.StatusCode, r.Message, r.Errors)
-}
-
-// TwoFactorAuthError occurs when using HTTP Basic Authentication for a user
-// that has two-factor authentication enabled. The request can be reattempted
-// by providing a one-time password in the request.
-type TwoFactorAuthError ErrorResponse
-
-func (r *TwoFactorAuthError) Error() string { return (*ErrorResponse)(r).Error() }
-
-// RateLimitError occurs when GitHub returns 403 Forbidden response with a rate limit
-// remaining value of 0, and error message starts with "API rate limit exceeded for ".
-type RateLimitError struct {
- Rate Rate // Rate specifies last known rate limit for the client
- Response *http.Response // HTTP response that caused this error
- Message string `json:"message"` // error message
-}
-
-func (r *RateLimitError) Error() string {
- return fmt.Sprintf("%v %v: %d %v %v",
- r.Response.Request.Method, sanitizeURL(r.Response.Request.URL),
- r.Response.StatusCode, r.Message, formatRateReset(r.Rate.Reset.Time.Sub(time.Now())))
-}
-
-// AcceptedError occurs when GitHub returns 202 Accepted response with an
-// empty body, which means a job was scheduled on the GitHub side to process
-// the information needed and cache it.
-// Technically, 202 Accepted is not a real error, it's just used to
-// indicate that results are not ready yet, but should be available soon.
-// The request can be repeated after some time.
-type AcceptedError struct{}
-
-func (*AcceptedError) Error() string {
- return "job scheduled on GitHub side; try again later"
-}
-
-// AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the
-// "documentation_url" field value equal to "https://developer.github.com/v3/#abuse-rate-limits".
-type AbuseRateLimitError struct {
- Response *http.Response // HTTP response that caused this error
- Message string `json:"message"` // error message
-
- // RetryAfter is provided with some abuse rate limit errors. If present,
- // it is the amount of time that the client should wait before retrying.
- // Otherwise, the client should try again later (after an unspecified amount of time).
- RetryAfter *time.Duration
-}
-
-func (r *AbuseRateLimitError) Error() string {
- return fmt.Sprintf("%v %v: %d %v",
- r.Response.Request.Method, sanitizeURL(r.Response.Request.URL),
- r.Response.StatusCode, r.Message)
-}
-
-// sanitizeURL redacts the client_secret parameter from the URL which may be
-// exposed to the user.
-func sanitizeURL(uri *url.URL) *url.URL {
- if uri == nil {
- return nil
- }
- params := uri.Query()
- if len(params.Get("client_secret")) > 0 {
- params.Set("client_secret", "REDACTED")
- uri.RawQuery = params.Encode()
- }
- return uri
-}
-
-/*
-An Error reports more details on an individual error in an ErrorResponse.
-These are the possible validation error codes:
-
- missing:
- resource does not exist
- missing_field:
- a required field on a resource has not been set
- invalid:
- the formatting of a field is invalid
- already_exists:
- another resource has the same valid as this field
- custom:
- some resources return this (e.g. github.User.CreateKey()), additional
- information is set in the Message field of the Error
-
-GitHub API docs: https://developer.github.com/v3/#client-errors
-*/
-type Error struct {
- Resource string `json:"resource"` // resource on which the error occurred
- Field string `json:"field"` // field on which the error occurred
- Code string `json:"code"` // validation error code
- Message string `json:"message"` // Message describing the error. Errors with Code == "custom" will always have this set.
-}
-
-func (e *Error) Error() string {
- return fmt.Sprintf("%v error caused by %v field on %v resource",
- e.Code, e.Field, e.Resource)
-}
-
-// CheckResponse checks the API response for errors, and returns them if
-// present. A response is considered an error if it has a status code outside
-// the 200 range or equal to 202 Accepted.
-// API error responses are expected to have either no response
-// body, or a JSON response body that maps to ErrorResponse. Any other
-// response body will be silently ignored.
-//
-// The error type will be *RateLimitError for rate limit exceeded errors,
-// *AcceptedError for 202 Accepted status codes,
-// and *TwoFactorAuthError for two-factor authentication errors.
-func CheckResponse(r *http.Response) error {
- if r.StatusCode == http.StatusAccepted {
- return &AcceptedError{}
- }
- if c := r.StatusCode; 200 <= c && c <= 299 {
- return nil
- }
- errorResponse := &ErrorResponse{Response: r}
- data, err := ioutil.ReadAll(r.Body)
- if err == nil && data != nil {
- json.Unmarshal(data, errorResponse)
- }
- switch {
- case r.StatusCode == http.StatusUnauthorized && strings.HasPrefix(r.Header.Get(headerOTP), "required"):
- return (*TwoFactorAuthError)(errorResponse)
- case r.StatusCode == http.StatusForbidden && r.Header.Get(headerRateRemaining) == "0" && strings.HasPrefix(errorResponse.Message, "API rate limit exceeded for "):
- return &RateLimitError{
- Rate: parseRate(r),
- Response: errorResponse.Response,
- Message: errorResponse.Message,
- }
- case r.StatusCode == http.StatusForbidden && errorResponse.DocumentationURL == "https://developer.github.com/v3/#abuse-rate-limits":
- abuseRateLimitError := &AbuseRateLimitError{
- Response: errorResponse.Response,
- Message: errorResponse.Message,
- }
- if v := r.Header["Retry-After"]; len(v) > 0 {
- // According to GitHub support, the "Retry-After" header value will be
- // an integer which represents the number of seconds that one should
- // wait before resuming making requests.
- retryAfterSeconds, _ := strconv.ParseInt(v[0], 10, 64) // Error handling is noop.
- retryAfter := time.Duration(retryAfterSeconds) * time.Second
- abuseRateLimitError.RetryAfter = &retryAfter
- }
- return abuseRateLimitError
- default:
- return errorResponse
- }
-}
-
-// parseBoolResponse determines the boolean result from a GitHub API response.
-// Several GitHub API methods return boolean responses indicated by the HTTP
-// status code in the response (true indicated by a 204, false indicated by a
-// 404). This helper function will determine that result and hide the 404
-// error if present. Any other error will be returned through as-is.
-func parseBoolResponse(err error) (bool, error) {
- if err == nil {
- return true, nil
- }
-
- if err, ok := err.(*ErrorResponse); ok && err.Response.StatusCode == http.StatusNotFound {
- // Simply false. In this one case, we do not pass the error through.
- return false, nil
- }
-
- // some other real error occurred
- return false, err
-}
-
-// Rate represents the rate limit for the current client.
-type Rate struct {
- // The number of requests per hour the client is currently limited to.
- Limit int `json:"limit"`
-
- // The number of remaining requests the client can make this hour.
- Remaining int `json:"remaining"`
-
- // The time at which the current rate limit will reset.
- Reset Timestamp `json:"reset"`
-}
-
-func (r Rate) String() string {
- return Stringify(r)
-}
-
-// RateLimits represents the rate limits for the current client.
-type RateLimits struct {
- // The rate limit for non-search API requests. Unauthenticated
- // requests are limited to 60 per hour. Authenticated requests are
- // limited to 5,000 per hour.
- //
- // GitHub API docs: https://developer.github.com/v3/#rate-limiting
- Core *Rate `json:"core"`
-
- // The rate limit for search API requests. Unauthenticated requests
- // are limited to 10 requests per minutes. Authenticated requests are
- // limited to 30 per minute.
- //
- // GitHub API docs: https://developer.github.com/v3/search/#rate-limit
- Search *Rate `json:"search"`
-}
-
-func (r RateLimits) String() string {
- return Stringify(r)
-}
-
-type rateLimitCategory uint8
-
-const (
- coreCategory rateLimitCategory = iota
- searchCategory
-
- categories // An array of this length will be able to contain all rate limit categories.
-)
-
-// category returns the rate limit category of the endpoint, determined by Request.URL.Path.
-func category(path string) rateLimitCategory {
- switch {
- default:
- return coreCategory
- case strings.HasPrefix(path, "/search/"):
- return searchCategory
- }
-}
-
-// RateLimits returns the rate limits for the current client.
-func (c *Client) RateLimits(ctx context.Context) (*RateLimits, *Response, error) {
- req, err := c.NewRequest("GET", "rate_limit", nil)
- if err != nil {
- return nil, nil, err
- }
-
- response := new(struct {
- Resources *RateLimits `json:"resources"`
- })
- resp, err := c.Do(ctx, req, response)
- if err != nil {
- return nil, nil, err
- }
-
- if response.Resources != nil {
- c.rateMu.Lock()
- if response.Resources.Core != nil {
- c.rateLimits[coreCategory] = *response.Resources.Core
- }
- if response.Resources.Search != nil {
- c.rateLimits[searchCategory] = *response.Resources.Search
- }
- c.rateMu.Unlock()
- }
-
- return response.Resources, resp, nil
-}
-
-/*
-UnauthenticatedRateLimitedTransport allows you to make unauthenticated calls
-that need to use a higher rate limit associated with your OAuth application.
-
- t := &github.UnauthenticatedRateLimitedTransport{
- ClientID: "your app's client ID",
- ClientSecret: "your app's client secret",
- }
- client := github.NewClient(t.Client())
-
-This will append the querystring params client_id=xxx&client_secret=yyy to all
-requests.
-
-See https://developer.github.com/v3/#unauthenticated-rate-limited-requests for
-more information.
-*/
-type UnauthenticatedRateLimitedTransport struct {
- // ClientID is the GitHub OAuth client ID of the current application, which
- // can be found by selecting its entry in the list at
- // https://github.com/settings/applications.
- ClientID string
-
- // ClientSecret is the GitHub OAuth client secret of the current
- // application.
- ClientSecret string
-
- // Transport is the underlying HTTP transport to use when making requests.
- // It will default to http.DefaultTransport if nil.
- Transport http.RoundTripper
-}
-
-// RoundTrip implements the RoundTripper interface.
-func (t *UnauthenticatedRateLimitedTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- if t.ClientID == "" {
- return nil, errors.New("t.ClientID is empty")
- }
- if t.ClientSecret == "" {
- return nil, errors.New("t.ClientSecret is empty")
- }
-
- // To set extra querystring params, we must make a copy of the Request so
- // that we don't modify the Request we were given. This is required by the
- // specification of http.RoundTripper.
- //
- // Since we are going to modify only req.URL here, we only need a deep copy
- // of req.URL.
- req2 := new(http.Request)
- *req2 = *req
- req2.URL = new(url.URL)
- *req2.URL = *req.URL
-
- q := req2.URL.Query()
- q.Set("client_id", t.ClientID)
- q.Set("client_secret", t.ClientSecret)
- req2.URL.RawQuery = q.Encode()
-
- // Make the HTTP request.
- return t.transport().RoundTrip(req2)
-}
-
-// Client returns an *http.Client that makes requests which are subject to the
-// rate limit of your OAuth application.
-func (t *UnauthenticatedRateLimitedTransport) Client() *http.Client {
- return &http.Client{Transport: t}
-}
-
-func (t *UnauthenticatedRateLimitedTransport) transport() http.RoundTripper {
- if t.Transport != nil {
- return t.Transport
- }
- return http.DefaultTransport
-}
-
-// BasicAuthTransport is an http.RoundTripper that authenticates all requests
-// using HTTP Basic Authentication with the provided username and password. It
-// additionally supports users who have two-factor authentication enabled on
-// their GitHub account.
-type BasicAuthTransport struct {
- Username string // GitHub username
- Password string // GitHub password
- OTP string // one-time password for users with two-factor auth enabled
-
- // Transport is the underlying HTTP transport to use when making requests.
- // It will default to http.DefaultTransport if nil.
- Transport http.RoundTripper
-}
-
-// RoundTrip implements the RoundTripper interface.
-func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- // To set extra headers, we must make a copy of the Request so
- // that we don't modify the Request we were given. This is required by the
- // specification of http.RoundTripper.
- //
- // Since we are going to modify only req.Header here, we only need a deep copy
- // of req.Header.
- req2 := new(http.Request)
- *req2 = *req
- req2.Header = make(http.Header, len(req.Header))
- for k, s := range req.Header {
- req2.Header[k] = append([]string(nil), s...)
- }
-
- req2.SetBasicAuth(t.Username, t.Password)
- if t.OTP != "" {
- req2.Header.Set(headerOTP, t.OTP)
- }
- return t.transport().RoundTrip(req2)
-}
-
-// Client returns an *http.Client that makes requests that are authenticated
-// using HTTP Basic Authentication.
-func (t *BasicAuthTransport) Client() *http.Client {
- return &http.Client{Transport: t}
-}
-
-func (t *BasicAuthTransport) transport() http.RoundTripper {
- if t.Transport != nil {
- return t.Transport
- }
- return http.DefaultTransport
-}
-
-// formatRateReset formats d to look like "[rate reset in 2s]" or
-// "[rate reset in 87m02s]" for the positive durations. And like "[rate limit was reset 87m02s ago]"
-// for the negative cases.
-func formatRateReset(d time.Duration) string {
- isNegative := d < 0
- if isNegative {
- d *= -1
- }
- secondsTotal := int(0.5 + d.Seconds())
- minutes := secondsTotal / 60
- seconds := secondsTotal - minutes*60
-
- var timeString string
- if minutes > 0 {
- timeString = fmt.Sprintf("%dm%02ds", minutes, seconds)
- } else {
- timeString = fmt.Sprintf("%ds", seconds)
- }
-
- if isNegative {
- return fmt.Sprintf("[rate limit was reset %v ago]", timeString)
- }
- return fmt.Sprintf("[rate reset in %v]", timeString)
-}
-
-// Bool is a helper routine that allocates a new bool value
-// to store v and returns a pointer to it.
-func Bool(v bool) *bool { return &v }
-
-// Int is a helper routine that allocates a new int value
-// to store v and returns a pointer to it.
-func Int(v int) *int { return &v }
-
-// Int64 is a helper routine that allocates a new int64 value
-// to store v and returns a pointer to it.
-func Int64(v int64) *int64 { return &v }
-
-// String is a helper routine that allocates a new string value
-// to store v and returns a pointer to it.
-func String(v string) *string { return &v }
diff --git a/vendor/github.com/google/go-github/github/gitignore.go b/vendor/github.com/google/go-github/github/gitignore.go
deleted file mode 100644
index 2f691bc3..00000000
--- a/vendor/github.com/google/go-github/github/gitignore.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// GitignoresService provides access to the gitignore related functions in the
-// GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/gitignore/
-type GitignoresService service
-
-// Gitignore represents a .gitignore file as returned by the GitHub API.
-type Gitignore struct {
- Name *string `json:"name,omitempty"`
- Source *string `json:"source,omitempty"`
-}
-
-func (g Gitignore) String() string {
- return Stringify(g)
-}
-
-// List all available Gitignore templates.
-//
-// GitHub API docs: https://developer.github.com/v3/gitignore/#listing-available-templates
-func (s GitignoresService) List(ctx context.Context) ([]string, *Response, error) {
- req, err := s.client.NewRequest("GET", "gitignore/templates", nil)
- if err != nil {
- return nil, nil, err
- }
-
- var availableTemplates []string
- resp, err := s.client.Do(ctx, req, &availableTemplates)
- if err != nil {
- return nil, resp, err
- }
-
- return availableTemplates, resp, nil
-}
-
-// Get a Gitignore by name.
-//
-// GitHub API docs: https://developer.github.com/v3/gitignore/#get-a-single-template
-func (s GitignoresService) Get(ctx context.Context, name string) (*Gitignore, *Response, error) {
- u := fmt.Sprintf("gitignore/templates/%v", name)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- gitignore := new(Gitignore)
- resp, err := s.client.Do(ctx, req, gitignore)
- if err != nil {
- return nil, resp, err
- }
-
- return gitignore, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/issues.go b/vendor/github.com/google/go-github/github/issues.go
deleted file mode 100644
index f865ea20..00000000
--- a/vendor/github.com/google/go-github/github/issues.go
+++ /dev/null
@@ -1,330 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "strings"
- "time"
-)
-
-// IssuesService handles communication with the issue related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/
-type IssuesService service
-
-// Issue represents a GitHub issue on a repository.
-//
-// Note: As far as the GitHub API is concerned, every pull request is an issue,
-// but not every issue is a pull request. Some endpoints, events, and webhooks
-// may also return pull requests via this struct. If PullRequestLinks is nil,
-// this is an issue, and if PullRequestLinks is not nil, this is a pull request.
-// The IsPullRequest helper method can be used to check that.
-type Issue struct {
- ID *int64 `json:"id,omitempty"`
- Number *int `json:"number,omitempty"`
- State *string `json:"state,omitempty"`
- Locked *bool `json:"locked,omitempty"`
- Title *string `json:"title,omitempty"`
- Body *string `json:"body,omitempty"`
- User *User `json:"user,omitempty"`
- Labels []Label `json:"labels,omitempty"`
- Assignee *User `json:"assignee,omitempty"`
- Comments *int `json:"comments,omitempty"`
- ClosedAt *time.Time `json:"closed_at,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- ClosedBy *User `json:"closed_by,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- CommentsURL *string `json:"comments_url,omitempty"`
- EventsURL *string `json:"events_url,omitempty"`
- LabelsURL *string `json:"labels_url,omitempty"`
- RepositoryURL *string `json:"repository_url,omitempty"`
- Milestone *Milestone `json:"milestone,omitempty"`
- PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
- Repository *Repository `json:"repository,omitempty"`
- Reactions *Reactions `json:"reactions,omitempty"`
- Assignees []*User `json:"assignees,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-
- // TextMatches is only populated from search results that request text matches
- // See: search.go and https://developer.github.com/v3/search/#text-match-metadata
- TextMatches []TextMatch `json:"text_matches,omitempty"`
-}
-
-func (i Issue) String() string {
- return Stringify(i)
-}
-
-// IsPullRequest reports whether the issue is also a pull request. It uses the
-// method recommended by GitHub's API documentation, which is to check whether
-// PullRequestLinks is non-nil.
-func (i Issue) IsPullRequest() bool {
- return i.PullRequestLinks != nil
-}
-
-// IssueRequest represents a request to create/edit an issue.
-// It is separate from Issue above because otherwise Labels
-// and Assignee fail to serialize to the correct JSON.
-type IssueRequest struct {
- Title *string `json:"title,omitempty"`
- Body *string `json:"body,omitempty"`
- Labels *[]string `json:"labels,omitempty"`
- Assignee *string `json:"assignee,omitempty"`
- State *string `json:"state,omitempty"`
- Milestone *int `json:"milestone,omitempty"`
- Assignees *[]string `json:"assignees,omitempty"`
-}
-
-// IssueListOptions specifies the optional parameters to the IssuesService.List
-// and IssuesService.ListByOrg methods.
-type IssueListOptions struct {
- // Filter specifies which issues to list. Possible values are: assigned,
- // created, mentioned, subscribed, all. Default is "assigned".
- Filter string `url:"filter,omitempty"`
-
- // State filters issues based on their state. Possible values are: open,
- // closed, all. Default is "open".
- State string `url:"state,omitempty"`
-
- // Labels filters issues based on their label.
- Labels []string `url:"labels,comma,omitempty"`
-
- // Sort specifies how to sort issues. Possible values are: created, updated,
- // and comments. Default value is "created".
- Sort string `url:"sort,omitempty"`
-
- // Direction in which to sort issues. Possible values are: asc, desc.
- // Default is "desc".
- Direction string `url:"direction,omitempty"`
-
- // Since filters issues by time.
- Since time.Time `url:"since,omitempty"`
-
- ListOptions
-}
-
-// PullRequestLinks object is added to the Issue object when it's an issue included
-// in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR.
-type PullRequestLinks struct {
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- DiffURL *string `json:"diff_url,omitempty"`
- PatchURL *string `json:"patch_url,omitempty"`
-}
-
-// List the issues for the authenticated user. If all is true, list issues
-// across all the user's visible repositories including owned, member, and
-// organization repositories; if false, list only owned and member
-// repositories.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/#list-issues
-func (s *IssuesService) List(ctx context.Context, all bool, opt *IssueListOptions) ([]*Issue, *Response, error) {
- var u string
- if all {
- u = "issues"
- } else {
- u = "user/issues"
- }
- return s.listIssues(ctx, u, opt)
-}
-
-// ListByOrg fetches the issues in the specified organization for the
-// authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/#list-issues
-func (s *IssuesService) ListByOrg(ctx context.Context, org string, opt *IssueListOptions) ([]*Issue, *Response, error) {
- u := fmt.Sprintf("orgs/%v/issues", org)
- return s.listIssues(ctx, u, opt)
-}
-
-func (s *IssuesService) listIssues(ctx context.Context, u string, opt *IssueListOptions) ([]*Issue, *Response, error) {
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- var issues []*Issue
- resp, err := s.client.Do(ctx, req, &issues)
- if err != nil {
- return nil, resp, err
- }
-
- return issues, resp, nil
-}
-
-// IssueListByRepoOptions specifies the optional parameters to the
-// IssuesService.ListByRepo method.
-type IssueListByRepoOptions struct {
- // Milestone limits issues for the specified milestone. Possible values are
- // a milestone number, "none" for issues with no milestone, "*" for issues
- // with any milestone.
- Milestone string `url:"milestone,omitempty"`
-
- // State filters issues based on their state. Possible values are: open,
- // closed, all. Default is "open".
- State string `url:"state,omitempty"`
-
- // Assignee filters issues based on their assignee. Possible values are a
- // user name, "none" for issues that are not assigned, "*" for issues with
- // any assigned user.
- Assignee string `url:"assignee,omitempty"`
-
- // Creator filters issues based on their creator.
- Creator string `url:"creator,omitempty"`
-
- // Mentioned filters issues to those mentioned a specific user.
- Mentioned string `url:"mentioned,omitempty"`
-
- // Labels filters issues based on their label.
- Labels []string `url:"labels,omitempty,comma"`
-
- // Sort specifies how to sort issues. Possible values are: created, updated,
- // and comments. Default value is "created".
- Sort string `url:"sort,omitempty"`
-
- // Direction in which to sort issues. Possible values are: asc, desc.
- // Default is "desc".
- Direction string `url:"direction,omitempty"`
-
- // Since filters issues by time.
- Since time.Time `url:"since,omitempty"`
-
- ListOptions
-}
-
-// ListByRepo lists the issues for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/#list-issues-for-a-repository
-func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opt *IssueListByRepoOptions) ([]*Issue, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- var issues []*Issue
- resp, err := s.client.Do(ctx, req, &issues)
- if err != nil {
- return nil, resp, err
- }
-
- return issues, resp, nil
-}
-
-// Get a single issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/#get-a-single-issue
-func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- issue := new(Issue)
- resp, err := s.client.Do(ctx, req, issue)
- if err != nil {
- return nil, resp, err
- }
-
- return issue, resp, nil
-}
-
-// Create a new issue on the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/#create-an-issue
-func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
- req, err := s.client.NewRequest("POST", u, issue)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- i := new(Issue)
- resp, err := s.client.Do(ctx, req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, nil
-}
-
-// Edit an issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/#edit-an-issue
-func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
- req, err := s.client.NewRequest("PATCH", u, issue)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- i := new(Issue)
- resp, err := s.client.Do(ctx, req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, nil
-}
-
-// Lock an issue's conversation.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/#lock-an-issue
-func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// Unlock an issue's conversation.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/#unlock-an-issue
-func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/issues_assignees.go b/vendor/github.com/google/go-github/github/issues_assignees.go
deleted file mode 100644
index 9cb366f5..00000000
--- a/vendor/github.com/google/go-github/github/issues_assignees.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ListAssignees fetches all available assignees (owners and collaborators) to
-// which issues may be assigned.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/assignees/#list-assignees
-func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
- var assignees []*User
- resp, err := s.client.Do(ctx, req, &assignees)
- if err != nil {
- return nil, resp, err
- }
-
- return assignees, resp, nil
-}
-
-// IsAssignee checks if a user is an assignee for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/assignees/#check-assignee
-func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
- resp, err := s.client.Do(ctx, req, nil)
- assignee, err := parseBoolResponse(err)
- return assignee, resp, err
-}
-
-// AddAssignees adds the provided GitHub users as assignees to the issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
-func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
- users := &struct {
- Assignees []string `json:"assignees,omitempty"`
- }{Assignees: assignees}
- u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number)
- req, err := s.client.NewRequest("POST", u, users)
- if err != nil {
- return nil, nil, err
- }
-
- issue := &Issue{}
- resp, err := s.client.Do(ctx, req, issue)
- return issue, resp, err
-}
-
-// RemoveAssignees removes the provided GitHub users as assignees from the issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
-func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
- users := &struct {
- Assignees []string `json:"assignees,omitempty"`
- }{Assignees: assignees}
- u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number)
- req, err := s.client.NewRequest("DELETE", u, users)
- if err != nil {
- return nil, nil, err
- }
-
- issue := &Issue{}
- resp, err := s.client.Do(ctx, req, issue)
- return issue, resp, err
-}
diff --git a/vendor/github.com/google/go-github/github/issues_comments.go b/vendor/github.com/google/go-github/github/issues_comments.go
deleted file mode 100644
index 70047453..00000000
--- a/vendor/github.com/google/go-github/github/issues_comments.go
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// IssueComment represents a comment left on an issue.
-type IssueComment struct {
- ID *int64 `json:"id,omitempty"`
- Body *string `json:"body,omitempty"`
- User *User `json:"user,omitempty"`
- Reactions *Reactions `json:"reactions,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- IssueURL *string `json:"issue_url,omitempty"`
-}
-
-func (i IssueComment) String() string {
- return Stringify(i)
-}
-
-// IssueListCommentsOptions specifies the optional parameters to the
-// IssuesService.ListComments method.
-type IssueListCommentsOptions struct {
- // Sort specifies how to sort comments. Possible values are: created, updated.
- Sort string `url:"sort,omitempty"`
-
- // Direction in which to sort comments. Possible values are: asc, desc.
- Direction string `url:"direction,omitempty"`
-
- // Since filters comments by time.
- Since time.Time `url:"since,omitempty"`
-
- ListOptions
-}
-
-// ListComments lists all comments on the specified issue. Specifying an issue
-// number of 0 will return all comments on all issues for the repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
-func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opt *IssueListCommentsOptions) ([]*IssueComment, *Response, error) {
- var u string
- if number == 0 {
- u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo)
- } else {
- u = fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number)
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- var comments []*IssueComment
- resp, err := s.client.Do(ctx, req, &comments)
- if err != nil {
- return nil, resp, err
- }
-
- return comments, resp, nil
-}
-
-// GetComment fetches the specified issue comment.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/comments/#get-a-single-comment
-func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, id int) (*IssueComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- comment := new(IssueComment)
- resp, err := s.client.Do(ctx, req, comment)
- if err != nil {
- return nil, resp, err
- }
-
- return comment, resp, nil
-}
-
-// CreateComment creates a new comment on the specified issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/comments/#create-a-comment
-func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number)
- req, err := s.client.NewRequest("POST", u, comment)
- if err != nil {
- return nil, nil, err
- }
- c := new(IssueComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// EditComment updates an issue comment.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/comments/#edit-a-comment
-func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, id int, comment *IssueComment) (*IssueComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
- req, err := s.client.NewRequest("PATCH", u, comment)
- if err != nil {
- return nil, nil, err
- }
- c := new(IssueComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// DeleteComment deletes an issue comment.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/comments/#delete-a-comment
-func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, id int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/issues_events.go b/vendor/github.com/google/go-github/github/issues_events.go
deleted file mode 100644
index 55e6d431..00000000
--- a/vendor/github.com/google/go-github/github/issues_events.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// IssueEvent represents an event that occurred around an Issue or Pull Request.
-type IssueEvent struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
-
- // The User that generated this event.
- Actor *User `json:"actor,omitempty"`
-
- // Event identifies the actual type of Event that occurred. Possible
- // values are:
- //
- // closed
- // The Actor closed the issue.
- // If the issue was closed by commit message, CommitID holds the SHA1 hash of the commit.
- //
- // merged
- // The Actor merged into master a branch containing a commit mentioning the issue.
- // CommitID holds the SHA1 of the merge commit.
- //
- // referenced
- // The Actor committed to master a commit mentioning the issue in its commit message.
- // CommitID holds the SHA1 of the commit.
- //
- // reopened, locked, unlocked
- // The Actor did that to the issue.
- //
- // renamed
- // The Actor changed the issue title from Rename.From to Rename.To.
- //
- // mentioned
- // Someone unspecified @mentioned the Actor [sic] in an issue comment body.
- //
- // assigned, unassigned
- // The Assigner assigned the issue to or removed the assignment from the Assignee.
- //
- // labeled, unlabeled
- // The Actor added or removed the Label from the issue.
- //
- // milestoned, demilestoned
- // The Actor added or removed the issue from the Milestone.
- //
- // subscribed, unsubscribed
- // The Actor subscribed to or unsubscribed from notifications for an issue.
- //
- // head_ref_deleted, head_ref_restored
- // The pull request’s branch was deleted or restored.
- //
- Event *string `json:"event,omitempty"`
-
- CreatedAt *time.Time `json:"created_at,omitempty"`
- Issue *Issue `json:"issue,omitempty"`
-
- // Only present on certain events; see above.
- Assignee *User `json:"assignee,omitempty"`
- Assigner *User `json:"assigner,omitempty"`
- CommitID *string `json:"commit_id,omitempty"`
- Milestone *Milestone `json:"milestone,omitempty"`
- Label *Label `json:"label,omitempty"`
- Rename *Rename `json:"rename,omitempty"`
-}
-
-// ListIssueEvents lists events for the specified issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-an-issue
-func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*IssueEvent, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*IssueEvent
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// ListRepositoryEvents lists events for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-a-repository
-func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var events []*IssueEvent
- resp, err := s.client.Do(ctx, req, &events)
- if err != nil {
- return nil, resp, err
- }
-
- return events, resp, nil
-}
-
-// GetEvent returns the specified issue event.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/events/#get-a-single-event
-func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- event := new(IssueEvent)
- resp, err := s.client.Do(ctx, req, event)
- if err != nil {
- return nil, resp, err
- }
-
- return event, resp, nil
-}
-
-// Rename contains details for 'renamed' events.
-type Rename struct {
- From *string `json:"from,omitempty"`
- To *string `json:"to,omitempty"`
-}
-
-func (r Rename) String() string {
- return Stringify(r)
-}
diff --git a/vendor/github.com/google/go-github/github/issues_labels.go b/vendor/github.com/google/go-github/github/issues_labels.go
deleted file mode 100644
index aacf7d7c..00000000
--- a/vendor/github.com/google/go-github/github/issues_labels.go
+++ /dev/null
@@ -1,251 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Label represents a GitHub label on an Issue
-type Label struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- Name *string `json:"name,omitempty"`
- Color *string `json:"color,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-func (l Label) String() string {
- return Stringify(l)
-}
-
-// ListLabels lists all labels for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
-func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Label, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var labels []*Label
- resp, err := s.client.Do(ctx, req, &labels)
- if err != nil {
- return nil, resp, err
- }
-
- return labels, resp, nil
-}
-
-// GetLabel gets a single label.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#get-a-single-label
-func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- label := new(Label)
- resp, err := s.client.Do(ctx, req, label)
- if err != nil {
- return nil, resp, err
- }
-
- return label, resp, nil
-}
-
-// CreateLabel creates a new label on the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#create-a-label
-func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
- req, err := s.client.NewRequest("POST", u, label)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- l := new(Label)
- resp, err := s.client.Do(ctx, req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, nil
-}
-
-// EditLabel edits a label.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#update-a-label
-func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
- req, err := s.client.NewRequest("PATCH", u, label)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- l := new(Label)
- resp, err := s.client.Do(ctx, req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, nil
-}
-
-// DeleteLabel deletes a label.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#delete-a-label
-func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// ListLabelsByIssue lists all labels for an issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue
-func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var labels []*Label
- resp, err := s.client.Do(ctx, req, &labels)
- if err != nil {
- return nil, resp, err
- }
-
- return labels, resp, nil
-}
-
-// AddLabelsToIssue adds labels to an issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
-func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
- req, err := s.client.NewRequest("POST", u, labels)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var l []*Label
- resp, err := s.client.Do(ctx, req, &l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, nil
-}
-
-// RemoveLabelForIssue removes a label for an issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
-func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// ReplaceLabelsForIssue replaces all labels for an issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
-func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
- req, err := s.client.NewRequest("PUT", u, labels)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var l []*Label
- resp, err := s.client.Do(ctx, req, &l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, nil
-}
-
-// RemoveLabelsForIssue removes all labels for an issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue
-func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// ListLabelsForMilestone lists labels for every issue in a milestone.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone
-func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var labels []*Label
- resp, err := s.client.Do(ctx, req, &labels)
- if err != nil {
- return nil, resp, err
- }
-
- return labels, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/issues_milestones.go b/vendor/github.com/google/go-github/github/issues_milestones.go
deleted file mode 100644
index 6af1cc03..00000000
--- a/vendor/github.com/google/go-github/github/issues_milestones.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// Milestone represents a GitHub repository milestone.
-type Milestone struct {
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- LabelsURL *string `json:"labels_url,omitempty"`
- ID *int64 `json:"id,omitempty"`
- Number *int `json:"number,omitempty"`
- State *string `json:"state,omitempty"`
- Title *string `json:"title,omitempty"`
- Description *string `json:"description,omitempty"`
- Creator *User `json:"creator,omitempty"`
- OpenIssues *int `json:"open_issues,omitempty"`
- ClosedIssues *int `json:"closed_issues,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- ClosedAt *time.Time `json:"closed_at,omitempty"`
- DueOn *time.Time `json:"due_on,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-func (m Milestone) String() string {
- return Stringify(m)
-}
-
-// MilestoneListOptions specifies the optional parameters to the
-// IssuesService.ListMilestones method.
-type MilestoneListOptions struct {
- // State filters milestones based on their state. Possible values are:
- // open, closed, all. Default is "open".
- State string `url:"state,omitempty"`
-
- // Sort specifies how to sort milestones. Possible values are: due_on, completeness.
- // Default value is "due_on".
- Sort string `url:"sort,omitempty"`
-
- // Direction in which to sort milestones. Possible values are: asc, desc.
- // Default is "asc".
- Direction string `url:"direction,omitempty"`
-
- ListOptions
-}
-
-// ListMilestones lists all milestones for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
-func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo string, opt *MilestoneListOptions) ([]*Milestone, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var milestones []*Milestone
- resp, err := s.client.Do(ctx, req, &milestones)
- if err != nil {
- return nil, resp, err
- }
-
- return milestones, resp, nil
-}
-
-// GetMilestone gets a single milestone.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/milestones/#get-a-single-milestone
-func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- milestone := new(Milestone)
- resp, err := s.client.Do(ctx, req, milestone)
- if err != nil {
- return nil, resp, err
- }
-
- return milestone, resp, nil
-}
-
-// CreateMilestone creates a new milestone on the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/milestones/#create-a-milestone
-func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
- req, err := s.client.NewRequest("POST", u, milestone)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- m := new(Milestone)
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// EditMilestone edits a milestone.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/milestones/#update-a-milestone
-func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
- req, err := s.client.NewRequest("PATCH", u, milestone)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- m := new(Milestone)
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// DeleteMilestone deletes a milestone.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/milestones/#delete-a-milestone
-func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/issues_timeline.go b/vendor/github.com/google/go-github/github/issues_timeline.go
deleted file mode 100644
index 9cfda832..00000000
--- a/vendor/github.com/google/go-github/github/issues_timeline.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// Timeline represents an event that occurred around an Issue or Pull Request.
-//
-// It is similar to an IssueEvent but may contain more information.
-// GitHub API docs: https://developer.github.com/v3/issues/timeline/
-type Timeline struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- CommitURL *string `json:"commit_url,omitempty"`
-
- // The User object that generated the event.
- Actor *User `json:"actor,omitempty"`
-
- // Event identifies the actual type of Event that occurred. Possible values
- // are:
- //
- // assigned
- // The issue was assigned to the assignee.
- //
- // closed
- // The issue was closed by the actor. When the commit_id is present, it
- // identifies the commit that closed the issue using "closes / fixes #NN"
- // syntax.
- //
- // commented
- // A comment was added to the issue.
- //
- // committed
- // A commit was added to the pull request's 'HEAD' branch. Only provided
- // for pull requests.
- //
- // cross-referenced
- // The issue was referenced from another issue. The 'source' attribute
- // contains the 'id', 'actor', and 'url' of the reference's source.
- //
- // demilestoned
- // The issue was removed from a milestone.
- //
- // head_ref_deleted
- // The pull request's branch was deleted.
- //
- // head_ref_restored
- // The pull request's branch was restored.
- //
- // labeled
- // A label was added to the issue.
- //
- // locked
- // The issue was locked by the actor.
- //
- // mentioned
- // The actor was @mentioned in an issue body.
- //
- // merged
- // The issue was merged by the actor. The 'commit_id' attribute is the
- // SHA1 of the HEAD commit that was merged.
- //
- // milestoned
- // The issue was added to a milestone.
- //
- // referenced
- // The issue was referenced from a commit message. The 'commit_id'
- // attribute is the commit SHA1 of where that happened.
- //
- // renamed
- // The issue title was changed.
- //
- // reopened
- // The issue was reopened by the actor.
- //
- // subscribed
- // The actor subscribed to receive notifications for an issue.
- //
- // unassigned
- // The assignee was unassigned from the issue.
- //
- // unlabeled
- // A label was removed from the issue.
- //
- // unlocked
- // The issue was unlocked by the actor.
- //
- // unsubscribed
- // The actor unsubscribed to stop receiving notifications for an issue.
- //
- Event *string `json:"event,omitempty"`
-
- // The string SHA of a commit that referenced this Issue or Pull Request.
- CommitID *string `json:"commit_id,omitempty"`
- // The timestamp indicating when the event occurred.
- CreatedAt *time.Time `json:"created_at,omitempty"`
- // The Label object including `name` and `color` attributes. Only provided for
- // 'labeled' and 'unlabeled' events.
- Label *Label `json:"label,omitempty"`
- // The User object which was assigned to (or unassigned from) this Issue or
- // Pull Request. Only provided for 'assigned' and 'unassigned' events.
- Assignee *User `json:"assignee,omitempty"`
- // The Milestone object including a 'title' attribute.
- // Only provided for 'milestoned' and 'demilestoned' events.
- Milestone *Milestone `json:"milestone,omitempty"`
- // The 'id', 'actor', and 'url' for the source of a reference from another issue.
- // Only provided for 'cross-referenced' events.
- Source *Source `json:"source,omitempty"`
- // An object containing rename details including 'from' and 'to' attributes.
- // Only provided for 'renamed' events.
- Rename *Rename `json:"rename,omitempty"`
-}
-
-// Source represents a reference's source.
-type Source struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- Actor *User `json:"actor,omitempty"`
-}
-
-// ListIssueTimeline lists events for the specified issue.
-//
-// GitHub API docs: https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
-func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*Timeline, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%v/timeline", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTimelinePreview)
-
- var events []*Timeline
- resp, err := s.client.Do(ctx, req, &events)
- return events, resp, err
-}
diff --git a/vendor/github.com/google/go-github/github/licenses.go b/vendor/github.com/google/go-github/github/licenses.go
deleted file mode 100644
index e9cd1777..00000000
--- a/vendor/github.com/google/go-github/github/licenses.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// LicensesService handles communication with the license related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/licenses/
-type LicensesService service
-
-// RepositoryLicense represents the license for a repository.
-type RepositoryLicense struct {
- Name *string `json:"name,omitempty"`
- Path *string `json:"path,omitempty"`
-
- SHA *string `json:"sha,omitempty"`
- Size *int `json:"size,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- GitURL *string `json:"git_url,omitempty"`
- DownloadURL *string `json:"download_url,omitempty"`
- Type *string `json:"type,omitempty"`
- Content *string `json:"content,omitempty"`
- Encoding *string `json:"encoding,omitempty"`
- License *License `json:"license,omitempty"`
-}
-
-func (l RepositoryLicense) String() string {
- return Stringify(l)
-}
-
-// License represents an open source license.
-type License struct {
- Key *string `json:"key,omitempty"`
- Name *string `json:"name,omitempty"`
- URL *string `json:"url,omitempty"`
-
- SPDXID *string `json:"spdx_id,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- Featured *bool `json:"featured,omitempty"`
- Description *string `json:"description,omitempty"`
- Implementation *string `json:"implementation,omitempty"`
- Permissions *[]string `json:"permissions,omitempty"`
- Conditions *[]string `json:"conditions,omitempty"`
- Limitations *[]string `json:"limitations,omitempty"`
- Body *string `json:"body,omitempty"`
-}
-
-func (l License) String() string {
- return Stringify(l)
-}
-
-// List popular open source licenses.
-//
-// GitHub API docs: https://developer.github.com/v3/licenses/#list-all-licenses
-func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, error) {
- req, err := s.client.NewRequest("GET", "licenses", nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeLicensesPreview)
-
- var licenses []*License
- resp, err := s.client.Do(ctx, req, &licenses)
- if err != nil {
- return nil, resp, err
- }
-
- return licenses, resp, nil
-}
-
-// Get extended metadata for one license.
-//
-// GitHub API docs: https://developer.github.com/v3/licenses/#get-an-individual-license
-func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) {
- u := fmt.Sprintf("licenses/%s", licenseName)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeLicensesPreview)
-
- license := new(License)
- resp, err := s.client.Do(ctx, req, license)
- if err != nil {
- return nil, resp, err
- }
-
- return license, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/messages.go b/vendor/github.com/google/go-github/github/messages.go
deleted file mode 100644
index 2396fd43..00000000
--- a/vendor/github.com/google/go-github/github/messages.go
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This file provides functions for validating payloads from GitHub Webhooks.
-// GitHub API docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github
-
-package github
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "crypto/sha256"
- "crypto/sha512"
- "encoding/hex"
- "encoding/json"
- "errors"
- "fmt"
- "hash"
- "io/ioutil"
- "net/http"
- "net/url"
- "strings"
-)
-
-const (
- // sha1Prefix is the prefix used by GitHub before the HMAC hexdigest.
- sha1Prefix = "sha1"
- // sha256Prefix and sha512Prefix are provided for future compatibility.
- sha256Prefix = "sha256"
- sha512Prefix = "sha512"
- // signatureHeader is the GitHub header key used to pass the HMAC hexdigest.
- signatureHeader = "X-Hub-Signature"
- // eventTypeHeader is the GitHub header key used to pass the event type.
- eventTypeHeader = "X-Github-Event"
- // deliveryIDHeader is the GitHub header key used to pass the unique ID for the webhook event.
- deliveryIDHeader = "X-Github-Delivery"
-)
-
-var (
- // eventTypeMapping maps webhooks types to their corresponding go-github struct types.
- eventTypeMapping = map[string]string{
- "commit_comment": "CommitCommentEvent",
- "create": "CreateEvent",
- "delete": "DeleteEvent",
- "deployment": "DeploymentEvent",
- "deployment_status": "DeploymentStatusEvent",
- "fork": "ForkEvent",
- "gollum": "GollumEvent",
- "installation": "InstallationEvent",
- "installation_repositories": "InstallationRepositoriesEvent",
- "issue_comment": "IssueCommentEvent",
- "issues": "IssuesEvent",
- "label": "LabelEvent",
- "marketplace_purchase": "MarketplacePurchaseEvent",
- "member": "MemberEvent",
- "membership": "MembershipEvent",
- "milestone": "MilestoneEvent",
- "organization": "OrganizationEvent",
- "org_block": "OrgBlockEvent",
- "page_build": "PageBuildEvent",
- "ping": "PingEvent",
- "project": "ProjectEvent",
- "project_card": "ProjectCardEvent",
- "project_column": "ProjectColumnEvent",
- "public": "PublicEvent",
- "pull_request_review": "PullRequestReviewEvent",
- "pull_request_review_comment": "PullRequestReviewCommentEvent",
- "pull_request": "PullRequestEvent",
- "push": "PushEvent",
- "repository": "RepositoryEvent",
- "release": "ReleaseEvent",
- "status": "StatusEvent",
- "team": "TeamEvent",
- "team_add": "TeamAddEvent",
- "watch": "WatchEvent",
- }
-)
-
-// genMAC generates the HMAC signature for a message provided the secret key
-// and hashFunc.
-func genMAC(message, key []byte, hashFunc func() hash.Hash) []byte {
- mac := hmac.New(hashFunc, key)
- mac.Write(message)
- return mac.Sum(nil)
-}
-
-// checkMAC reports whether messageMAC is a valid HMAC tag for message.
-func checkMAC(message, messageMAC, key []byte, hashFunc func() hash.Hash) bool {
- expectedMAC := genMAC(message, key, hashFunc)
- return hmac.Equal(messageMAC, expectedMAC)
-}
-
-// messageMAC returns the hex-decoded HMAC tag from the signature and its
-// corresponding hash function.
-func messageMAC(signature string) ([]byte, func() hash.Hash, error) {
- if signature == "" {
- return nil, nil, errors.New("missing signature")
- }
- sigParts := strings.SplitN(signature, "=", 2)
- if len(sigParts) != 2 {
- return nil, nil, fmt.Errorf("error parsing signature %q", signature)
- }
-
- var hashFunc func() hash.Hash
- switch sigParts[0] {
- case sha1Prefix:
- hashFunc = sha1.New
- case sha256Prefix:
- hashFunc = sha256.New
- case sha512Prefix:
- hashFunc = sha512.New
- default:
- return nil, nil, fmt.Errorf("unknown hash type prefix: %q", sigParts[0])
- }
-
- buf, err := hex.DecodeString(sigParts[1])
- if err != nil {
- return nil, nil, fmt.Errorf("error decoding signature %q: %v", signature, err)
- }
- return buf, hashFunc, nil
-}
-
-// ValidatePayload validates an incoming GitHub Webhook event request
-// and returns the (JSON) payload.
-// The Content-Type header of the payload can be "application/json" or "application/x-www-form-urlencoded".
-// If the Content-Type is neither then an error is returned.
-// secretKey is the GitHub Webhook secret message.
-//
-// Example usage:
-//
-// func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-// payload, err := github.ValidatePayload(r, s.webhookSecretKey)
-// if err != nil { ... }
-// // Process payload...
-// }
-//
-func ValidatePayload(r *http.Request, secretKey []byte) (payload []byte, err error) {
- var body []byte // Raw body that GitHub uses to calculate the signature.
-
- switch ct := r.Header.Get("Content-Type"); ct {
- case "application/json":
- var err error
- if body, err = ioutil.ReadAll(r.Body); err != nil {
- return nil, err
- }
-
- // If the content type is application/json,
- // the JSON payload is just the original body.
- payload = body
-
- case "application/x-www-form-urlencoded":
- // payloadFormParam is the name of the form parameter that the JSON payload
- // will be in if a webhook has its content type set to application/x-www-form-urlencoded.
- const payloadFormParam = "payload"
-
- var err error
- if body, err = ioutil.ReadAll(r.Body); err != nil {
- return nil, err
- }
-
- // If the content type is application/x-www-form-urlencoded,
- // the JSON payload will be under the "payload" form param.
- form, err := url.ParseQuery(string(body))
- if err != nil {
- return nil, err
- }
- payload = []byte(form.Get(payloadFormParam))
-
- default:
- return nil, fmt.Errorf("Webhook request has unsupported Content-Type %q", ct)
- }
-
- sig := r.Header.Get(signatureHeader)
- if err := validateSignature(sig, body, secretKey); err != nil {
- return nil, err
- }
- return payload, nil
-}
-
-// validateSignature validates the signature for the given payload.
-// signature is the GitHub hash signature delivered in the X-Hub-Signature header.
-// payload is the JSON payload sent by GitHub Webhooks.
-// secretKey is the GitHub Webhook secret message.
-//
-// GitHub API docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github
-func validateSignature(signature string, payload, secretKey []byte) error {
- messageMAC, hashFunc, err := messageMAC(signature)
- if err != nil {
- return err
- }
- if !checkMAC(payload, messageMAC, secretKey, hashFunc) {
- return errors.New("payload signature check failed")
- }
- return nil
-}
-
-// WebHookType returns the event type of webhook request r.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers
-func WebHookType(r *http.Request) string {
- return r.Header.Get(eventTypeHeader)
-}
-
-// DeliveryID returns the unique delivery ID of webhook request r.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers
-func DeliveryID(r *http.Request) string {
- return r.Header.Get(deliveryIDHeader)
-}
-
-// ParseWebHook parses the event payload. For recognized event types, a
-// value of the corresponding struct type will be returned (as returned
-// by Event.ParsePayload()). An error will be returned for unrecognized event
-// types.
-//
-// Example usage:
-//
-// func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-// payload, err := github.ValidatePayload(r, s.webhookSecretKey)
-// if err != nil { ... }
-// event, err := github.ParseWebHook(github.WebHookType(r), payload)
-// if err != nil { ... }
-// switch event := event.(type) {
-// case *github.CommitCommentEvent:
-// processCommitCommentEvent(event)
-// case *github.CreateEvent:
-// processCreateEvent(event)
-// ...
-// }
-// }
-//
-func ParseWebHook(messageType string, payload []byte) (interface{}, error) {
- eventType, ok := eventTypeMapping[messageType]
- if !ok {
- return nil, fmt.Errorf("unknown X-Github-Event in message: %v", messageType)
- }
-
- event := Event{
- Type: &eventType,
- RawPayload: (*json.RawMessage)(&payload),
- }
- return event.ParsePayload()
-}
diff --git a/vendor/github.com/google/go-github/github/migrations.go b/vendor/github.com/google/go-github/github/migrations.go
deleted file mode 100644
index 90cc1fae..00000000
--- a/vendor/github.com/google/go-github/github/migrations.go
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "errors"
- "fmt"
- "net/http"
- "strings"
-)
-
-// MigrationService provides access to the migration related functions
-// in the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/
-type MigrationService service
-
-// Migration represents a GitHub migration (archival).
-type Migration struct {
- ID *int64 `json:"id,omitempty"`
- GUID *string `json:"guid,omitempty"`
- // State is the current state of a migration.
- // Possible values are:
- // "pending" which means the migration hasn't started yet,
- // "exporting" which means the migration is in progress,
- // "exported" which means the migration finished successfully, or
- // "failed" which means the migration failed.
- State *string `json:"state,omitempty"`
- // LockRepositories indicates whether repositories are locked (to prevent
- // manipulation) while migrating data.
- LockRepositories *bool `json:"lock_repositories,omitempty"`
- // ExcludeAttachments indicates whether attachments should be excluded from
- // the migration (to reduce migration archive file size).
- ExcludeAttachments *bool `json:"exclude_attachments,omitempty"`
- URL *string `json:"url,omitempty"`
- CreatedAt *string `json:"created_at,omitempty"`
- UpdatedAt *string `json:"updated_at,omitempty"`
- Repositories []*Repository `json:"repositories,omitempty"`
-}
-
-func (m Migration) String() string {
- return Stringify(m)
-}
-
-// MigrationOptions specifies the optional parameters to Migration methods.
-type MigrationOptions struct {
- // LockRepositories indicates whether repositories should be locked (to prevent
- // manipulation) while migrating data.
- LockRepositories bool
-
- // ExcludeAttachments indicates whether attachments should be excluded from
- // the migration (to reduce migration archive file size).
- ExcludeAttachments bool
-}
-
-// startMigration represents the body of a StartMigration request.
-type startMigration struct {
- // Repositories is a slice of repository names to migrate.
- Repositories []string `json:"repositories,omitempty"`
-
- // LockRepositories indicates whether repositories should be locked (to prevent
- // manipulation) while migrating data.
- LockRepositories *bool `json:"lock_repositories,omitempty"`
-
- // ExcludeAttachments indicates whether attachments should be excluded from
- // the migration (to reduce migration archive file size).
- ExcludeAttachments *bool `json:"exclude_attachments,omitempty"`
-}
-
-// StartMigration starts the generation of a migration archive.
-// repos is a slice of repository names to migrate.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/migrations/#start-a-migration
-func (s *MigrationService) StartMigration(ctx context.Context, org string, repos []string, opt *MigrationOptions) (*Migration, *Response, error) {
- u := fmt.Sprintf("orgs/%v/migrations", org)
-
- body := &startMigration{Repositories: repos}
- if opt != nil {
- body.LockRepositories = Bool(opt.LockRepositories)
- body.ExcludeAttachments = Bool(opt.ExcludeAttachments)
- }
-
- req, err := s.client.NewRequest("POST", u, body)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
- m := &Migration{}
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// ListMigrations lists the most recent migrations.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/migrations/#get-a-list-of-migrations
-func (s *MigrationService) ListMigrations(ctx context.Context, org string) ([]*Migration, *Response, error) {
- u := fmt.Sprintf("orgs/%v/migrations", org)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
- var m []*Migration
- resp, err := s.client.Do(ctx, req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// MigrationStatus gets the status of a specific migration archive.
-// id is the migration ID.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/migrations/#get-the-status-of-a-migration
-func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int64) (*Migration, *Response, error) {
- u := fmt.Sprintf("orgs/%v/migrations/%v", org, id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
- m := &Migration{}
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// MigrationArchiveURL fetches a migration archive URL.
-// id is the migration ID.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/migrations/#download-a-migration-archive
-func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int64) (url string, err error) {
- u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return "", err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
- s.client.clientMu.Lock()
- defer s.client.clientMu.Unlock()
-
- // Disable the redirect mechanism because AWS fails if the GitHub auth token is provided.
- var loc string
- saveRedirect := s.client.client.CheckRedirect
- s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
- loc = req.URL.String()
- return errors.New("disable redirect")
- }
- defer func() { s.client.client.CheckRedirect = saveRedirect }()
-
- _, err = s.client.Do(ctx, req, nil) // expect error from disable redirect
- if err == nil {
- return "", errors.New("expected redirect, none provided")
- }
- if !strings.Contains(err.Error(), "disable redirect") {
- return "", err
- }
- return loc, nil
-}
-
-// DeleteMigration deletes a previous migration archive.
-// id is the migration ID.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/migrations/#delete-a-migration-archive
-func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int64) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// UnlockRepo unlocks a repository that was locked for migration.
-// id is the migration ID.
-// You should unlock each migrated repository and delete them when the migration
-// is complete and you no longer need the source data.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/migrations/#unlock-a-repository
-func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, repo string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/migrations/%v/repos/%v/lock", org, id, repo)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/migrations_source_import.go b/vendor/github.com/google/go-github/github/migrations_source_import.go
deleted file mode 100644
index fd45e780..00000000
--- a/vendor/github.com/google/go-github/github/migrations_source_import.go
+++ /dev/null
@@ -1,329 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Import represents a repository import request.
-type Import struct {
- // The URL of the originating repository.
- VCSURL *string `json:"vcs_url,omitempty"`
- // The originating VCS type. Can be one of 'subversion', 'git',
- // 'mercurial', or 'tfvc'. Without this parameter, the import job will
- // take additional time to detect the VCS type before beginning the
- // import. This detection step will be reflected in the response.
- VCS *string `json:"vcs,omitempty"`
- // VCSUsername and VCSPassword are only used for StartImport calls that
- // are importing a password-protected repository.
- VCSUsername *string `json:"vcs_username,omitempty"`
- VCSPassword *string `json:"vcs_password,omitempty"`
- // For a tfvc import, the name of the project that is being imported.
- TFVCProject *string `json:"tfvc_project,omitempty"`
-
- // LFS related fields that may be preset in the Import Progress response
-
- // Describes whether the import has been opted in or out of using Git
- // LFS. The value can be 'opt_in', 'opt_out', or 'undecided' if no
- // action has been taken.
- UseLFS *string `json:"use_lfs,omitempty"`
- // Describes whether files larger than 100MB were found during the
- // importing step.
- HasLargeFiles *bool `json:"has_large_files,omitempty"`
- // The total size in gigabytes of files larger than 100MB found in the
- // originating repository.
- LargeFilesSize *int `json:"large_files_size,omitempty"`
- // The total number of files larger than 100MB found in the originating
- // repository. To see a list of these files, call LargeFiles.
- LargeFilesCount *int `json:"large_files_count,omitempty"`
-
- // Identifies the current status of an import. An import that does not
- // have errors will progress through these steps:
- //
- // detecting - the "detection" step of the import is in progress
- // because the request did not include a VCS parameter. The
- // import is identifying the type of source control present at
- // the URL.
- // importing - the "raw" step of the import is in progress. This is
- // where commit data is fetched from the original repository.
- // The import progress response will include CommitCount (the
- // total number of raw commits that will be imported) and
- // Percent (0 - 100, the current progress through the import).
- // mapping - the "rewrite" step of the import is in progress. This
- // is where SVN branches are converted to Git branches, and
- // where author updates are applied. The import progress
- // response does not include progress information.
- // pushing - the "push" step of the import is in progress. This is
- // where the importer updates the repository on GitHub. The
- // import progress response will include PushPercent, which is
- // the percent value reported by git push when it is "Writing
- // objects".
- // complete - the import is complete, and the repository is ready
- // on GitHub.
- //
- // If there are problems, you will see one of these in the status field:
- //
- // auth_failed - the import requires authentication in order to
- // connect to the original repository. Make an UpdateImport
- // request, and include VCSUsername and VCSPassword.
- // error - the import encountered an error. The import progress
- // response will include the FailedStep and an error message.
- // Contact GitHub support for more information.
- // detection_needs_auth - the importer requires authentication for
- // the originating repository to continue detection. Make an
- // UpdatImport request, and include VCSUsername and
- // VCSPassword.
- // detection_found_nothing - the importer didn't recognize any
- // source control at the URL.
- // detection_found_multiple - the importer found several projects
- // or repositories at the provided URL. When this is the case,
- // the Import Progress response will also include a
- // ProjectChoices field with the possible project choices as
- // values. Make an UpdateImport request, and include VCS and
- // (if applicable) TFVCProject.
- Status *string `json:"status,omitempty"`
- CommitCount *int `json:"commit_count,omitempty"`
- StatusText *string `json:"status_text,omitempty"`
- AuthorsCount *int `json:"authors_count,omitempty"`
- Percent *int `json:"percent,omitempty"`
- PushPercent *int `json:"push_percent,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- AuthorsURL *string `json:"authors_url,omitempty"`
- RepositoryURL *string `json:"repository_url,omitempty"`
- Message *string `json:"message,omitempty"`
- FailedStep *string `json:"failed_step,omitempty"`
-
- // Human readable display name, provided when the Import appears as
- // part of ProjectChoices.
- HumanName *string `json:"human_name,omitempty"`
-
- // When the importer finds several projects or repositories at the
- // provided URLs, this will identify the available choices. Call
- // UpdateImport with the selected Import value.
- ProjectChoices []Import `json:"project_choices,omitempty"`
-}
-
-func (i Import) String() string {
- return Stringify(i)
-}
-
-// SourceImportAuthor identifies an author imported from a source repository.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors
-type SourceImportAuthor struct {
- ID *int64 `json:"id,omitempty"`
- RemoteID *string `json:"remote_id,omitempty"`
- RemoteName *string `json:"remote_name,omitempty"`
- Email *string `json:"email,omitempty"`
- Name *string `json:"name,omitempty"`
- URL *string `json:"url,omitempty"`
- ImportURL *string `json:"import_url,omitempty"`
-}
-
-func (a SourceImportAuthor) String() string {
- return Stringify(a)
-}
-
-// LargeFile identifies a file larger than 100MB found during a repository import.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-large-files
-type LargeFile struct {
- RefName *string `json:"ref_name,omitempty"`
- Path *string `json:"path,omitempty"`
- OID *string `json:"oid,omitempty"`
- Size *int `json:"size,omitempty"`
-}
-
-func (f LargeFile) String() string {
- return Stringify(f)
-}
-
-// StartImport initiates a repository import.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#start-an-import
-func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
- req, err := s.client.NewRequest("PUT", u, in)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeImportPreview)
-
- out := new(Import)
- resp, err := s.client.Do(ctx, req, out)
- if err != nil {
- return nil, resp, err
- }
-
- return out, resp, nil
-}
-
-// ImportProgress queries for the status and progress of an ongoing repository import.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-import-progress
-func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo string) (*Import, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeImportPreview)
-
- out := new(Import)
- resp, err := s.client.Do(ctx, req, out)
- if err != nil {
- return nil, resp, err
- }
-
- return out, resp, nil
-}
-
-// UpdateImport initiates a repository import.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#update-existing-import
-func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
- req, err := s.client.NewRequest("PATCH", u, in)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeImportPreview)
-
- out := new(Import)
- resp, err := s.client.Do(ctx, req, out)
- if err != nil {
- return nil, resp, err
- }
-
- return out, resp, nil
-}
-
-// CommitAuthors gets the authors mapped from the original repository.
-//
-// Each type of source control system represents authors in a different way.
-// For example, a Git commit author has a display name and an email address,
-// but a Subversion commit author just has a username. The GitHub Importer will
-// make the author information valid, but the author might not be correct. For
-// example, it will change the bare Subversion username "hubot" into something
-// like "hubot ".
-//
-// This method and MapCommitAuthor allow you to provide correct Git author
-// information.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors
-func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string) ([]*SourceImportAuthor, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeImportPreview)
-
- var authors []*SourceImportAuthor
- resp, err := s.client.Do(ctx, req, &authors)
- if err != nil {
- return nil, resp, err
- }
-
- return authors, resp, nil
-}
-
-// MapCommitAuthor updates an author's identity for the import. Your
-// application can continue updating authors any time before you push new
-// commits to the repository.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#map-a-commit-author
-func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id)
- req, err := s.client.NewRequest("PATCH", u, author)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeImportPreview)
-
- out := new(SourceImportAuthor)
- resp, err := s.client.Do(ctx, req, out)
- if err != nil {
- return nil, resp, err
- }
-
- return out, resp, nil
-}
-
-// SetLFSPreference sets whether imported repositories should use Git LFS for
-// files larger than 100MB. Only the UseLFS field on the provided Import is
-// used.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#set-git-lfs-preference
-func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo)
- req, err := s.client.NewRequest("PATCH", u, in)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeImportPreview)
-
- out := new(Import)
- resp, err := s.client.Do(ctx, req, out)
- if err != nil {
- return nil, resp, err
- }
-
- return out, resp, nil
-}
-
-// LargeFiles lists files larger than 100MB found during the import.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-large-files
-func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ([]*LargeFile, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeImportPreview)
-
- var files []*LargeFile
- resp, err := s.client.Do(ctx, req, &files)
- if err != nil {
- return nil, resp, err
- }
-
- return files, resp, nil
-}
-
-// CancelImport stops an import for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#cancel-an-import
-func (s *MigrationService) CancelImport(ctx context.Context, owner, repo string) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeImportPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/misc.go b/vendor/github.com/google/go-github/github/misc.go
deleted file mode 100644
index 5b8082d3..00000000
--- a/vendor/github.com/google/go-github/github/misc.go
+++ /dev/null
@@ -1,253 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "bytes"
- "context"
- "fmt"
- "net/url"
-)
-
-// MarkdownOptions specifies optional parameters to the Markdown method.
-type MarkdownOptions struct {
- // Mode identifies the rendering mode. Possible values are:
- // markdown - render a document as plain Markdown, just like
- // README files are rendered.
- //
- // gfm - to render a document as user-content, e.g. like user
- // comments or issues are rendered. In GFM mode, hard line breaks are
- // always taken into account, and issue and user mentions are linked
- // accordingly.
- //
- // Default is "markdown".
- Mode string
-
- // Context identifies the repository context. Only taken into account
- // when rendering as "gfm".
- Context string
-}
-
-type markdownRequest struct {
- Text *string `json:"text,omitempty"`
- Mode *string `json:"mode,omitempty"`
- Context *string `json:"context,omitempty"`
-}
-
-// Markdown renders an arbitrary Markdown document.
-//
-// GitHub API docs: https://developer.github.com/v3/markdown/
-func (c *Client) Markdown(ctx context.Context, text string, opt *MarkdownOptions) (string, *Response, error) {
- request := &markdownRequest{Text: String(text)}
- if opt != nil {
- if opt.Mode != "" {
- request.Mode = String(opt.Mode)
- }
- if opt.Context != "" {
- request.Context = String(opt.Context)
- }
- }
-
- req, err := c.NewRequest("POST", "markdown", request)
- if err != nil {
- return "", nil, err
- }
-
- buf := new(bytes.Buffer)
- resp, err := c.Do(ctx, req, buf)
- if err != nil {
- return "", resp, err
- }
-
- return buf.String(), resp, nil
-}
-
-// ListEmojis returns the emojis available to use on GitHub.
-//
-// GitHub API docs: https://developer.github.com/v3/emojis/
-func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) {
- req, err := c.NewRequest("GET", "emojis", nil)
- if err != nil {
- return nil, nil, err
- }
-
- var emoji map[string]string
- resp, err := c.Do(ctx, req, &emoji)
- if err != nil {
- return nil, resp, err
- }
-
- return emoji, resp, nil
-}
-
-// CodeOfConduct represents a code of conduct.
-type CodeOfConduct struct {
- Name *string `json:"name,omitempty"`
- Key *string `json:"key,omitempty"`
- URL *string `json:"url,omitempty"`
- Body *string `json:"body,omitempty"`
-}
-
-func (c *CodeOfConduct) String() string {
- return Stringify(c)
-}
-
-// ListCodesOfConduct returns all codes of conduct.
-//
-// GitHub API docs: https://developer.github.com/v3/codes_of_conduct/#list-all-codes-of-conduct
-func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) {
- req, err := c.NewRequest("GET", "codes_of_conduct", nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeCodesOfConductPreview)
-
- var cs []*CodeOfConduct
- resp, err := c.Do(ctx, req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, nil
-}
-
-// GetCodeOfConduct returns an individual code of conduct.
-//
-// https://developer.github.com/v3/codes_of_conduct/#get-an-individual-code-of-conduct
-func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) {
- u := fmt.Sprintf("codes_of_conduct/%s", key)
- req, err := c.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeCodesOfConductPreview)
-
- coc := new(CodeOfConduct)
- resp, err := c.Do(ctx, req, coc)
- if err != nil {
- return nil, resp, err
- }
-
- return coc, resp, nil
-}
-
-// APIMeta represents metadata about the GitHub API.
-type APIMeta struct {
- // An Array of IP addresses in CIDR format specifying the addresses
- // that incoming service hooks will originate from on GitHub.com.
- Hooks []string `json:"hooks,omitempty"`
-
- // An Array of IP addresses in CIDR format specifying the Git servers
- // for GitHub.com.
- Git []string `json:"git,omitempty"`
-
- // Whether authentication with username and password is supported.
- // (GitHub Enterprise instances using CAS or OAuth for authentication
- // will return false. Features like Basic Authentication with a
- // username and password, sudo mode, and two-factor authentication are
- // not supported on these servers.)
- VerifiablePasswordAuthentication *bool `json:"verifiable_password_authentication,omitempty"`
-
- // An array of IP addresses in CIDR format specifying the addresses
- // which serve GitHub Pages websites.
- Pages []string `json:"pages,omitempty"`
-}
-
-// APIMeta returns information about GitHub.com, the service. Or, if you access
-// this endpoint on your organization’s GitHub Enterprise installation, this
-// endpoint provides information about that installation.
-//
-// GitHub API docs: https://developer.github.com/v3/meta/
-func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) {
- req, err := c.NewRequest("GET", "meta", nil)
- if err != nil {
- return nil, nil, err
- }
-
- meta := new(APIMeta)
- resp, err := c.Do(ctx, req, meta)
- if err != nil {
- return nil, resp, err
- }
-
- return meta, resp, nil
-}
-
-// Octocat returns an ASCII art octocat with the specified message in a speech
-// bubble. If message is empty, a random zen phrase is used.
-func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) {
- u := "octocat"
- if message != "" {
- u = fmt.Sprintf("%s?s=%s", u, url.QueryEscape(message))
- }
-
- req, err := c.NewRequest("GET", u, nil)
- if err != nil {
- return "", nil, err
- }
-
- buf := new(bytes.Buffer)
- resp, err := c.Do(ctx, req, buf)
- if err != nil {
- return "", resp, err
- }
-
- return buf.String(), resp, nil
-}
-
-// Zen returns a random line from The Zen of GitHub.
-//
-// see also: http://warpspire.com/posts/taste/
-func (c *Client) Zen(ctx context.Context) (string, *Response, error) {
- req, err := c.NewRequest("GET", "zen", nil)
- if err != nil {
- return "", nil, err
- }
-
- buf := new(bytes.Buffer)
- resp, err := c.Do(ctx, req, buf)
- if err != nil {
- return "", resp, err
- }
-
- return buf.String(), resp, nil
-}
-
-// ServiceHook represents a hook that has configuration settings, a list of
-// available events, and default events.
-type ServiceHook struct {
- Name *string `json:"name,omitempty"`
- Events []string `json:"events,omitempty"`
- SupportedEvents []string `json:"supported_events,omitempty"`
- Schema [][]string `json:"schema,omitempty"`
-}
-
-func (s *ServiceHook) String() string {
- return Stringify(s)
-}
-
-// ListServiceHooks lists all of the available service hooks.
-//
-// GitHub API docs: https://developer.github.com/webhooks/#services
-func (c *Client) ListServiceHooks(ctx context.Context) ([]*ServiceHook, *Response, error) {
- u := "hooks"
- req, err := c.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var hooks []*ServiceHook
- resp, err := c.Do(ctx, req, &hooks)
- if err != nil {
- return nil, resp, err
- }
-
- return hooks, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/orgs.go b/vendor/github.com/google/go-github/github/orgs.go
deleted file mode 100644
index 976a5fca..00000000
--- a/vendor/github.com/google/go-github/github/orgs.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// OrganizationsService provides access to the organization related functions
-// in the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/
-type OrganizationsService service
-
-// Organization represents a GitHub organization account.
-type Organization struct {
- Login *string `json:"login,omitempty"`
- ID *int64 `json:"id,omitempty"`
- AvatarURL *string `json:"avatar_url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- Name *string `json:"name,omitempty"`
- Company *string `json:"company,omitempty"`
- Blog *string `json:"blog,omitempty"`
- Location *string `json:"location,omitempty"`
- Email *string `json:"email,omitempty"`
- Description *string `json:"description,omitempty"`
- PublicRepos *int `json:"public_repos,omitempty"`
- PublicGists *int `json:"public_gists,omitempty"`
- Followers *int `json:"followers,omitempty"`
- Following *int `json:"following,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- TotalPrivateRepos *int `json:"total_private_repos,omitempty"`
- OwnedPrivateRepos *int `json:"owned_private_repos,omitempty"`
- PrivateGists *int `json:"private_gists,omitempty"`
- DiskUsage *int `json:"disk_usage,omitempty"`
- Collaborators *int `json:"collaborators,omitempty"`
- BillingEmail *string `json:"billing_email,omitempty"`
- Type *string `json:"type,omitempty"`
- Plan *Plan `json:"plan,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-
- // API URLs
- URL *string `json:"url,omitempty"`
- EventsURL *string `json:"events_url,omitempty"`
- HooksURL *string `json:"hooks_url,omitempty"`
- IssuesURL *string `json:"issues_url,omitempty"`
- MembersURL *string `json:"members_url,omitempty"`
- PublicMembersURL *string `json:"public_members_url,omitempty"`
- ReposURL *string `json:"repos_url,omitempty"`
-}
-
-func (o Organization) String() string {
- return Stringify(o)
-}
-
-// Plan represents the payment plan for an account. See plans at https://github.com/plans.
-type Plan struct {
- Name *string `json:"name,omitempty"`
- Space *int `json:"space,omitempty"`
- Collaborators *int `json:"collaborators,omitempty"`
- PrivateRepos *int `json:"private_repos,omitempty"`
-}
-
-func (p Plan) String() string {
- return Stringify(p)
-}
-
-// OrganizationsListOptions specifies the optional parameters to the
-// OrganizationsService.ListAll method.
-type OrganizationsListOptions struct {
- // Since filters Organizations by ID.
- Since int `url:"since,omitempty"`
-
- ListOptions
-}
-
-// ListAll lists all organizations, in the order that they were created on GitHub.
-//
-// Note: Pagination is powered exclusively by the since parameter. To continue
-// listing the next set of organizations, use the ID of the last-returned organization
-// as the opts.Since parameter for the next call.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/#list-all-organizations
-func (s *OrganizationsService) ListAll(ctx context.Context, opt *OrganizationsListOptions) ([]*Organization, *Response, error) {
- u, err := addOptions("organizations", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- orgs := []*Organization{}
- resp, err := s.client.Do(ctx, req, &orgs)
- if err != nil {
- return nil, resp, err
- }
- return orgs, resp, nil
-}
-
-// List the organizations for a user. Passing the empty string will list
-// organizations for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/#list-user-organizations
-func (s *OrganizationsService) List(ctx context.Context, user string, opt *ListOptions) ([]*Organization, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/orgs", user)
- } else {
- u = "user/orgs"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var orgs []*Organization
- resp, err := s.client.Do(ctx, req, &orgs)
- if err != nil {
- return nil, resp, err
- }
-
- return orgs, resp, nil
-}
-
-// Get fetches an organization by name.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/#get-an-organization
-func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organization, *Response, error) {
- u := fmt.Sprintf("orgs/%v", org)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- organization := new(Organization)
- resp, err := s.client.Do(ctx, req, organization)
- if err != nil {
- return nil, resp, err
- }
-
- return organization, resp, nil
-}
-
-// GetByID fetches an organization.
-//
-// Note: GetByID uses the undocumented GitHub API endpoint /organizations/:id.
-func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organization, *Response, error) {
- u := fmt.Sprintf("organizations/%d", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- organization := new(Organization)
- resp, err := s.client.Do(ctx, req, organization)
- if err != nil {
- return nil, resp, err
- }
-
- return organization, resp, nil
-}
-
-// Edit an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/#edit-an-organization
-func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) {
- u := fmt.Sprintf("orgs/%v", name)
- req, err := s.client.NewRequest("PATCH", u, org)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- o := new(Organization)
- resp, err := s.client.Do(ctx, req, o)
- if err != nil {
- return nil, resp, err
- }
-
- return o, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/orgs_hooks.go b/vendor/github.com/google/go-github/github/orgs_hooks.go
deleted file mode 100644
index 4fc692e0..00000000
--- a/vendor/github.com/google/go-github/github/orgs_hooks.go
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2015 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ListHooks lists all Hooks for the specified organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#list-hooks
-func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opt *ListOptions) ([]*Hook, *Response, error) {
- u := fmt.Sprintf("orgs/%v/hooks", org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var hooks []*Hook
- resp, err := s.client.Do(ctx, req, &hooks)
- if err != nil {
- return nil, resp, err
- }
-
- return hooks, resp, nil
-}
-
-// GetHook returns a single specified Hook.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#get-single-hook
-func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int) (*Hook, *Response, error) {
- u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
- hook := new(Hook)
- resp, err := s.client.Do(ctx, req, hook)
- return hook, resp, err
-}
-
-// CreateHook creates a Hook for the specified org.
-// Name and Config are required fields.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#create-a-hook
-func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook *Hook) (*Hook, *Response, error) {
- u := fmt.Sprintf("orgs/%v/hooks", org)
- req, err := s.client.NewRequest("POST", u, hook)
- if err != nil {
- return nil, nil, err
- }
-
- h := new(Hook)
- resp, err := s.client.Do(ctx, req, h)
- if err != nil {
- return nil, resp, err
- }
-
- return h, resp, nil
-}
-
-// EditHook updates a specified Hook.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#edit-a-hook
-func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int, hook *Hook) (*Hook, *Response, error) {
- u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
- req, err := s.client.NewRequest("PATCH", u, hook)
- if err != nil {
- return nil, nil, err
- }
- h := new(Hook)
- resp, err := s.client.Do(ctx, req, h)
- return h, resp, err
-}
-
-// PingHook triggers a 'ping' event to be sent to the Hook.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#ping-a-hook
-func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id)
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// DeleteHook deletes a specified Hook.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#delete-a-hook
-func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/orgs_members.go b/vendor/github.com/google/go-github/github/orgs_members.go
deleted file mode 100644
index d0ea6a98..00000000
--- a/vendor/github.com/google/go-github/github/orgs_members.go
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Membership represents the status of a user's membership in an organization or team.
-type Membership struct {
- URL *string `json:"url,omitempty"`
-
- // State is the user's status within the organization or team.
- // Possible values are: "active", "pending"
- State *string `json:"state,omitempty"`
-
- // Role identifies the user's role within the organization or team.
- // Possible values for organization membership:
- // member - non-owner organization member
- // admin - organization owner
- //
- // Possible values for team membership are:
- // member - a normal member of the team
- // maintainer - a team maintainer. Able to add/remove other team
- // members, promote other team members to team
- // maintainer, and edit the team’s name and description
- Role *string `json:"role,omitempty"`
-
- // For organization membership, the API URL of the organization.
- OrganizationURL *string `json:"organization_url,omitempty"`
-
- // For organization membership, the organization the membership is for.
- Organization *Organization `json:"organization,omitempty"`
-
- // For organization membership, the user the membership is for.
- User *User `json:"user,omitempty"`
-}
-
-func (m Membership) String() string {
- return Stringify(m)
-}
-
-// ListMembersOptions specifies optional parameters to the
-// OrganizationsService.ListMembers method.
-type ListMembersOptions struct {
- // If true (or if the authenticated user is not an owner of the
- // organization), list only publicly visible members.
- PublicOnly bool `url:"-"`
-
- // Filter members returned in the list. Possible values are:
- // 2fa_disabled, all. Default is "all".
- Filter string `url:"filter,omitempty"`
-
- // Role filters members returned by their role in the organization.
- // Possible values are:
- // all - all members of the organization, regardless of role
- // admin - organization owners
- // member - non-organization members
- //
- // Default is "all".
- Role string `url:"role,omitempty"`
-
- ListOptions
-}
-
-// ListMembers lists the members for an organization. If the authenticated
-// user is an owner of the organization, this will return both concealed and
-// public members, otherwise it will only return public members.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#members-list
-func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opt *ListMembersOptions) ([]*User, *Response, error) {
- var u string
- if opt != nil && opt.PublicOnly {
- u = fmt.Sprintf("orgs/%v/public_members", org)
- } else {
- u = fmt.Sprintf("orgs/%v/members", org)
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var members []*User
- resp, err := s.client.Do(ctx, req, &members)
- if err != nil {
- return nil, resp, err
- }
-
- return members, resp, nil
-}
-
-// IsMember checks if a user is a member of an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#check-membership
-func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (bool, *Response, error) {
- u := fmt.Sprintf("orgs/%v/members/%v", org, user)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
-
- resp, err := s.client.Do(ctx, req, nil)
- member, err := parseBoolResponse(err)
- return member, resp, err
-}
-
-// IsPublicMember checks if a user is a public member of an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#check-public-membership
-func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user string) (bool, *Response, error) {
- u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
-
- resp, err := s.client.Do(ctx, req, nil)
- member, err := parseBoolResponse(err)
- return member, resp, err
-}
-
-// RemoveMember removes a user from all teams of an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#remove-a-member
-func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/members/%v", org, user)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// PublicizeMembership publicizes a user's membership in an organization. (A
-// user cannot publicize the membership for another user.)
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#publicize-a-users-membership
-func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, user string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ConcealMembership conceals a user's membership in an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#conceal-a-users-membership
-func (s *OrganizationsService) ConcealMembership(ctx context.Context, org, user string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ListOrgMembershipsOptions specifies optional parameters to the
-// OrganizationsService.ListOrgMemberships method.
-type ListOrgMembershipsOptions struct {
- // Filter memberships to include only those with the specified state.
- // Possible values are: "active", "pending".
- State string `url:"state,omitempty"`
-
- ListOptions
-}
-
-// ListOrgMemberships lists the organization memberships for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-your-organization-memberships
-func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opt *ListOrgMembershipsOptions) ([]*Membership, *Response, error) {
- u := "user/memberships/orgs"
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var memberships []*Membership
- resp, err := s.client.Do(ctx, req, &memberships)
- if err != nil {
- return nil, resp, err
- }
-
- return memberships, resp, nil
-}
-
-// GetOrgMembership gets the membership for a user in a specified organization.
-// Passing an empty string for user will get the membership for the
-// authenticated user.
-//
-// GitHub API docs:
-// https://developer.github.com/v3/orgs/members/#get-organization-membership
-// https://developer.github.com/v3/orgs/members/#get-your-organization-membership
-func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org string) (*Membership, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("orgs/%v/memberships/%v", org, user)
- } else {
- u = fmt.Sprintf("user/memberships/orgs/%v", org)
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- membership := new(Membership)
- resp, err := s.client.Do(ctx, req, membership)
- if err != nil {
- return nil, resp, err
- }
-
- return membership, resp, nil
-}
-
-// EditOrgMembership edits the membership for user in specified organization.
-// Passing an empty string for user will edit the membership for the
-// authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#edit-your-organization-membership
-func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org string, membership *Membership) (*Membership, *Response, error) {
- var u, method string
- if user != "" {
- u = fmt.Sprintf("orgs/%v/memberships/%v", org, user)
- method = "PUT"
- } else {
- u = fmt.Sprintf("user/memberships/orgs/%v", org)
- method = "PATCH"
- }
-
- req, err := s.client.NewRequest(method, u, membership)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(Membership)
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// RemoveOrgMembership removes user from the specified organization. If the
-// user has been invited to the organization, this will cancel their invitation.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#remove-organization-membership
-func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, org string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/memberships/%v", org, user)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ListPendingOrgInvitations returns a list of pending invitations.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-pending-organization-invitations
-func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opt *ListOptions) ([]*Invitation, *Response, error) {
- u := fmt.Sprintf("orgs/%v/invitations", org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var pendingInvitations []*Invitation
- resp, err := s.client.Do(ctx, req, &pendingInvitations)
- if err != nil {
- return nil, resp, err
- }
- return pendingInvitations, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/orgs_outside_collaborators.go b/vendor/github.com/google/go-github/github/orgs_outside_collaborators.go
deleted file mode 100644
index 85ffd05f..00000000
--- a/vendor/github.com/google/go-github/github/orgs_outside_collaborators.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ListOutsideCollaboratorsOptions specifies optional parameters to the
-// OrganizationsService.ListOutsideCollaborators method.
-type ListOutsideCollaboratorsOptions struct {
- // Filter outside collaborators returned in the list. Possible values are:
- // 2fa_disabled, all. Default is "all".
- Filter string `url:"filter,omitempty"`
-
- ListOptions
-}
-
-// ListOutsideCollaborators lists outside collaborators of organization's repositories.
-// This will only work if the authenticated
-// user is an owner of the organization.
-//
-// Warning: The API may change without advance notice during the preview period.
-// Preview features are not supported for production use.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators
-func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org string, opt *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) {
- u := fmt.Sprintf("orgs/%v/outside_collaborators", org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var members []*User
- resp, err := s.client.Do(ctx, req, &members)
- if err != nil {
- return nil, resp, err
- }
-
- return members, resp, nil
-}
-
-// RemoveOutsideCollaborator removes a user from the list of outside collaborators;
-// consequently, removing them from all the organization's repositories.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#remove-outside-collaborator
-func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ConvertMemberToOutsideCollaborator reduces the permission level of a member of the
-// organization to that of an outside collaborator. Therefore, they will only
-// have access to the repositories that their current team membership allows.
-// Responses for converting a non-member or the last owner to an outside collaborator
-// are listed in GitHub API docs.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#convert-member-to-outside-collaborator
-func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user)
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/orgs_projects.go b/vendor/github.com/google/go-github/github/orgs_projects.go
deleted file mode 100644
index e57cba97..00000000
--- a/vendor/github.com/google/go-github/github/orgs_projects.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ListProjects lists the projects for an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/#list-organization-projects
-func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opt *ProjectListOptions) ([]*Project, *Response, error) {
- u := fmt.Sprintf("orgs/%v/projects", org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- var projects []*Project
- resp, err := s.client.Do(ctx, req, &projects)
- if err != nil {
- return nil, resp, err
- }
-
- return projects, resp, nil
-}
-
-// CreateProject creates a GitHub Project for the specified organization.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/#create-an-organization-project
-func (s *OrganizationsService) CreateProject(ctx context.Context, org string, opt *ProjectOptions) (*Project, *Response, error) {
- u := fmt.Sprintf("orgs/%v/projects", org)
- req, err := s.client.NewRequest("POST", u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- project := &Project{}
- resp, err := s.client.Do(ctx, req, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/orgs_teams.go b/vendor/github.com/google/go-github/github/orgs_teams.go
deleted file mode 100644
index c1457108..00000000
--- a/vendor/github.com/google/go-github/github/orgs_teams.go
+++ /dev/null
@@ -1,512 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "strings"
- "time"
-)
-
-// Team represents a team within a GitHub organization. Teams are used to
-// manage access to an organization's repositories.
-type Team struct {
- ID *int64 `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Description *string `json:"description,omitempty"`
- URL *string `json:"url,omitempty"`
- Slug *string `json:"slug,omitempty"`
-
- // Permission specifies the default permission for repositories owned by the team.
- Permission *string `json:"permission,omitempty"`
-
- // Privacy identifies the level of privacy this team should have.
- // Possible values are:
- // secret - only visible to organization owners and members of this team
- // closed - visible to all members of this organization
- // Default is "secret".
- Privacy *string `json:"privacy,omitempty"`
-
- MembersCount *int `json:"members_count,omitempty"`
- ReposCount *int `json:"repos_count,omitempty"`
- Organization *Organization `json:"organization,omitempty"`
- MembersURL *string `json:"members_url,omitempty"`
- RepositoriesURL *string `json:"repositories_url,omitempty"`
- Parent *Team `json:"parent,omitempty"`
-
- // LDAPDN is only available in GitHub Enterprise and when the team
- // membership is synchronized with LDAP.
- LDAPDN *string `json:"ldap_dn,omitempty"`
-}
-
-func (t Team) String() string {
- return Stringify(t)
-}
-
-// Invitation represents a team member's invitation status.
-type Invitation struct {
- ID *int64 `json:"id,omitempty"`
- Login *string `json:"login,omitempty"`
- Email *string `json:"email,omitempty"`
- // Role can be one of the values - 'direct_member', 'admin', 'billing_manager', 'hiring_manager', or 'reinstate'.
- Role *string `json:"role,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- Inviter *User `json:"inviter,omitempty"`
-}
-
-func (i Invitation) String() string {
- return Stringify(i)
-}
-
-// ListTeams lists all of the teams for an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-teams
-func (s *OrganizationsService) ListTeams(ctx context.Context, org string, opt *ListOptions) ([]*Team, *Response, error) {
- u := fmt.Sprintf("orgs/%v/teams", org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- var teams []*Team
- resp, err := s.client.Do(ctx, req, &teams)
- if err != nil {
- return nil, resp, err
- }
-
- return teams, resp, nil
-}
-
-// GetTeam fetches a team by ID.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team
-func (s *OrganizationsService) GetTeam(ctx context.Context, team int64) (*Team, *Response, error) {
- u := fmt.Sprintf("teams/%v", team)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- t := new(Team)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, nil
-}
-
-// NewTeam represents a team to be created or modified.
-type NewTeam struct {
- Name string `json:"name"` // Name of the team. (Required.)
- Description *string `json:"description,omitempty"`
- Maintainers []string `json:"maintainers,omitempty"`
- RepoNames []string `json:"repo_names,omitempty"`
- ParentTeamID *int64 `json:"parent_team_id,omitempty"`
-
- // Deprecated: Permission is deprecated when creating or editing a team in an org
- // using the new GitHub permission model. It no longer identifies the
- // permission a team has on its repos, but only specifies the default
- // permission a repo is initially added with. Avoid confusion by
- // specifying a permission value when calling AddTeamRepo.
- Permission *string `json:"permission,omitempty"`
-
- // Privacy identifies the level of privacy this team should have.
- // Possible values are:
- // secret - only visible to organization owners and members of this team
- // closed - visible to all members of this organization
- // Default is "secret".
- Privacy *string `json:"privacy,omitempty"`
-
- // LDAPDN may be used in GitHub Enterprise when the team membership
- // is synchronized with LDAP.
- LDAPDN *string `json:"ldap_dn,omitempty"`
-}
-
-func (s NewTeam) String() string {
- return Stringify(s)
-}
-
-// CreateTeam creates a new team within an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#create-team
-func (s *OrganizationsService) CreateTeam(ctx context.Context, org string, team *NewTeam) (*Team, *Response, error) {
- u := fmt.Sprintf("orgs/%v/teams", org)
- req, err := s.client.NewRequest("POST", u, team)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- t := new(Team)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, nil
-}
-
-// EditTeam edits a team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#edit-team
-func (s *OrganizationsService) EditTeam(ctx context.Context, id int64, team *NewTeam) (*Team, *Response, error) {
- u := fmt.Sprintf("teams/%v", id)
- req, err := s.client.NewRequest("PATCH", u, team)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- t := new(Team)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, nil
-}
-
-// DeleteTeam deletes a team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#delete-team
-func (s *OrganizationsService) DeleteTeam(ctx context.Context, team int64) (*Response, error) {
- u := fmt.Sprintf("teams/%v", team)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// OrganizationListTeamMembersOptions specifies the optional parameters to the
-// OrganizationsService.ListTeamMembers method.
-type OrganizationListTeamMembersOptions struct {
- // Role filters members returned by their role in the team. Possible
- // values are "all", "member", "maintainer". Default is "all".
- Role string `url:"role,omitempty"`
-
- ListOptions
-}
-
-// ListChildTeams lists child teams for a team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-child-teams
-func (s *OrganizationsService) ListChildTeams(ctx context.Context, teamID int64, opt *ListOptions) ([]*Team, *Response, error) {
- u := fmt.Sprintf("teams/%v/teams", teamID)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- var teams []*Team
- resp, err := s.client.Do(ctx, req, &teams)
- if err != nil {
- return nil, resp, err
- }
-
- return teams, resp, nil
-}
-
-// ListTeamMembers lists all of the users who are members of the specified
-// team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-team-members
-func (s *OrganizationsService) ListTeamMembers(ctx context.Context, team int64, opt *OrganizationListTeamMembersOptions) ([]*User, *Response, error) {
- u := fmt.Sprintf("teams/%v/members", team)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- var members []*User
- resp, err := s.client.Do(ctx, req, &members)
- if err != nil {
- return nil, resp, err
- }
-
- return members, resp, nil
-}
-
-// IsTeamMember checks if a user is a member of the specified team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team-member
-//
-// Deprecated: This API has been marked as deprecated in the Github API docs,
-// OrganizationsService.GetTeamMembership method should be used instead.
-func (s *OrganizationsService) IsTeamMember(ctx context.Context, team int64, user string) (bool, *Response, error) {
- u := fmt.Sprintf("teams/%v/members/%v", team, user)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
-
- resp, err := s.client.Do(ctx, req, nil)
- member, err := parseBoolResponse(err)
- return member, resp, err
-}
-
-// ListTeamRepos lists the repositories that the specified team has access to.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-team-repos
-func (s *OrganizationsService) ListTeamRepos(ctx context.Context, team int64, opt *ListOptions) ([]*Repository, *Response, error) {
- u := fmt.Sprintf("teams/%v/repos", team)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when topics API fully launches.
- headers := []string{mediaTypeTopicsPreview, mediaTypeNestedTeamsPreview}
- req.Header.Set("Accept", strings.Join(headers, ", "))
-
- var repos []*Repository
- resp, err := s.client.Do(ctx, req, &repos)
- if err != nil {
- return nil, resp, err
- }
-
- return repos, resp, nil
-}
-
-// IsTeamRepo checks if a team manages the specified repository. If the
-// repository is managed by team, a Repository is returned which includes the
-// permissions team has for that repo.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#check-if-a-team-manages-a-repository
-func (s *OrganizationsService) IsTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Repository, *Response, error) {
- u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- headers := []string{mediaTypeOrgPermissionRepo, mediaTypeNestedTeamsPreview}
- req.Header.Set("Accept", strings.Join(headers, ", "))
-
- repository := new(Repository)
- resp, err := s.client.Do(ctx, req, repository)
- if err != nil {
- return nil, resp, err
- }
-
- return repository, resp, nil
-}
-
-// OrganizationAddTeamRepoOptions specifies the optional parameters to the
-// OrganizationsService.AddTeamRepo method.
-type OrganizationAddTeamRepoOptions struct {
- // Permission specifies the permission to grant the team on this repository.
- // Possible values are:
- // pull - team members can pull, but not push to or administer this repository
- // push - team members can pull and push, but not administer this repository
- // admin - team members can pull, push and administer this repository
- //
- // If not specified, the team's permission attribute will be used.
- Permission string `json:"permission,omitempty"`
-}
-
-// AddTeamRepo adds a repository to be managed by the specified team. The
-// specified repository must be owned by the organization to which the team
-// belongs, or a direct fork of a repository owned by the organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#add-team-repo
-func (s *OrganizationsService) AddTeamRepo(ctx context.Context, team int64, owner string, repo string, opt *OrganizationAddTeamRepoOptions) (*Response, error) {
- u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
- req, err := s.client.NewRequest("PUT", u, opt)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// RemoveTeamRepo removes a repository from being managed by the specified
-// team. Note that this does not delete the repository, it just removes it
-// from the team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#remove-team-repo
-func (s *OrganizationsService) RemoveTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Response, error) {
- u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ListUserTeams lists a user's teams
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-user-teams
-func (s *OrganizationsService) ListUserTeams(ctx context.Context, opt *ListOptions) ([]*Team, *Response, error) {
- u := "user/teams"
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- var teams []*Team
- resp, err := s.client.Do(ctx, req, &teams)
- if err != nil {
- return nil, resp, err
- }
-
- return teams, resp, nil
-}
-
-// GetTeamMembership returns the membership status for a user in a team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team-membership
-func (s *OrganizationsService) GetTeamMembership(ctx context.Context, team int64, user string) (*Membership, *Response, error) {
- u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- t := new(Membership)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, nil
-}
-
-// OrganizationAddTeamMembershipOptions does stuff specifies the optional
-// parameters to the OrganizationsService.AddTeamMembership method.
-type OrganizationAddTeamMembershipOptions struct {
- // Role specifies the role the user should have in the team. Possible
- // values are:
- // member - a normal member of the team
- // maintainer - a team maintainer. Able to add/remove other team
- // members, promote other team members to team
- // maintainer, and edit the team’s name and description
- //
- // Default value is "member".
- Role string `json:"role,omitempty"`
-}
-
-// AddTeamMembership adds or invites a user to a team.
-//
-// In order to add a membership between a user and a team, the authenticated
-// user must have 'admin' permissions to the team or be an owner of the
-// organization that the team is associated with.
-//
-// If the user is already a part of the team's organization (meaning they're on
-// at least one other team in the organization), this endpoint will add the
-// user to the team.
-//
-// If the user is completely unaffiliated with the team's organization (meaning
-// they're on none of the organization's teams), this endpoint will send an
-// invitation to the user via email. This newly-created membership will be in
-// the "pending" state until the user accepts the invitation, at which point
-// the membership will transition to the "active" state and the user will be
-// added as a member of the team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#add-team-membership
-func (s *OrganizationsService) AddTeamMembership(ctx context.Context, team int64, user string, opt *OrganizationAddTeamMembershipOptions) (*Membership, *Response, error) {
- u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
- req, err := s.client.NewRequest("PUT", u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(Membership)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, nil
-}
-
-// RemoveTeamMembership removes a user from a team.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#remove-team-membership
-func (s *OrganizationsService) RemoveTeamMembership(ctx context.Context, team int64, user string) (*Response, error) {
- u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ListPendingTeamInvitations get pending invitaion list in team.
-// Warning: The API may change without advance notice during the preview period.
-// Preview features are not supported for production use.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-pending-team-invitations
-func (s *OrganizationsService) ListPendingTeamInvitations(ctx context.Context, team int64, opt *ListOptions) ([]*Invitation, *Response, error) {
- u := fmt.Sprintf("teams/%v/invitations", team)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var pendingInvitations []*Invitation
- resp, err := s.client.Do(ctx, req, &pendingInvitations)
- if err != nil {
- return nil, resp, err
- }
-
- return pendingInvitations, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/orgs_users_blocking.go b/vendor/github.com/google/go-github/github/orgs_users_blocking.go
deleted file mode 100644
index b1aecf44..00000000
--- a/vendor/github.com/google/go-github/github/orgs_users_blocking.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ListBlockedUsers lists all the users blocked by an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#list-blocked-users
-func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, opt *ListOptions) ([]*User, *Response, error) {
- u := fmt.Sprintf("orgs/%v/blocks", org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
- var blockedUsers []*User
- resp, err := s.client.Do(ctx, req, &blockedUsers)
- if err != nil {
- return nil, resp, err
- }
-
- return blockedUsers, resp, nil
-}
-
-// IsBlocked reports whether specified user is blocked from an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#check-whether-a-user-is-blocked-from-an-organization
-func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user string) (bool, *Response, error) {
- u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
- resp, err := s.client.Do(ctx, req, nil)
- isBlocked, err := parseBoolResponse(err)
- return isBlocked, resp, err
-}
-
-// BlockUser blocks specified user from an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#block-a-user
-func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
-
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// UnblockUser unblocks specified user from an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#unblock-a-user
-func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user string) (*Response, error) {
- u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/projects.go b/vendor/github.com/google/go-github/github/projects.go
deleted file mode 100644
index 22061363..00000000
--- a/vendor/github.com/google/go-github/github/projects.go
+++ /dev/null
@@ -1,431 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ProjectsService provides access to the projects functions in the
-// GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/
-type ProjectsService service
-
-// Project represents a GitHub Project.
-type Project struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- OwnerURL *string `json:"owner_url,omitempty"`
- Name *string `json:"name,omitempty"`
- Body *string `json:"body,omitempty"`
- Number *int `json:"number,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
-
- // The User object that generated the project.
- Creator *User `json:"creator,omitempty"`
-}
-
-func (p Project) String() string {
- return Stringify(p)
-}
-
-// GetProject gets a GitHub Project for a repo.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/#get-a-project
-func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *Response, error) {
- u := fmt.Sprintf("projects/%v", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- project := &Project{}
- resp, err := s.client.Do(ctx, req, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, nil
-}
-
-// ProjectOptions specifies the parameters to the
-// RepositoriesService.CreateProject and
-// ProjectsService.UpdateProject methods.
-type ProjectOptions struct {
- // The name of the project. (Required for creation; optional for update.)
- Name string `json:"name,omitempty"`
- // The body of the project. (Optional.)
- Body string `json:"body,omitempty"`
-
- // The following field(s) are only applicable for update.
- // They should be left with zero values for creation.
-
- // State of the project. Either "open" or "closed". (Optional.)
- State string `json:"state,omitempty"`
-}
-
-// UpdateProject updates a repository project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/#update-a-project
-func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opt *ProjectOptions) (*Project, *Response, error) {
- u := fmt.Sprintf("projects/%v", id)
- req, err := s.client.NewRequest("PATCH", u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- project := &Project{}
- resp, err := s.client.Do(ctx, req, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, nil
-}
-
-// DeleteProject deletes a GitHub Project from a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/#delete-a-project
-func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Response, error) {
- u := fmt.Sprintf("projects/%v", id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ProjectColumn represents a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/
-type ProjectColumn struct {
- ID *int64 `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- ProjectURL *string `json:"project_url,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
-}
-
-// ListProjectColumns lists the columns of a GitHub Project for a repo.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/columns/#list-project-columns
-func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opt *ListOptions) ([]*ProjectColumn, *Response, error) {
- u := fmt.Sprintf("projects/%v/columns", projectID)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- columns := []*ProjectColumn{}
- resp, err := s.client.Do(ctx, req, &columns)
- if err != nil {
- return nil, resp, err
- }
-
- return columns, resp, nil
-}
-
-// GetProjectColumn gets a column of a GitHub Project for a repo.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/columns/#get-a-project-column
-func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*ProjectColumn, *Response, error) {
- u := fmt.Sprintf("projects/columns/%v", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- column := &ProjectColumn{}
- resp, err := s.client.Do(ctx, req, column)
- if err != nil {
- return nil, resp, err
- }
-
- return column, resp, nil
-}
-
-// ProjectColumnOptions specifies the parameters to the
-// ProjectsService.CreateProjectColumn and
-// ProjectsService.UpdateProjectColumn methods.
-type ProjectColumnOptions struct {
- // The name of the project column. (Required for creation and update.)
- Name string `json:"name"`
-}
-
-// CreateProjectColumn creates a column for the specified (by number) project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/columns/#create-a-project-column
-func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int64, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
- u := fmt.Sprintf("projects/%v/columns", projectID)
- req, err := s.client.NewRequest("POST", u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- column := &ProjectColumn{}
- resp, err := s.client.Do(ctx, req, column)
- if err != nil {
- return nil, resp, err
- }
-
- return column, resp, nil
-}
-
-// UpdateProjectColumn updates a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/columns/#update-a-project-column
-func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
- u := fmt.Sprintf("projects/columns/%v", columnID)
- req, err := s.client.NewRequest("PATCH", u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- column := &ProjectColumn{}
- resp, err := s.client.Do(ctx, req, column)
- if err != nil {
- return nil, resp, err
- }
-
- return column, resp, nil
-}
-
-// DeleteProjectColumn deletes a column from a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/columns/#delete-a-project-column
-func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int64) (*Response, error) {
- u := fmt.Sprintf("projects/columns/%v", columnID)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ProjectColumnMoveOptions specifies the parameters to the
-// ProjectsService.MoveProjectColumn method.
-type ProjectColumnMoveOptions struct {
- // Position can be one of "first", "last", or "after:", where
- // is the ID of a column in the same project. (Required.)
- Position string `json:"position"`
-}
-
-// MoveProjectColumn moves a column within a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/columns/#move-a-project-column
-func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, opt *ProjectColumnMoveOptions) (*Response, error) {
- u := fmt.Sprintf("projects/columns/%v/moves", columnID)
- req, err := s.client.NewRequest("POST", u, opt)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ProjectCard represents a card in a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/cards/#get-a-project-card
-type ProjectCard struct {
- URL *string `json:"url,omitempty"`
- ColumnURL *string `json:"column_url,omitempty"`
- ContentURL *string `json:"content_url,omitempty"`
- ID *int64 `json:"id,omitempty"`
- Note *string `json:"note,omitempty"`
- Creator *User `json:"creator,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
-
- // The following fields are only populated by Webhook events.
- ColumnID *int64 `json:"column_id,omitempty"`
-}
-
-// ListProjectCards lists the cards in a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/cards/#list-project-cards
-func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ListOptions) ([]*ProjectCard, *Response, error) {
- u := fmt.Sprintf("projects/columns/%v/cards", columnID)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- cards := []*ProjectCard{}
- resp, err := s.client.Do(ctx, req, &cards)
- if err != nil {
- return nil, resp, err
- }
-
- return cards, resp, nil
-}
-
-// GetProjectCard gets a card in a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/cards/#get-a-project-card
-func (s *ProjectsService) GetProjectCard(ctx context.Context, columnID int64) (*ProjectCard, *Response, error) {
- u := fmt.Sprintf("projects/columns/cards/%v", columnID)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- card := &ProjectCard{}
- resp, err := s.client.Do(ctx, req, card)
- if err != nil {
- return nil, resp, err
- }
-
- return card, resp, nil
-}
-
-// ProjectCardOptions specifies the parameters to the
-// ProjectsService.CreateProjectCard and
-// ProjectsService.UpdateProjectCard methods.
-type ProjectCardOptions struct {
- // The note of the card. Note and ContentID are mutually exclusive.
- Note string `json:"note,omitempty"`
- // The ID (not Number) of the Issue to associate with this card.
- // Note and ContentID are mutually exclusive.
- ContentID int64 `json:"content_id,omitempty"`
- // The type of content to associate with this card. Possible values are: "Issue".
- ContentType string `json:"content_type,omitempty"`
-}
-
-// CreateProjectCard creates a card in the specified column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/cards/#create-a-project-card
-func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, opt *ProjectCardOptions) (*ProjectCard, *Response, error) {
- u := fmt.Sprintf("projects/columns/%v/cards", columnID)
- req, err := s.client.NewRequest("POST", u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- card := &ProjectCard{}
- resp, err := s.client.Do(ctx, req, card)
- if err != nil {
- return nil, resp, err
- }
-
- return card, resp, nil
-}
-
-// UpdateProjectCard updates a card of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/cards/#update-a-project-card
-func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, opt *ProjectCardOptions) (*ProjectCard, *Response, error) {
- u := fmt.Sprintf("projects/columns/cards/%v", cardID)
- req, err := s.client.NewRequest("PATCH", u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- card := &ProjectCard{}
- resp, err := s.client.Do(ctx, req, card)
- if err != nil {
- return nil, resp, err
- }
-
- return card, resp, nil
-}
-
-// DeleteProjectCard deletes a card from a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/cards/#delete-a-project-card
-func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (*Response, error) {
- u := fmt.Sprintf("projects/columns/cards/%v", cardID)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// ProjectCardMoveOptions specifies the parameters to the
-// ProjectsService.MoveProjectCard method.
-type ProjectCardMoveOptions struct {
- // Position can be one of "top", "bottom", or "after:", where
- // is the ID of a card in the same project.
- Position string `json:"position"`
- // ColumnID is the ID of a column in the same project. Note that ColumnID
- // is required when using Position "after:" when that card is in
- // another column; otherwise it is optional.
- ColumnID int64 `json:"column_id,omitempty"`
-}
-
-// MoveProjectCard moves a card within a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/cards/#move-a-project-card
-func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opt *ProjectCardMoveOptions) (*Response, error) {
- u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID)
- req, err := s.client.NewRequest("POST", u, opt)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/pulls.go b/vendor/github.com/google/go-github/github/pulls.go
deleted file mode 100644
index 31d492ee..00000000
--- a/vendor/github.com/google/go-github/github/pulls.go
+++ /dev/null
@@ -1,371 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "bytes"
- "context"
- "fmt"
- "time"
-)
-
-// PullRequestsService handles communication with the pull request related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/
-type PullRequestsService service
-
-// PullRequest represents a GitHub pull request on a repository.
-type PullRequest struct {
- ID *int64 `json:"id,omitempty"`
- Number *int `json:"number,omitempty"`
- State *string `json:"state,omitempty"`
- Title *string `json:"title,omitempty"`
- Body *string `json:"body,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- ClosedAt *time.Time `json:"closed_at,omitempty"`
- MergedAt *time.Time `json:"merged_at,omitempty"`
- User *User `json:"user,omitempty"`
- Merged *bool `json:"merged,omitempty"`
- Mergeable *bool `json:"mergeable,omitempty"`
- MergeableState *string `json:"mergeable_state,omitempty"`
- MergedBy *User `json:"merged_by,omitempty"`
- MergeCommitSHA *string `json:"merge_commit_sha,omitempty"`
- Comments *int `json:"comments,omitempty"`
- Commits *int `json:"commits,omitempty"`
- Additions *int `json:"additions,omitempty"`
- Deletions *int `json:"deletions,omitempty"`
- ChangedFiles *int `json:"changed_files,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- IssueURL *string `json:"issue_url,omitempty"`
- StatusesURL *string `json:"statuses_url,omitempty"`
- DiffURL *string `json:"diff_url,omitempty"`
- PatchURL *string `json:"patch_url,omitempty"`
- ReviewCommentsURL *string `json:"review_comments_url,omitempty"`
- ReviewCommentURL *string `json:"review_comment_url,omitempty"`
- Assignee *User `json:"assignee,omitempty"`
- Assignees []*User `json:"assignees,omitempty"`
- Milestone *Milestone `json:"milestone,omitempty"`
- MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"`
- AuthorAssociation *string `json:"author_association,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-
- Head *PullRequestBranch `json:"head,omitempty"`
- Base *PullRequestBranch `json:"base,omitempty"`
-}
-
-func (p PullRequest) String() string {
- return Stringify(p)
-}
-
-// PullRequestBranch represents a base or head branch in a GitHub pull request.
-type PullRequestBranch struct {
- Label *string `json:"label,omitempty"`
- Ref *string `json:"ref,omitempty"`
- SHA *string `json:"sha,omitempty"`
- Repo *Repository `json:"repo,omitempty"`
- User *User `json:"user,omitempty"`
-}
-
-// PullRequestListOptions specifies the optional parameters to the
-// PullRequestsService.List method.
-type PullRequestListOptions struct {
- // State filters pull requests based on their state. Possible values are:
- // open, closed. Default is "open".
- State string `url:"state,omitempty"`
-
- // Head filters pull requests by head user and branch name in the format of:
- // "user:ref-name".
- Head string `url:"head,omitempty"`
-
- // Base filters pull requests by base branch name.
- Base string `url:"base,omitempty"`
-
- // Sort specifies how to sort pull requests. Possible values are: created,
- // updated, popularity, long-running. Default is "created".
- Sort string `url:"sort,omitempty"`
-
- // Direction in which to sort pull requests. Possible values are: asc, desc.
- // If Sort is "created" or not specified, Default is "desc", otherwise Default
- // is "asc"
- Direction string `url:"direction,omitempty"`
-
- ListOptions
-}
-
-// List the pull requests for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests
-func (s *PullRequestsService) List(ctx context.Context, owner string, repo string, opt *PullRequestListOptions) ([]*PullRequest, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var pulls []*PullRequest
- resp, err := s.client.Do(ctx, req, &pulls)
- if err != nil {
- return nil, resp, err
- }
-
- return pulls, resp, nil
-}
-
-// Get a single pull request.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/#get-a-single-pull-request
-func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string, number int) (*PullRequest, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- pull := new(PullRequest)
- resp, err := s.client.Do(ctx, req, pull)
- if err != nil {
- return nil, resp, err
- }
-
- return pull, resp, nil
-}
-
-// GetRaw gets a single pull request in raw (diff or patch) format.
-func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo string, number int, opt RawOptions) (string, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return "", nil, err
- }
-
- switch opt.Type {
- case Diff:
- req.Header.Set("Accept", mediaTypeV3Diff)
- case Patch:
- req.Header.Set("Accept", mediaTypeV3Patch)
- default:
- return "", nil, fmt.Errorf("unsupported raw type %d", opt.Type)
- }
-
- var buf bytes.Buffer
- resp, err := s.client.Do(ctx, req, &buf)
- if err != nil {
- return "", resp, err
- }
-
- return buf.String(), resp, nil
-}
-
-// NewPullRequest represents a new pull request to be created.
-type NewPullRequest struct {
- Title *string `json:"title,omitempty"`
- Head *string `json:"head,omitempty"`
- Base *string `json:"base,omitempty"`
- Body *string `json:"body,omitempty"`
- Issue *int `json:"issue,omitempty"`
- MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"`
-}
-
-// Create a new pull request on the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/#create-a-pull-request
-func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
- req, err := s.client.NewRequest("POST", u, pull)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- p := new(PullRequest)
- resp, err := s.client.Do(ctx, req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, nil
-}
-
-type pullRequestUpdate struct {
- Title *string `json:"title,omitempty"`
- Body *string `json:"body,omitempty"`
- State *string `json:"state,omitempty"`
- Base *string `json:"base,omitempty"`
- MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"`
-}
-
-// Edit a pull request.
-// pull must not be nil.
-//
-// The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify.
-// Base.Ref updates the base branch of the pull request.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/#update-a-pull-request
-func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) {
- if pull == nil {
- return nil, nil, fmt.Errorf("pull must be provided")
- }
-
- u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
-
- update := &pullRequestUpdate{
- Title: pull.Title,
- Body: pull.Body,
- State: pull.State,
- MaintainerCanModify: pull.MaintainerCanModify,
- }
- if pull.Base != nil {
- update.Base = pull.Base.Ref
- }
-
- req, err := s.client.NewRequest("PATCH", u, update)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- p := new(PullRequest)
- resp, err := s.client.Do(ctx, req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, nil
-}
-
-// ListCommits lists the commits in a pull request.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
-func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*RepositoryCommit, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGitSigningPreview)
-
- var commits []*RepositoryCommit
- resp, err := s.client.Do(ctx, req, &commits)
- if err != nil {
- return nil, resp, err
- }
-
- return commits, resp, nil
-}
-
-// ListFiles lists the files in a pull request.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests-files
-func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*CommitFile, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var commitFiles []*CommitFile
- resp, err := s.client.Do(ctx, req, &commitFiles)
- if err != nil {
- return nil, resp, err
- }
-
- return commitFiles, resp, nil
-}
-
-// IsMerged checks if a pull request has been merged.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
-func (s *PullRequestsService) IsMerged(ctx context.Context, owner string, repo string, number int) (bool, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
-
- resp, err := s.client.Do(ctx, req, nil)
- merged, err := parseBoolResponse(err)
- return merged, resp, err
-}
-
-// PullRequestMergeResult represents the result of merging a pull request.
-type PullRequestMergeResult struct {
- SHA *string `json:"sha,omitempty"`
- Merged *bool `json:"merged,omitempty"`
- Message *string `json:"message,omitempty"`
-}
-
-// PullRequestOptions lets you define how a pull request will be merged.
-type PullRequestOptions struct {
- CommitTitle string // Extra detail to append to automatic commit message. (Optional.)
- SHA string // SHA that pull request head must match to allow merge. (Optional.)
-
- // The merge method to use. Possible values include: "merge", "squash", and "rebase" with the default being merge. (Optional.)
- MergeMethod string
-}
-
-type pullRequestMergeRequest struct {
- CommitMessage string `json:"commit_message"`
- CommitTitle string `json:"commit_title,omitempty"`
- MergeMethod string `json:"merge_method,omitempty"`
- SHA string `json:"sha,omitempty"`
-}
-
-// Merge a pull request (Merge Button™).
-// commitMessage is the title for the automatic commit message.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade
-func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
-
- pullRequestBody := &pullRequestMergeRequest{CommitMessage: commitMessage}
- if options != nil {
- pullRequestBody.CommitTitle = options.CommitTitle
- pullRequestBody.MergeMethod = options.MergeMethod
- pullRequestBody.SHA = options.SHA
- }
- req, err := s.client.NewRequest("PUT", u, pullRequestBody)
- if err != nil {
- return nil, nil, err
- }
-
- mergeResult := new(PullRequestMergeResult)
- resp, err := s.client.Do(ctx, req, mergeResult)
- if err != nil {
- return nil, resp, err
- }
-
- return mergeResult, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/pulls_comments.go b/vendor/github.com/google/go-github/github/pulls_comments.go
deleted file mode 100644
index ff892279..00000000
--- a/vendor/github.com/google/go-github/github/pulls_comments.go
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// PullRequestComment represents a comment left on a pull request.
-type PullRequestComment struct {
- ID *int64 `json:"id,omitempty"`
- InReplyTo *int64 `json:"in_reply_to,omitempty"`
- Body *string `json:"body,omitempty"`
- Path *string `json:"path,omitempty"`
- DiffHunk *string `json:"diff_hunk,omitempty"`
- Position *int `json:"position,omitempty"`
- OriginalPosition *int `json:"original_position,omitempty"`
- CommitID *string `json:"commit_id,omitempty"`
- OriginalCommitID *string `json:"original_commit_id,omitempty"`
- User *User `json:"user,omitempty"`
- Reactions *Reactions `json:"reactions,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- PullRequestURL *string `json:"pull_request_url,omitempty"`
-}
-
-func (p PullRequestComment) String() string {
- return Stringify(p)
-}
-
-// PullRequestListCommentsOptions specifies the optional parameters to the
-// PullRequestsService.ListComments method.
-type PullRequestListCommentsOptions struct {
- // Sort specifies how to sort comments. Possible values are: created, updated.
- Sort string `url:"sort,omitempty"`
-
- // Direction in which to sort comments. Possible values are: asc, desc.
- Direction string `url:"direction,omitempty"`
-
- // Since filters comments by time.
- Since time.Time `url:"since,omitempty"`
-
- ListOptions
-}
-
-// ListComments lists all comments on the specified pull request. Specifying a
-// pull request number of 0 will return all comments on all pull requests for
-// the repository.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
-func (s *PullRequestsService) ListComments(ctx context.Context, owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) {
- var u string
- if number == 0 {
- u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo)
- } else {
- u = fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number)
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- var comments []*PullRequestComment
- resp, err := s.client.Do(ctx, req, &comments)
- if err != nil {
- return nil, resp, err
- }
-
- return comments, resp, nil
-}
-
-// GetComment fetches the specified pull request comment.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/comments/#get-a-single-comment
-func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo string, number int) (*PullRequestComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- comment := new(PullRequestComment)
- resp, err := s.client.Do(ctx, req, comment)
- if err != nil {
- return nil, resp, err
- }
-
- return comment, resp, nil
-}
-
-// CreateComment creates a new comment on the specified pull request.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/comments/#create-a-comment
-func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number)
- req, err := s.client.NewRequest("POST", u, comment)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(PullRequestComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// EditComment updates a pull request comment.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/comments/#edit-a-comment
-func (s *PullRequestsService) EditComment(ctx context.Context, owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
- req, err := s.client.NewRequest("PATCH", u, comment)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(PullRequestComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// DeleteComment deletes a pull request comment.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/comments/#delete-a-comment
-func (s *PullRequestsService) DeleteComment(ctx context.Context, owner string, repo string, number int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/pulls_reviewers.go b/vendor/github.com/google/go-github/github/pulls_reviewers.go
deleted file mode 100644
index 15b47be3..00000000
--- a/vendor/github.com/google/go-github/github/pulls_reviewers.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ReviewersRequest specifies users and teams for a pull request review request.
-type ReviewersRequest struct {
- Reviewers []string `json:"reviewers,omitempty"`
- TeamReviewers []string `json:"team_reviewers,omitempty"`
-}
-
-// Reviewers represents reviewers of a pull request.
-type Reviewers struct {
- Users []*User `json:"users,omitempty"`
- Teams []*Team `json:"teams,omitempty"`
-}
-
-// RequestReviewers creates a review request for the provided reviewers for the specified pull request.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#create-a-review-request
-func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number)
- req, err := s.client.NewRequest("POST", u, &reviewers)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTeamReviewPreview)
-
- r := new(PullRequest)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// ListReviewers lists reviewers whose reviews have been requested on the specified pull request.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#list-review-requests
-func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int, opt *ListOptions) (*Reviewers, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/requested_reviewers", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTeamReviewPreview)
-
- reviewers := new(Reviewers)
- resp, err := s.client.Do(ctx, req, reviewers)
- if err != nil {
- return nil, resp, err
- }
-
- return reviewers, resp, nil
-}
-
-// RemoveReviewers removes the review request for the provided reviewers for the specified pull request.
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#delete-a-review-request
-func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) {
- u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number)
- req, err := s.client.NewRequest("DELETE", u, &reviewers)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTeamReviewPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/pulls_reviews.go b/vendor/github.com/google/go-github/github/pulls_reviews.go
deleted file mode 100644
index 1aceb0d4..00000000
--- a/vendor/github.com/google/go-github/github/pulls_reviews.go
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// PullRequestReview represents a review of a pull request.
-type PullRequestReview struct {
- ID *int64 `json:"id,omitempty"`
- User *User `json:"user,omitempty"`
- Body *string `json:"body,omitempty"`
- SubmittedAt *time.Time `json:"submitted_at,omitempty"`
- CommitID *string `json:"commit_id,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- PullRequestURL *string `json:"pull_request_url,omitempty"`
- State *string `json:"state,omitempty"`
-}
-
-func (p PullRequestReview) String() string {
- return Stringify(p)
-}
-
-// DraftReviewComment represents a comment part of the review.
-type DraftReviewComment struct {
- Path *string `json:"path,omitempty"`
- Position *int `json:"position,omitempty"`
- Body *string `json:"body,omitempty"`
-}
-
-func (c DraftReviewComment) String() string {
- return Stringify(c)
-}
-
-// PullRequestReviewRequest represents a request to create a review.
-type PullRequestReviewRequest struct {
- CommitID *string `json:"commit_id,omitempty"`
- Body *string `json:"body,omitempty"`
- Event *string `json:"event,omitempty"`
- Comments []*DraftReviewComment `json:"comments,omitempty"`
-}
-
-func (r PullRequestReviewRequest) String() string {
- return Stringify(r)
-}
-
-// PullRequestReviewDismissalRequest represents a request to dismiss a review.
-type PullRequestReviewDismissalRequest struct {
- Message *string `json:"message,omitempty"`
-}
-
-func (r PullRequestReviewDismissalRequest) String() string {
- return Stringify(r)
-}
-
-// ListReviews lists all reviews on the specified pull request.
-//
-// TODO: Follow up with GitHub support about an issue with this method's
-// returned error format and remove this comment once it's fixed.
-// Read more about it here - https://github.com/google/go-github/issues/540
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request
-func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*PullRequestReview, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var reviews []*PullRequestReview
- resp, err := s.client.Do(ctx, req, &reviews)
- if err != nil {
- return nil, resp, err
- }
-
- return reviews, resp, nil
-}
-
-// GetReview fetches the specified pull request review.
-//
-// TODO: Follow up with GitHub support about an issue with this method's
-// returned error format and remove this comment once it's fixed.
-// Read more about it here - https://github.com/google/go-github/issues/540
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-a-single-review
-func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number, reviewID int64) (*PullRequestReview, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- review := new(PullRequestReview)
- resp, err := s.client.Do(ctx, req, review)
- if err != nil {
- return nil, resp, err
- }
-
- return review, resp, nil
-}
-
-// DeletePendingReview deletes the specified pull request pending review.
-//
-// TODO: Follow up with GitHub support about an issue with this method's
-// returned error format and remove this comment once it's fixed.
-// Read more about it here - https://github.com/google/go-github/issues/540
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review
-func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number, reviewID int64) (*PullRequestReview, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- review := new(PullRequestReview)
- resp, err := s.client.Do(ctx, req, review)
- if err != nil {
- return nil, resp, err
- }
-
- return review, resp, nil
-}
-
-// ListReviewComments lists all the comments for the specified review.
-//
-// TODO: Follow up with GitHub support about an issue with this method's
-// returned error format and remove this comment once it's fixed.
-// Read more about it here - https://github.com/google/go-github/issues/540
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review
-func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number, reviewID int64, opt *ListOptions) ([]*PullRequestComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var comments []*PullRequestComment
- resp, err := s.client.Do(ctx, req, &comments)
- if err != nil {
- return nil, resp, err
- }
-
- return comments, resp, nil
-}
-
-// CreateReview creates a new review on the specified pull request.
-//
-// TODO: Follow up with GitHub support about an issue with this method's
-// returned error format and remove this comment once it's fixed.
-// Read more about it here - https://github.com/google/go-github/issues/540
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review
-func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number)
-
- req, err := s.client.NewRequest("POST", u, review)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(PullRequestReview)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// SubmitReview submits a specified review on the specified pull request.
-//
-// TODO: Follow up with GitHub support about an issue with this method's
-// returned error format and remove this comment once it's fixed.
-// Read more about it here - https://github.com/google/go-github/issues/540
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review
-func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID)
-
- req, err := s.client.NewRequest("POST", u, review)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(PullRequestReview)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// DismissReview dismisses a specified review on the specified pull request.
-//
-// TODO: Follow up with GitHub support about an issue with this method's
-// returned error format and remove this comment once it's fixed.
-// Read more about it here - https://github.com/google/go-github/issues/540
-//
-// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review
-func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID)
-
- req, err := s.client.NewRequest("PUT", u, review)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(PullRequestReview)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/reactions.go b/vendor/github.com/google/go-github/github/reactions.go
deleted file mode 100644
index b276ff3e..00000000
--- a/vendor/github.com/google/go-github/github/reactions.go
+++ /dev/null
@@ -1,273 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ReactionsService provides access to the reactions-related functions in the
-// GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/
-type ReactionsService service
-
-// Reaction represents a GitHub reaction.
-type Reaction struct {
- // ID is the Reaction ID.
- ID *int64 `json:"id,omitempty"`
- User *User `json:"user,omitempty"`
- // Content is the type of reaction.
- // Possible values are:
- // "+1", "-1", "laugh", "confused", "heart", "hooray".
- Content *string `json:"content,omitempty"`
-}
-
-// Reactions represents a summary of GitHub reactions.
-type Reactions struct {
- TotalCount *int `json:"total_count,omitempty"`
- PlusOne *int `json:"+1,omitempty"`
- MinusOne *int `json:"-1,omitempty"`
- Laugh *int `json:"laugh,omitempty"`
- Confused *int `json:"confused,omitempty"`
- Heart *int `json:"heart,omitempty"`
- Hooray *int `json:"hooray,omitempty"`
- URL *string `json:"url,omitempty"`
-}
-
-func (r Reaction) String() string {
- return Stringify(r)
-}
-
-// ListCommentReactions lists the reactions for a commit comment.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment
-func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- var m []*Reaction
- resp, err := s.client.Do(ctx, req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// CreateCommentReaction creates a reaction for a commit comment.
-// Note that if you have already created a reaction of type content, the
-// previously created reaction will be returned with Status: 200 OK.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment
-func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id)
-
- body := &Reaction{Content: String(content)}
- req, err := s.client.NewRequest("POST", u, body)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- m := &Reaction{}
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// ListIssueReactions lists the reactions for an issue.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue
-func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*Reaction, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- var m []*Reaction
- resp, err := s.client.Do(ctx, req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// CreateIssueReaction creates a reaction for an issue.
-// Note that if you have already created a reaction of type content, the
-// previously created reaction will be returned with Status: 200 OK.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue
-func (s ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number)
-
- body := &Reaction{Content: String(content)}
- req, err := s.client.NewRequest("POST", u, body)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- m := &Reaction{}
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// ListIssueCommentReactions lists the reactions for an issue comment.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment
-func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- var m []*Reaction
- resp, err := s.client.Do(ctx, req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// CreateIssueCommentReaction creates a reaction for an issue comment.
-// Note that if you have already created a reaction of type content, the
-// previously created reaction will be returned with Status: 200 OK.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment
-func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id)
-
- body := &Reaction{Content: String(content)}
- req, err := s.client.NewRequest("POST", u, body)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- m := &Reaction{}
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// ListPullRequestCommentReactions lists the reactions for a pull request review comment.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment
-func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- var m []*Reaction
- resp, err := s.client.Do(ctx, req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// CreatePullRequestCommentReaction creates a reaction for a pull request review comment.
-// Note that if you have already created a reaction of type content, the
-// previously created reaction will be returned with Status: 200 OK.
-//
-// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment
-func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id)
-
- body := &Reaction{Content: String(content)}
- req, err := s.client.NewRequest("POST", u, body)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- m := &Reaction{}
- resp, err := s.client.Do(ctx, req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, nil
-}
-
-// DeleteReaction deletes a reaction.
-//
-// GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive
-func (s *ReactionsService) DeleteReaction(ctx context.Context, id int64) (*Response, error) {
- u := fmt.Sprintf("reactions/%v", id)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/repos.go b/vendor/github.com/google/go-github/github/repos.go
deleted file mode 100644
index 68accf7f..00000000
--- a/vendor/github.com/google/go-github/github/repos.go
+++ /dev/null
@@ -1,1076 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "strings"
-)
-
-// RepositoriesService handles communication with the repository related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/
-type RepositoriesService service
-
-// Repository represents a GitHub repository.
-type Repository struct {
- ID *int64 `json:"id,omitempty"`
- Owner *User `json:"owner,omitempty"`
- Name *string `json:"name,omitempty"`
- FullName *string `json:"full_name,omitempty"`
- Description *string `json:"description,omitempty"`
- Homepage *string `json:"homepage,omitempty"`
- CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"`
- DefaultBranch *string `json:"default_branch,omitempty"`
- MasterBranch *string `json:"master_branch,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- PushedAt *Timestamp `json:"pushed_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- CloneURL *string `json:"clone_url,omitempty"`
- GitURL *string `json:"git_url,omitempty"`
- MirrorURL *string `json:"mirror_url,omitempty"`
- SSHURL *string `json:"ssh_url,omitempty"`
- SVNURL *string `json:"svn_url,omitempty"`
- Language *string `json:"language,omitempty"`
- Fork *bool `json:"fork,omitempty"`
- ForksCount *int `json:"forks_count,omitempty"`
- NetworkCount *int `json:"network_count,omitempty"`
- OpenIssuesCount *int `json:"open_issues_count,omitempty"`
- StargazersCount *int `json:"stargazers_count,omitempty"`
- SubscribersCount *int `json:"subscribers_count,omitempty"`
- WatchersCount *int `json:"watchers_count,omitempty"`
- Size *int `json:"size,omitempty"`
- AutoInit *bool `json:"auto_init,omitempty"`
- Parent *Repository `json:"parent,omitempty"`
- Source *Repository `json:"source,omitempty"`
- Organization *Organization `json:"organization,omitempty"`
- Permissions *map[string]bool `json:"permissions,omitempty"`
- AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"`
- AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"`
- AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"`
- Topics []string `json:"topics,omitempty"`
-
- // Only provided when using RepositoriesService.Get while in preview
- License *License `json:"license,omitempty"`
-
- // Additional mutable fields when creating and editing a repository
- Private *bool `json:"private,omitempty"`
- HasIssues *bool `json:"has_issues,omitempty"`
- HasWiki *bool `json:"has_wiki,omitempty"`
- HasPages *bool `json:"has_pages,omitempty"`
- HasProjects *bool `json:"has_projects,omitempty"`
- HasDownloads *bool `json:"has_downloads,omitempty"`
- LicenseTemplate *string `json:"license_template,omitempty"`
- GitignoreTemplate *string `json:"gitignore_template,omitempty"`
- Archived *bool `json:"archived,omitempty"`
-
- // Creating an organization repository. Required for non-owners.
- TeamID *int64 `json:"team_id,omitempty"`
-
- // API URLs
- URL *string `json:"url,omitempty"`
- ArchiveURL *string `json:"archive_url,omitempty"`
- AssigneesURL *string `json:"assignees_url,omitempty"`
- BlobsURL *string `json:"blobs_url,omitempty"`
- BranchesURL *string `json:"branches_url,omitempty"`
- CollaboratorsURL *string `json:"collaborators_url,omitempty"`
- CommentsURL *string `json:"comments_url,omitempty"`
- CommitsURL *string `json:"commits_url,omitempty"`
- CompareURL *string `json:"compare_url,omitempty"`
- ContentsURL *string `json:"contents_url,omitempty"`
- ContributorsURL *string `json:"contributors_url,omitempty"`
- DeploymentsURL *string `json:"deployments_url,omitempty"`
- DownloadsURL *string `json:"downloads_url,omitempty"`
- EventsURL *string `json:"events_url,omitempty"`
- ForksURL *string `json:"forks_url,omitempty"`
- GitCommitsURL *string `json:"git_commits_url,omitempty"`
- GitRefsURL *string `json:"git_refs_url,omitempty"`
- GitTagsURL *string `json:"git_tags_url,omitempty"`
- HooksURL *string `json:"hooks_url,omitempty"`
- IssueCommentURL *string `json:"issue_comment_url,omitempty"`
- IssueEventsURL *string `json:"issue_events_url,omitempty"`
- IssuesURL *string `json:"issues_url,omitempty"`
- KeysURL *string `json:"keys_url,omitempty"`
- LabelsURL *string `json:"labels_url,omitempty"`
- LanguagesURL *string `json:"languages_url,omitempty"`
- MergesURL *string `json:"merges_url,omitempty"`
- MilestonesURL *string `json:"milestones_url,omitempty"`
- NotificationsURL *string `json:"notifications_url,omitempty"`
- PullsURL *string `json:"pulls_url,omitempty"`
- ReleasesURL *string `json:"releases_url,omitempty"`
- StargazersURL *string `json:"stargazers_url,omitempty"`
- StatusesURL *string `json:"statuses_url,omitempty"`
- SubscribersURL *string `json:"subscribers_url,omitempty"`
- SubscriptionURL *string `json:"subscription_url,omitempty"`
- TagsURL *string `json:"tags_url,omitempty"`
- TreesURL *string `json:"trees_url,omitempty"`
- TeamsURL *string `json:"teams_url,omitempty"`
-
- // TextMatches is only populated from search results that request text matches
- // See: search.go and https://developer.github.com/v3/search/#text-match-metadata
- TextMatches []TextMatch `json:"text_matches,omitempty"`
-}
-
-func (r Repository) String() string {
- return Stringify(r)
-}
-
-// RepositoryListOptions specifies the optional parameters to the
-// RepositoriesService.List method.
-type RepositoryListOptions struct {
- // Visibility of repositories to list. Can be one of all, public, or private.
- // Default: all
- Visibility string `url:"visibility,omitempty"`
-
- // List repos of given affiliation[s].
- // Comma-separated list of values. Can include:
- // * owner: Repositories that are owned by the authenticated user.
- // * collaborator: Repositories that the user has been added to as a
- // collaborator.
- // * organization_member: Repositories that the user has access to through
- // being a member of an organization. This includes every repository on
- // every team that the user is on.
- // Default: owner,collaborator,organization_member
- Affiliation string `url:"affiliation,omitempty"`
-
- // Type of repositories to list.
- // Can be one of all, owner, public, private, member. Default: all
- // Will cause a 422 error if used in the same request as visibility or
- // affiliation.
- Type string `url:"type,omitempty"`
-
- // How to sort the repository list. Can be one of created, updated, pushed,
- // full_name. Default: full_name
- Sort string `url:"sort,omitempty"`
-
- // Direction in which to sort repositories. Can be one of asc or desc.
- // Default: when using full_name: asc; otherwise desc
- Direction string `url:"direction,omitempty"`
-
- ListOptions
-}
-
-// List the repositories for a user. Passing the empty string will list
-// repositories for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-user-repositories
-func (s *RepositoriesService) List(ctx context.Context, user string, opt *RepositoryListOptions) ([]*Repository, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/repos", user)
- } else {
- u = "user/repos"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- var repos []*Repository
- resp, err := s.client.Do(ctx, req, &repos)
- if err != nil {
- return nil, resp, err
- }
-
- return repos, resp, nil
-}
-
-// RepositoryListByOrgOptions specifies the optional parameters to the
-// RepositoriesService.ListByOrg method.
-type RepositoryListByOrgOptions struct {
- // Type of repositories to list. Possible values are: all, public, private,
- // forks, sources, member. Default is "all".
- Type string `url:"type,omitempty"`
-
- ListOptions
-}
-
-// ListByOrg lists the repositories for an organization.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-organization-repositories
-func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opt *RepositoryListByOrgOptions) ([]*Repository, *Response, error) {
- u := fmt.Sprintf("orgs/%v/repos", org)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- var repos []*Repository
- resp, err := s.client.Do(ctx, req, &repos)
- if err != nil {
- return nil, resp, err
- }
-
- return repos, resp, nil
-}
-
-// RepositoryListAllOptions specifies the optional parameters to the
-// RepositoriesService.ListAll method.
-type RepositoryListAllOptions struct {
- // ID of the last repository seen
- Since int64 `url:"since,omitempty"`
-}
-
-// ListAll lists all GitHub repositories in the order that they were created.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-all-public-repositories
-func (s *RepositoriesService) ListAll(ctx context.Context, opt *RepositoryListAllOptions) ([]*Repository, *Response, error) {
- u, err := addOptions("repositories", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var repos []*Repository
- resp, err := s.client.Do(ctx, req, &repos)
- if err != nil {
- return nil, resp, err
- }
-
- return repos, resp, nil
-}
-
-// Create a new repository. If an organization is specified, the new
-// repository will be created under that org. If the empty string is
-// specified, it will be created for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#create
-func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error) {
- var u string
- if org != "" {
- u = fmt.Sprintf("orgs/%v/repos", org)
- } else {
- u = "user/repos"
- }
-
- req, err := s.client.NewRequest("POST", u, repo)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Repository)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// Get fetches a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#get
-func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when the license support fully launches
- // https://developer.github.com/v3/licenses/#get-a-repositorys-license
- acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- repository := new(Repository)
- resp, err := s.client.Do(ctx, req, repository)
- if err != nil {
- return nil, resp, err
- }
-
- return repository, resp, nil
-}
-
-// GetCodeOfConduct gets the contents of a repository's code of conduct.
-//
-// GitHub API docs: https://developer.github.com/v3/codes_of_conduct/#get-the-contents-of-a-repositorys-code-of-conduct
-func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/community/code_of_conduct", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeCodesOfConductPreview)
-
- coc := new(CodeOfConduct)
- resp, err := s.client.Do(ctx, req, coc)
- if err != nil {
- return nil, resp, err
- }
-
- return coc, resp, nil
-}
-
-// GetByID fetches a repository.
-//
-// Note: GetByID uses the undocumented GitHub API endpoint /repositories/:id.
-func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repository, *Response, error) {
- u := fmt.Sprintf("repositories/%d", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when the license support fully launches
- // https://developer.github.com/v3/licenses/#get-a-repositorys-license
- req.Header.Set("Accept", mediaTypeLicensesPreview)
-
- repository := new(Repository)
- resp, err := s.client.Do(ctx, req, repository)
- if err != nil {
- return nil, resp, err
- }
-
- return repository, resp, nil
-}
-
-// Edit updates a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#edit
-func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v", owner, repo)
- req, err := s.client.NewRequest("PATCH", u, repository)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Repository)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// Delete a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#delete-a-repository
-func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v", owner, repo)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// Contributor represents a repository contributor
-type Contributor struct {
- Login *string `json:"login,omitempty"`
- ID *int64 `json:"id,omitempty"`
- AvatarURL *string `json:"avatar_url,omitempty"`
- GravatarID *string `json:"gravatar_id,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- FollowersURL *string `json:"followers_url,omitempty"`
- FollowingURL *string `json:"following_url,omitempty"`
- GistsURL *string `json:"gists_url,omitempty"`
- StarredURL *string `json:"starred_url,omitempty"`
- SubscriptionsURL *string `json:"subscriptions_url,omitempty"`
- OrganizationsURL *string `json:"organizations_url,omitempty"`
- ReposURL *string `json:"repos_url,omitempty"`
- EventsURL *string `json:"events_url,omitempty"`
- ReceivedEventsURL *string `json:"received_events_url,omitempty"`
- Type *string `json:"type,omitempty"`
- SiteAdmin *bool `json:"site_admin,omitempty"`
- Contributions *int `json:"contributions,omitempty"`
-}
-
-// ListContributorsOptions specifies the optional parameters to the
-// RepositoriesService.ListContributors method.
-type ListContributorsOptions struct {
- // Include anonymous contributors in results or not
- Anon string `url:"anon,omitempty"`
-
- ListOptions
-}
-
-// ListContributors lists contributors for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-contributors
-func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opt *ListContributorsOptions) ([]*Contributor, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var contributor []*Contributor
- resp, err := s.client.Do(ctx, req, &contributor)
- if err != nil {
- return nil, nil, err
- }
-
- return contributor, resp, nil
-}
-
-// ListLanguages lists languages for the specified repository. The returned map
-// specifies the languages and the number of bytes of code written in that
-// language. For example:
-//
-// {
-// "C": 78769,
-// "Python": 7769
-// }
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-languages
-func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, repo string) (map[string]int, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/languages", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- languages := make(map[string]int)
- resp, err := s.client.Do(ctx, req, &languages)
- if err != nil {
- return nil, resp, err
- }
-
- return languages, resp, nil
-}
-
-// ListTeams lists the teams for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-teams
-func (s *RepositoriesService) ListTeams(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Team, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/teams", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- var teams []*Team
- resp, err := s.client.Do(ctx, req, &teams)
- if err != nil {
- return nil, resp, err
- }
-
- return teams, resp, nil
-}
-
-// RepositoryTag represents a repository tag.
-type RepositoryTag struct {
- Name *string `json:"name,omitempty"`
- Commit *Commit `json:"commit,omitempty"`
- ZipballURL *string `json:"zipball_url,omitempty"`
- TarballURL *string `json:"tarball_url,omitempty"`
-}
-
-// ListTags lists tags for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-tags
-func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*RepositoryTag, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/tags", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var tags []*RepositoryTag
- resp, err := s.client.Do(ctx, req, &tags)
- if err != nil {
- return nil, resp, err
- }
-
- return tags, resp, nil
-}
-
-// Branch represents a repository branch
-type Branch struct {
- Name *string `json:"name,omitempty"`
- Commit *RepositoryCommit `json:"commit,omitempty"`
- Protected *bool `json:"protected,omitempty"`
-}
-
-// Protection represents a repository branch's protection.
-type Protection struct {
- RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
- RequiredPullRequestReviews *PullRequestReviewsEnforcement `json:"required_pull_request_reviews"`
- EnforceAdmins *AdminEnforcement `json:"enforce_admins"`
- Restrictions *BranchRestrictions `json:"restrictions"`
-}
-
-// ProtectionRequest represents a request to create/edit a branch's protection.
-type ProtectionRequest struct {
- RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
- RequiredPullRequestReviews *PullRequestReviewsEnforcementRequest `json:"required_pull_request_reviews"`
- EnforceAdmins bool `json:"enforce_admins"`
- Restrictions *BranchRestrictionsRequest `json:"restrictions"`
-}
-
-// RequiredStatusChecks represents the protection status of a individual branch.
-type RequiredStatusChecks struct {
- // Require branches to be up to date before merging. (Required.)
- Strict bool `json:"strict"`
- // The list of status checks to require in order to merge into this
- // branch. (Required; use []string{} instead of nil for empty list.)
- Contexts []string `json:"contexts"`
-}
-
-// PullRequestReviewsEnforcement represents the pull request reviews enforcement of a protected branch.
-type PullRequestReviewsEnforcement struct {
- // Specifies which users and teams can dismiss pull request reviews.
- DismissalRestrictions DismissalRestrictions `json:"dismissal_restrictions"`
- // Specifies if approved reviews are dismissed automatically, when a new commit is pushed.
- DismissStaleReviews bool `json:"dismiss_stale_reviews"`
- // RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
- RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"`
-}
-
-// PullRequestReviewsEnforcementRequest represents request to set the pull request review
-// enforcement of a protected branch. It is separate from PullRequestReviewsEnforcement above
-// because the request structure is different from the response structure.
-type PullRequestReviewsEnforcementRequest struct {
- // Specifies which users and teams should be allowed to dismiss pull request reviews. Can be nil to disable the restrictions.
- DismissalRestrictionsRequest *DismissalRestrictionsRequest `json:"dismissal_restrictions"`
- // Specifies if approved reviews can be dismissed automatically, when a new commit is pushed. (Required)
- DismissStaleReviews bool `json:"dismiss_stale_reviews"`
- // RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
- RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"`
-}
-
-// MarshalJSON implements the json.Marshaler interface.
-// Converts nil value of PullRequestReviewsEnforcementRequest.DismissalRestrictionsRequest to empty array
-func (req PullRequestReviewsEnforcementRequest) MarshalJSON() ([]byte, error) {
- if req.DismissalRestrictionsRequest == nil {
- newReq := struct {
- R []interface{} `json:"dismissal_restrictions"`
- D bool `json:"dismiss_stale_reviews"`
- O bool `json:"require_code_owner_reviews"`
- }{
- R: []interface{}{},
- D: req.DismissStaleReviews,
- O: req.RequireCodeOwnerReviews,
- }
- return json.Marshal(newReq)
- }
- newReq := struct {
- R *DismissalRestrictionsRequest `json:"dismissal_restrictions"`
- D bool `json:"dismiss_stale_reviews"`
- O bool `json:"require_code_owner_reviews"`
- }{
- R: req.DismissalRestrictionsRequest,
- D: req.DismissStaleReviews,
- O: req.RequireCodeOwnerReviews,
- }
- return json.Marshal(newReq)
-}
-
-// PullRequestReviewsEnforcementUpdate represents request to patch the pull request review
-// enforcement of a protected branch. It is separate from PullRequestReviewsEnforcementRequest above
-// because the patch request does not require all fields to be initialized.
-type PullRequestReviewsEnforcementUpdate struct {
- // Specifies which users and teams can dismiss pull request reviews. Can be omitted.
- DismissalRestrictionsRequest *DismissalRestrictionsRequest `json:"dismissal_restrictions,omitempty"`
- // Specifies if approved reviews can be dismissed automatically, when a new commit is pushed. Can be omitted.
- DismissStaleReviews *bool `json:"dismiss_stale_reviews,omitempty"`
- // RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
- RequireCodeOwnerReviews bool `json:"require_code_owner_reviews,omitempty"`
-}
-
-// AdminEnforcement represents the configuration to enforce required status checks for repository administrators.
-type AdminEnforcement struct {
- URL *string `json:"url,omitempty"`
- Enabled bool `json:"enabled"`
-}
-
-// BranchRestrictions represents the restriction that only certain users or
-// teams may push to a branch.
-type BranchRestrictions struct {
- // The list of user logins with push access.
- Users []*User `json:"users"`
- // The list of team slugs with push access.
- Teams []*Team `json:"teams"`
-}
-
-// BranchRestrictionsRequest represents the request to create/edit the
-// restriction that only certain users or teams may push to a branch. It is
-// separate from BranchRestrictions above because the request structure is
-// different from the response structure.
-type BranchRestrictionsRequest struct {
- // The list of user logins with push access. (Required; use []string{} instead of nil for empty list.)
- Users []string `json:"users"`
- // The list of team slugs with push access. (Required; use []string{} instead of nil for empty list.)
- Teams []string `json:"teams"`
-}
-
-// DismissalRestrictions specifies which users and teams can dismiss pull request reviews.
-type DismissalRestrictions struct {
- // The list of users who can dimiss pull request reviews.
- Users []*User `json:"users"`
- // The list of teams which can dismiss pull request reviews.
- Teams []*Team `json:"teams"`
-}
-
-// DismissalRestrictionsRequest represents the request to create/edit the
-// restriction to allows only specific users or teams to dimiss pull request reviews. It is
-// separate from DismissalRestrictions above because the request structure is
-// different from the response structure.
-type DismissalRestrictionsRequest struct {
- // The list of user logins who can dismiss pull request reviews. (Required; use []string{} instead of nil for empty list.)
- Users []string `json:"users"`
- // The list of team slugs which can dismiss pull request reviews. (Required; use []string{} instead of nil for empty list.)
- Teams []string `json:"teams"`
-}
-
-// ListBranches lists branches for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-branches
-func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Branch, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- var branches []*Branch
- resp, err := s.client.Do(ctx, req, &branches)
- if err != nil {
- return nil, resp, err
- }
-
- return branches, resp, nil
-}
-
-// GetBranch gets the specified branch for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#get-branch
-func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string) (*Branch, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, branch)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- b := new(Branch)
- resp, err := s.client.Do(ctx, req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, nil
-}
-
-// GetBranchProtection gets the protection of a given branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-branch-protection
-func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- p := new(Protection)
- resp, err := s.client.Do(ctx, req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, nil
-}
-
-// GetRequiredStatusChecks gets the required status checks for a given protected branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch
-func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- p := new(RequiredStatusChecks)
- resp, err := s.client.Do(ctx, req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, nil
-}
-
-// ListRequiredStatusChecksContexts lists the required status checks contexts for a given protected branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#list-required-status-checks-contexts-of-protected-branch
-func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, branch)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- resp, err = s.client.Do(ctx, req, &contexts)
- if err != nil {
- return nil, resp, err
- }
-
- return contexts, resp, nil
-}
-
-// UpdateBranchProtection updates the protection of a given branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-branch-protection
-func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
- req, err := s.client.NewRequest("PUT", u, preq)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- p := new(Protection)
- resp, err := s.client.Do(ctx, req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, nil
-}
-
-// RemoveBranchProtection removes the protection of a given branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-branch-protection
-func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// License gets the contents of a repository's license if one is detected.
-//
-// GitHub API docs: https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license
-func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/license", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- r := &RepositoryLicense{}
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// GetPullRequestReviewEnforcement gets pull request review enforcement of a protected branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-pull-request-review-enforcement-of-protected-branch
-func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- r := new(PullRequestReviewsEnforcement)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// UpdatePullRequestReviewEnforcement patches pull request review enforcement of a protected branch.
-// It requires admin access and branch protection to be enabled.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-pull-request-review-enforcement-of-protected-branch
-func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
- req, err := s.client.NewRequest("PATCH", u, patch)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- r := new(PullRequestReviewsEnforcement)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// DisableDismissalRestrictions disables dismissal restrictions of a protected branch.
-// It requires admin access and branch protection to be enabled.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-pull-request-review-enforcement-of-protected-branch
-func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
-
- data := struct {
- R []interface{} `json:"dismissal_restrictions"`
- }{[]interface{}{}}
-
- req, err := s.client.NewRequest("PATCH", u, data)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- r := new(PullRequestReviewsEnforcement)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// RemovePullRequestReviewEnforcement removes pull request enforcement of a protected branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-pull-request-review-enforcement-of-protected-branch
-func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// GetAdminEnforcement gets admin enforcement information of a protected branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-admin-enforcement-of-protected-branch
-func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- r := new(AdminEnforcement)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
-
-// AddAdminEnforcement adds admin enforcement to a protected branch.
-// It requires admin access and branch protection to be enabled.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#add-admin-enforcement-of-protected-branch
-func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- r := new(AdminEnforcement)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// RemoveAdminEnforcement removes admin enforcement from a protected branch.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-admin-enforcement-of-protected-branch
-func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// repositoryTopics represents a collection of repository topics.
-type repositoryTopics struct {
- Names []string `json:"names"`
-}
-
-// ListAllTopics lists topics for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#list-all-topics-for-a-repository
-func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/topics", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
-
- topics := new(repositoryTopics)
- resp, err := s.client.Do(ctx, req, topics)
- if err != nil {
- return nil, resp, err
- }
-
- return topics.Names, resp, nil
-}
-
-// ReplaceAllTopics replaces topics for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#replace-all-topics-for-a-repository
-func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/topics", owner, repo)
- t := &repositoryTopics{
- Names: topics,
- }
- if t.Names == nil {
- t.Names = []string{}
- }
- req, err := s.client.NewRequest("PUT", u, t)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
-
- t = new(repositoryTopics)
- resp, err := s.client.Do(ctx, req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t.Names, resp, nil
-}
-
-// TransferRequest represents a request to transfer a repository.
-type TransferRequest struct {
- NewOwner string `json:"new_owner"`
- TeamID []int64 `json:"team_id,omitempty"`
-}
-
-// Transfer transfers a repository from one account or organization to another.
-//
-// This method might return an *AcceptedError and a status code of
-// 202. This is because this is the status that GitHub returns to signify that
-// it has now scheduled the transfer of the repository in a background task.
-// A follow up request, after a delay of a second or so, should result
-// in a successful request.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/#transfer-a-repository
-func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/transfer", owner, repo)
-
- req, err := s.client.NewRequest("POST", u, &transfer)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryTransferPreview)
-
- r := new(Repository)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_collaborators.go b/vendor/github.com/google/go-github/github/repos_collaborators.go
deleted file mode 100644
index 61ee9d39..00000000
--- a/vendor/github.com/google/go-github/github/repos_collaborators.go
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ListCollaboratorsOptions specifies the optional parameters to the
-// RepositoriesService.ListCollaborators method.
-type ListCollaboratorsOptions struct {
- // Affiliation specifies how collaborators should be filtered by their affiliation.
- // Possible values are:
- // outside - All outside collaborators of an organization-owned repository
- // direct - All collaborators with permissions to an organization-owned repository,
- // regardless of organization membership status
- // all - All collaborators the authenticated user can see
- //
- // Default value is "all".
- Affiliation string `url:"affiliation,omitempty"`
-
- ListOptions
-}
-
-// ListCollaborators lists the GitHub users that have access to the repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#list-collaborators
-func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opt *ListCollaboratorsOptions) ([]*User, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
-
- var users []*User
- resp, err := s.client.Do(ctx, req, &users)
- if err != nil {
- return nil, resp, err
- }
-
- return users, resp, nil
-}
-
-// IsCollaborator checks whether the specified GitHub user has collaborator
-// access to the given repo.
-// Note: This will return false if the user is not a collaborator OR the user
-// is not a GitHub user.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#get
-func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
-
- resp, err := s.client.Do(ctx, req, nil)
- isCollab, err := parseBoolResponse(err)
- return isCollab, resp, err
-}
-
-// RepositoryPermissionLevel represents the permission level an organization
-// member has for a given repository.
-type RepositoryPermissionLevel struct {
- // Possible values: "admin", "write", "read", "none"
- Permission *string `json:"permission,omitempty"`
-
- User *User `json:"user,omitempty"`
-}
-
-// GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository.
-// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level
-func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- rpl := new(RepositoryPermissionLevel)
- resp, err := s.client.Do(ctx, req, rpl)
- if err != nil {
- return nil, resp, err
- }
- return rpl, resp, nil
-}
-
-// RepositoryAddCollaboratorOptions specifies the optional parameters to the
-// RepositoriesService.AddCollaborator method.
-type RepositoryAddCollaboratorOptions struct {
- // Permission specifies the permission to grant the user on this repository.
- // Possible values are:
- // pull - team members can pull, but not push to or administer this repository
- // push - team members can pull and push, but not administer this repository
- // admin - team members can pull, push and administer this repository
- //
- // Default value is "push". This option is only valid for organization-owned repositories.
- Permission string `json:"permission,omitempty"`
-}
-
-// AddCollaborator sends an invitation to the specified GitHub user
-// to become a collaborator to the given repo.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator
-func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opt *RepositoryAddCollaboratorOptions) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
- req, err := s.client.NewRequest("PUT", u, opt)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// RemoveCollaborator removes the specified GitHub user as collaborator from the given repo.
-// Note: Does not return error if a valid user that is not a collaborator is removed.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#remove-collaborator
-func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/repos_comments.go b/vendor/github.com/google/go-github/github/repos_comments.go
deleted file mode 100644
index fa2377d4..00000000
--- a/vendor/github.com/google/go-github/github/repos_comments.go
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// RepositoryComment represents a comment for a commit, file, or line in a repository.
-type RepositoryComment struct {
- HTMLURL *string `json:"html_url,omitempty"`
- URL *string `json:"url,omitempty"`
- ID *int64 `json:"id,omitempty"`
- CommitID *string `json:"commit_id,omitempty"`
- User *User `json:"user,omitempty"`
- Reactions *Reactions `json:"reactions,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
-
- // User-mutable fields
- Body *string `json:"body"`
- // User-initialized fields
- Path *string `json:"path,omitempty"`
- Position *int `json:"position,omitempty"`
-}
-
-func (r RepositoryComment) String() string {
- return Stringify(r)
-}
-
-// ListComments lists all the comments for the repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
-func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/comments", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- var comments []*RepositoryComment
- resp, err := s.client.Do(ctx, req, &comments)
- if err != nil {
- return nil, resp, err
- }
-
- return comments, resp, nil
-}
-
-// ListCommitComments lists all the comments for a given commit SHA.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
-func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- var comments []*RepositoryComment
- resp, err := s.client.Do(ctx, req, &comments)
- if err != nil {
- return nil, resp, err
- }
-
- return comments, resp, nil
-}
-
-// CreateComment creates a comment for the given commit.
-// Note: GitHub allows for comments to be created for non-existing files and positions.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/comments/#create-a-commit-comment
-func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
- req, err := s.client.NewRequest("POST", u, comment)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(RepositoryComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// GetComment gets a single comment from a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment
-func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
- c := new(RepositoryComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// UpdateComment updates the body of a single comment.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/comments/#update-a-commit-comment
-func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
- req, err := s.client.NewRequest("PATCH", u, comment)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(RepositoryComment)
- resp, err := s.client.Do(ctx, req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, nil
-}
-
-// DeleteComment deletes a single comment from a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/comments/#delete-a-commit-comment
-func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/repos_commits.go b/vendor/github.com/google/go-github/github/repos_commits.go
deleted file mode 100644
index 04847373..00000000
--- a/vendor/github.com/google/go-github/github/repos_commits.go
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "bytes"
- "context"
- "fmt"
- "time"
-)
-
-// RepositoryCommit represents a commit in a repo.
-// Note that it's wrapping a Commit, so author/committer information is in two places,
-// but contain different details about them: in RepositoryCommit "github details", in Commit - "git details".
-type RepositoryCommit struct {
- SHA *string `json:"sha,omitempty"`
- Commit *Commit `json:"commit,omitempty"`
- Author *User `json:"author,omitempty"`
- Committer *User `json:"committer,omitempty"`
- Parents []Commit `json:"parents,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- URL *string `json:"url,omitempty"`
- CommentsURL *string `json:"comments_url,omitempty"`
-
- // Details about how many changes were made in this commit. Only filled in during GetCommit!
- Stats *CommitStats `json:"stats,omitempty"`
- // Details about which files, and how this commit touched. Only filled in during GetCommit!
- Files []CommitFile `json:"files,omitempty"`
-}
-
-func (r RepositoryCommit) String() string {
- return Stringify(r)
-}
-
-// CommitStats represents the number of additions / deletions from a file in a given RepositoryCommit or GistCommit.
-type CommitStats struct {
- Additions *int `json:"additions,omitempty"`
- Deletions *int `json:"deletions,omitempty"`
- Total *int `json:"total,omitempty"`
-}
-
-func (c CommitStats) String() string {
- return Stringify(c)
-}
-
-// CommitFile represents a file modified in a commit.
-type CommitFile struct {
- SHA *string `json:"sha,omitempty"`
- Filename *string `json:"filename,omitempty"`
- Additions *int `json:"additions,omitempty"`
- Deletions *int `json:"deletions,omitempty"`
- Changes *int `json:"changes,omitempty"`
- Status *string `json:"status,omitempty"`
- Patch *string `json:"patch,omitempty"`
- BlobURL *string `json:"blob_url,omitempty"`
- RawURL *string `json:"raw_url,omitempty"`
- ContentsURL *string `json:"contents_url,omitempty"`
-}
-
-func (c CommitFile) String() string {
- return Stringify(c)
-}
-
-// CommitsComparison is the result of comparing two commits.
-// See CompareCommits() for details.
-type CommitsComparison struct {
- BaseCommit *RepositoryCommit `json:"base_commit,omitempty"`
- MergeBaseCommit *RepositoryCommit `json:"merge_base_commit,omitempty"`
-
- // Head can be 'behind' or 'ahead'
- Status *string `json:"status,omitempty"`
- AheadBy *int `json:"ahead_by,omitempty"`
- BehindBy *int `json:"behind_by,omitempty"`
- TotalCommits *int `json:"total_commits,omitempty"`
-
- Commits []RepositoryCommit `json:"commits,omitempty"`
-
- Files []CommitFile `json:"files,omitempty"`
-
- HTMLURL *string `json:"html_url,omitempty"`
- PermalinkURL *string `json:"permalink_url,omitempty"`
- DiffURL *string `json:"diff_url,omitempty"`
- PatchURL *string `json:"patch_url,omitempty"`
- URL *string `json:"url,omitempty"` // API URL.
-}
-
-func (c CommitsComparison) String() string {
- return Stringify(c)
-}
-
-// CommitsListOptions specifies the optional parameters to the
-// RepositoriesService.ListCommits method.
-type CommitsListOptions struct {
- // SHA or branch to start listing Commits from.
- SHA string `url:"sha,omitempty"`
-
- // Path that should be touched by the returned Commits.
- Path string `url:"path,omitempty"`
-
- // Author of by which to filter Commits.
- Author string `url:"author,omitempty"`
-
- // Since when should Commits be included in the response.
- Since time.Time `url:"since,omitempty"`
-
- // Until when should Commits be included in the response.
- Until time.Time `url:"until,omitempty"`
-
- ListOptions
-}
-
-// ListCommits lists the commits of a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/commits/#list
-func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opt *CommitsListOptions) ([]*RepositoryCommit, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/commits", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGitSigningPreview)
-
- var commits []*RepositoryCommit
- resp, err := s.client.Do(ctx, req, &commits)
- if err != nil {
- return nil, resp, err
- }
-
- return commits, resp, nil
-}
-
-// GetCommit fetches the specified commit, including all details about it.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-a-single-commit
-// See also: https://developer.github.com/v3/git/commits/#get-a-single-commit provides the same functionality
-func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string) (*RepositoryCommit, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGitSigningPreview)
-
- commit := new(RepositoryCommit)
- resp, err := s.client.Do(ctx, req, commit)
- if err != nil {
- return nil, resp, err
- }
-
- return commit, resp, nil
-}
-
-// GetCommitRaw fetches the specified commit in raw (diff or patch) format.
-func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opt RawOptions) (string, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return "", nil, err
- }
-
- switch opt.Type {
- case Diff:
- req.Header.Set("Accept", mediaTypeV3Diff)
- case Patch:
- req.Header.Set("Accept", mediaTypeV3Patch)
- default:
- return "", nil, fmt.Errorf("unsupported raw type %d", opt.Type)
- }
-
- var buf bytes.Buffer
- resp, err := s.client.Do(ctx, req, &buf)
- if err != nil {
- return "", resp, err
- }
-
- return buf.String(), resp, nil
-}
-
-// GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is
-// supplied and no new commits have occurred, a 304 Unmodified response is returned.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-the-sha-1-of-a-commit-reference
-func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, ref)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return "", nil, err
- }
- if lastSHA != "" {
- req.Header.Set("If-None-Match", `"`+lastSHA+`"`)
- }
-
- req.Header.Set("Accept", mediaTypeV3SHA)
-
- var buf bytes.Buffer
- resp, err := s.client.Do(ctx, req, &buf)
- if err != nil {
- return "", resp, err
- }
-
- return buf.String(), resp, nil
-}
-
-// CompareCommits compares a range of commits with each other.
-// todo: support media formats - https://github.com/google/go-github/issues/6
-//
-// GitHub API docs: https://developer.github.com/v3/repos/commits/index.html#compare-two-commits
-func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- comp := new(CommitsComparison)
- resp, err := s.client.Do(ctx, req, comp)
- if err != nil {
- return nil, resp, err
- }
-
- return comp, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_community_health.go b/vendor/github.com/google/go-github/github/repos_community_health.go
deleted file mode 100644
index b5c75d6f..00000000
--- a/vendor/github.com/google/go-github/github/repos_community_health.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// Metric represents the different fields for one file in community health files.
-type Metric struct {
- Name *string `json:"name"`
- Key *string `json:"key"`
- URL *string `json:"url"`
- HTMLURL *string `json:"html_url"`
-}
-
-// CommunityHealthFiles represents the different files in the community health metrics response.
-type CommunityHealthFiles struct {
- CodeOfConduct *Metric `json:"code_of_conduct"`
- Contributing *Metric `json:"contributing"`
- License *Metric `json:"license"`
- Readme *Metric `json:"readme"`
-}
-
-// CommunityHealthMetrics represents a response containing the community metrics of a repository.
-type CommunityHealthMetrics struct {
- HealthPercentage *int `json:"health_percentage"`
- Files *CommunityHealthFiles `json:"files"`
- UpdatedAt *time.Time `json:"updated_at"`
-}
-
-// GetCommunityHealthMetrics retrieves all the community health metrics for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/community/#retrieve-community-health-metrics
-func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryCommunityHealthMetricsPreview)
-
- metrics := &CommunityHealthMetrics{}
- resp, err := s.client.Do(ctx, req, metrics)
- if err != nil {
- return nil, resp, err
- }
-
- return metrics, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_contents.go b/vendor/github.com/google/go-github/github/repos_contents.go
deleted file mode 100644
index ffb56b90..00000000
--- a/vendor/github.com/google/go-github/github/repos_contents.go
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Repository contents API methods.
-// GitHub API docs: https://developer.github.com/v3/repos/contents/
-
-package github
-
-import (
- "context"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "path"
-)
-
-// RepositoryContent represents a file or directory in a github repository.
-type RepositoryContent struct {
- Type *string `json:"type,omitempty"`
- Encoding *string `json:"encoding,omitempty"`
- Size *int `json:"size,omitempty"`
- Name *string `json:"name,omitempty"`
- Path *string `json:"path,omitempty"`
- // Content contains the actual file content, which may be encoded.
- // Callers should call GetContent which will decode the content if
- // necessary.
- Content *string `json:"content,omitempty"`
- SHA *string `json:"sha,omitempty"`
- URL *string `json:"url,omitempty"`
- GitURL *string `json:"git_url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- DownloadURL *string `json:"download_url,omitempty"`
-}
-
-// RepositoryContentResponse holds the parsed response from CreateFile, UpdateFile, and DeleteFile.
-type RepositoryContentResponse struct {
- Content *RepositoryContent `json:"content,omitempty"`
- Commit `json:"commit,omitempty"`
-}
-
-// RepositoryContentFileOptions specifies optional parameters for CreateFile, UpdateFile, and DeleteFile.
-type RepositoryContentFileOptions struct {
- Message *string `json:"message,omitempty"`
- Content []byte `json:"content,omitempty"` // unencoded
- SHA *string `json:"sha,omitempty"`
- Branch *string `json:"branch,omitempty"`
- Author *CommitAuthor `json:"author,omitempty"`
- Committer *CommitAuthor `json:"committer,omitempty"`
-}
-
-// RepositoryContentGetOptions represents an optional ref parameter, which can be a SHA,
-// branch, or tag
-type RepositoryContentGetOptions struct {
- Ref string `url:"ref,omitempty"`
-}
-
-// String converts RepositoryContent to a string. It's primarily for testing.
-func (r RepositoryContent) String() string {
- return Stringify(r)
-}
-
-// GetContent returns the content of r, decoding it if necessary.
-func (r *RepositoryContent) GetContent() (string, error) {
- var encoding string
- if r.Encoding != nil {
- encoding = *r.Encoding
- }
-
- switch encoding {
- case "base64":
- c, err := base64.StdEncoding.DecodeString(*r.Content)
- return string(c), err
- case "":
- if r.Content == nil {
- return "", nil
- }
- return *r.Content, nil
- default:
- return "", fmt.Errorf("unsupported content encoding: %v", encoding)
- }
-}
-
-// GetReadme gets the Readme file for the repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-the-readme
-func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opt *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/readme", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
- readme := new(RepositoryContent)
- resp, err := s.client.Do(ctx, req, readme)
- if err != nil {
- return nil, resp, err
- }
- return readme, resp, nil
-}
-
-// DownloadContents returns an io.ReadCloser that reads the contents of the
-// specified file. This function will work with files of any size, as opposed
-// to GetContents which is limited to 1 Mb files. It is the caller's
-// responsibility to close the ReadCloser.
-func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opt *RepositoryContentGetOptions) (io.ReadCloser, error) {
- dir := path.Dir(filepath)
- filename := path.Base(filepath)
- _, dirContents, _, err := s.GetContents(ctx, owner, repo, dir, opt)
- if err != nil {
- return nil, err
- }
- for _, contents := range dirContents {
- if *contents.Name == filename {
- if contents.DownloadURL == nil || *contents.DownloadURL == "" {
- return nil, fmt.Errorf("No download link found for %s", filepath)
- }
- resp, err := s.client.client.Get(*contents.DownloadURL)
- if err != nil {
- return nil, err
- }
- return resp.Body, nil
- }
- }
- return nil, fmt.Errorf("No file named %s found in %s", filename, dir)
-}
-
-// GetContents can return either the metadata and content of a single file
-// (when path references a file) or the metadata of all the files and/or
-// subdirectories of a directory (when path references a directory). To make it
-// easy to distinguish between both result types and to mimic the API as much
-// as possible, both result types will be returned but only one will contain a
-// value and the other will be nil.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-contents
-func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opt *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) {
- escapedPath := (&url.URL{Path: path}).String()
- u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath)
- u, err = addOptions(u, opt)
- if err != nil {
- return nil, nil, nil, err
- }
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, nil, err
- }
- var rawJSON json.RawMessage
- resp, err = s.client.Do(ctx, req, &rawJSON)
- if err != nil {
- return nil, nil, resp, err
- }
- fileUnmarshalError := json.Unmarshal(rawJSON, &fileContent)
- if fileUnmarshalError == nil {
- return fileContent, nil, resp, nil
- }
- directoryUnmarshalError := json.Unmarshal(rawJSON, &directoryContent)
- if directoryUnmarshalError == nil {
- return nil, directoryContent, resp, nil
- }
- return nil, nil, resp, fmt.Errorf("unmarshalling failed for both file and directory content: %s and %s", fileUnmarshalError, directoryUnmarshalError)
-}
-
-// CreateFile creates a new file in a repository at the given path and returns
-// the commit and file metadata.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/contents/#create-a-file
-func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
- req, err := s.client.NewRequest("PUT", u, opt)
- if err != nil {
- return nil, nil, err
- }
- createResponse := new(RepositoryContentResponse)
- resp, err := s.client.Do(ctx, req, createResponse)
- if err != nil {
- return nil, resp, err
- }
- return createResponse, resp, nil
-}
-
-// UpdateFile updates a file in a repository at the given path and returns the
-// commit and file metadata. Requires the blob SHA of the file being updated.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/contents/#update-a-file
-func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
- req, err := s.client.NewRequest("PUT", u, opt)
- if err != nil {
- return nil, nil, err
- }
- updateResponse := new(RepositoryContentResponse)
- resp, err := s.client.Do(ctx, req, updateResponse)
- if err != nil {
- return nil, resp, err
- }
- return updateResponse, resp, nil
-}
-
-// DeleteFile deletes a file from a repository and returns the commit.
-// Requires the blob SHA of the file to be deleted.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/contents/#delete-a-file
-func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
- req, err := s.client.NewRequest("DELETE", u, opt)
- if err != nil {
- return nil, nil, err
- }
- deleteResponse := new(RepositoryContentResponse)
- resp, err := s.client.Do(ctx, req, deleteResponse)
- if err != nil {
- return nil, resp, err
- }
- return deleteResponse, resp, nil
-}
-
-// archiveFormat is used to define the archive type when calling GetArchiveLink.
-type archiveFormat string
-
-const (
- // Tarball specifies an archive in gzipped tar format.
- Tarball archiveFormat = "tarball"
-
- // Zipball specifies an archive in zip format.
- Zipball archiveFormat = "zipball"
-)
-
-// GetArchiveLink returns an URL to download a tarball or zipball archive for a
-// repository. The archiveFormat can be specified by either the github.Tarball
-// or github.Zipball constant.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-archive-link
-func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat archiveFormat, opt *RepositoryContentGetOptions) (*url.URL, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat)
- if opt != nil && opt.Ref != "" {
- u += fmt.Sprintf("/%s", opt.Ref)
- }
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
- var resp *http.Response
- // Use http.DefaultTransport if no custom Transport is configured
- req = withContext(ctx, req)
- if s.client.client.Transport == nil {
- resp, err = http.DefaultTransport.RoundTrip(req)
- } else {
- resp, err = s.client.client.Transport.RoundTrip(req)
- }
- if err != nil {
- return nil, nil, err
- }
- resp.Body.Close()
- if resp.StatusCode != http.StatusFound {
- return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status)
- }
- parsedURL, err := url.Parse(resp.Header.Get("Location"))
- return parsedURL, newResponse(resp), err
-}
diff --git a/vendor/github.com/google/go-github/github/repos_deployments.go b/vendor/github.com/google/go-github/github/repos_deployments.go
deleted file mode 100644
index 1300f05e..00000000
--- a/vendor/github.com/google/go-github/github/repos_deployments.go
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "strings"
-)
-
-// Deployment represents a deployment in a repo
-type Deployment struct {
- URL *string `json:"url,omitempty"`
- ID *int64 `json:"id,omitempty"`
- SHA *string `json:"sha,omitempty"`
- Ref *string `json:"ref,omitempty"`
- Task *string `json:"task,omitempty"`
- Payload json.RawMessage `json:"payload,omitempty"`
- Environment *string `json:"environment,omitempty"`
- Description *string `json:"description,omitempty"`
- Creator *User `json:"creator,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- StatusesURL *string `json:"statuses_url,omitempty"`
- RepositoryURL *string `json:"repository_url,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-// DeploymentRequest represents a deployment request
-type DeploymentRequest struct {
- Ref *string `json:"ref,omitempty"`
- Task *string `json:"task,omitempty"`
- AutoMerge *bool `json:"auto_merge,omitempty"`
- RequiredContexts *[]string `json:"required_contexts,omitempty"`
- Payload *string `json:"payload,omitempty"`
- Environment *string `json:"environment,omitempty"`
- Description *string `json:"description,omitempty"`
- TransientEnvironment *bool `json:"transient_environment,omitempty"`
- ProductionEnvironment *bool `json:"production_environment,omitempty"`
-}
-
-// DeploymentsListOptions specifies the optional parameters to the
-// RepositoriesService.ListDeployments method.
-type DeploymentsListOptions struct {
- // SHA of the Deployment.
- SHA string `url:"sha,omitempty"`
-
- // List deployments for a given ref.
- Ref string `url:"ref,omitempty"`
-
- // List deployments for a given task.
- Task string `url:"task,omitempty"`
-
- // List deployments for a given environment.
- Environment string `url:"environment,omitempty"`
-
- ListOptions
-}
-
-// ListDeployments lists the deployments of a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployments
-func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opt *DeploymentsListOptions) ([]*Deployment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var deployments []*Deployment
- resp, err := s.client.Do(ctx, req, &deployments)
- if err != nil {
- return nil, resp, err
- }
-
- return deployments, resp, nil
-}
-
-// GetDeployment returns a single deployment of a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment
-func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- deployment := new(Deployment)
- resp, err := s.client.Do(ctx, req, deployment)
- if err != nil {
- return nil, resp, err
- }
-
- return deployment, resp, nil
-}
-
-// CreateDeployment creates a new deployment for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/deployments/#create-a-deployment
-func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
-
- req, err := s.client.NewRequest("POST", u, request)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeGraphQLNodeIDPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- d := new(Deployment)
- resp, err := s.client.Do(ctx, req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, nil
-}
-
-// DeploymentStatus represents the status of a
-// particular deployment.
-type DeploymentStatus struct {
- ID *int64 `json:"id,omitempty"`
- // State is the deployment state.
- // Possible values are: "pending", "success", "failure", "error", "inactive".
- State *string `json:"state,omitempty"`
- Creator *User `json:"creator,omitempty"`
- Description *string `json:"description,omitempty"`
- TargetURL *string `json:"target_url,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- DeploymentURL *string `json:"deployment_url,omitempty"`
- RepositoryURL *string `json:"repository_url,omitempty"`
- NodeID *string `json:"node_id,omitempty"`
-}
-
-// DeploymentStatusRequest represents a deployment request
-type DeploymentStatusRequest struct {
- State *string `json:"state,omitempty"`
- LogURL *string `json:"log_url,omitempty"`
- Description *string `json:"description,omitempty"`
- EnvironmentURL *string `json:"environment_url,omitempty"`
- AutoInactive *bool `json:"auto_inactive,omitempty"`
-}
-
-// ListDeploymentStatuses lists the statuses of a given deployment of a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
-func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opt *ListOptions) ([]*DeploymentStatus, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
-
- var statuses []*DeploymentStatus
- resp, err := s.client.Do(ctx, req, &statuses)
- if err != nil {
- return nil, resp, err
- }
-
- return statuses, resp, nil
-}
-
-// GetDeploymentStatus returns a single deployment status of a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment-status
-func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeGraphQLNodeIDPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- d := new(DeploymentStatus)
- resp, err := s.client.Do(ctx, req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, nil
-}
-
-// CreateDeploymentStatus creates a new status for a deployment.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/deployments/#create-a-deployment-status
-func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
-
- req, err := s.client.NewRequest("POST", u, request)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeGraphQLNodeIDPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
- d := new(DeploymentStatus)
- resp, err := s.client.Do(ctx, req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_forks.go b/vendor/github.com/google/go-github/github/repos_forks.go
deleted file mode 100644
index 4ca19a42..00000000
--- a/vendor/github.com/google/go-github/github/repos_forks.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// RepositoryListForksOptions specifies the optional parameters to the
-// RepositoriesService.ListForks method.
-type RepositoryListForksOptions struct {
- // How to sort the forks list. Possible values are: newest, oldest,
- // watchers. Default is "newest".
- Sort string `url:"sort,omitempty"`
-
- ListOptions
-}
-
-// ListForks lists the forks of the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/forks/#list-forks
-func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opt *RepositoryListForksOptions) ([]*Repository, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when topics API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
-
- var repos []*Repository
- resp, err := s.client.Do(ctx, req, &repos)
- if err != nil {
- return nil, resp, err
- }
-
- return repos, resp, nil
-}
-
-// RepositoryCreateForkOptions specifies the optional parameters to the
-// RepositoriesService.CreateFork method.
-type RepositoryCreateForkOptions struct {
- // The organization to fork the repository into.
- Organization string `url:"organization,omitempty"`
-}
-
-// CreateFork creates a fork of the specified repository.
-//
-// This method might return an *AcceptedError and a status code of
-// 202. This is because this is the status that GitHub returns to signify that
-// it is now computing creating the fork in a background task.
-// A follow up request, after a delay of a second or so, should result
-// in a successful request.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/forks/#create-a-fork
-func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opt *RepositoryCreateForkOptions) (*Repository, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- fork := new(Repository)
- resp, err := s.client.Do(ctx, req, fork)
- if err != nil {
- return nil, resp, err
- }
-
- return fork, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_hooks.go b/vendor/github.com/google/go-github/github/repos_hooks.go
deleted file mode 100644
index f7ab3a13..00000000
--- a/vendor/github.com/google/go-github/github/repos_hooks.go
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// WebHookPayload represents the data that is received from GitHub when a push
-// event hook is triggered. The format of these payloads pre-date most of the
-// GitHub v3 API, so there are lots of minor incompatibilities with the types
-// defined in the rest of the API. Therefore, several types are duplicated
-// here to account for these differences.
-//
-// GitHub API docs: https://help.github.com/articles/post-receive-hooks
-type WebHookPayload struct {
- After *string `json:"after,omitempty"`
- Before *string `json:"before,omitempty"`
- Commits []WebHookCommit `json:"commits,omitempty"`
- Compare *string `json:"compare,omitempty"`
- Created *bool `json:"created,omitempty"`
- Deleted *bool `json:"deleted,omitempty"`
- Forced *bool `json:"forced,omitempty"`
- HeadCommit *WebHookCommit `json:"head_commit,omitempty"`
- Pusher *User `json:"pusher,omitempty"`
- Ref *string `json:"ref,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
-}
-
-func (w WebHookPayload) String() string {
- return Stringify(w)
-}
-
-// WebHookCommit represents the commit variant we receive from GitHub in a
-// WebHookPayload.
-type WebHookCommit struct {
- Added []string `json:"added,omitempty"`
- Author *WebHookAuthor `json:"author,omitempty"`
- Committer *WebHookAuthor `json:"committer,omitempty"`
- Distinct *bool `json:"distinct,omitempty"`
- ID *string `json:"id,omitempty"`
- Message *string `json:"message,omitempty"`
- Modified []string `json:"modified,omitempty"`
- Removed []string `json:"removed,omitempty"`
- Timestamp *time.Time `json:"timestamp,omitempty"`
-}
-
-func (w WebHookCommit) String() string {
- return Stringify(w)
-}
-
-// WebHookAuthor represents the author or committer of a commit, as specified
-// in a WebHookCommit. The commit author may not correspond to a GitHub User.
-type WebHookAuthor struct {
- Email *string `json:"email,omitempty"`
- Name *string `json:"name,omitempty"`
- Username *string `json:"username,omitempty"`
-}
-
-func (w WebHookAuthor) String() string {
- return Stringify(w)
-}
-
-// Hook represents a GitHub (web and service) hook for a repository.
-type Hook struct {
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- Name *string `json:"name,omitempty"`
- URL *string `json:"url,omitempty"`
- Events []string `json:"events,omitempty"`
- Active *bool `json:"active,omitempty"`
- Config map[string]interface{} `json:"config,omitempty"`
- ID *int64 `json:"id,omitempty"`
-}
-
-func (h Hook) String() string {
- return Stringify(h)
-}
-
-// CreateHook creates a Hook for the specified repository.
-// Name and Config are required fields.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#create-a-hook
-func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
- req, err := s.client.NewRequest("POST", u, hook)
- if err != nil {
- return nil, nil, err
- }
-
- h := new(Hook)
- resp, err := s.client.Do(ctx, req, h)
- if err != nil {
- return nil, resp, err
- }
-
- return h, resp, nil
-}
-
-// ListHooks lists all Hooks for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#list
-func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Hook, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var hooks []*Hook
- resp, err := s.client.Do(ctx, req, &hooks)
- if err != nil {
- return nil, resp, err
- }
-
- return hooks, resp, nil
-}
-
-// GetHook returns a single specified Hook.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#get-single-hook
-func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
- hook := new(Hook)
- resp, err := s.client.Do(ctx, req, hook)
- return hook, resp, err
-}
-
-// EditHook updates a specified Hook.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#edit-a-hook
-func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
- req, err := s.client.NewRequest("PATCH", u, hook)
- if err != nil {
- return nil, nil, err
- }
- h := new(Hook)
- resp, err := s.client.Do(ctx, req, h)
- return h, resp, err
-}
-
-// DeleteHook deletes a specified Hook.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#delete-a-hook
-func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// PingHook triggers a 'ping' event to be sent to the Hook.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#ping-a-hook
-func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id)
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// TestHook triggers a test Hook by github.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/hooks/#test-a-push-hook
-func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id)
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/repos_invitations.go b/vendor/github.com/google/go-github/github/repos_invitations.go
deleted file mode 100644
index 34bf3830..00000000
--- a/vendor/github.com/google/go-github/github/repos_invitations.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// RepositoryInvitation represents an invitation to collaborate on a repo.
-type RepositoryInvitation struct {
- ID *int64 `json:"id,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Invitee *User `json:"invitee,omitempty"`
- Inviter *User `json:"inviter,omitempty"`
-
- // Permissions represents the permissions that the associated user will have
- // on the repository. Possible values are: "read", "write", "admin".
- Permissions *string `json:"permissions,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
-}
-
-// ListInvitations lists all currently-open repository invitations.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository
-func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/invitations", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
-
- invites := []*RepositoryInvitation{}
- resp, err := s.client.Do(ctx, req, &invites)
- if err != nil {
- return nil, resp, err
- }
-
- return invites, resp, nil
-}
-
-// DeleteInvitation deletes a repository invitation.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation
-func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// UpdateInvitation updates the permissions associated with a repository
-// invitation.
-//
-// permissions represents the permissions that the associated user will have
-// on the repository. Possible values are: "read", "write", "admin".
-//
-// GitHub API docs: https://developer.github.com/v3/repos/invitations/#update-a-repository-invitation
-func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) {
- opts := &struct {
- Permissions string `json:"permissions"`
- }{Permissions: permissions}
- u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID)
- req, err := s.client.NewRequest("PATCH", u, opts)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
-
- invite := &RepositoryInvitation{}
- resp, err := s.client.Do(ctx, req, invite)
- if err != nil {
- return nil, resp, err
- }
-
- return invite, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_keys.go b/vendor/github.com/google/go-github/github/repos_keys.go
deleted file mode 100644
index 966d7b54..00000000
--- a/vendor/github.com/google/go-github/github/repos_keys.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// The Key type is defined in users_keys.go
-
-// ListKeys lists the deploy keys for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/keys/#list
-func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Key, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var keys []*Key
- resp, err := s.client.Do(ctx, req, &keys)
- if err != nil {
- return nil, resp, err
- }
-
- return keys, resp, nil
-}
-
-// GetKey fetches a single deploy key.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/keys/#get
-func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- key := new(Key)
- resp, err := s.client.Do(ctx, req, key)
- if err != nil {
- return nil, resp, err
- }
-
- return key, resp, nil
-}
-
-// CreateKey adds a deploy key for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/keys/#create
-func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
-
- req, err := s.client.NewRequest("POST", u, key)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(Key)
- resp, err := s.client.Do(ctx, req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, nil
-}
-
-// EditKey edits a deploy key.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/keys/#edit
-func (s *RepositoriesService) EditKey(ctx context.Context, owner string, repo string, id int, key *Key) (*Key, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
-
- req, err := s.client.NewRequest("PATCH", u, key)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(Key)
- resp, err := s.client.Do(ctx, req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, nil
-}
-
-// DeleteKey deletes a deploy key.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/keys/#delete
-func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/repos_merging.go b/vendor/github.com/google/go-github/github/repos_merging.go
deleted file mode 100644
index 04383c1a..00000000
--- a/vendor/github.com/google/go-github/github/repos_merging.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// RepositoryMergeRequest represents a request to merge a branch in a
-// repository.
-type RepositoryMergeRequest struct {
- Base *string `json:"base,omitempty"`
- Head *string `json:"head,omitempty"`
- CommitMessage *string `json:"commit_message,omitempty"`
-}
-
-// Merge a branch in the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/merging/#perform-a-merge
-func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/merges", owner, repo)
- req, err := s.client.NewRequest("POST", u, request)
- if err != nil {
- return nil, nil, err
- }
-
- commit := new(RepositoryCommit)
- resp, err := s.client.Do(ctx, req, commit)
- if err != nil {
- return nil, resp, err
- }
-
- return commit, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_pages.go b/vendor/github.com/google/go-github/github/repos_pages.go
deleted file mode 100644
index 94a95f2b..00000000
--- a/vendor/github.com/google/go-github/github/repos_pages.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Pages represents a GitHub Pages site configuration.
-type Pages struct {
- URL *string `json:"url,omitempty"`
- Status *string `json:"status,omitempty"`
- CNAME *string `json:"cname,omitempty"`
- Custom404 *bool `json:"custom_404,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
-}
-
-// PagesError represents a build error for a GitHub Pages site.
-type PagesError struct {
- Message *string `json:"message,omitempty"`
-}
-
-// PagesBuild represents the build information for a GitHub Pages site.
-type PagesBuild struct {
- URL *string `json:"url,omitempty"`
- Status *string `json:"status,omitempty"`
- Error *PagesError `json:"error,omitempty"`
- Pusher *User `json:"pusher,omitempty"`
- Commit *string `json:"commit,omitempty"`
- Duration *int `json:"duration,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
-}
-
-// GetPagesInfo fetches information about a GitHub Pages site.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/pages/#get-information-about-a-pages-site
-func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypePagesPreview)
-
- site := new(Pages)
- resp, err := s.client.Do(ctx, req, site)
- if err != nil {
- return nil, resp, err
- }
-
- return site, resp, nil
-}
-
-// ListPagesBuilds lists the builds for a GitHub Pages site.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-pages-builds
-func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opt *ListOptions) ([]*PagesBuild, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var pages []*PagesBuild
- resp, err := s.client.Do(ctx, req, &pages)
- if err != nil {
- return nil, resp, err
- }
-
- return pages, resp, nil
-}
-
-// GetLatestPagesBuild fetches the latest build information for a GitHub pages site.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-latest-pages-build
-func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- build := new(PagesBuild)
- resp, err := s.client.Do(ctx, req, build)
- if err != nil {
- return nil, resp, err
- }
-
- return build, resp, nil
-}
-
-// GetPageBuild fetches the specific build information for a GitHub pages site.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-a-specific-pages-build
-func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- build := new(PagesBuild)
- resp, err := s.client.Do(ctx, req, build)
- if err != nil {
- return nil, resp, err
- }
-
- return build, resp, nil
-}
-
-// RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/pages/#request-a-page-build
-func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
- req, err := s.client.NewRequest("POST", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypePagesPreview)
-
- build := new(PagesBuild)
- resp, err := s.client.Do(ctx, req, build)
- if err != nil {
- return nil, resp, err
- }
-
- return build, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_projects.go b/vendor/github.com/google/go-github/github/repos_projects.go
deleted file mode 100644
index 770ffc76..00000000
--- a/vendor/github.com/google/go-github/github/repos_projects.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ProjectListOptions specifies the optional parameters to the
-// OrganizationsService.ListProjects and RepositoriesService.ListProjects methods.
-type ProjectListOptions struct {
- // Indicates the state of the projects to return. Can be either open, closed, or all. Default: open
- State string `url:"state,omitempty"`
-
- ListOptions
-}
-
-// ListProjects lists the projects for a repo.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/#list-repository-projects
-func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opt *ProjectListOptions) ([]*Project, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- var projects []*Project
- resp, err := s.client.Do(ctx, req, &projects)
- if err != nil {
- return nil, resp, err
- }
-
- return projects, resp, nil
-}
-
-// CreateProject creates a GitHub Project for the specified repository.
-//
-// GitHub API docs: https://developer.github.com/v3/projects/#create-a-repository-project
-func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo string, opt *ProjectOptions) (*Project, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
- req, err := s.client.NewRequest("POST", u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- project := &Project{}
- resp, err := s.client.Do(ctx, req, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_releases.go b/vendor/github.com/google/go-github/github/repos_releases.go
deleted file mode 100644
index 7ad2b278..00000000
--- a/vendor/github.com/google/go-github/github/repos_releases.go
+++ /dev/null
@@ -1,327 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "mime"
- "net/http"
- "os"
- "path/filepath"
- "strings"
-)
-
-// RepositoryRelease represents a GitHub release in a repository.
-type RepositoryRelease struct {
- ID *int64 `json:"id,omitempty"`
- TagName *string `json:"tag_name,omitempty"`
- TargetCommitish *string `json:"target_commitish,omitempty"`
- Name *string `json:"name,omitempty"`
- Body *string `json:"body,omitempty"`
- Draft *bool `json:"draft,omitempty"`
- Prerelease *bool `json:"prerelease,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- PublishedAt *Timestamp `json:"published_at,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- AssetsURL *string `json:"assets_url,omitempty"`
- Assets []ReleaseAsset `json:"assets,omitempty"`
- UploadURL *string `json:"upload_url,omitempty"`
- ZipballURL *string `json:"zipball_url,omitempty"`
- TarballURL *string `json:"tarball_url,omitempty"`
- Author *User `json:"author,omitempty"`
-}
-
-func (r RepositoryRelease) String() string {
- return Stringify(r)
-}
-
-// ReleaseAsset represents a GitHub release asset in a repository.
-type ReleaseAsset struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- Name *string `json:"name,omitempty"`
- Label *string `json:"label,omitempty"`
- State *string `json:"state,omitempty"`
- ContentType *string `json:"content_type,omitempty"`
- Size *int `json:"size,omitempty"`
- DownloadCount *int `json:"download_count,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- BrowserDownloadURL *string `json:"browser_download_url,omitempty"`
- Uploader *User `json:"uploader,omitempty"`
-}
-
-func (r ReleaseAsset) String() string {
- return Stringify(r)
-}
-
-// ListReleases lists the releases for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
-func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opt *ListOptions) ([]*RepositoryRelease, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var releases []*RepositoryRelease
- resp, err := s.client.Do(ctx, req, &releases)
- if err != nil {
- return nil, resp, err
- }
- return releases, resp, nil
-}
-
-// GetRelease fetches a single release.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release
-func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
- return s.getSingleRelease(ctx, u)
-}
-
-// GetLatestRelease fetches the latest published release for the repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-the-latest-release
-func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo)
- return s.getSingleRelease(ctx, u)
-}
-
-// GetReleaseByTag fetches a release with the specified tag.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name
-func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag)
- return s.getSingleRelease(ctx, u)
-}
-
-func (s *RepositoriesService) getSingleRelease(ctx context.Context, url string) (*RepositoryRelease, *Response, error) {
- req, err := s.client.NewRequest("GET", url, nil)
- if err != nil {
- return nil, nil, err
- }
-
- release := new(RepositoryRelease)
- resp, err := s.client.Do(ctx, req, release)
- if err != nil {
- return nil, resp, err
- }
- return release, resp, nil
-}
-
-// CreateRelease adds a new release for a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#create-a-release
-func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
-
- req, err := s.client.NewRequest("POST", u, release)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(RepositoryRelease)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
- return r, resp, nil
-}
-
-// EditRelease edits a repository release.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release
-func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
-
- req, err := s.client.NewRequest("PATCH", u, release)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(RepositoryRelease)
- resp, err := s.client.Do(ctx, req, r)
- if err != nil {
- return nil, resp, err
- }
- return r, resp, nil
-}
-
-// DeleteRelease delete a single release from a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release
-func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// ListReleaseAssets lists the release's assets.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-assets-for-a-release
-func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*ReleaseAsset, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var assets []*ReleaseAsset
- resp, err := s.client.Do(ctx, req, &assets)
- if err != nil {
- return nil, resp, err
- }
- return assets, resp, nil
-}
-
-// GetReleaseAsset fetches a single release asset.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset
-func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- asset := new(ReleaseAsset)
- resp, err := s.client.Do(ctx, req, asset)
- if err != nil {
- return nil, resp, err
- }
- return asset, resp, nil
-}
-
-// DownloadReleaseAsset downloads a release asset or returns a redirect URL.
-//
-// DownloadReleaseAsset returns an io.ReadCloser that reads the contents of the
-// specified release asset. It is the caller's responsibility to close the ReadCloser.
-// If a redirect is returned, the redirect URL will be returned as a string instead
-// of the io.ReadCloser. Exactly one of rc and redirectURL will be zero.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset
-func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64) (rc io.ReadCloser, redirectURL string, err error) {
- u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, "", err
- }
- req.Header.Set("Accept", defaultMediaType)
-
- s.client.clientMu.Lock()
- defer s.client.clientMu.Unlock()
-
- var loc string
- saveRedirect := s.client.client.CheckRedirect
- s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
- loc = req.URL.String()
- return errors.New("disable redirect")
- }
- defer func() { s.client.client.CheckRedirect = saveRedirect }()
-
- req = withContext(ctx, req)
- resp, err := s.client.client.Do(req)
- if err != nil {
- if !strings.Contains(err.Error(), "disable redirect") {
- return nil, "", err
- }
- return nil, loc, nil // Intentionally return no error with valid redirect URL.
- }
-
- if err := CheckResponse(resp); err != nil {
- resp.Body.Close()
- return nil, "", err
- }
-
- return resp.Body, "", nil
-}
-
-// EditReleaseAsset edits a repository release asset.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release-asset
-func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
-
- req, err := s.client.NewRequest("PATCH", u, release)
- if err != nil {
- return nil, nil, err
- }
-
- asset := new(ReleaseAsset)
- resp, err := s.client.Do(ctx, req, asset)
- if err != nil {
- return nil, resp, err
- }
- return asset, resp, nil
-}
-
-// DeleteReleaseAsset delete a single release asset from a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release-asset
-func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
- return s.client.Do(ctx, req, nil)
-}
-
-// UploadReleaseAsset creates an asset by uploading a file into a release repository.
-// To upload assets that cannot be represented by an os.File, call NewUploadRequest directly.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/releases/#upload-a-release-asset
-func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opt *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) {
- u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- stat, err := file.Stat()
- if err != nil {
- return nil, nil, err
- }
- if stat.IsDir() {
- return nil, nil, errors.New("the asset to upload can't be a directory")
- }
-
- mediaType := mime.TypeByExtension(filepath.Ext(file.Name()))
- req, err := s.client.NewUploadRequest(u, file, stat.Size(), mediaType)
- if err != nil {
- return nil, nil, err
- }
-
- asset := new(ReleaseAsset)
- resp, err := s.client.Do(ctx, req, asset)
- if err != nil {
- return nil, resp, err
- }
- return asset, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_stats.go b/vendor/github.com/google/go-github/github/repos_stats.go
deleted file mode 100644
index bb355aea..00000000
--- a/vendor/github.com/google/go-github/github/repos_stats.go
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// ContributorStats represents a contributor to a repository and their
-// weekly contributions to a given repo.
-type ContributorStats struct {
- Author *Contributor `json:"author,omitempty"`
- Total *int `json:"total,omitempty"`
- Weeks []WeeklyStats `json:"weeks,omitempty"`
-}
-
-func (c ContributorStats) String() string {
- return Stringify(c)
-}
-
-// WeeklyStats represents the number of additions, deletions and commits
-// a Contributor made in a given week.
-type WeeklyStats struct {
- Week *Timestamp `json:"w,omitempty"`
- Additions *int `json:"a,omitempty"`
- Deletions *int `json:"d,omitempty"`
- Commits *int `json:"c,omitempty"`
-}
-
-func (w WeeklyStats) String() string {
- return Stringify(w)
-}
-
-// ListContributorsStats gets a repo's contributor list with additions,
-// deletions and commit counts.
-//
-// If this is the first time these statistics are requested for the given
-// repository, this method will return an *AcceptedError and a status code of
-// 202. This is because this is the status that GitHub returns to signify that
-// it is now computing the requested statistics. A follow up request, after a
-// delay of a second or so, should result in a successful request.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/statistics/#contributors
-func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var contributorStats []*ContributorStats
- resp, err := s.client.Do(ctx, req, &contributorStats)
- if err != nil {
- return nil, resp, err
- }
-
- return contributorStats, resp, nil
-}
-
-// WeeklyCommitActivity represents the weekly commit activity for a repository.
-// The days array is a group of commits per day, starting on Sunday.
-type WeeklyCommitActivity struct {
- Days []int `json:"days,omitempty"`
- Total *int `json:"total,omitempty"`
- Week *Timestamp `json:"week,omitempty"`
-}
-
-func (w WeeklyCommitActivity) String() string {
- return Stringify(w)
-}
-
-// ListCommitActivity returns the last year of commit activity
-// grouped by week. The days array is a group of commits per day,
-// starting on Sunday.
-//
-// If this is the first time these statistics are requested for the given
-// repository, this method will return an *AcceptedError and a status code of
-// 202. This is because this is the status that GitHub returns to signify that
-// it is now computing the requested statistics. A follow up request, after a
-// delay of a second or so, should result in a successful request.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/statistics/#commit-activity
-func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var weeklyCommitActivity []*WeeklyCommitActivity
- resp, err := s.client.Do(ctx, req, &weeklyCommitActivity)
- if err != nil {
- return nil, resp, err
- }
-
- return weeklyCommitActivity, resp, nil
-}
-
-// ListCodeFrequency returns a weekly aggregate of the number of additions and
-// deletions pushed to a repository. Returned WeeklyStats will contain
-// additions and deletions, but not total commits.
-//
-// If this is the first time these statistics are requested for the given
-// repository, this method will return an *AcceptedError and a status code of
-// 202. This is because this is the status that GitHub returns to signify that
-// it is now computing the requested statistics. A follow up request, after a
-// delay of a second or so, should result in a successful request.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/statistics/#code-frequency
-func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var weeks [][]int
- resp, err := s.client.Do(ctx, req, &weeks)
-
- // convert int slices into WeeklyStats
- var stats []*WeeklyStats
- for _, week := range weeks {
- if len(week) != 3 {
- continue
- }
- stat := &WeeklyStats{
- Week: &Timestamp{time.Unix(int64(week[0]), 0)},
- Additions: Int(week[1]),
- Deletions: Int(week[2]),
- }
- stats = append(stats, stat)
- }
-
- return stats, resp, err
-}
-
-// RepositoryParticipation is the number of commits by everyone
-// who has contributed to the repository (including the owner)
-// as well as the number of commits by the owner themself.
-type RepositoryParticipation struct {
- All []int `json:"all,omitempty"`
- Owner []int `json:"owner,omitempty"`
-}
-
-func (r RepositoryParticipation) String() string {
- return Stringify(r)
-}
-
-// ListParticipation returns the total commit counts for the 'owner'
-// and total commit counts in 'all'. 'all' is everyone combined,
-// including the 'owner' in the last 52 weeks. If you’d like to get
-// the commit counts for non-owners, you can subtract 'all' from 'owner'.
-//
-// The array order is oldest week (index 0) to most recent week.
-//
-// If this is the first time these statistics are requested for the given
-// repository, this method will return an *AcceptedError and a status code of
-// 202. This is because this is the status that GitHub returns to signify that
-// it is now computing the requested statistics. A follow up request, after a
-// delay of a second or so, should result in a successful request.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/statistics/#participation
-func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/stats/participation", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- participation := new(RepositoryParticipation)
- resp, err := s.client.Do(ctx, req, participation)
- if err != nil {
- return nil, resp, err
- }
-
- return participation, resp, nil
-}
-
-// PunchCard represents the number of commits made during a given hour of a
-// day of the week.
-type PunchCard struct {
- Day *int // Day of the week (0-6: =Sunday - Saturday).
- Hour *int // Hour of day (0-23).
- Commits *int // Number of commits.
-}
-
-// ListPunchCard returns the number of commits per hour in each day.
-//
-// If this is the first time these statistics are requested for the given
-// repository, this method will return an *AcceptedError and a status code of
-// 202. This is because this is the status that GitHub returns to signify that
-// it is now computing the requested statistics. A follow up request, after a
-// delay of a second or so, should result in a successful request.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/statistics/#punch-card
-func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var results [][]int
- resp, err := s.client.Do(ctx, req, &results)
-
- // convert int slices into Punchcards
- var cards []*PunchCard
- for _, result := range results {
- if len(result) != 3 {
- continue
- }
- card := &PunchCard{
- Day: Int(result[0]),
- Hour: Int(result[1]),
- Commits: Int(result[2]),
- }
- cards = append(cards, card)
- }
-
- return cards, resp, err
-}
diff --git a/vendor/github.com/google/go-github/github/repos_statuses.go b/vendor/github.com/google/go-github/github/repos_statuses.go
deleted file mode 100644
index f94fdc85..00000000
--- a/vendor/github.com/google/go-github/github/repos_statuses.go
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// RepoStatus represents the status of a repository at a particular reference.
-type RepoStatus struct {
- ID *int64 `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
-
- // State is the current state of the repository. Possible values are:
- // pending, success, error, or failure.
- State *string `json:"state,omitempty"`
-
- // TargetURL is the URL of the page representing this status. It will be
- // linked from the GitHub UI to allow users to see the source of the status.
- TargetURL *string `json:"target_url,omitempty"`
-
- // Description is a short high level summary of the status.
- Description *string `json:"description,omitempty"`
-
- // A string label to differentiate this status from the statuses of other systems.
- Context *string `json:"context,omitempty"`
-
- Creator *User `json:"creator,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
-}
-
-func (r RepoStatus) String() string {
- return Stringify(r)
-}
-
-// ListStatuses lists the statuses of a repository at the specified
-// reference. ref can be a SHA, a branch name, or a tag name.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref
-func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opt *ListOptions) ([]*RepoStatus, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, ref)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var statuses []*RepoStatus
- resp, err := s.client.Do(ctx, req, &statuses)
- if err != nil {
- return nil, resp, err
- }
-
- return statuses, resp, nil
-}
-
-// CreateStatus creates a new status for a repository at the specified
-// reference. Ref can be a SHA, a branch name, or a tag name.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/statuses/#create-a-status
-func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, ref)
- req, err := s.client.NewRequest("POST", u, status)
- if err != nil {
- return nil, nil, err
- }
-
- repoStatus := new(RepoStatus)
- resp, err := s.client.Do(ctx, req, repoStatus)
- if err != nil {
- return nil, resp, err
- }
-
- return repoStatus, resp, nil
-}
-
-// CombinedStatus represents the combined status of a repository at a particular reference.
-type CombinedStatus struct {
- // State is the combined state of the repository. Possible values are:
- // failure, pending, or success.
- State *string `json:"state,omitempty"`
-
- Name *string `json:"name,omitempty"`
- SHA *string `json:"sha,omitempty"`
- TotalCount *int `json:"total_count,omitempty"`
- Statuses []RepoStatus `json:"statuses,omitempty"`
-
- CommitURL *string `json:"commit_url,omitempty"`
- RepositoryURL *string `json:"repository_url,omitempty"`
-}
-
-func (s CombinedStatus) String() string {
- return Stringify(s)
-}
-
-// GetCombinedStatus returns the combined status of a repository at the specified
-// reference. ref can be a SHA, a branch name, or a tag name.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref
-func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opt *ListOptions) (*CombinedStatus, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/commits/%v/status", owner, repo, ref)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- status := new(CombinedStatus)
- resp, err := s.client.Do(ctx, req, status)
- if err != nil {
- return nil, resp, err
- }
-
- return status, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/repos_traffic.go b/vendor/github.com/google/go-github/github/repos_traffic.go
deleted file mode 100644
index fb1c9764..00000000
--- a/vendor/github.com/google/go-github/github/repos_traffic.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// TrafficReferrer represent information about traffic from a referrer .
-type TrafficReferrer struct {
- Referrer *string `json:"referrer,omitempty"`
- Count *int `json:"count,omitempty"`
- Uniques *int `json:"uniques,omitempty"`
-}
-
-// TrafficPath represent information about the traffic on a path of the repo.
-type TrafficPath struct {
- Path *string `json:"path,omitempty"`
- Title *string `json:"title,omitempty"`
- Count *int `json:"count,omitempty"`
- Uniques *int `json:"uniques,omitempty"`
-}
-
-// TrafficData represent information about a specific timestamp in views or clones list.
-type TrafficData struct {
- Timestamp *Timestamp `json:"timestamp,omitempty"`
- Count *int `json:"count,omitempty"`
- Uniques *int `json:"uniques,omitempty"`
-}
-
-// TrafficViews represent information about the number of views in the last 14 days.
-type TrafficViews struct {
- Views []*TrafficData `json:"views,omitempty"`
- Count *int `json:"count,omitempty"`
- Uniques *int `json:"uniques,omitempty"`
-}
-
-// TrafficClones represent information about the number of clones in the last 14 days.
-type TrafficClones struct {
- Clones []*TrafficData `json:"clones,omitempty"`
- Count *int `json:"count,omitempty"`
- Uniques *int `json:"uniques,omitempty"`
-}
-
-// TrafficBreakdownOptions specifies the parameters to methods that support breakdown per day or week.
-// Can be one of: day, week. Default: day.
-type TrafficBreakdownOptions struct {
- Per string `url:"per,omitempty"`
-}
-
-// ListTrafficReferrers list the top 10 referrers over the last 14 days.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/traffic/#list-referrers
-func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var trafficReferrers []*TrafficReferrer
- resp, err := s.client.Do(ctx, req, &trafficReferrers)
- if err != nil {
- return nil, resp, err
- }
-
- return trafficReferrers, resp, nil
-}
-
-// ListTrafficPaths list the top 10 popular content over the last 14 days.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/traffic/#list-paths
-func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var paths []*TrafficPath
- resp, err := s.client.Do(ctx, req, &paths)
- if err != nil {
- return nil, resp, err
- }
-
- return paths, resp, nil
-}
-
-// ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/traffic/#views
-func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opt *TrafficBreakdownOptions) (*TrafficViews, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/traffic/views", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- trafficViews := new(TrafficViews)
- resp, err := s.client.Do(ctx, req, &trafficViews)
- if err != nil {
- return nil, resp, err
- }
-
- return trafficViews, resp, nil
-}
-
-// ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/traffic/#views
-func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opt *TrafficBreakdownOptions) (*TrafficClones, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/traffic/clones", owner, repo)
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- trafficClones := new(TrafficClones)
- resp, err := s.client.Do(ctx, req, &trafficClones)
- if err != nil {
- return nil, resp, err
- }
-
- return trafficClones, resp, nil
-}
diff --git a/vendor/github.com/google/go-github/github/search.go b/vendor/github.com/google/go-github/github/search.go
deleted file mode 100644
index a5973520..00000000
--- a/vendor/github.com/google/go-github/github/search.go
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-
- qs "github.com/google/go-querystring/query"
-)
-
-// SearchService provides access to the search related functions
-// in the GitHub API.
-//
-// Each method takes a query string defining the search keywords and any search qualifiers.
-// For example, when searching issues, the query "gopher is:issue language:go" will search
-// for issues containing the word "gopher" in Go repositories. The method call
-// opts := &github.SearchOptions{Sort: "created", Order: "asc"}
-// cl.Search.Issues(ctx, "gopher is:issue language:go", opts)
-// will search for such issues, sorting by creation date in ascending order
-// (i.e., oldest first).
-//
-// GitHub API docs: https://developer.github.com/v3/search/
-type SearchService service
-
-// SearchOptions specifies optional parameters to the SearchService methods.
-type SearchOptions struct {
- // How to sort the search results. Possible values are:
- // - for repositories: stars, fork, updated
- // - for commits: author-date, committer-date
- // - for code: indexed
- // - for issues: comments, created, updated
- // - for users: followers, repositories, joined
- //
- // Default is to sort by best match.
- Sort string `url:"sort,omitempty"`
-
- // Sort order if sort parameter is provided. Possible values are: asc,
- // desc. Default is desc.
- Order string `url:"order,omitempty"`
-
- // Whether to retrieve text match metadata with a query
- TextMatch bool `url:"-"`
-
- ListOptions
-}
-
-// RepositoriesSearchResult represents the result of a repositories search.
-type RepositoriesSearchResult struct {
- Total *int `json:"total_count,omitempty"`
- IncompleteResults *bool `json:"incomplete_results,omitempty"`
- Repositories []Repository `json:"items,omitempty"`
-}
-
-// Repositories searches repositories via various criteria.
-//
-// GitHub API docs: https://developer.github.com/v3/search/#search-repositories
-func (s *SearchService) Repositories(ctx context.Context, query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) {
- result := new(RepositoriesSearchResult)
- resp, err := s.search(ctx, "repositories", query, opt, result)
- return result, resp, err
-}
-
-// CommitsSearchResult represents the result of a commits search.
-type CommitsSearchResult struct {
- Total *int `json:"total_count,omitempty"`
- IncompleteResults *bool `json:"incomplete_results,omitempty"`
- Commits []*CommitResult `json:"items,omitempty"`
-}
-
-// CommitResult represents a commit object as returned in commit search endpoint response.
-type CommitResult struct {
- SHA *string `json:"sha,omitempty"`
- Commit *Commit `json:"commit,omitempty"`
- Author *User `json:"author,omitempty"`
- Committer *User `json:"committer,omitempty"`
- Parents []*Commit `json:"parents,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- URL *string `json:"url,omitempty"`
- CommentsURL *string `json:"comments_url,omitempty"`
-
- Repository *Repository `json:"repository,omitempty"`
- Score *float64 `json:"score,omitempty"`
-}
-
-// Commits searches commits via various criteria.
-//
-// GitHub API docs: https://developer.github.com/v3/search/#search-commits
-func (s *SearchService) Commits(ctx context.Context, query string, opt *SearchOptions) (*CommitsSearchResult, *Response, error) {
- result := new(CommitsSearchResult)
- resp, err := s.search(ctx, "commits", query, opt, result)
- return result, resp, err
-}
-
-// IssuesSearchResult represents the result of an issues search.
-type IssuesSearchResult struct {
- Total *int `json:"total_count,omitempty"`
- IncompleteResults *bool `json:"incomplete_results,omitempty"`
- Issues []Issue `json:"items,omitempty"`
-}
-
-// Issues searches issues via various criteria.
-//
-// GitHub API docs: https://developer.github.com/v3/search/#search-issues
-func (s *SearchService) Issues(ctx context.Context, query string, opt *SearchOptions) (*IssuesSearchResult, *Response, error) {
- result := new(IssuesSearchResult)
- resp, err := s.search(ctx, "issues", query, opt, result)
- return result, resp, err
-}
-
-// UsersSearchResult represents the result of a users search.
-type UsersSearchResult struct {
- Total *int `json:"total_count,omitempty"`
- IncompleteResults *bool `json:"incomplete_results,omitempty"`
- Users []User `json:"items,omitempty"`
-}
-
-// Users searches users via various criteria.
-//
-// GitHub API docs: https://developer.github.com/v3/search/#search-users
-func (s *SearchService) Users(ctx context.Context, query string, opt *SearchOptions) (*UsersSearchResult, *Response, error) {
- result := new(UsersSearchResult)
- resp, err := s.search(ctx, "users", query, opt, result)
- return result, resp, err
-}
-
-// Match represents a single text match.
-type Match struct {
- Text *string `json:"text,omitempty"`
- Indices []int `json:"indices,omitempty"`
-}
-
-// TextMatch represents a text match for a SearchResult
-type TextMatch struct {
- ObjectURL *string `json:"object_url,omitempty"`
- ObjectType *string `json:"object_type,omitempty"`
- Property *string `json:"property,omitempty"`
- Fragment *string `json:"fragment,omitempty"`
- Matches []Match `json:"matches,omitempty"`
-}
-
-func (tm TextMatch) String() string {
- return Stringify(tm)
-}
-
-// CodeSearchResult represents the result of a code search.
-type CodeSearchResult struct {
- Total *int `json:"total_count,omitempty"`
- IncompleteResults *bool `json:"incomplete_results,omitempty"`
- CodeResults []CodeResult `json:"items,omitempty"`
-}
-
-// CodeResult represents a single search result.
-type CodeResult struct {
- Name *string `json:"name,omitempty"`
- Path *string `json:"path,omitempty"`
- SHA *string `json:"sha,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- Repository *Repository `json:"repository,omitempty"`
- TextMatches []TextMatch `json:"text_matches,omitempty"`
-}
-
-func (c CodeResult) String() string {
- return Stringify(c)
-}
-
-// Code searches code via various criteria.
-//
-// GitHub API docs: https://developer.github.com/v3/search/#search-code
-func (s *SearchService) Code(ctx context.Context, query string, opt *SearchOptions) (*CodeSearchResult, *Response, error) {
- result := new(CodeSearchResult)
- resp, err := s.search(ctx, "code", query, opt, result)
- return result, resp, err
-}
-
-// Helper function that executes search queries against different
-// GitHub search types (repositories, commits, code, issues, users)
-func (s *SearchService) search(ctx context.Context, searchType string, query string, opt *SearchOptions, result interface{}) (*Response, error) {
- params, err := qs.Values(opt)
- if err != nil {
- return nil, err
- }
- params.Set("q", query)
- u := fmt.Sprintf("search/%s?%s", searchType, params.Encode())
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, err
- }
-
- switch {
- case searchType == "commits":
- // Accept header for search commits preview endpoint
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeCommitSearchPreview)
- case searchType == "repositories":
- // Accept header for search repositories based on topics preview endpoint
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
- case opt != nil && opt.TextMatch:
- // Accept header defaults to "application/vnd.github.v3+json"
- // We change it here to fetch back text-match metadata
- req.Header.Set("Accept", "application/vnd.github.v3.text-match+json")
- }
-
- return s.client.Do(ctx, req, result)
-}
diff --git a/vendor/github.com/google/go-github/github/strings.go b/vendor/github.com/google/go-github/github/strings.go
deleted file mode 100644
index 431e1cc6..00000000
--- a/vendor/github.com/google/go-github/github/strings.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "bytes"
- "fmt"
- "io"
-
- "reflect"
-)
-
-var timestampType = reflect.TypeOf(Timestamp{})
-
-// Stringify attempts to create a reasonable string representation of types in
-// the GitHub library. It does things like resolve pointers to their values
-// and omits struct fields with nil values.
-func Stringify(message interface{}) string {
- var buf bytes.Buffer
- v := reflect.ValueOf(message)
- stringifyValue(&buf, v)
- return buf.String()
-}
-
-// stringifyValue was heavily inspired by the goprotobuf library.
-
-func stringifyValue(w io.Writer, val reflect.Value) {
- if val.Kind() == reflect.Ptr && val.IsNil() {
- w.Write([]byte(""))
- return
- }
-
- v := reflect.Indirect(val)
-
- switch v.Kind() {
- case reflect.String:
- fmt.Fprintf(w, `"%s"`, v)
- case reflect.Slice:
- w.Write([]byte{'['})
- for i := 0; i < v.Len(); i++ {
- if i > 0 {
- w.Write([]byte{' '})
- }
-
- stringifyValue(w, v.Index(i))
- }
-
- w.Write([]byte{']'})
- return
- case reflect.Struct:
- if v.Type().Name() != "" {
- w.Write([]byte(v.Type().String()))
- }
-
- // special handling of Timestamp values
- if v.Type() == timestampType {
- fmt.Fprintf(w, "{%s}", v.Interface())
- return
- }
-
- w.Write([]byte{'{'})
-
- var sep bool
- for i := 0; i < v.NumField(); i++ {
- fv := v.Field(i)
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- continue
- }
- if fv.Kind() == reflect.Slice && fv.IsNil() {
- continue
- }
-
- if sep {
- w.Write([]byte(", "))
- } else {
- sep = true
- }
-
- w.Write([]byte(v.Type().Field(i).Name))
- w.Write([]byte{':'})
- stringifyValue(w, fv)
- }
-
- w.Write([]byte{'}'})
- default:
- if v.CanInterface() {
- fmt.Fprint(w, v.Interface())
- }
- }
-}
diff --git a/vendor/github.com/google/go-github/github/timestamp.go b/vendor/github.com/google/go-github/github/timestamp.go
deleted file mode 100644
index a1c1554a..00000000
--- a/vendor/github.com/google/go-github/github/timestamp.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "strconv"
- "time"
-)
-
-// Timestamp represents a time that can be unmarshalled from a JSON string
-// formatted as either an RFC3339 or Unix timestamp. This is necessary for some
-// fields since the GitHub API is inconsistent in how it represents times. All
-// exported methods of time.Time can be called on Timestamp.
-type Timestamp struct {
- time.Time
-}
-
-func (t Timestamp) String() string {
- return t.Time.String()
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-// Time is expected in RFC3339 or Unix format.
-func (t *Timestamp) UnmarshalJSON(data []byte) (err error) {
- str := string(data)
- i, err := strconv.ParseInt(str, 10, 64)
- if err == nil {
- (*t).Time = time.Unix(i, 0)
- } else {
- (*t).Time, err = time.Parse(`"`+time.RFC3339+`"`, str)
- }
- return
-}
-
-// Equal reports whether t and u are equal based on time.Equal
-func (t Timestamp) Equal(u Timestamp) bool {
- return t.Time.Equal(u.Time)
-}
diff --git a/vendor/github.com/google/go-github/github/users.go b/vendor/github.com/google/go-github/github/users.go
deleted file mode 100644
index ef8f3dd5..00000000
--- a/vendor/github.com/google/go-github/github/users.go
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// UsersService handles communication with the user related
-// methods of the GitHub API.
-//
-// GitHub API docs: https://developer.github.com/v3/users/
-type UsersService service
-
-// User represents a GitHub user.
-type User struct {
- Login *string `json:"login,omitempty"`
- ID *int64 `json:"id,omitempty"`
- AvatarURL *string `json:"avatar_url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- GravatarID *string `json:"gravatar_id,omitempty"`
- Name *string `json:"name,omitempty"`
- Company *string `json:"company,omitempty"`
- Blog *string `json:"blog,omitempty"`
- Location *string `json:"location,omitempty"`
- Email *string `json:"email,omitempty"`
- Hireable *bool `json:"hireable,omitempty"`
- Bio *string `json:"bio,omitempty"`
- PublicRepos *int `json:"public_repos,omitempty"`
- PublicGists *int `json:"public_gists,omitempty"`
- Followers *int `json:"followers,omitempty"`
- Following *int `json:"following,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- SuspendedAt *Timestamp `json:"suspended_at,omitempty"`
- Type *string `json:"type,omitempty"`
- SiteAdmin *bool `json:"site_admin,omitempty"`
- TotalPrivateRepos *int `json:"total_private_repos,omitempty"`
- OwnedPrivateRepos *int `json:"owned_private_repos,omitempty"`
- PrivateGists *int `json:"private_gists,omitempty"`
- DiskUsage *int `json:"disk_usage,omitempty"`
- Collaborators *int `json:"collaborators,omitempty"`
- Plan *Plan `json:"plan,omitempty"`
-
- // API URLs
- URL *string `json:"url,omitempty"`
- EventsURL *string `json:"events_url,omitempty"`
- FollowingURL *string `json:"following_url,omitempty"`
- FollowersURL *string `json:"followers_url,omitempty"`
- GistsURL *string `json:"gists_url,omitempty"`
- OrganizationsURL *string `json:"organizations_url,omitempty"`
- ReceivedEventsURL *string `json:"received_events_url,omitempty"`
- ReposURL *string `json:"repos_url,omitempty"`
- StarredURL *string `json:"starred_url,omitempty"`
- SubscriptionsURL *string `json:"subscriptions_url,omitempty"`
-
- // TextMatches is only populated from search results that request text matches
- // See: search.go and https://developer.github.com/v3/search/#text-match-metadata
- TextMatches []TextMatch `json:"text_matches,omitempty"`
-
- // Permissions identifies the permissions that a user has on a given
- // repository. This is only populated when calling Repositories.ListCollaborators.
- Permissions *map[string]bool `json:"permissions,omitempty"`
-}
-
-func (u User) String() string {
- return Stringify(u)
-}
-
-// Get fetches a user. Passing the empty string will fetch the authenticated
-// user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/#get-a-single-user
-func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v", user)
- } else {
- u = "user"
- }
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- uResp := new(User)
- resp, err := s.client.Do(ctx, req, uResp)
- if err != nil {
- return nil, resp, err
- }
-
- return uResp, resp, nil
-}
-
-// GetByID fetches a user.
-//
-// Note: GetByID uses the undocumented GitHub API endpoint /user/:id.
-func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) {
- u := fmt.Sprintf("user/%d", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- user := new(User)
- resp, err := s.client.Do(ctx, req, user)
- if err != nil {
- return nil, resp, err
- }
-
- return user, resp, nil
-}
-
-// Edit the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/#update-the-authenticated-user
-func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response, error) {
- u := "user"
- req, err := s.client.NewRequest("PATCH", u, user)
- if err != nil {
- return nil, nil, err
- }
-
- uResp := new(User)
- resp, err := s.client.Do(ctx, req, uResp)
- if err != nil {
- return nil, resp, err
- }
-
- return uResp, resp, nil
-}
-
-// UserListOptions specifies optional parameters to the UsersService.ListAll
-// method.
-type UserListOptions struct {
- // ID of the last user seen
- Since int64 `url:"since,omitempty"`
-
- ListOptions
-}
-
-// ListAll lists all GitHub users.
-//
-// To paginate through all users, populate 'Since' with the ID of the last user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/#get-all-users
-func (s *UsersService) ListAll(ctx context.Context, opt *UserListOptions) ([]*User, *Response, error) {
- u, err := addOptions("users", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var users []*User
- resp, err := s.client.Do(ctx, req, &users)
- if err != nil {
- return nil, resp, err
- }
-
- return users, resp, nil
-}
-
-// ListInvitations lists all currently-open repository invitations for the
-// authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-a-users-repository-invitations
-func (s *UsersService) ListInvitations(ctx context.Context, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) {
- u, err := addOptions("user/repository_invitations", opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
-
- invites := []*RepositoryInvitation{}
- resp, err := s.client.Do(ctx, req, &invites)
- if err != nil {
- return nil, resp, err
- }
-
- return invites, resp, nil
-}
-
-// AcceptInvitation accepts the currently-open repository invitation for the
-// authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/invitations/#accept-a-repository-invitation
-func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) (*Response, error) {
- u := fmt.Sprintf("user/repository_invitations/%v", invitationID)
- req, err := s.client.NewRequest("PATCH", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// DeclineInvitation declines the currently-open repository invitation for the
-// authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/invitations/#decline-a-repository-invitation
-func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64) (*Response, error) {
- u := fmt.Sprintf("user/repository_invitations/%v", invitationID)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/users_administration.go b/vendor/github.com/google/go-github/github/users_administration.go
deleted file mode 100644
index e042398d..00000000
--- a/vendor/github.com/google/go-github/github/users_administration.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance.
-//
-// GitHub API docs: https://developer.github.com/v3/users/administration/#promote-an-ordinary-user-to-a-site-administrator
-func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Response, error) {
- u := fmt.Sprintf("users/%v/site_admin", user)
-
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance.
-//
-// GitHub API docs: https://developer.github.com/v3/users/administration/#demote-a-site-administrator-to-an-ordinary-user
-func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Response, error) {
- u := fmt.Sprintf("users/%v/site_admin", user)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// Suspend a user on a GitHub Enterprise instance.
-//
-// GitHub API docs: https://developer.github.com/v3/users/administration/#suspend-a-user
-func (s *UsersService) Suspend(ctx context.Context, user string) (*Response, error) {
- u := fmt.Sprintf("users/%v/suspended", user)
-
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// Unsuspend a user on a GitHub Enterprise instance.
-//
-// GitHub API docs: https://developer.github.com/v3/users/administration/#unsuspend-a-user
-func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) {
- u := fmt.Sprintf("users/%v/suspended", user)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/users_blocking.go b/vendor/github.com/google/go-github/github/users_blocking.go
deleted file mode 100644
index 39e45601..00000000
--- a/vendor/github.com/google/go-github/github/users_blocking.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ListBlockedUsers lists all the blocked users by the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/blocking/#list-blocked-users
-func (s *UsersService) ListBlockedUsers(ctx context.Context, opt *ListOptions) ([]*User, *Response, error) {
- u := "user/blocks"
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
- var blockedUsers []*User
- resp, err := s.client.Do(ctx, req, &blockedUsers)
- if err != nil {
- return nil, resp, err
- }
-
- return blockedUsers, resp, nil
-}
-
-// IsBlocked reports whether specified user is blocked by the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/blocking/#check-whether-youve-blocked-a-user
-func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Response, error) {
- u := fmt.Sprintf("user/blocks/%v", user)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
- resp, err := s.client.Do(ctx, req, nil)
- isBlocked, err := parseBoolResponse(err)
- return isBlocked, resp, err
-}
-
-// BlockUser blocks specified user for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/blocking/#block-a-user
-func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, error) {
- u := fmt.Sprintf("user/blocks/%v", user)
-
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
- return s.client.Do(ctx, req, nil)
-}
-
-// UnblockUser unblocks specified user for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/blocking/#unblock-a-user
-func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, error) {
- u := fmt.Sprintf("user/blocks/%v", user)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/users_emails.go b/vendor/github.com/google/go-github/github/users_emails.go
deleted file mode 100644
index 0bbd4627..00000000
--- a/vendor/github.com/google/go-github/github/users_emails.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import "context"
-
-// UserEmail represents user's email address
-type UserEmail struct {
- Email *string `json:"email,omitempty"`
- Primary *bool `json:"primary,omitempty"`
- Verified *bool `json:"verified,omitempty"`
-}
-
-// ListEmails lists all email addresses for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user
-func (s *UsersService) ListEmails(ctx context.Context, opt *ListOptions) ([]*UserEmail, *Response, error) {
- u := "user/emails"
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var emails []*UserEmail
- resp, err := s.client.Do(ctx, req, &emails)
- if err != nil {
- return nil, resp, err
- }
-
- return emails, resp, nil
-}
-
-// AddEmails adds email addresses of the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/emails/#add-email-addresses
-func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserEmail, *Response, error) {
- u := "user/emails"
- req, err := s.client.NewRequest("POST", u, emails)
- if err != nil {
- return nil, nil, err
- }
-
- var e []*UserEmail
- resp, err := s.client.Do(ctx, req, &e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, nil
-}
-
-// DeleteEmails deletes email addresses from authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/emails/#delete-email-addresses
-func (s *UsersService) DeleteEmails(ctx context.Context, emails []string) (*Response, error) {
- u := "user/emails"
- req, err := s.client.NewRequest("DELETE", u, emails)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/users_followers.go b/vendor/github.com/google/go-github/github/users_followers.go
deleted file mode 100644
index c2224096..00000000
--- a/vendor/github.com/google/go-github/github/users_followers.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// ListFollowers lists the followers for a user. Passing the empty string will
-// fetch followers for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/followers/#list-followers-of-a-user
-func (s *UsersService) ListFollowers(ctx context.Context, user string, opt *ListOptions) ([]*User, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/followers", user)
- } else {
- u = "user/followers"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var users []*User
- resp, err := s.client.Do(ctx, req, &users)
- if err != nil {
- return nil, resp, err
- }
-
- return users, resp, nil
-}
-
-// ListFollowing lists the people that a user is following. Passing the empty
-// string will list people the authenticated user is following.
-//
-// GitHub API docs: https://developer.github.com/v3/users/followers/#list-users-followed-by-another-user
-func (s *UsersService) ListFollowing(ctx context.Context, user string, opt *ListOptions) ([]*User, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/following", user)
- } else {
- u = "user/following"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var users []*User
- resp, err := s.client.Do(ctx, req, &users)
- if err != nil {
- return nil, resp, err
- }
-
- return users, resp, nil
-}
-
-// IsFollowing checks if "user" is following "target". Passing the empty
-// string for "user" will check if the authenticated user is following "target".
-//
-// GitHub API docs: https://developer.github.com/v3/users/followers/#check-if-you-are-following-a-user
-func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bool, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/following/%v", user, target)
- } else {
- u = fmt.Sprintf("user/following/%v", target)
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return false, nil, err
- }
-
- resp, err := s.client.Do(ctx, req, nil)
- following, err := parseBoolResponse(err)
- return following, resp, err
-}
-
-// Follow will cause the authenticated user to follow the specified user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/followers/#follow-a-user
-func (s *UsersService) Follow(ctx context.Context, user string) (*Response, error) {
- u := fmt.Sprintf("user/following/%v", user)
- req, err := s.client.NewRequest("PUT", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
-
-// Unfollow will cause the authenticated user to unfollow the specified user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/followers/#unfollow-a-user
-func (s *UsersService) Unfollow(ctx context.Context, user string) (*Response, error) {
- u := fmt.Sprintf("user/following/%v", user)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/users_gpg_keys.go b/vendor/github.com/google/go-github/github/users_gpg_keys.go
deleted file mode 100644
index d8bbc520..00000000
--- a/vendor/github.com/google/go-github/github/users_gpg_keys.go
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2016 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-// GPGKey represents a GitHub user's public GPG key used to verify GPG signed commits and tags.
-//
-// https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
-type GPGKey struct {
- ID *int64 `json:"id,omitempty"`
- PrimaryKeyID *int64 `json:"primary_key_id,omitempty"`
- KeyID *string `json:"key_id,omitempty"`
- PublicKey *string `json:"public_key,omitempty"`
- Emails []GPGEmail `json:"emails,omitempty"`
- Subkeys []GPGKey `json:"subkeys,omitempty"`
- CanSign *bool `json:"can_sign,omitempty"`
- CanEncryptComms *bool `json:"can_encrypt_comms,omitempty"`
- CanEncryptStorage *bool `json:"can_encrypt_storage,omitempty"`
- CanCertify *bool `json:"can_certify,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- ExpiresAt *time.Time `json:"expires_at,omitempty"`
-}
-
-// String stringifies a GPGKey.
-func (k GPGKey) String() string {
- return Stringify(k)
-}
-
-// GPGEmail represents an email address associated to a GPG key.
-type GPGEmail struct {
- Email *string `json:"email,omitempty"`
- Verified *bool `json:"verified,omitempty"`
-}
-
-// ListGPGKeys lists the public GPG keys for a user. Passing the empty
-// string will fetch keys for the authenticated user. It requires authentication
-// via Basic Auth or via OAuth with at least read:gpg_key scope.
-//
-// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#list-gpg-keys-for-a-user
-func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opt *ListOptions) ([]*GPGKey, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/gpg_keys", user)
- } else {
- u = "user/gpg_keys"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGitSigningPreview)
-
- var keys []*GPGKey
- resp, err := s.client.Do(ctx, req, &keys)
- if err != nil {
- return nil, resp, err
- }
-
- return keys, resp, nil
-}
-
-// GetGPGKey gets extended details for a single GPG key. It requires authentication
-// via Basic Auth or via OAuth with at least read:gpg_key scope.
-//
-// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#get-a-single-gpg-key
-func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Response, error) {
- u := fmt.Sprintf("user/gpg_keys/%v", id)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGitSigningPreview)
-
- key := &GPGKey{}
- resp, err := s.client.Do(ctx, req, key)
- if err != nil {
- return nil, resp, err
- }
-
- return key, resp, nil
-}
-
-// CreateGPGKey creates a GPG key. It requires authenticatation via Basic Auth
-// or OAuth with at least write:gpg_key scope.
-//
-// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#create-a-gpg-key
-func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string) (*GPGKey, *Response, error) {
- gpgKey := &struct {
- ArmoredPublicKey string `json:"armored_public_key"`
- }{ArmoredPublicKey: armoredPublicKey}
- req, err := s.client.NewRequest("POST", "user/gpg_keys", gpgKey)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGitSigningPreview)
-
- key := &GPGKey{}
- resp, err := s.client.Do(ctx, req, key)
- if err != nil {
- return nil, resp, err
- }
-
- return key, resp, nil
-}
-
-// DeleteGPGKey deletes a GPG key. It requires authentication via Basic Auth or
-// via OAuth with at least admin:gpg_key scope.
-//
-// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#delete-a-gpg-key
-func (s *UsersService) DeleteGPGKey(ctx context.Context, id int64) (*Response, error) {
- u := fmt.Sprintf("user/gpg_keys/%v", id)
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeGitSigningPreview)
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/users_keys.go b/vendor/github.com/google/go-github/github/users_keys.go
deleted file mode 100644
index ddc832a1..00000000
--- a/vendor/github.com/google/go-github/github/users_keys.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2013 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package github
-
-import (
- "context"
- "fmt"
-)
-
-// Key represents a public SSH key used to authenticate a user or deploy script.
-type Key struct {
- ID *int64 `json:"id,omitempty"`
- Key *string `json:"key,omitempty"`
- URL *string `json:"url,omitempty"`
- Title *string `json:"title,omitempty"`
- ReadOnly *bool `json:"read_only,omitempty"`
-}
-
-func (k Key) String() string {
- return Stringify(k)
-}
-
-// ListKeys lists the verified public keys for a user. Passing the empty
-// string will fetch keys for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user
-func (s *UsersService) ListKeys(ctx context.Context, user string, opt *ListOptions) ([]*Key, *Response, error) {
- var u string
- if user != "" {
- u = fmt.Sprintf("users/%v/keys", user)
- } else {
- u = "user/keys"
- }
- u, err := addOptions(u, opt)
- if err != nil {
- return nil, nil, err
- }
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- var keys []*Key
- resp, err := s.client.Do(ctx, req, &keys)
- if err != nil {
- return nil, resp, err
- }
-
- return keys, resp, nil
-}
-
-// GetKey fetches a single public key.
-//
-// GitHub API docs: https://developer.github.com/v3/users/keys/#get-a-single-public-key
-func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, error) {
- u := fmt.Sprintf("user/keys/%v", id)
-
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- key := new(Key)
- resp, err := s.client.Do(ctx, req, key)
- if err != nil {
- return nil, resp, err
- }
-
- return key, resp, nil
-}
-
-// CreateKey adds a public key for the authenticated user.
-//
-// GitHub API docs: https://developer.github.com/v3/users/keys/#create-a-public-key
-func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response, error) {
- u := "user/keys"
-
- req, err := s.client.NewRequest("POST", u, key)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(Key)
- resp, err := s.client.Do(ctx, req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, nil
-}
-
-// DeleteKey deletes a public key.
-//
-// GitHub API docs: https://developer.github.com/v3/users/keys/#delete-a-public-key
-func (s *UsersService) DeleteKey(ctx context.Context, id int64) (*Response, error) {
- u := fmt.Sprintf("user/keys/%v", id)
-
- req, err := s.client.NewRequest("DELETE", u, nil)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(ctx, req, nil)
-}
diff --git a/vendor/github.com/google/go-github/github/with_appengine.go b/vendor/github.com/google/go-github/github/with_appengine.go
deleted file mode 100644
index 87a228ad..00000000
--- a/vendor/github.com/google/go-github/github/with_appengine.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build appengine
-
-// This file provides glue for making github work on App Engine.
-// In order to get the entire github package to compile with
-// Go 1.6, you will need to rewrite all the import "context" lines.
-// Fortunately, this is easy with "gofmt":
-//
-// gofmt -w -r '"context" -> "golang.org/x/net/context"' *.go
-
-package github
-
-import (
- "context"
- "net/http"
-)
-
-func withContext(ctx context.Context, req *http.Request) *http.Request {
- // No-op because App Engine adds context to a request differently.
- return req
-}
diff --git a/vendor/github.com/google/go-github/github/without_appengine.go b/vendor/github.com/google/go-github/github/without_appengine.go
deleted file mode 100644
index 6f8fdac5..00000000
--- a/vendor/github.com/google/go-github/github/without_appengine.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 The go-github AUTHORS. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine
-
-// This file provides glue for making github work without App Engine.
-
-package github
-
-import (
- "context"
- "net/http"
-)
-
-func withContext(ctx context.Context, req *http.Request) *http.Request {
- return req.WithContext(ctx)
-}
diff --git a/vendor/github.com/google/go-querystring/LICENSE b/vendor/github.com/google/go-querystring/LICENSE
deleted file mode 100644
index ae121a1e..00000000
--- a/vendor/github.com/google/go-querystring/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2013 Google. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-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.
diff --git a/vendor/github.com/google/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go
deleted file mode 100644
index 37080b19..00000000
--- a/vendor/github.com/google/go-querystring/query/encode.go
+++ /dev/null
@@ -1,320 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package query implements encoding of structs into URL query parameters.
-//
-// As a simple example:
-//
-// type Options struct {
-// Query string `url:"q"`
-// ShowAll bool `url:"all"`
-// Page int `url:"page"`
-// }
-//
-// opt := Options{ "foo", true, 2 }
-// v, _ := query.Values(opt)
-// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2"
-//
-// The exact mapping between Go values and url.Values is described in the
-// documentation for the Values() function.
-package query
-
-import (
- "bytes"
- "fmt"
- "net/url"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-var timeType = reflect.TypeOf(time.Time{})
-
-var encoderType = reflect.TypeOf(new(Encoder)).Elem()
-
-// Encoder is an interface implemented by any type that wishes to encode
-// itself into URL values in a non-standard way.
-type Encoder interface {
- EncodeValues(key string, v *url.Values) error
-}
-
-// Values returns the url.Values encoding of v.
-//
-// Values expects to be passed a struct, and traverses it recursively using the
-// following encoding rules.
-//
-// Each exported struct field is encoded as a URL parameter unless
-//
-// - the field's tag is "-", or
-// - the field is empty and its tag specifies the "omitempty" option
-//
-// The empty values are false, 0, any nil pointer or interface value, any array
-// slice, map, or string of length zero, and any time.Time that returns true
-// for IsZero().
-//
-// The URL parameter name defaults to the struct field name but can be
-// specified in the struct field's tag value. The "url" key in the struct
-// field's tag value is the key name, followed by an optional comma and
-// options. For example:
-//
-// // Field is ignored by this package.
-// Field int `url:"-"`
-//
-// // Field appears as URL parameter "myName".
-// Field int `url:"myName"`
-//
-// // Field appears as URL parameter "myName" and the field is omitted if
-// // its value is empty
-// Field int `url:"myName,omitempty"`
-//
-// // Field appears as URL parameter "Field" (the default), but the field
-// // is skipped if empty. Note the leading comma.
-// Field int `url:",omitempty"`
-//
-// For encoding individual field values, the following type-dependent rules
-// apply:
-//
-// Boolean values default to encoding as the strings "true" or "false".
-// Including the "int" option signals that the field should be encoded as the
-// strings "1" or "0".
-//
-// time.Time values default to encoding as RFC3339 timestamps. Including the
-// "unix" option signals that the field should be encoded as a Unix time (see
-// time.Unix())
-//
-// Slice and Array values default to encoding as multiple URL values of the
-// same name. Including the "comma" option signals that the field should be
-// encoded as a single comma-delimited value. Including the "space" option
-// similarly encodes the value as a single space-delimited string. Including
-// the "semicolon" option will encode the value as a semicolon-delimited string.
-// Including the "brackets" option signals that the multiple URL values should
-// have "[]" appended to the value name. "numbered" will append a number to
-// the end of each incidence of the value name, example:
-// name0=value0&name1=value1, etc.
-//
-// Anonymous struct fields are usually encoded as if their inner exported
-// fields were fields in the outer struct, subject to the standard Go
-// visibility rules. An anonymous struct field with a name given in its URL
-// tag is treated as having that name, rather than being anonymous.
-//
-// Non-nil pointer values are encoded as the value pointed to.
-//
-// Nested structs are encoded including parent fields in value names for
-// scoping. e.g:
-//
-// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO"
-//
-// All other values are encoded using their default string representation.
-//
-// Multiple fields that encode to the same URL parameter name will be included
-// as multiple URL values of the same name.
-func Values(v interface{}) (url.Values, error) {
- values := make(url.Values)
- val := reflect.ValueOf(v)
- for val.Kind() == reflect.Ptr {
- if val.IsNil() {
- return values, nil
- }
- val = val.Elem()
- }
-
- if v == nil {
- return values, nil
- }
-
- if val.Kind() != reflect.Struct {
- return nil, fmt.Errorf("query: Values() expects struct input. Got %v", val.Kind())
- }
-
- err := reflectValue(values, val, "")
- return values, err
-}
-
-// reflectValue populates the values parameter from the struct fields in val.
-// Embedded structs are followed recursively (using the rules defined in the
-// Values function documentation) breadth-first.
-func reflectValue(values url.Values, val reflect.Value, scope string) error {
- var embedded []reflect.Value
-
- typ := val.Type()
- for i := 0; i < typ.NumField(); i++ {
- sf := typ.Field(i)
- if sf.PkgPath != "" && !sf.Anonymous { // unexported
- continue
- }
-
- sv := val.Field(i)
- tag := sf.Tag.Get("url")
- if tag == "-" {
- continue
- }
- name, opts := parseTag(tag)
- if name == "" {
- if sf.Anonymous && sv.Kind() == reflect.Struct {
- // save embedded struct for later processing
- embedded = append(embedded, sv)
- continue
- }
-
- name = sf.Name
- }
-
- if scope != "" {
- name = scope + "[" + name + "]"
- }
-
- if opts.Contains("omitempty") && isEmptyValue(sv) {
- continue
- }
-
- if sv.Type().Implements(encoderType) {
- if !reflect.Indirect(sv).IsValid() {
- sv = reflect.New(sv.Type().Elem())
- }
-
- m := sv.Interface().(Encoder)
- if err := m.EncodeValues(name, &values); err != nil {
- return err
- }
- continue
- }
-
- if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array {
- var del byte
- if opts.Contains("comma") {
- del = ','
- } else if opts.Contains("space") {
- del = ' '
- } else if opts.Contains("semicolon") {
- del = ';'
- } else if opts.Contains("brackets") {
- name = name + "[]"
- }
-
- if del != 0 {
- s := new(bytes.Buffer)
- first := true
- for i := 0; i < sv.Len(); i++ {
- if first {
- first = false
- } else {
- s.WriteByte(del)
- }
- s.WriteString(valueString(sv.Index(i), opts))
- }
- values.Add(name, s.String())
- } else {
- for i := 0; i < sv.Len(); i++ {
- k := name
- if opts.Contains("numbered") {
- k = fmt.Sprintf("%s%d", name, i)
- }
- values.Add(k, valueString(sv.Index(i), opts))
- }
- }
- continue
- }
-
- for sv.Kind() == reflect.Ptr {
- if sv.IsNil() {
- break
- }
- sv = sv.Elem()
- }
-
- if sv.Type() == timeType {
- values.Add(name, valueString(sv, opts))
- continue
- }
-
- if sv.Kind() == reflect.Struct {
- reflectValue(values, sv, name)
- continue
- }
-
- values.Add(name, valueString(sv, opts))
- }
-
- for _, f := range embedded {
- if err := reflectValue(values, f, scope); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// valueString returns the string representation of a value.
-func valueString(v reflect.Value, opts tagOptions) string {
- for v.Kind() == reflect.Ptr {
- if v.IsNil() {
- return ""
- }
- v = v.Elem()
- }
-
- if v.Kind() == reflect.Bool && opts.Contains("int") {
- if v.Bool() {
- return "1"
- }
- return "0"
- }
-
- if v.Type() == timeType {
- t := v.Interface().(time.Time)
- if opts.Contains("unix") {
- return strconv.FormatInt(t.Unix(), 10)
- }
- return t.Format(time.RFC3339)
- }
-
- return fmt.Sprint(v.Interface())
-}
-
-// isEmptyValue checks if a value should be considered empty for the purposes
-// of omitting fields with the "omitempty" option.
-func isEmptyValue(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- 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.Interface, reflect.Ptr:
- return v.IsNil()
- }
-
- if v.Type() == timeType {
- return v.Interface().(time.Time).IsZero()
- }
-
- return false
-}
-
-// tagOptions is the string following a comma in a struct field's "url" tag, or
-// the empty string. It does not include the leading comma.
-type tagOptions []string
-
-// parseTag splits a struct field's url tag into its name and comma-separated
-// options.
-func parseTag(tag string) (string, tagOptions) {
- s := strings.Split(tag, ",")
- return s[0], s[1:]
-}
-
-// Contains checks whether the tagOptions contains the specified option.
-func (o tagOptions) Contains(option string) bool {
- for _, s := range o {
- if s == option {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/hako/durafmt/.gitignore b/vendor/github.com/hako/durafmt/.gitignore
deleted file mode 100644
index daf913b1..00000000
--- a/vendor/github.com/hako/durafmt/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/hako/durafmt/.travis.yml b/vendor/github.com/hako/durafmt/.travis.yml
deleted file mode 100644
index 77f8c12c..00000000
--- a/vendor/github.com/hako/durafmt/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-language: go
-
-go:
- - 1.5
- - 1.6
- - 1.7
- - 1.8
- - 1.9
- - tip
-
-before_install:
- - go get golang.org/x/tools/cmd/cover
-
-script:
- - GOARCH=386 go test # test 32bit architectures.
- - go test -coverprofile=coverage.txt -covermode=atomic
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
-
-sudo: false
diff --git a/vendor/github.com/hako/durafmt/CODE_OF_CONDUCT.md b/vendor/github.com/hako/durafmt/CODE_OF_CONDUCT.md
deleted file mode 100644
index 19a95e51..00000000
--- a/vendor/github.com/hako/durafmt/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at wesley@hakobaito.co.uk. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
-
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
diff --git a/vendor/github.com/hako/durafmt/CONTRIBUTING.md b/vendor/github.com/hako/durafmt/CONTRIBUTING.md
deleted file mode 100644
index bdfb376f..00000000
--- a/vendor/github.com/hako/durafmt/CONTRIBUTING.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Contributing
-
-Contributions are welcome! Fork this repo and add your changes and submit a PR.
-
-If you would like to fix a bug, add a feature or provide feedback you can do so in the issues section.
-
-You can run tests by runnning `go test`. Running `go test; go vet; golint` is recommended.
-
-durafmt is also tested against `gometalinter`.
diff --git a/vendor/github.com/hako/durafmt/LICENSE b/vendor/github.com/hako/durafmt/LICENSE
deleted file mode 100644
index ccb59504..00000000
--- a/vendor/github.com/hako/durafmt/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Wesley Hill
-
-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.
diff --git a/vendor/github.com/hako/durafmt/README.md b/vendor/github.com/hako/durafmt/README.md
deleted file mode 100644
index 6b26faaf..00000000
--- a/vendor/github.com/hako/durafmt/README.md
+++ /dev/null
@@ -1,122 +0,0 @@
-# durafmt
-
-[](https://travis-ci.org/hako/durafmt) [](https://goreportcard.com/report/github.com/hako/durafmt) [](https://codecov.io/gh/hako/durafmt) [](https://godoc.org/github.com/hako/durafmt)
-[](https://www.codetriage.com/hako/durafmt)
-
-
-
-durafmt is a tiny Go library that formats `time.Duration` strings into a human readable format.
-
-```
-go get github.com/hako/durafmt
-```
-
-# Why
-
-If you've worked with `time.Duration` in Go, you most likely have come across this:
-
-```
-53m28.587093086s // :)
-```
-
-The above seems very easy to read, unless your duration looks like this:
-
-```
-354h22m3.24s // :S
-```
-
-# Usage
-
-### durafmt.ParseString()
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/hako/durafmt"
-)
-
-func main() {
- duration, err := durafmt.ParseString("354h22m3.24s")
- if err != nil {
- fmt.Println(err)
- }
- fmt.Println(duration) // 2 weeks 18 hours 22 minutes 3 seconds
- // duration.String() // String representation. "2 weeks 18 hours 22 minutes 3 seconds"
-}
-```
-
-### durafmt.ParseStringShort()
-
-Version of `durafmt.ParseString()` that only returns the first part of the duration string.
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/hako/durafmt"
-)
-
-func main() {
- duration, err := durafmt.ParseStringShort("354h22m3.24s")
- if err != nil {
- fmt.Println(err)
- }
- fmt.Println(duration) // 2 weeks
- // duration.String() // String short representation. "2 weeks"
-}
-```
-
-### durafmt.Parse()
-
-```go
-package main
-
-import (
- "fmt"
- "time"
- "github.com/hako/durafmt"
-)
-
-func main() {
- timeduration := (354 * time.Hour) + (22 * time.Minute) + (3 * time.Second)
- duration := durafmt.Parse(timeduration).String()
- fmt.Println(duration) // 2 weeks 18 hours 22 minutes 3 seconds
-}
-```
-
-### durafmt.ParseShort()
-
-Version of `durafmt.Parse()` that only returns the first part of the duration string.
-
-```go
-package main
-
-import (
- "fmt"
- "time"
- "github.com/hako/durafmt"
-)
-
-func main() {
- timeduration := (354 * time.Hour) + (22 * time.Minute) + (3 * time.Second)
- duration := durafmt.ParseShort(timeduration).String()
- fmt.Println(duration) // 2 weeks
-}
-```
-
-# Contributing
-
-Contributions are welcome! Fork this repo and add your changes and submit a PR.
-
-If you would like to fix a bug, add a feature or provide feedback you can do so in the issues section.
-
-You can run tests by runnning `go test`. Running `go test; go vet; golint` is recommended.
-
-durafmt is also tested against `gometalinter`.
-
-# License
-
-MIT
\ No newline at end of file
diff --git a/vendor/github.com/hako/durafmt/durafmt.go b/vendor/github.com/hako/durafmt/durafmt.go
deleted file mode 100644
index 730237d5..00000000
--- a/vendor/github.com/hako/durafmt/durafmt.go
+++ /dev/null
@@ -1,147 +0,0 @@
-// Package durafmt formats time.Duration into a human readable format.
-package durafmt
-
-import (
- "errors"
- "strconv"
- "strings"
- "time"
-)
-
-var (
- units = []string{"years", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"}
-)
-
-// Durafmt holds the parsed duration and the original input duration.
-type Durafmt struct {
- duration time.Duration
- input string // Used as reference.
- short bool
-}
-
-// Parse creates a new *Durafmt struct, returns error if input is invalid.
-func Parse(dinput time.Duration) *Durafmt {
- input := dinput.String()
- return &Durafmt{dinput, input, false}
-}
-
-// ParseShort creates a new *Durafmt struct, short form, returns error if input is invalid.
-func ParseShort(dinput time.Duration) *Durafmt {
- input := dinput.String()
- return &Durafmt{dinput, input, true}
-}
-
-// ParseString creates a new *Durafmt struct from a string.
-// returns an error if input is invalid.
-func ParseString(input string) (*Durafmt, error) {
- if input == "0" || input == "-0" {
- return nil, errors.New("durafmt: missing unit in duration " + input)
- }
- duration, err := time.ParseDuration(input)
- if err != nil {
- return nil, err
- }
- return &Durafmt{duration, input, false}, nil
-}
-
-// ParseStringShort creates a new *Durafmt struct from a string, short form
-// returns an error if input is invalid.
-func ParseStringShort(input string) (*Durafmt, error) {
- if input == "0" || input == "-0" {
- return nil, errors.New("durafmt: missing unit in duration " + input)
- }
- duration, err := time.ParseDuration(input)
- if err != nil {
- return nil, err
- }
- return &Durafmt{duration, input, true}, nil
-}
-
-// String parses d *Durafmt into a human readable duration.
-func (d *Durafmt) String() string {
- var duration string
-
- // Check for minus durations.
- if string(d.input[0]) == "-" {
- duration += "-"
- d.duration = -d.duration
- }
-
- // Convert duration.
- seconds := int64(d.duration.Seconds()) % 60
- minutes := int64(d.duration.Minutes()) % 60
- hours := int64(d.duration.Hours()) % 24
- days := int64(d.duration/(24*time.Hour)) % 365 % 7
-
- // Edge case between 364 and 365 days.
- // We need to calculate weeks from what is left from years
- leftYearDays := int64(d.duration/(24*time.Hour)) % 365
- weeks := leftYearDays / 7
- if leftYearDays >= 364 && leftYearDays < 365 {
- weeks = 52
- }
-
- years := int64(d.duration/(24*time.Hour)) / 365
- milliseconds := int64(d.duration/time.Millisecond) -
- (seconds * 1000) - (minutes * 60000) - (hours * 3600000) -
- (days * 86400000) - (weeks * 604800000) - (years * 31536000000)
-
- // Create a map of the converted duration time.
- durationMap := map[string]int64{
- "milliseconds": milliseconds,
- "seconds": seconds,
- "minutes": minutes,
- "hours": hours,
- "days": days,
- "weeks": weeks,
- "years": years,
- }
-
- // Construct duration string.
- for _, u := range units {
- v := durationMap[u]
- strval := strconv.FormatInt(v, 10)
- switch {
- // add to the duration string if v > 1.
- case v > 1:
- duration += strval + " " + u + " "
- // remove the plural 's', if v is 1.
- case v == 1:
- duration += strval + " " + strings.TrimRight(u, "s") + " "
- // omit any value with 0s or 0.
- case d.duration.String() == "0" || d.duration.String() == "0s":
- // note: milliseconds and minutes have the same suffix (m)
- // so we have to check if the units match with the suffix.
-
- // check for a suffix that is NOT the milliseconds suffix.
- if strings.HasSuffix(d.input, string(u[0])) && !strings.Contains(d.input, "ms") {
- // if it happens that the units are milliseconds, skip.
- if u == "milliseconds" {
- continue
- }
- duration += strval + " " + u
- }
- // process milliseconds here.
- if u == "milliseconds" {
- if strings.Contains(d.input, "ms") {
- duration += strval + " " + u
- break
- }
- }
- break
- // omit any value with 0.
- case v == 0:
- continue
- }
- }
- // trim any remaining spaces.
- duration = strings.TrimSpace(duration)
-
- // if more than 2 spaces present return the first 2 strings
- // if short version is requested
- if d.short {
- duration = strings.Join(strings.Split(duration, " ")[:2], " ")
- }
-
- return duration
-}
diff --git a/vendor/github.com/jbenet/go-context/LICENSE b/vendor/github.com/jbenet/go-context/LICENSE
deleted file mode 100644
index c7386b3c..00000000
--- a/vendor/github.com/jbenet/go-context/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Juan Batiz-Benet
-
-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.
diff --git a/vendor/github.com/jbenet/go-context/io/ctxio.go b/vendor/github.com/jbenet/go-context/io/ctxio.go
deleted file mode 100644
index b4f24542..00000000
--- a/vendor/github.com/jbenet/go-context/io/ctxio.go
+++ /dev/null
@@ -1,120 +0,0 @@
-// Package ctxio provides io.Reader and io.Writer wrappers that
-// respect context.Contexts. Use these at the interface between
-// your context code and your io.
-//
-// WARNING: read the code. see how writes and reads will continue
-// until you cancel the io. Maybe this package should provide
-// versions of io.ReadCloser and io.WriteCloser that automatically
-// call .Close when the context expires. But for now -- since in my
-// use cases I have long-lived connections with ephemeral io wrappers
-// -- this has yet to be a need.
-package ctxio
-
-import (
- "io"
-
- context "golang.org/x/net/context"
-)
-
-type ioret struct {
- n int
- err error
-}
-
-type Writer interface {
- io.Writer
-}
-
-type ctxWriter struct {
- w io.Writer
- ctx context.Context
-}
-
-// NewWriter wraps a writer to make it respect given Context.
-// If there is a blocking write, the returned Writer will return
-// whenever the context is cancelled (the return values are n=0
-// and err=ctx.Err().)
-//
-// Note well: this wrapper DOES NOT ACTUALLY cancel the underlying
-// write-- there is no way to do that with the standard go io
-// interface. So the read and write _will_ happen or hang. So, use
-// this sparingly, make sure to cancel the read or write as necesary
-// (e.g. closing a connection whose context is up, etc.)
-//
-// Furthermore, in order to protect your memory from being read
-// _after_ you've cancelled the context, this io.Writer will
-// first make a **copy** of the buffer.
-func NewWriter(ctx context.Context, w io.Writer) *ctxWriter {
- if ctx == nil {
- ctx = context.Background()
- }
- return &ctxWriter{ctx: ctx, w: w}
-}
-
-func (w *ctxWriter) Write(buf []byte) (int, error) {
- buf2 := make([]byte, len(buf))
- copy(buf2, buf)
-
- c := make(chan ioret, 1)
-
- go func() {
- n, err := w.w.Write(buf2)
- c <- ioret{n, err}
- close(c)
- }()
-
- select {
- case r := <-c:
- return r.n, r.err
- case <-w.ctx.Done():
- return 0, w.ctx.Err()
- }
-}
-
-type Reader interface {
- io.Reader
-}
-
-type ctxReader struct {
- r io.Reader
- ctx context.Context
-}
-
-// NewReader wraps a reader to make it respect given Context.
-// If there is a blocking read, the returned Reader will return
-// whenever the context is cancelled (the return values are n=0
-// and err=ctx.Err().)
-//
-// Note well: this wrapper DOES NOT ACTUALLY cancel the underlying
-// write-- there is no way to do that with the standard go io
-// interface. So the read and write _will_ happen or hang. So, use
-// this sparingly, make sure to cancel the read or write as necesary
-// (e.g. closing a connection whose context is up, etc.)
-//
-// Furthermore, in order to protect your memory from being read
-// _before_ you've cancelled the context, this io.Reader will
-// allocate a buffer of the same size, and **copy** into the client's
-// if the read succeeds in time.
-func NewReader(ctx context.Context, r io.Reader) *ctxReader {
- return &ctxReader{ctx: ctx, r: r}
-}
-
-func (r *ctxReader) Read(buf []byte) (int, error) {
- buf2 := make([]byte, len(buf))
-
- c := make(chan ioret, 1)
-
- go func() {
- n, err := r.r.Read(buf2)
- c <- ioret{n, err}
- close(c)
- }()
-
- select {
- case ret := <-c:
- copy(buf, buf2)
- return ret.n, ret.err
- case <-r.ctx.Done():
- return 0, r.ctx.Err()
- }
-}
diff --git a/vendor/github.com/jessevdk/go-flags/.travis.yml b/vendor/github.com/jessevdk/go-flags/.travis.yml
deleted file mode 100644
index 0f0728d2..00000000
--- a/vendor/github.com/jessevdk/go-flags/.travis.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-language: go
-
-os:
- - linux
- - osx
-
-go:
- - 1.x
- - 1.7.x
- - 1.8.x
- - 1.9.x
- - 1.10.x
-
-install:
- # go-flags
- - go get -d -v ./...
- - go build -v ./...
-
- # linting
- - go get github.com/golang/lint/golint
-
- # code coverage
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/onsi/ginkgo/ginkgo
- - go get github.com/modocache/gover
- - if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then go get github.com/mattn/goveralls; fi
-
-script:
- # go-flags
- - $(exit $(gofmt -l . | wc -l))
- - go test -v ./...
-
- # linting
- - go tool vet -all=true -v=true . || true
- - $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/golint ./...
-
- # code coverage
- - $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/ginkgo -r -cover
- - $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/gover
- - if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/goveralls -coverprofile=gover.coverprofile -service=travis-ci -repotoken $COVERALLS_TOKEN; fi
-
-env:
- # coveralls.io
- secure: "RCYbiB4P0RjQRIoUx/vG/AjP3mmYCbzOmr86DCww1Z88yNcy3hYr3Cq8rpPtYU5v0g7wTpu4adaKIcqRE9xknYGbqj3YWZiCoBP1/n4Z+9sHW3Dsd9D/GRGeHUus0laJUGARjWoCTvoEtOgTdGQDoX7mH+pUUY0FBltNYUdOiiU="
diff --git a/vendor/github.com/jessevdk/go-flags/LICENSE b/vendor/github.com/jessevdk/go-flags/LICENSE
deleted file mode 100644
index bcca0d52..00000000
--- a/vendor/github.com/jessevdk/go-flags/LICENSE
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 2012 Jesse van den Kieboom. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following disclaimer
- in the documentation and/or other materials provided with the
- distribution.
- * Neither the name of Google Inc. nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-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.
diff --git a/vendor/github.com/jessevdk/go-flags/README.md b/vendor/github.com/jessevdk/go-flags/README.md
deleted file mode 100644
index 3b02394e..00000000
--- a/vendor/github.com/jessevdk/go-flags/README.md
+++ /dev/null
@@ -1,134 +0,0 @@
-go-flags: a go library for parsing command line arguments
-=========================================================
-
-[](https://godoc.org/github.com/jessevdk/go-flags) [](https://travis-ci.org/jessevdk/go-flags) [](https://coveralls.io/r/jessevdk/go-flags?branch=master)
-
-This library provides similar functionality to the builtin flag library of
-go, but provides much more functionality and nicer formatting. From the
-documentation:
-
-Package flags provides an extensive command line option parser.
-The flags package is similar in functionality to the go builtin flag package
-but provides more options and uses reflection to provide a convenient and
-succinct way of specifying command line options.
-
-Supported features:
-* Options with short names (-v)
-* Options with long names (--verbose)
-* Options with and without arguments (bool v.s. other type)
-* Options with optional arguments and default values
-* Multiple option groups each containing a set of options
-* Generate and print well-formatted help message
-* Passing remaining command line arguments after -- (optional)
-* Ignoring unknown command line options (optional)
-* Supports -I/usr/include -I=/usr/include -I /usr/include option argument specification
-* Supports multiple short options -aux
-* Supports all primitive go types (string, int{8..64}, uint{8..64}, float)
-* Supports same option multiple times (can store in slice or last option counts)
-* Supports maps
-* Supports function callbacks
-* Supports namespaces for (nested) option groups
-
-The flags package uses structs, reflection and struct field tags
-to allow users to specify command line options. This results in very simple
-and concise specification of your application options. For example:
-
-```go
-type Options struct {
- Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
-}
-```
-
-This specifies one option with a short name -v and a long name --verbose.
-When either -v or --verbose is found on the command line, a 'true' value
-will be appended to the Verbose field. e.g. when specifying -vvv, the
-resulting value of Verbose will be {[true, true, true]}.
-
-Example:
---------
-```go
-var opts struct {
- // Slice of bool will append 'true' each time the option
- // is encountered (can be set multiple times, like -vvv)
- Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
-
- // Example of automatic marshalling to desired type (uint)
- Offset uint `long:"offset" description:"Offset"`
-
- // Example of a callback, called each time the option is found.
- Call func(string) `short:"c" description:"Call phone number"`
-
- // Example of a required flag
- Name string `short:"n" long:"name" description:"A name" required:"true"`
-
- // Example of a value name
- File string `short:"f" long:"file" description:"A file" value-name:"FILE"`
-
- // Example of a pointer
- Ptr *int `short:"p" description:"A pointer to an integer"`
-
- // Example of a slice of strings
- StringSlice []string `short:"s" description:"A slice of strings"`
-
- // Example of a slice of pointers
- PtrSlice []*string `long:"ptrslice" description:"A slice of pointers to string"`
-
- // Example of a map
- IntMap map[string]int `long:"intmap" description:"A map from string to int"`
-}
-
-// Callback which will invoke callto: to call a number.
-// Note that this works just on OS X (and probably only with
-// Skype) but it shows the idea.
-opts.Call = func(num string) {
- cmd := exec.Command("open", "callto:"+num)
- cmd.Start()
- cmd.Process.Release()
-}
-
-// Make some fake arguments to parse.
-args := []string{
- "-vv",
- "--offset=5",
- "-n", "Me",
- "-p", "3",
- "-s", "hello",
- "-s", "world",
- "--ptrslice", "hello",
- "--ptrslice", "world",
- "--intmap", "a:1",
- "--intmap", "b:5",
- "arg1",
- "arg2",
- "arg3",
-}
-
-// Parse flags from `args'. Note that here we use flags.ParseArgs for
-// the sake of making a working example. Normally, you would simply use
-// flags.Parse(&opts) which uses os.Args
-args, err := flags.ParseArgs(&opts, args)
-
-if err != nil {
- panic(err)
-}
-
-fmt.Printf("Verbosity: %v\n", opts.Verbose)
-fmt.Printf("Offset: %d\n", opts.Offset)
-fmt.Printf("Name: %s\n", opts.Name)
-fmt.Printf("Ptr: %d\n", *opts.Ptr)
-fmt.Printf("StringSlice: %v\n", opts.StringSlice)
-fmt.Printf("PtrSlice: [%v %v]\n", *opts.PtrSlice[0], *opts.PtrSlice[1])
-fmt.Printf("IntMap: [a:%v b:%v]\n", opts.IntMap["a"], opts.IntMap["b"])
-fmt.Printf("Remaining args: %s\n", strings.Join(args, " "))
-
-// Output: Verbosity: [true true]
-// Offset: 5
-// Name: Me
-// Ptr: 3
-// StringSlice: [hello world]
-// PtrSlice: [hello world]
-// IntMap: [a:1 b:5]
-// Remaining args: arg1 arg2 arg3
-```
-
-More information can be found in the godocs:
diff --git a/vendor/github.com/jessevdk/go-flags/arg.go b/vendor/github.com/jessevdk/go-flags/arg.go
deleted file mode 100644
index 8ec62048..00000000
--- a/vendor/github.com/jessevdk/go-flags/arg.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package flags
-
-import (
- "reflect"
-)
-
-// Arg represents a positional argument on the command line.
-type Arg struct {
- // The name of the positional argument (used in the help)
- Name string
-
- // A description of the positional argument (used in the help)
- Description string
-
- // The minimal number of required positional arguments
- Required int
-
- // The maximum number of required positional arguments
- RequiredMaximum int
-
- value reflect.Value
- tag multiTag
-}
-
-func (a *Arg) isRemaining() bool {
- return a.value.Type().Kind() == reflect.Slice
-}
diff --git a/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh b/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh
deleted file mode 100755
index c494f611..00000000
--- a/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-set -e
-
-echo '# linux arm7'
-GOARM=7 GOARCH=arm GOOS=linux go build
-echo '# linux arm5'
-GOARM=5 GOARCH=arm GOOS=linux go build
-echo '# windows 386'
-GOARCH=386 GOOS=windows go build
-echo '# windows amd64'
-GOARCH=amd64 GOOS=windows go build
-echo '# darwin'
-GOARCH=amd64 GOOS=darwin go build
-echo '# freebsd'
-GOARCH=amd64 GOOS=freebsd go build
diff --git a/vendor/github.com/jessevdk/go-flags/closest.go b/vendor/github.com/jessevdk/go-flags/closest.go
deleted file mode 100644
index 3b518757..00000000
--- a/vendor/github.com/jessevdk/go-flags/closest.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package flags
-
-func levenshtein(s string, t string) int {
- if len(s) == 0 {
- return len(t)
- }
-
- if len(t) == 0 {
- return len(s)
- }
-
- dists := make([][]int, len(s)+1)
- for i := range dists {
- dists[i] = make([]int, len(t)+1)
- dists[i][0] = i
- }
-
- for j := range t {
- dists[0][j] = j
- }
-
- for i, sc := range s {
- for j, tc := range t {
- if sc == tc {
- dists[i+1][j+1] = dists[i][j]
- } else {
- dists[i+1][j+1] = dists[i][j] + 1
- if dists[i+1][j] < dists[i+1][j+1] {
- dists[i+1][j+1] = dists[i+1][j] + 1
- }
- if dists[i][j+1] < dists[i+1][j+1] {
- dists[i+1][j+1] = dists[i][j+1] + 1
- }
- }
- }
- }
-
- return dists[len(s)][len(t)]
-}
-
-func closestChoice(cmd string, choices []string) (string, int) {
- if len(choices) == 0 {
- return "", 0
- }
-
- mincmd := -1
- mindist := -1
-
- for i, c := range choices {
- l := levenshtein(cmd, c)
-
- if mincmd < 0 || l < mindist {
- mindist = l
- mincmd = i
- }
- }
-
- return choices[mincmd], mindist
-}
diff --git a/vendor/github.com/jessevdk/go-flags/command.go b/vendor/github.com/jessevdk/go-flags/command.go
deleted file mode 100644
index 486bacba..00000000
--- a/vendor/github.com/jessevdk/go-flags/command.go
+++ /dev/null
@@ -1,465 +0,0 @@
-package flags
-
-import (
- "reflect"
- "sort"
- "strconv"
- "strings"
-)
-
-// Command represents an application command. Commands can be added to the
-// parser (which itself is a command) and are selected/executed when its name
-// is specified on the command line. The Command type embeds a Group and
-// therefore also carries a set of command specific options.
-type Command struct {
- // Embedded, see Group for more information
- *Group
-
- // The name by which the command can be invoked
- Name string
-
- // The active sub command (set by parsing) or nil
- Active *Command
-
- // Whether subcommands are optional
- SubcommandsOptional bool
-
- // Aliases for the command
- Aliases []string
-
- // Whether positional arguments are required
- ArgsRequired bool
-
- commands []*Command
- hasBuiltinHelpGroup bool
- args []*Arg
-}
-
-// Commander is an interface which can be implemented by any command added in
-// the options. When implemented, the Execute method will be called for the last
-// specified (sub)command providing the remaining command line arguments.
-type Commander interface {
- // Execute will be called for the last active (sub)command. The
- // args argument contains the remaining command line arguments. The
- // error that Execute returns will be eventually passed out of the
- // Parse method of the Parser.
- Execute(args []string) error
-}
-
-// Usage is an interface which can be implemented to show a custom usage string
-// in the help message shown for a command.
-type Usage interface {
- // Usage is called for commands to allow customized printing of command
- // usage in the generated help message.
- Usage() string
-}
-
-type lookup struct {
- shortNames map[string]*Option
- longNames map[string]*Option
-
- commands map[string]*Command
-}
-
-// AddCommand adds a new command to the parser with the given name and data. The
-// data needs to be a pointer to a struct from which the fields indicate which
-// options are in the command. The provided data can implement the Command and
-// Usage interfaces.
-func (c *Command) AddCommand(command string, shortDescription string, longDescription string, data interface{}) (*Command, error) {
- cmd := newCommand(command, shortDescription, longDescription, data)
-
- cmd.parent = c
-
- if err := cmd.scan(); err != nil {
- return nil, err
- }
-
- c.commands = append(c.commands, cmd)
- return cmd, nil
-}
-
-// AddGroup adds a new group to the command with the given name and data. The
-// data needs to be a pointer to a struct from which the fields indicate which
-// options are in the group.
-func (c *Command) AddGroup(shortDescription string, longDescription string, data interface{}) (*Group, error) {
- group := newGroup(shortDescription, longDescription, data)
-
- group.parent = c
-
- if err := group.scanType(c.scanSubcommandHandler(group)); err != nil {
- return nil, err
- }
-
- c.groups = append(c.groups, group)
- return group, nil
-}
-
-// Commands returns a list of subcommands of this command.
-func (c *Command) Commands() []*Command {
- return c.commands
-}
-
-// Find locates the subcommand with the given name and returns it. If no such
-// command can be found Find will return nil.
-func (c *Command) Find(name string) *Command {
- for _, cc := range c.commands {
- if cc.match(name) {
- return cc
- }
- }
-
- return nil
-}
-
-// FindOptionByLongName finds an option that is part of the command, or any of
-// its parent commands, by matching its long name (including the option
-// namespace).
-func (c *Command) FindOptionByLongName(longName string) (option *Option) {
- for option == nil && c != nil {
- option = c.Group.FindOptionByLongName(longName)
-
- c, _ = c.parent.(*Command)
- }
-
- return option
-}
-
-// FindOptionByShortName finds an option that is part of the command, or any of
-// its parent commands, by matching its long name (including the option
-// namespace).
-func (c *Command) FindOptionByShortName(shortName rune) (option *Option) {
- for option == nil && c != nil {
- option = c.Group.FindOptionByShortName(shortName)
-
- c, _ = c.parent.(*Command)
- }
-
- return option
-}
-
-// Args returns a list of positional arguments associated with this command.
-func (c *Command) Args() []*Arg {
- ret := make([]*Arg, len(c.args))
- copy(ret, c.args)
-
- return ret
-}
-
-func newCommand(name string, shortDescription string, longDescription string, data interface{}) *Command {
- return &Command{
- Group: newGroup(shortDescription, longDescription, data),
- Name: name,
- }
-}
-
-func (c *Command) scanSubcommandHandler(parentg *Group) scanHandler {
- f := func(realval reflect.Value, sfield *reflect.StructField) (bool, error) {
- mtag := newMultiTag(string(sfield.Tag))
-
- if err := mtag.Parse(); err != nil {
- return true, err
- }
-
- positional := mtag.Get("positional-args")
-
- if len(positional) != 0 {
- stype := realval.Type()
-
- for i := 0; i < stype.NumField(); i++ {
- field := stype.Field(i)
-
- m := newMultiTag((string(field.Tag)))
-
- if err := m.Parse(); err != nil {
- return true, err
- }
-
- name := m.Get("positional-arg-name")
-
- if len(name) == 0 {
- name = field.Name
- }
-
- required := -1
- requiredMaximum := -1
-
- sreq := m.Get("required")
-
- if sreq != "" {
- required = 1
-
- rng := strings.SplitN(sreq, "-", 2)
-
- if len(rng) > 1 {
- if preq, err := strconv.ParseInt(rng[0], 10, 32); err == nil {
- required = int(preq)
- }
-
- if preq, err := strconv.ParseInt(rng[1], 10, 32); err == nil {
- requiredMaximum = int(preq)
- }
- } else {
- if preq, err := strconv.ParseInt(sreq, 10, 32); err == nil {
- required = int(preq)
- }
- }
- }
-
- arg := &Arg{
- Name: name,
- Description: m.Get("description"),
- Required: required,
- RequiredMaximum: requiredMaximum,
-
- value: realval.Field(i),
- tag: m,
- }
-
- c.args = append(c.args, arg)
-
- if len(mtag.Get("required")) != 0 {
- c.ArgsRequired = true
- }
- }
-
- return true, nil
- }
-
- subcommand := mtag.Get("command")
-
- if len(subcommand) != 0 {
- var ptrval reflect.Value
-
- if realval.Kind() == reflect.Ptr {
- ptrval = realval
-
- if ptrval.IsNil() {
- ptrval.Set(reflect.New(ptrval.Type().Elem()))
- }
- } else {
- ptrval = realval.Addr()
- }
-
- shortDescription := mtag.Get("description")
- longDescription := mtag.Get("long-description")
- subcommandsOptional := mtag.Get("subcommands-optional")
- aliases := mtag.GetMany("alias")
-
- subc, err := c.AddCommand(subcommand, shortDescription, longDescription, ptrval.Interface())
-
- if err != nil {
- return true, err
- }
-
- subc.Hidden = mtag.Get("hidden") != ""
-
- if len(subcommandsOptional) > 0 {
- subc.SubcommandsOptional = true
- }
-
- if len(aliases) > 0 {
- subc.Aliases = aliases
- }
-
- return true, nil
- }
-
- return parentg.scanSubGroupHandler(realval, sfield)
- }
-
- return f
-}
-
-func (c *Command) scan() error {
- return c.scanType(c.scanSubcommandHandler(c.Group))
-}
-
-func (c *Command) eachOption(f func(*Command, *Group, *Option)) {
- c.eachCommand(func(c *Command) {
- c.eachGroup(func(g *Group) {
- for _, option := range g.options {
- f(c, g, option)
- }
- })
- }, true)
-}
-
-func (c *Command) eachCommand(f func(*Command), recurse bool) {
- f(c)
-
- for _, cc := range c.commands {
- if recurse {
- cc.eachCommand(f, true)
- } else {
- f(cc)
- }
- }
-}
-
-func (c *Command) eachActiveGroup(f func(cc *Command, g *Group)) {
- c.eachGroup(func(g *Group) {
- f(c, g)
- })
-
- if c.Active != nil {
- c.Active.eachActiveGroup(f)
- }
-}
-
-func (c *Command) addHelpGroups(showHelp func() error) {
- if !c.hasBuiltinHelpGroup {
- c.addHelpGroup(showHelp)
- c.hasBuiltinHelpGroup = true
- }
-
- for _, cc := range c.commands {
- cc.addHelpGroups(showHelp)
- }
-}
-
-func (c *Command) makeLookup() lookup {
- ret := lookup{
- shortNames: make(map[string]*Option),
- longNames: make(map[string]*Option),
- commands: make(map[string]*Command),
- }
-
- parent := c.parent
-
- var parents []*Command
-
- for parent != nil {
- if cmd, ok := parent.(*Command); ok {
- parents = append(parents, cmd)
- parent = cmd.parent
- } else {
- parent = nil
- }
- }
-
- for i := len(parents) - 1; i >= 0; i-- {
- parents[i].fillLookup(&ret, true)
- }
-
- c.fillLookup(&ret, false)
- return ret
-}
-
-func (c *Command) fillLookup(ret *lookup, onlyOptions bool) {
- c.eachGroup(func(g *Group) {
- for _, option := range g.options {
- if option.ShortName != 0 {
- ret.shortNames[string(option.ShortName)] = option
- }
-
- if len(option.LongName) > 0 {
- ret.longNames[option.LongNameWithNamespace()] = option
- }
- }
- })
-
- if onlyOptions {
- return
- }
-
- for _, subcommand := range c.commands {
- ret.commands[subcommand.Name] = subcommand
-
- for _, a := range subcommand.Aliases {
- ret.commands[a] = subcommand
- }
- }
-}
-
-func (c *Command) groupByName(name string) *Group {
- if grp := c.Group.groupByName(name); grp != nil {
- return grp
- }
-
- for _, subc := range c.commands {
- prefix := subc.Name + "."
-
- if strings.HasPrefix(name, prefix) {
- if grp := subc.groupByName(name[len(prefix):]); grp != nil {
- return grp
- }
- } else if name == subc.Name {
- return subc.Group
- }
- }
-
- return nil
-}
-
-type commandList []*Command
-
-func (c commandList) Less(i, j int) bool {
- return c[i].Name < c[j].Name
-}
-
-func (c commandList) Len() int {
- return len(c)
-}
-
-func (c commandList) Swap(i, j int) {
- c[i], c[j] = c[j], c[i]
-}
-
-func (c *Command) sortedVisibleCommands() []*Command {
- ret := commandList(c.visibleCommands())
- sort.Sort(ret)
-
- return []*Command(ret)
-}
-
-func (c *Command) visibleCommands() []*Command {
- ret := make([]*Command, 0, len(c.commands))
-
- for _, cmd := range c.commands {
- if !cmd.Hidden {
- ret = append(ret, cmd)
- }
- }
-
- return ret
-}
-
-func (c *Command) match(name string) bool {
- if c.Name == name {
- return true
- }
-
- for _, v := range c.Aliases {
- if v == name {
- return true
- }
- }
-
- return false
-}
-
-func (c *Command) hasCliOptions() bool {
- ret := false
-
- c.eachGroup(func(g *Group) {
- if g.isBuiltinHelp {
- return
- }
-
- for _, opt := range g.options {
- if opt.canCli() {
- ret = true
- }
- }
- })
-
- return ret
-}
-
-func (c *Command) fillParseState(s *parseState) {
- s.positional = make([]*Arg, len(c.args))
- copy(s.positional, c.args)
-
- s.lookup = c.makeLookup()
- s.command = c
-}
diff --git a/vendor/github.com/jessevdk/go-flags/completion.go b/vendor/github.com/jessevdk/go-flags/completion.go
deleted file mode 100644
index 7a7a08b9..00000000
--- a/vendor/github.com/jessevdk/go-flags/completion.go
+++ /dev/null
@@ -1,309 +0,0 @@
-package flags
-
-import (
- "fmt"
- "path/filepath"
- "reflect"
- "sort"
- "strings"
- "unicode/utf8"
-)
-
-// Completion is a type containing information of a completion.
-type Completion struct {
- // The completed item
- Item string
-
- // A description of the completed item (optional)
- Description string
-}
-
-type completions []Completion
-
-func (c completions) Len() int {
- return len(c)
-}
-
-func (c completions) Less(i, j int) bool {
- return c[i].Item < c[j].Item
-}
-
-func (c completions) Swap(i, j int) {
- c[i], c[j] = c[j], c[i]
-}
-
-// Completer is an interface which can be implemented by types
-// to provide custom command line argument completion.
-type Completer interface {
- // Complete receives a prefix representing a (partial) value
- // for its type and should provide a list of possible valid
- // completions.
- Complete(match string) []Completion
-}
-
-type completion struct {
- parser *Parser
-}
-
-// Filename is a string alias which provides filename completion.
-type Filename string
-
-func completionsWithoutDescriptions(items []string) []Completion {
- ret := make([]Completion, len(items))
-
- for i, v := range items {
- ret[i].Item = v
- }
-
- return ret
-}
-
-// Complete returns a list of existing files with the given
-// prefix.
-func (f *Filename) Complete(match string) []Completion {
- ret, _ := filepath.Glob(match + "*")
- return completionsWithoutDescriptions(ret)
-}
-
-func (c *completion) skipPositional(s *parseState, n int) {
- if n >= len(s.positional) {
- s.positional = nil
- } else {
- s.positional = s.positional[n:]
- }
-}
-
-func (c *completion) completeOptionNames(s *parseState, prefix string, match string, short bool) []Completion {
- if short && len(match) != 0 {
- return []Completion{
- Completion{
- Item: prefix + match,
- },
- }
- }
-
- var results []Completion
- repeats := map[string]bool{}
-
- for name, opt := range s.lookup.longNames {
- if strings.HasPrefix(name, match) && !opt.Hidden {
- results = append(results, Completion{
- Item: defaultLongOptDelimiter + name,
- Description: opt.Description,
- })
-
- if short {
- repeats[string(opt.ShortName)] = true
- }
- }
- }
-
- if short {
- for name, opt := range s.lookup.shortNames {
- if _, exist := repeats[name]; !exist && strings.HasPrefix(name, match) && !opt.Hidden {
- results = append(results, Completion{
- Item: string(defaultShortOptDelimiter) + name,
- Description: opt.Description,
- })
- }
- }
- }
-
- return results
-}
-
-func (c *completion) completeNamesForLongPrefix(s *parseState, prefix string, match string) []Completion {
- return c.completeOptionNames(s, prefix, match, false)
-}
-
-func (c *completion) completeNamesForShortPrefix(s *parseState, prefix string, match string) []Completion {
- return c.completeOptionNames(s, prefix, match, true)
-}
-
-func (c *completion) completeCommands(s *parseState, match string) []Completion {
- n := make([]Completion, 0, len(s.command.commands))
-
- for _, cmd := range s.command.commands {
- if cmd.data != c && strings.HasPrefix(cmd.Name, match) {
- n = append(n, Completion{
- Item: cmd.Name,
- Description: cmd.ShortDescription,
- })
- }
- }
-
- return n
-}
-
-func (c *completion) completeValue(value reflect.Value, prefix string, match string) []Completion {
- if value.Kind() == reflect.Slice {
- value = reflect.New(value.Type().Elem())
- }
- i := value.Interface()
-
- var ret []Completion
-
- if cmp, ok := i.(Completer); ok {
- ret = cmp.Complete(match)
- } else if value.CanAddr() {
- if cmp, ok = value.Addr().Interface().(Completer); ok {
- ret = cmp.Complete(match)
- }
- }
-
- for i, v := range ret {
- ret[i].Item = prefix + v.Item
- }
-
- return ret
-}
-
-func (c *completion) complete(args []string) []Completion {
- if len(args) == 0 {
- args = []string{""}
- }
-
- s := &parseState{
- args: args,
- }
-
- c.parser.fillParseState(s)
-
- var opt *Option
-
- for len(s.args) > 1 {
- arg := s.pop()
-
- if (c.parser.Options&PassDoubleDash) != None && arg == "--" {
- opt = nil
- c.skipPositional(s, len(s.args)-1)
-
- break
- }
-
- if argumentIsOption(arg) {
- prefix, optname, islong := stripOptionPrefix(arg)
- optname, _, argument := splitOption(prefix, optname, islong)
-
- if argument == nil {
- var o *Option
- canarg := true
-
- if islong {
- o = s.lookup.longNames[optname]
- } else {
- for i, r := range optname {
- sname := string(r)
- o = s.lookup.shortNames[sname]
-
- if o == nil {
- break
- }
-
- if i == 0 && o.canArgument() && len(optname) != len(sname) {
- canarg = false
- break
- }
- }
- }
-
- if o == nil && (c.parser.Options&PassAfterNonOption) != None {
- opt = nil
- c.skipPositional(s, len(s.args)-1)
-
- break
- } else if o != nil && o.canArgument() && !o.OptionalArgument && canarg {
- if len(s.args) > 1 {
- s.pop()
- } else {
- opt = o
- }
- }
- }
- } else {
- if len(s.positional) > 0 {
- if !s.positional[0].isRemaining() {
- // Don't advance beyond a remaining positional arg (because
- // it consumes all subsequent args).
- s.positional = s.positional[1:]
- }
- } else if cmd, ok := s.lookup.commands[arg]; ok {
- cmd.fillParseState(s)
- }
-
- opt = nil
- }
- }
-
- lastarg := s.args[len(s.args)-1]
- var ret []Completion
-
- if opt != nil {
- // Completion for the argument of 'opt'
- ret = c.completeValue(opt.value, "", lastarg)
- } else if argumentStartsOption(lastarg) {
- // Complete the option
- prefix, optname, islong := stripOptionPrefix(lastarg)
- optname, split, argument := splitOption(prefix, optname, islong)
-
- if argument == nil && !islong {
- rname, n := utf8.DecodeRuneInString(optname)
- sname := string(rname)
-
- if opt := s.lookup.shortNames[sname]; opt != nil && opt.canArgument() {
- ret = c.completeValue(opt.value, prefix+sname, optname[n:])
- } else {
- ret = c.completeNamesForShortPrefix(s, prefix, optname)
- }
- } else if argument != nil {
- if islong {
- opt = s.lookup.longNames[optname]
- } else {
- opt = s.lookup.shortNames[optname]
- }
-
- if opt != nil {
- ret = c.completeValue(opt.value, prefix+optname+split, *argument)
- }
- } else if islong {
- ret = c.completeNamesForLongPrefix(s, prefix, optname)
- } else {
- ret = c.completeNamesForShortPrefix(s, prefix, optname)
- }
- } else if len(s.positional) > 0 {
- // Complete for positional argument
- ret = c.completeValue(s.positional[0].value, "", lastarg)
- } else if len(s.command.commands) > 0 {
- // Complete for command
- ret = c.completeCommands(s, lastarg)
- }
-
- sort.Sort(completions(ret))
- return ret
-}
-
-func (c *completion) print(items []Completion, showDescriptions bool) {
- if showDescriptions && len(items) > 1 {
- maxl := 0
-
- for _, v := range items {
- if len(v.Item) > maxl {
- maxl = len(v.Item)
- }
- }
-
- for _, v := range items {
- fmt.Printf("%s", v.Item)
-
- if len(v.Description) > 0 {
- fmt.Printf("%s # %s", strings.Repeat(" ", maxl-len(v.Item)), v.Description)
- }
-
- fmt.Printf("\n")
- }
- } else {
- for _, v := range items {
- fmt.Println(v.Item)
- }
- }
-}
diff --git a/vendor/github.com/jessevdk/go-flags/convert.go b/vendor/github.com/jessevdk/go-flags/convert.go
deleted file mode 100644
index 984aac89..00000000
--- a/vendor/github.com/jessevdk/go-flags/convert.go
+++ /dev/null
@@ -1,348 +0,0 @@
-// Copyright 2012 Jesse van den Kieboom. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package flags
-
-import (
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-// Marshaler is the interface implemented by types that can marshal themselves
-// to a string representation of the flag.
-type Marshaler interface {
- // MarshalFlag marshals a flag value to its string representation.
- MarshalFlag() (string, error)
-}
-
-// Unmarshaler is the interface implemented by types that can unmarshal a flag
-// argument to themselves. The provided value is directly passed from the
-// command line.
-type Unmarshaler interface {
- // UnmarshalFlag unmarshals a string value representation to the flag
- // value (which therefore needs to be a pointer receiver).
- UnmarshalFlag(value string) error
-}
-
-func getBase(options multiTag, base int) (int, error) {
- sbase := options.Get("base")
-
- var err error
- var ivbase int64
-
- if sbase != "" {
- ivbase, err = strconv.ParseInt(sbase, 10, 32)
- base = int(ivbase)
- }
-
- return base, err
-}
-
-func convertMarshal(val reflect.Value) (bool, string, error) {
- // Check first for the Marshaler interface
- if val.Type().NumMethod() > 0 && val.CanInterface() {
- if marshaler, ok := val.Interface().(Marshaler); ok {
- ret, err := marshaler.MarshalFlag()
- return true, ret, err
- }
- }
-
- return false, "", nil
-}
-
-func convertToString(val reflect.Value, options multiTag) (string, error) {
- if ok, ret, err := convertMarshal(val); ok {
- return ret, err
- }
-
- tp := val.Type()
-
- // Support for time.Duration
- if tp == reflect.TypeOf((*time.Duration)(nil)).Elem() {
- stringer := val.Interface().(fmt.Stringer)
- return stringer.String(), nil
- }
-
- switch tp.Kind() {
- case reflect.String:
- return val.String(), nil
- case reflect.Bool:
- if val.Bool() {
- return "true", nil
- }
-
- return "false", nil
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- base, err := getBase(options, 10)
-
- if err != nil {
- return "", err
- }
-
- return strconv.FormatInt(val.Int(), base), nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- base, err := getBase(options, 10)
-
- if err != nil {
- return "", err
- }
-
- return strconv.FormatUint(val.Uint(), base), nil
- case reflect.Float32, reflect.Float64:
- return strconv.FormatFloat(val.Float(), 'g', -1, tp.Bits()), nil
- case reflect.Slice:
- if val.Len() == 0 {
- return "", nil
- }
-
- ret := "["
-
- for i := 0; i < val.Len(); i++ {
- if i != 0 {
- ret += ", "
- }
-
- item, err := convertToString(val.Index(i), options)
-
- if err != nil {
- return "", err
- }
-
- ret += item
- }
-
- return ret + "]", nil
- case reflect.Map:
- ret := "{"
-
- for i, key := range val.MapKeys() {
- if i != 0 {
- ret += ", "
- }
-
- keyitem, err := convertToString(key, options)
-
- if err != nil {
- return "", err
- }
-
- item, err := convertToString(val.MapIndex(key), options)
-
- if err != nil {
- return "", err
- }
-
- ret += keyitem + ":" + item
- }
-
- return ret + "}", nil
- case reflect.Ptr:
- return convertToString(reflect.Indirect(val), options)
- case reflect.Interface:
- if !val.IsNil() {
- return convertToString(val.Elem(), options)
- }
- }
-
- return "", nil
-}
-
-func convertUnmarshal(val string, retval reflect.Value) (bool, error) {
- if retval.Type().NumMethod() > 0 && retval.CanInterface() {
- if unmarshaler, ok := retval.Interface().(Unmarshaler); ok {
- if retval.IsNil() {
- retval.Set(reflect.New(retval.Type().Elem()))
-
- // Re-assign from the new value
- unmarshaler = retval.Interface().(Unmarshaler)
- }
-
- return true, unmarshaler.UnmarshalFlag(val)
- }
- }
-
- if retval.Type().Kind() != reflect.Ptr && retval.CanAddr() {
- return convertUnmarshal(val, retval.Addr())
- }
-
- if retval.Type().Kind() == reflect.Interface && !retval.IsNil() {
- return convertUnmarshal(val, retval.Elem())
- }
-
- return false, nil
-}
-
-func convert(val string, retval reflect.Value, options multiTag) error {
- if ok, err := convertUnmarshal(val, retval); ok {
- return err
- }
-
- tp := retval.Type()
-
- // Support for time.Duration
- if tp == reflect.TypeOf((*time.Duration)(nil)).Elem() {
- parsed, err := time.ParseDuration(val)
-
- if err != nil {
- return err
- }
-
- retval.SetInt(int64(parsed))
- return nil
- }
-
- switch tp.Kind() {
- case reflect.String:
- retval.SetString(val)
- case reflect.Bool:
- if val == "" {
- retval.SetBool(true)
- } else {
- b, err := strconv.ParseBool(val)
-
- if err != nil {
- return err
- }
-
- retval.SetBool(b)
- }
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- base, err := getBase(options, 10)
-
- if err != nil {
- return err
- }
-
- parsed, err := strconv.ParseInt(val, base, tp.Bits())
-
- if err != nil {
- return err
- }
-
- retval.SetInt(parsed)
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- base, err := getBase(options, 10)
-
- if err != nil {
- return err
- }
-
- parsed, err := strconv.ParseUint(val, base, tp.Bits())
-
- if err != nil {
- return err
- }
-
- retval.SetUint(parsed)
- case reflect.Float32, reflect.Float64:
- parsed, err := strconv.ParseFloat(val, tp.Bits())
-
- if err != nil {
- return err
- }
-
- retval.SetFloat(parsed)
- case reflect.Slice:
- elemtp := tp.Elem()
-
- elemvalptr := reflect.New(elemtp)
- elemval := reflect.Indirect(elemvalptr)
-
- if err := convert(val, elemval, options); err != nil {
- return err
- }
-
- retval.Set(reflect.Append(retval, elemval))
- case reflect.Map:
- parts := strings.SplitN(val, ":", 2)
-
- key := parts[0]
- var value string
-
- if len(parts) == 2 {
- value = parts[1]
- }
-
- keytp := tp.Key()
- keyval := reflect.New(keytp)
-
- if err := convert(key, keyval, options); err != nil {
- return err
- }
-
- valuetp := tp.Elem()
- valueval := reflect.New(valuetp)
-
- if err := convert(value, valueval, options); err != nil {
- return err
- }
-
- if retval.IsNil() {
- retval.Set(reflect.MakeMap(tp))
- }
-
- retval.SetMapIndex(reflect.Indirect(keyval), reflect.Indirect(valueval))
- case reflect.Ptr:
- if retval.IsNil() {
- retval.Set(reflect.New(retval.Type().Elem()))
- }
-
- return convert(val, reflect.Indirect(retval), options)
- case reflect.Interface:
- if !retval.IsNil() {
- return convert(val, retval.Elem(), options)
- }
- }
-
- return nil
-}
-
-func isPrint(s string) bool {
- for _, c := range s {
- if !strconv.IsPrint(c) {
- return false
- }
- }
-
- return true
-}
-
-func quoteIfNeeded(s string) string {
- if !isPrint(s) {
- return strconv.Quote(s)
- }
-
- return s
-}
-
-func quoteIfNeededV(s []string) []string {
- ret := make([]string, len(s))
-
- for i, v := range s {
- ret[i] = quoteIfNeeded(v)
- }
-
- return ret
-}
-
-func quoteV(s []string) []string {
- ret := make([]string, len(s))
-
- for i, v := range s {
- ret[i] = strconv.Quote(v)
- }
-
- return ret
-}
-
-func unquoteIfPossible(s string) (string, error) {
- if len(s) == 0 || s[0] != '"' {
- return s, nil
- }
-
- return strconv.Unquote(s)
-}
diff --git a/vendor/github.com/jessevdk/go-flags/error.go b/vendor/github.com/jessevdk/go-flags/error.go
deleted file mode 100644
index 05528d8d..00000000
--- a/vendor/github.com/jessevdk/go-flags/error.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package flags
-
-import (
- "fmt"
-)
-
-// ErrorType represents the type of error.
-type ErrorType uint
-
-const (
- // ErrUnknown indicates a generic error.
- ErrUnknown ErrorType = iota
-
- // ErrExpectedArgument indicates that an argument was expected.
- ErrExpectedArgument
-
- // ErrUnknownFlag indicates an unknown flag.
- ErrUnknownFlag
-
- // ErrUnknownGroup indicates an unknown group.
- ErrUnknownGroup
-
- // ErrMarshal indicates a marshalling error while converting values.
- ErrMarshal
-
- // ErrHelp indicates that the built-in help was shown (the error
- // contains the help message).
- ErrHelp
-
- // ErrNoArgumentForBool indicates that an argument was given for a
- // boolean flag (which don't not take any arguments).
- ErrNoArgumentForBool
-
- // ErrRequired indicates that a required flag was not provided.
- ErrRequired
-
- // ErrShortNameTooLong indicates that a short flag name was specified,
- // longer than one character.
- ErrShortNameTooLong
-
- // ErrDuplicatedFlag indicates that a short or long flag has been
- // defined more than once
- ErrDuplicatedFlag
-
- // ErrTag indicates an error while parsing flag tags.
- ErrTag
-
- // ErrCommandRequired indicates that a command was required but not
- // specified
- ErrCommandRequired
-
- // ErrUnknownCommand indicates that an unknown command was specified.
- ErrUnknownCommand
-
- // ErrInvalidChoice indicates an invalid option value which only allows
- // a certain number of choices.
- ErrInvalidChoice
-
- // ErrInvalidTag indicates an invalid tag or invalid use of an existing tag
- ErrInvalidTag
-)
-
-func (e ErrorType) String() string {
- switch e {
- case ErrUnknown:
- return "unknown"
- case ErrExpectedArgument:
- return "expected argument"
- case ErrUnknownFlag:
- return "unknown flag"
- case ErrUnknownGroup:
- return "unknown group"
- case ErrMarshal:
- return "marshal"
- case ErrHelp:
- return "help"
- case ErrNoArgumentForBool:
- return "no argument for bool"
- case ErrRequired:
- return "required"
- case ErrShortNameTooLong:
- return "short name too long"
- case ErrDuplicatedFlag:
- return "duplicated flag"
- case ErrTag:
- return "tag"
- case ErrCommandRequired:
- return "command required"
- case ErrUnknownCommand:
- return "unknown command"
- case ErrInvalidChoice:
- return "invalid choice"
- case ErrInvalidTag:
- return "invalid tag"
- }
-
- return "unrecognized error type"
-}
-
-// Error represents a parser error. The error returned from Parse is of this
-// type. The error contains both a Type and Message.
-type Error struct {
- // The type of error
- Type ErrorType
-
- // The error message
- Message string
-}
-
-// Error returns the error's message
-func (e *Error) Error() string {
- return e.Message
-}
-
-func newError(tp ErrorType, message string) *Error {
- return &Error{
- Type: tp,
- Message: message,
- }
-}
-
-func newErrorf(tp ErrorType, format string, args ...interface{}) *Error {
- return newError(tp, fmt.Sprintf(format, args...))
-}
-
-func wrapError(err error) *Error {
- ret, ok := err.(*Error)
-
- if !ok {
- return newError(ErrUnknown, err.Error())
- }
-
- return ret
-}
diff --git a/vendor/github.com/jessevdk/go-flags/flags.go b/vendor/github.com/jessevdk/go-flags/flags.go
deleted file mode 100644
index 889762d1..00000000
--- a/vendor/github.com/jessevdk/go-flags/flags.go
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright 2012 Jesse van den Kieboom. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package flags provides an extensive command line option parser.
-The flags package is similar in functionality to the go built-in flag package
-but provides more options and uses reflection to provide a convenient and
-succinct way of specifying command line options.
-
-
-Supported features
-
-The following features are supported in go-flags:
-
- Options with short names (-v)
- Options with long names (--verbose)
- Options with and without arguments (bool v.s. other type)
- Options with optional arguments and default values
- Option default values from ENVIRONMENT_VARIABLES, including slice and map values
- Multiple option groups each containing a set of options
- Generate and print well-formatted help message
- Passing remaining command line arguments after -- (optional)
- Ignoring unknown command line options (optional)
- Supports -I/usr/include -I=/usr/include -I /usr/include option argument specification
- Supports multiple short options -aux
- Supports all primitive go types (string, int{8..64}, uint{8..64}, float)
- Supports same option multiple times (can store in slice or last option counts)
- Supports maps
- Supports function callbacks
- Supports namespaces for (nested) option groups
-
-Additional features specific to Windows:
- Options with short names (/v)
- Options with long names (/verbose)
- Windows-style options with arguments use a colon as the delimiter
- Modify generated help message with Windows-style / options
- Windows style options can be disabled at build time using the "forceposix"
- build tag
-
-
-Basic usage
-
-The flags package uses structs, reflection and struct field tags
-to allow users to specify command line options. This results in very simple
-and concise specification of your application options. For example:
-
- type Options struct {
- Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
- }
-
-This specifies one option with a short name -v and a long name --verbose.
-When either -v or --verbose is found on the command line, a 'true' value
-will be appended to the Verbose field. e.g. when specifying -vvv, the
-resulting value of Verbose will be {[true, true, true]}.
-
-Slice options work exactly the same as primitive type options, except that
-whenever the option is encountered, a value is appended to the slice.
-
-Map options from string to primitive type are also supported. On the command
-line, you specify the value for such an option as key:value. For example
-
- type Options struct {
- AuthorInfo string[string] `short:"a"`
- }
-
-Then, the AuthorInfo map can be filled with something like
--a name:Jesse -a "surname:van den Kieboom".
-
-Finally, for full control over the conversion between command line argument
-values and options, user defined types can choose to implement the Marshaler
-and Unmarshaler interfaces.
-
-
-Available field tags
-
-The following is a list of tags for struct fields supported by go-flags:
-
- short: the short name of the option (single character)
- long: the long name of the option
- required: if non empty, makes the option required to appear on the command
- line. If a required option is not present, the parser will
- return ErrRequired (optional)
- description: the description of the option (optional)
- long-description: the long description of the option. Currently only
- displayed in generated man pages (optional)
- no-flag: if non-empty, this field is ignored as an option (optional)
-
- optional: if non-empty, makes the argument of the option optional. When an
- argument is optional it can only be specified using
- --option=argument (optional)
- optional-value: the value of an optional option when the option occurs
- without an argument. This tag can be specified multiple
- times in the case of maps or slices (optional)
- default: the default value of an option. This tag can be specified
- multiple times in the case of slices or maps (optional)
- default-mask: when specified, this value will be displayed in the help
- instead of the actual default value. This is useful
- mostly for hiding otherwise sensitive information from
- showing up in the help. If default-mask takes the special
- value "-", then no default value will be shown at all
- (optional)
- env: the default value of the option is overridden from the
- specified environment variable, if one has been defined.
- (optional)
- env-delim: the 'env' default value from environment is split into
- multiple values with the given delimiter string, use with
- slices and maps (optional)
- value-name: the name of the argument value (to be shown in the help)
- (optional)
- choice: limits the values for an option to a set of values.
- This tag can be specified multiple times (optional)
- hidden: if non-empty, the option is not visible in the help or man page.
-
- base: a base (radix) used to convert strings to integer values, the
- default base is 10 (i.e. decimal) (optional)
-
- ini-name: the explicit ini option name (optional)
- no-ini: if non-empty this field is ignored as an ini option
- (optional)
-
- group: when specified on a struct field, makes the struct
- field a separate group with the given name (optional)
- namespace: when specified on a group struct field, the namespace
- gets prepended to every option's long name and
- subgroup's namespace of this group, separated by
- the parser's namespace delimiter (optional)
- command: when specified on a struct field, makes the struct
- field a (sub)command with the given name (optional)
- subcommands-optional: when specified on a command struct field, makes
- any subcommands of that command optional (optional)
- alias: when specified on a command struct field, adds the
- specified name as an alias for the command. Can be
- be specified multiple times to add more than one
- alias (optional)
- positional-args: when specified on a field with a struct type,
- uses the fields of that struct to parse remaining
- positional command line arguments into (in order
- of the fields). If a field has a slice type,
- then all remaining arguments will be added to it.
- Positional arguments are optional by default,
- unless the "required" tag is specified together
- with the "positional-args" tag. The "required" tag
- can also be set on the individual rest argument
- fields, to require only the first N positional
- arguments. If the "required" tag is set on the
- rest arguments slice, then its value determines
- the minimum amount of rest arguments that needs to
- be provided (e.g. `required:"2"`) (optional)
- positional-arg-name: used on a field in a positional argument struct; name
- of the positional argument placeholder to be shown in
- the help (optional)
-
-Either the `short:` tag or the `long:` must be specified to make the field eligible as an
-option.
-
-
-Option groups
-
-Option groups are a simple way to semantically separate your options. All
-options in a particular group are shown together in the help under the name
-of the group. Namespaces can be used to specify option long names more
-precisely and emphasize the options affiliation to their group.
-
-There are currently three ways to specify option groups.
-
- 1. Use NewNamedParser specifying the various option groups.
- 2. Use AddGroup to add a group to an existing parser.
- 3. Add a struct field to the top-level options annotated with the
- group:"group-name" tag.
-
-
-
-Commands
-
-The flags package also has basic support for commands. Commands are often
-used in monolithic applications that support various commands or actions.
-Take git for example, all of the add, commit, checkout, etc. are called
-commands. Using commands you can easily separate multiple functions of your
-application.
-
-There are currently two ways to specify a command.
-
- 1. Use AddCommand on an existing parser.
- 2. Add a struct field to your options struct annotated with the
- command:"command-name" tag.
-
-The most common, idiomatic way to implement commands is to define a global
-parser instance and implement each command in a separate file. These
-command files should define a go init function which calls AddCommand on
-the global parser.
-
-When parsing ends and there is an active command and that command implements
-the Commander interface, then its Execute method will be run with the
-remaining command line arguments.
-
-Command structs can have options which become valid to parse after the
-command has been specified on the command line, in addition to the options
-of all the parent commands. I.e. considering a -v flag on the parser and an
-add command, the following are equivalent:
-
- ./app -v add
- ./app add -v
-
-However, if the -v flag is defined on the add command, then the first of
-the two examples above would fail since the -v flag is not defined before
-the add command.
-
-
-Completion
-
-go-flags has builtin support to provide bash completion of flags, commands
-and argument values. To use completion, the binary which uses go-flags
-can be invoked in a special environment to list completion of the current
-command line argument. It should be noted that this `executes` your application,
-and it is up to the user to make sure there are no negative side effects (for
-example from init functions).
-
-Setting the environment variable `GO_FLAGS_COMPLETION=1` enables completion
-by replacing the argument parsing routine with the completion routine which
-outputs completions for the passed arguments. The basic invocation to
-complete a set of arguments is therefore:
-
- GO_FLAGS_COMPLETION=1 ./completion-example arg1 arg2 arg3
-
-where `completion-example` is the binary, `arg1` and `arg2` are
-the current arguments, and `arg3` (the last argument) is the argument
-to be completed. If the GO_FLAGS_COMPLETION is set to "verbose", then
-descriptions of possible completion items will also be shown, if there
-are more than 1 completion items.
-
-To use this with bash completion, a simple file can be written which
-calls the binary which supports go-flags completion:
-
- _completion_example() {
- # All arguments except the first one
- args=("${COMP_WORDS[@]:1:$COMP_CWORD}")
-
- # Only split on newlines
- local IFS=$'\n'
-
- # Call completion (note that the first element of COMP_WORDS is
- # the executable itself)
- COMPREPLY=($(GO_FLAGS_COMPLETION=1 ${COMP_WORDS[0]} "${args[@]}"))
- return 0
- }
-
- complete -F _completion_example completion-example
-
-Completion requires the parser option PassDoubleDash and is therefore enforced if the environment variable GO_FLAGS_COMPLETION is set.
-
-Customized completion for argument values is supported by implementing
-the flags.Completer interface for the argument value type. An example
-of a type which does so is the flags.Filename type, an alias of string
-allowing simple filename completion. A slice or array argument value
-whose element type implements flags.Completer will also be completed.
-*/
-package flags
diff --git a/vendor/github.com/jessevdk/go-flags/group.go b/vendor/github.com/jessevdk/go-flags/group.go
deleted file mode 100644
index 9e057abd..00000000
--- a/vendor/github.com/jessevdk/go-flags/group.go
+++ /dev/null
@@ -1,406 +0,0 @@
-// Copyright 2012 Jesse van den Kieboom. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package flags
-
-import (
- "errors"
- "reflect"
- "strings"
- "unicode/utf8"
-)
-
-// ErrNotPointerToStruct indicates that a provided data container is not
-// a pointer to a struct. Only pointers to structs are valid data containers
-// for options.
-var ErrNotPointerToStruct = errors.New("provided data is not a pointer to struct")
-
-// Group represents an option group. Option groups can be used to logically
-// group options together under a description. Groups are only used to provide
-// more structure to options both for the user (as displayed in the help message)
-// and for you, since groups can be nested.
-type Group struct {
- // A short description of the group. The
- // short description is primarily used in the built-in generated help
- // message
- ShortDescription string
-
- // A long description of the group. The long
- // description is primarily used to present information on commands
- // (Command embeds Group) in the built-in generated help and man pages.
- LongDescription string
-
- // The namespace of the group
- Namespace string
-
- // If true, the group is not displayed in the help or man page
- Hidden bool
-
- // The parent of the group or nil if it has no parent
- parent interface{}
-
- // All the options in the group
- options []*Option
-
- // All the subgroups
- groups []*Group
-
- // Whether the group represents the built-in help group
- isBuiltinHelp bool
-
- data interface{}
-}
-
-type scanHandler func(reflect.Value, *reflect.StructField) (bool, error)
-
-// AddGroup adds a new group to the command with the given name and data. The
-// data needs to be a pointer to a struct from which the fields indicate which
-// options are in the group.
-func (g *Group) AddGroup(shortDescription string, longDescription string, data interface{}) (*Group, error) {
- group := newGroup(shortDescription, longDescription, data)
-
- group.parent = g
-
- if err := group.scan(); err != nil {
- return nil, err
- }
-
- g.groups = append(g.groups, group)
- return group, nil
-}
-
-// Groups returns the list of groups embedded in this group.
-func (g *Group) Groups() []*Group {
- return g.groups
-}
-
-// Options returns the list of options in this group.
-func (g *Group) Options() []*Option {
- return g.options
-}
-
-// Find locates the subgroup with the given short description and returns it.
-// If no such group can be found Find will return nil. Note that the description
-// is matched case insensitively.
-func (g *Group) Find(shortDescription string) *Group {
- lshortDescription := strings.ToLower(shortDescription)
-
- var ret *Group
-
- g.eachGroup(func(gg *Group) {
- if gg != g && strings.ToLower(gg.ShortDescription) == lshortDescription {
- ret = gg
- }
- })
-
- return ret
-}
-
-func (g *Group) findOption(matcher func(*Option) bool) (option *Option) {
- g.eachGroup(func(g *Group) {
- for _, opt := range g.options {
- if option == nil && matcher(opt) {
- option = opt
- }
- }
- })
-
- return option
-}
-
-// FindOptionByLongName finds an option that is part of the group, or any of its
-// subgroups, by matching its long name (including the option namespace).
-func (g *Group) FindOptionByLongName(longName string) *Option {
- return g.findOption(func(option *Option) bool {
- return option.LongNameWithNamespace() == longName
- })
-}
-
-// FindOptionByShortName finds an option that is part of the group, or any of
-// its subgroups, by matching its short name.
-func (g *Group) FindOptionByShortName(shortName rune) *Option {
- return g.findOption(func(option *Option) bool {
- return option.ShortName == shortName
- })
-}
-
-func newGroup(shortDescription string, longDescription string, data interface{}) *Group {
- return &Group{
- ShortDescription: shortDescription,
- LongDescription: longDescription,
-
- data: data,
- }
-}
-
-func (g *Group) optionByName(name string, namematch func(*Option, string) bool) *Option {
- prio := 0
- var retopt *Option
-
- g.eachGroup(func(g *Group) {
- for _, opt := range g.options {
- if namematch != nil && namematch(opt, name) && prio < 4 {
- retopt = opt
- prio = 4
- }
-
- if name == opt.field.Name && prio < 3 {
- retopt = opt
- prio = 3
- }
-
- if name == opt.LongNameWithNamespace() && prio < 2 {
- retopt = opt
- prio = 2
- }
-
- if opt.ShortName != 0 && name == string(opt.ShortName) && prio < 1 {
- retopt = opt
- prio = 1
- }
- }
- })
-
- return retopt
-}
-
-func (g *Group) eachGroup(f func(*Group)) {
- f(g)
-
- for _, gg := range g.groups {
- gg.eachGroup(f)
- }
-}
-
-func isStringFalsy(s string) bool {
- return s == "" || s == "false" || s == "no" || s == "0"
-}
-
-func (g *Group) scanStruct(realval reflect.Value, sfield *reflect.StructField, handler scanHandler) error {
- stype := realval.Type()
-
- if sfield != nil {
- if ok, err := handler(realval, sfield); err != nil {
- return err
- } else if ok {
- return nil
- }
- }
-
- for i := 0; i < stype.NumField(); i++ {
- field := stype.Field(i)
-
- // PkgName is set only for non-exported fields, which we ignore
- if field.PkgPath != "" && !field.Anonymous {
- continue
- }
-
- mtag := newMultiTag(string(field.Tag))
-
- if err := mtag.Parse(); err != nil {
- return err
- }
-
- // Skip fields with the no-flag tag
- if mtag.Get("no-flag") != "" {
- continue
- }
-
- // Dive deep into structs or pointers to structs
- kind := field.Type.Kind()
- fld := realval.Field(i)
-
- if kind == reflect.Struct {
- if err := g.scanStruct(fld, &field, handler); err != nil {
- return err
- }
- } else if kind == reflect.Ptr && field.Type.Elem().Kind() == reflect.Struct {
- flagCountBefore := len(g.options) + len(g.groups)
-
- if fld.IsNil() {
- fld = reflect.New(fld.Type().Elem())
- }
-
- if err := g.scanStruct(reflect.Indirect(fld), &field, handler); err != nil {
- return err
- }
-
- if len(g.options)+len(g.groups) != flagCountBefore {
- realval.Field(i).Set(fld)
- }
- }
-
- longname := mtag.Get("long")
- shortname := mtag.Get("short")
-
- // Need at least either a short or long name
- if longname == "" && shortname == "" && mtag.Get("ini-name") == "" {
- continue
- }
-
- short := rune(0)
- rc := utf8.RuneCountInString(shortname)
-
- if rc > 1 {
- return newErrorf(ErrShortNameTooLong,
- "short names can only be 1 character long, not `%s'",
- shortname)
-
- } else if rc == 1 {
- short, _ = utf8.DecodeRuneInString(shortname)
- }
-
- description := mtag.Get("description")
- def := mtag.GetMany("default")
-
- optionalValue := mtag.GetMany("optional-value")
- valueName := mtag.Get("value-name")
- defaultMask := mtag.Get("default-mask")
-
- optional := !isStringFalsy(mtag.Get("optional"))
- required := !isStringFalsy(mtag.Get("required"))
- choices := mtag.GetMany("choice")
- hidden := !isStringFalsy(mtag.Get("hidden"))
-
- option := &Option{
- Description: description,
- ShortName: short,
- LongName: longname,
- Default: def,
- EnvDefaultKey: mtag.Get("env"),
- EnvDefaultDelim: mtag.Get("env-delim"),
- OptionalArgument: optional,
- OptionalValue: optionalValue,
- Required: required,
- ValueName: valueName,
- DefaultMask: defaultMask,
- Choices: choices,
- Hidden: hidden,
-
- group: g,
-
- field: field,
- value: realval.Field(i),
- tag: mtag,
- }
-
- if option.isBool() && option.Default != nil {
- return newErrorf(ErrInvalidTag,
- "boolean flag `%s' may not have default values, they always default to `false' and can only be turned on",
- option.shortAndLongName())
- }
-
- g.options = append(g.options, option)
- }
-
- return nil
-}
-
-func (g *Group) checkForDuplicateFlags() *Error {
- shortNames := make(map[rune]*Option)
- longNames := make(map[string]*Option)
-
- var duplicateError *Error
-
- g.eachGroup(func(g *Group) {
- for _, option := range g.options {
- if option.LongName != "" {
- longName := option.LongNameWithNamespace()
-
- if otherOption, ok := longNames[longName]; ok {
- duplicateError = newErrorf(ErrDuplicatedFlag, "option `%s' uses the same long name as option `%s'", option, otherOption)
- return
- }
- longNames[longName] = option
- }
- if option.ShortName != 0 {
- if otherOption, ok := shortNames[option.ShortName]; ok {
- duplicateError = newErrorf(ErrDuplicatedFlag, "option `%s' uses the same short name as option `%s'", option, otherOption)
- return
- }
- shortNames[option.ShortName] = option
- }
- }
- })
-
- return duplicateError
-}
-
-func (g *Group) scanSubGroupHandler(realval reflect.Value, sfield *reflect.StructField) (bool, error) {
- mtag := newMultiTag(string(sfield.Tag))
-
- if err := mtag.Parse(); err != nil {
- return true, err
- }
-
- subgroup := mtag.Get("group")
-
- if len(subgroup) != 0 {
- var ptrval reflect.Value
-
- if realval.Kind() == reflect.Ptr {
- ptrval = realval
-
- if ptrval.IsNil() {
- ptrval.Set(reflect.New(ptrval.Type()))
- }
- } else {
- ptrval = realval.Addr()
- }
-
- description := mtag.Get("description")
-
- group, err := g.AddGroup(subgroup, description, ptrval.Interface())
-
- if err != nil {
- return true, err
- }
-
- group.Namespace = mtag.Get("namespace")
- group.Hidden = mtag.Get("hidden") != ""
-
- return true, nil
- }
-
- return false, nil
-}
-
-func (g *Group) scanType(handler scanHandler) error {
- // Get all the public fields in the data struct
- ptrval := reflect.ValueOf(g.data)
-
- if ptrval.Type().Kind() != reflect.Ptr {
- panic(ErrNotPointerToStruct)
- }
-
- stype := ptrval.Type().Elem()
-
- if stype.Kind() != reflect.Struct {
- panic(ErrNotPointerToStruct)
- }
-
- realval := reflect.Indirect(ptrval)
-
- if err := g.scanStruct(realval, nil, handler); err != nil {
- return err
- }
-
- if err := g.checkForDuplicateFlags(); err != nil {
- return err
- }
-
- return nil
-}
-
-func (g *Group) scan() error {
- return g.scanType(g.scanSubGroupHandler)
-}
-
-func (g *Group) groupByName(name string) *Group {
- if len(name) == 0 {
- return g
- }
-
- return g.Find(name)
-}
diff --git a/vendor/github.com/jessevdk/go-flags/help.go b/vendor/github.com/jessevdk/go-flags/help.go
deleted file mode 100644
index d3803050..00000000
--- a/vendor/github.com/jessevdk/go-flags/help.go
+++ /dev/null
@@ -1,491 +0,0 @@
-// Copyright 2012 Jesse van den Kieboom. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package flags
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "runtime"
- "strings"
- "unicode/utf8"
-)
-
-type alignmentInfo struct {
- maxLongLen int
- hasShort bool
- hasValueName bool
- terminalColumns int
- indent bool
-}
-
-const (
- paddingBeforeOption = 2
- distanceBetweenOptionAndDescription = 2
-)
-
-func (a *alignmentInfo) descriptionStart() int {
- ret := a.maxLongLen + distanceBetweenOptionAndDescription
-
- if a.hasShort {
- ret += 2
- }
-
- if a.maxLongLen > 0 {
- ret += 4
- }
-
- if a.hasValueName {
- ret += 3
- }
-
- return ret
-}
-
-func (a *alignmentInfo) updateLen(name string, indent bool) {
- l := utf8.RuneCountInString(name)
-
- if indent {
- l = l + 4
- }
-
- if l > a.maxLongLen {
- a.maxLongLen = l
- }
-}
-
-func (p *Parser) getAlignmentInfo() alignmentInfo {
- ret := alignmentInfo{
- maxLongLen: 0,
- hasShort: false,
- hasValueName: false,
- terminalColumns: getTerminalColumns(),
- }
-
- if ret.terminalColumns <= 0 {
- ret.terminalColumns = 80
- }
-
- var prevcmd *Command
-
- p.eachActiveGroup(func(c *Command, grp *Group) {
- if c != prevcmd {
- for _, arg := range c.args {
- ret.updateLen(arg.Name, c != p.Command)
- }
- }
-
- for _, info := range grp.options {
- if !info.canCli() {
- continue
- }
-
- if info.ShortName != 0 {
- ret.hasShort = true
- }
-
- if len(info.ValueName) > 0 {
- ret.hasValueName = true
- }
-
- l := info.LongNameWithNamespace() + info.ValueName
-
- if len(info.Choices) != 0 {
- l += "[" + strings.Join(info.Choices, "|") + "]"
- }
-
- ret.updateLen(l, c != p.Command)
- }
- })
-
- return ret
-}
-
-func wrapText(s string, l int, prefix string) string {
- var ret string
-
- if l < 10 {
- l = 10
- }
-
- // Basic text wrapping of s at spaces to fit in l
- lines := strings.Split(s, "\n")
-
- for _, line := range lines {
- var retline string
-
- line = strings.TrimSpace(line)
-
- for len(line) > l {
- // Try to split on space
- suffix := ""
-
- pos := strings.LastIndex(line[:l], " ")
-
- if pos < 0 {
- pos = l - 1
- suffix = "-\n"
- }
-
- if len(retline) != 0 {
- retline += "\n" + prefix
- }
-
- retline += strings.TrimSpace(line[:pos]) + suffix
- line = strings.TrimSpace(line[pos:])
- }
-
- if len(line) > 0 {
- if len(retline) != 0 {
- retline += "\n" + prefix
- }
-
- retline += line
- }
-
- if len(ret) > 0 {
- ret += "\n"
-
- if len(retline) > 0 {
- ret += prefix
- }
- }
-
- ret += retline
- }
-
- return ret
-}
-
-func (p *Parser) writeHelpOption(writer *bufio.Writer, option *Option, info alignmentInfo) {
- line := &bytes.Buffer{}
-
- prefix := paddingBeforeOption
-
- if info.indent {
- prefix += 4
- }
-
- if option.Hidden {
- return
- }
-
- line.WriteString(strings.Repeat(" ", prefix))
-
- if option.ShortName != 0 {
- line.WriteRune(defaultShortOptDelimiter)
- line.WriteRune(option.ShortName)
- } else if info.hasShort {
- line.WriteString(" ")
- }
-
- descstart := info.descriptionStart() + paddingBeforeOption
-
- if len(option.LongName) > 0 {
- if option.ShortName != 0 {
- line.WriteString(", ")
- } else if info.hasShort {
- line.WriteString(" ")
- }
-
- line.WriteString(defaultLongOptDelimiter)
- line.WriteString(option.LongNameWithNamespace())
- }
-
- if option.canArgument() {
- line.WriteRune(defaultNameArgDelimiter)
-
- if len(option.ValueName) > 0 {
- line.WriteString(option.ValueName)
- }
-
- if len(option.Choices) > 0 {
- line.WriteString("[" + strings.Join(option.Choices, "|") + "]")
- }
- }
-
- written := line.Len()
- line.WriteTo(writer)
-
- if option.Description != "" {
- dw := descstart - written
- writer.WriteString(strings.Repeat(" ", dw))
-
- var def string
-
- if len(option.DefaultMask) != 0 {
- if option.DefaultMask != "-" {
- def = option.DefaultMask
- }
- } else {
- def = option.defaultLiteral
- }
-
- var envDef string
- if option.EnvDefaultKey != "" {
- var envPrintable string
- if runtime.GOOS == "windows" {
- envPrintable = "%" + option.EnvDefaultKey + "%"
- } else {
- envPrintable = "$" + option.EnvDefaultKey
- }
- envDef = fmt.Sprintf(" [%s]", envPrintable)
- }
-
- var desc string
-
- if def != "" {
- desc = fmt.Sprintf("%s (default: %v)%s", option.Description, def, envDef)
- } else {
- desc = option.Description + envDef
- }
-
- writer.WriteString(wrapText(desc,
- info.terminalColumns-descstart,
- strings.Repeat(" ", descstart)))
- }
-
- writer.WriteString("\n")
-}
-
-func maxCommandLength(s []*Command) int {
- if len(s) == 0 {
- return 0
- }
-
- ret := len(s[0].Name)
-
- for _, v := range s[1:] {
- l := len(v.Name)
-
- if l > ret {
- ret = l
- }
- }
-
- return ret
-}
-
-// WriteHelp writes a help message containing all the possible options and
-// their descriptions to the provided writer. Note that the HelpFlag parser
-// option provides a convenient way to add a -h/--help option group to the
-// command line parser which will automatically show the help messages using
-// this method.
-func (p *Parser) WriteHelp(writer io.Writer) {
- if writer == nil {
- return
- }
-
- wr := bufio.NewWriter(writer)
- aligninfo := p.getAlignmentInfo()
-
- cmd := p.Command
-
- for cmd.Active != nil {
- cmd = cmd.Active
- }
-
- if p.Name != "" {
- wr.WriteString("Usage:\n")
- wr.WriteString(" ")
-
- allcmd := p.Command
-
- for allcmd != nil {
- var usage string
-
- if allcmd == p.Command {
- if len(p.Usage) != 0 {
- usage = p.Usage
- } else if p.Options&HelpFlag != 0 {
- usage = "[OPTIONS]"
- }
- } else if us, ok := allcmd.data.(Usage); ok {
- usage = us.Usage()
- } else if allcmd.hasCliOptions() {
- usage = fmt.Sprintf("[%s-OPTIONS]", allcmd.Name)
- }
-
- if len(usage) != 0 {
- fmt.Fprintf(wr, " %s %s", allcmd.Name, usage)
- } else {
- fmt.Fprintf(wr, " %s", allcmd.Name)
- }
-
- if len(allcmd.args) > 0 {
- fmt.Fprintf(wr, " ")
- }
-
- for i, arg := range allcmd.args {
- if i != 0 {
- fmt.Fprintf(wr, " ")
- }
-
- name := arg.Name
-
- if arg.isRemaining() {
- name = name + "..."
- }
-
- if !allcmd.ArgsRequired {
- fmt.Fprintf(wr, "[%s]", name)
- } else {
- fmt.Fprintf(wr, "%s", name)
- }
- }
-
- if allcmd.Active == nil && len(allcmd.commands) > 0 {
- var co, cc string
-
- if allcmd.SubcommandsOptional {
- co, cc = "[", "]"
- } else {
- co, cc = "<", ">"
- }
-
- visibleCommands := allcmd.visibleCommands()
-
- if len(visibleCommands) > 3 {
- fmt.Fprintf(wr, " %scommand%s", co, cc)
- } else {
- subcommands := allcmd.sortedVisibleCommands()
- names := make([]string, len(subcommands))
-
- for i, subc := range subcommands {
- names[i] = subc.Name
- }
-
- fmt.Fprintf(wr, " %s%s%s", co, strings.Join(names, " | "), cc)
- }
- }
-
- allcmd = allcmd.Active
- }
-
- fmt.Fprintln(wr)
-
- if len(cmd.LongDescription) != 0 {
- fmt.Fprintln(wr)
-
- t := wrapText(cmd.LongDescription,
- aligninfo.terminalColumns,
- "")
-
- fmt.Fprintln(wr, t)
- }
- }
-
- c := p.Command
-
- for c != nil {
- printcmd := c != p.Command
-
- c.eachGroup(func(grp *Group) {
- first := true
-
- // Skip built-in help group for all commands except the top-level
- // parser
- if grp.Hidden || (grp.isBuiltinHelp && c != p.Command) {
- return
- }
-
- for _, info := range grp.options {
- if !info.canCli() || info.Hidden {
- continue
- }
-
- if printcmd {
- fmt.Fprintf(wr, "\n[%s command options]\n", c.Name)
- aligninfo.indent = true
- printcmd = false
- }
-
- if first && cmd.Group != grp {
- fmt.Fprintln(wr)
-
- if aligninfo.indent {
- wr.WriteString(" ")
- }
-
- fmt.Fprintf(wr, "%s:\n", grp.ShortDescription)
- first = false
- }
-
- p.writeHelpOption(wr, info, aligninfo)
- }
- })
-
- var args []*Arg
- for _, arg := range c.args {
- if arg.Description != "" {
- args = append(args, arg)
- }
- }
-
- if len(args) > 0 {
- if c == p.Command {
- fmt.Fprintf(wr, "\nArguments:\n")
- } else {
- fmt.Fprintf(wr, "\n[%s command arguments]\n", c.Name)
- }
-
- descStart := aligninfo.descriptionStart() + paddingBeforeOption
-
- for _, arg := range args {
- argPrefix := strings.Repeat(" ", paddingBeforeOption)
- argPrefix += arg.Name
-
- if len(arg.Description) > 0 {
- argPrefix += ":"
- wr.WriteString(argPrefix)
-
- // Space between "arg:" and the description start
- descPadding := strings.Repeat(" ", descStart-len(argPrefix))
- // How much space the description gets before wrapping
- descWidth := aligninfo.terminalColumns - 1 - descStart
- // Whitespace to which we can indent new description lines
- descPrefix := strings.Repeat(" ", descStart)
-
- wr.WriteString(descPadding)
- wr.WriteString(wrapText(arg.Description, descWidth, descPrefix))
- } else {
- wr.WriteString(argPrefix)
- }
-
- fmt.Fprintln(wr)
- }
- }
-
- c = c.Active
- }
-
- scommands := cmd.sortedVisibleCommands()
-
- if len(scommands) > 0 {
- maxnamelen := maxCommandLength(scommands)
-
- fmt.Fprintln(wr)
- fmt.Fprintln(wr, "Available commands:")
-
- for _, c := range scommands {
- fmt.Fprintf(wr, " %s", c.Name)
-
- if len(c.ShortDescription) > 0 {
- pad := strings.Repeat(" ", maxnamelen-len(c.Name))
- fmt.Fprintf(wr, "%s %s", pad, c.ShortDescription)
-
- if len(c.Aliases) > 0 {
- fmt.Fprintf(wr, " (aliases: %s)", strings.Join(c.Aliases, ", "))
- }
-
- }
-
- fmt.Fprintln(wr)
- }
- }
-
- wr.Flush()
-}
diff --git a/vendor/github.com/jessevdk/go-flags/ini.go b/vendor/github.com/jessevdk/go-flags/ini.go
deleted file mode 100644
index e714d3d3..00000000
--- a/vendor/github.com/jessevdk/go-flags/ini.go
+++ /dev/null
@@ -1,597 +0,0 @@
-package flags
-
-import (
- "bufio"
- "fmt"
- "io"
- "os"
- "reflect"
- "sort"
- "strconv"
- "strings"
-)
-
-// IniError contains location information on where an error occurred.
-type IniError struct {
- // The error message.
- Message string
-
- // The filename of the file in which the error occurred.
- File string
-
- // The line number at which the error occurred.
- LineNumber uint
-}
-
-// Error provides a "file:line: message" formatted message of the ini error.
-func (x *IniError) Error() string {
- return fmt.Sprintf(
- "%s:%d: %s",
- x.File,
- x.LineNumber,
- x.Message,
- )
-}
-
-// IniOptions for writing
-type IniOptions uint
-
-const (
- // IniNone indicates no options.
- IniNone IniOptions = 0
-
- // IniIncludeDefaults indicates that default values should be written.
- IniIncludeDefaults = 1 << iota
-
- // IniCommentDefaults indicates that if IniIncludeDefaults is used
- // options with default values are written but commented out.
- IniCommentDefaults
-
- // IniIncludeComments indicates that comments containing the description
- // of an option should be written.
- IniIncludeComments
-
- // IniDefault provides a default set of options.
- IniDefault = IniIncludeComments
-)
-
-// IniParser is a utility to read and write flags options from and to ini
-// formatted strings.
-type IniParser struct {
- ParseAsDefaults bool // override default flags
-
- parser *Parser
-}
-
-type iniValue struct {
- Name string
- Value string
- Quoted bool
- LineNumber uint
-}
-
-type iniSection []iniValue
-
-type ini struct {
- File string
- Sections map[string]iniSection
-}
-
-// NewIniParser creates a new ini parser for a given Parser.
-func NewIniParser(p *Parser) *IniParser {
- return &IniParser{
- parser: p,
- }
-}
-
-// IniParse is a convenience function to parse command line options with default
-// settings from an ini formatted file. The provided data is a pointer to a struct
-// representing the default option group (named "Application Options"). For
-// more control, use flags.NewParser.
-func IniParse(filename string, data interface{}) error {
- p := NewParser(data, Default)
-
- return NewIniParser(p).ParseFile(filename)
-}
-
-// ParseFile parses flags from an ini formatted file. See Parse for more
-// information on the ini file format. The returned errors can be of the type
-// flags.Error or flags.IniError.
-func (i *IniParser) ParseFile(filename string) error {
- ini, err := readIniFromFile(filename)
-
- if err != nil {
- return err
- }
-
- return i.parse(ini)
-}
-
-// Parse parses flags from an ini format. You can use ParseFile as a
-// convenience function to parse from a filename instead of a general
-// io.Reader.
-//
-// The format of the ini file is as follows:
-//
-// [Option group name]
-// option = value
-//
-// Each section in the ini file represents an option group or command in the
-// flags parser. The default flags parser option group (i.e. when using
-// flags.Parse) is named 'Application Options'. The ini option name is matched
-// in the following order:
-//
-// 1. Compared to the ini-name tag on the option struct field (if present)
-// 2. Compared to the struct field name
-// 3. Compared to the option long name (if present)
-// 4. Compared to the option short name (if present)
-//
-// Sections for nested groups and commands can be addressed using a dot `.'
-// namespacing notation (i.e [subcommand.Options]). Group section names are
-// matched case insensitive.
-//
-// The returned errors can be of the type flags.Error or flags.IniError.
-func (i *IniParser) Parse(reader io.Reader) error {
- ini, err := readIni(reader, "")
-
- if err != nil {
- return err
- }
-
- return i.parse(ini)
-}
-
-// WriteFile writes the flags as ini format into a file. See Write
-// for more information. The returned error occurs when the specified file
-// could not be opened for writing.
-func (i *IniParser) WriteFile(filename string, options IniOptions) error {
- return writeIniToFile(i, filename, options)
-}
-
-// Write writes the current values of all the flags to an ini format.
-// See Parse for more information on the ini file format. You typically
-// call this only after settings have been parsed since the default values of each
-// option are stored just before parsing the flags (this is only relevant when
-// IniIncludeDefaults is _not_ set in options).
-func (i *IniParser) Write(writer io.Writer, options IniOptions) {
- writeIni(i, writer, options)
-}
-
-func readFullLine(reader *bufio.Reader) (string, error) {
- var line []byte
-
- for {
- l, more, err := reader.ReadLine()
-
- if err != nil {
- return "", err
- }
-
- if line == nil && !more {
- return string(l), nil
- }
-
- line = append(line, l...)
-
- if !more {
- break
- }
- }
-
- return string(line), nil
-}
-
-func optionIniName(option *Option) string {
- name := option.tag.Get("_read-ini-name")
-
- if len(name) != 0 {
- return name
- }
-
- name = option.tag.Get("ini-name")
-
- if len(name) != 0 {
- return name
- }
-
- return option.field.Name
-}
-
-func writeGroupIni(cmd *Command, group *Group, namespace string, writer io.Writer, options IniOptions) {
- var sname string
-
- if len(namespace) != 0 {
- sname = namespace
- }
-
- if cmd.Group != group && len(group.ShortDescription) != 0 {
- if len(sname) != 0 {
- sname += "."
- }
-
- sname += group.ShortDescription
- }
-
- sectionwritten := false
- comments := (options & IniIncludeComments) != IniNone
-
- for _, option := range group.options {
- if option.isFunc() || option.Hidden {
- continue
- }
-
- if len(option.tag.Get("no-ini")) != 0 {
- continue
- }
-
- val := option.value
-
- if (options&IniIncludeDefaults) == IniNone && option.valueIsDefault() {
- continue
- }
-
- if !sectionwritten {
- fmt.Fprintf(writer, "[%s]\n", sname)
- sectionwritten = true
- }
-
- if comments && len(option.Description) != 0 {
- fmt.Fprintf(writer, "; %s\n", option.Description)
- }
-
- oname := optionIniName(option)
-
- commentOption := (options&(IniIncludeDefaults|IniCommentDefaults)) == IniIncludeDefaults|IniCommentDefaults && option.valueIsDefault()
-
- kind := val.Type().Kind()
- switch kind {
- case reflect.Slice:
- kind = val.Type().Elem().Kind()
-
- if val.Len() == 0 {
- writeOption(writer, oname, kind, "", "", true, option.iniQuote)
- } else {
- for idx := 0; idx < val.Len(); idx++ {
- v, _ := convertToString(val.Index(idx), option.tag)
-
- writeOption(writer, oname, kind, "", v, commentOption, option.iniQuote)
- }
- }
- case reflect.Map:
- kind = val.Type().Elem().Kind()
-
- if val.Len() == 0 {
- writeOption(writer, oname, kind, "", "", true, option.iniQuote)
- } else {
- mkeys := val.MapKeys()
- keys := make([]string, len(val.MapKeys()))
- kkmap := make(map[string]reflect.Value)
-
- for i, k := range mkeys {
- keys[i], _ = convertToString(k, option.tag)
- kkmap[keys[i]] = k
- }
-
- sort.Strings(keys)
-
- for _, k := range keys {
- v, _ := convertToString(val.MapIndex(kkmap[k]), option.tag)
-
- writeOption(writer, oname, kind, k, v, commentOption, option.iniQuote)
- }
- }
- default:
- v, _ := convertToString(val, option.tag)
-
- writeOption(writer, oname, kind, "", v, commentOption, option.iniQuote)
- }
-
- if comments {
- fmt.Fprintln(writer)
- }
- }
-
- if sectionwritten && !comments {
- fmt.Fprintln(writer)
- }
-}
-
-func writeOption(writer io.Writer, optionName string, optionType reflect.Kind, optionKey string, optionValue string, commentOption bool, forceQuote bool) {
- if forceQuote || (optionType == reflect.String && !isPrint(optionValue)) {
- optionValue = strconv.Quote(optionValue)
- }
-
- comment := ""
- if commentOption {
- comment = "; "
- }
-
- fmt.Fprintf(writer, "%s%s =", comment, optionName)
-
- if optionKey != "" {
- fmt.Fprintf(writer, " %s:%s", optionKey, optionValue)
- } else if optionValue != "" {
- fmt.Fprintf(writer, " %s", optionValue)
- }
-
- fmt.Fprintln(writer)
-}
-
-func writeCommandIni(command *Command, namespace string, writer io.Writer, options IniOptions) {
- command.eachGroup(func(group *Group) {
- if !group.Hidden {
- writeGroupIni(command, group, namespace, writer, options)
- }
- })
-
- for _, c := range command.commands {
- var nns string
-
- if c.Hidden {
- continue
- }
-
- if len(namespace) != 0 {
- nns = c.Name + "." + nns
- } else {
- nns = c.Name
- }
-
- writeCommandIni(c, nns, writer, options)
- }
-}
-
-func writeIni(parser *IniParser, writer io.Writer, options IniOptions) {
- writeCommandIni(parser.parser.Command, "", writer, options)
-}
-
-func writeIniToFile(parser *IniParser, filename string, options IniOptions) error {
- file, err := os.Create(filename)
-
- if err != nil {
- return err
- }
-
- defer file.Close()
-
- writeIni(parser, file, options)
-
- return nil
-}
-
-func readIniFromFile(filename string) (*ini, error) {
- file, err := os.Open(filename)
-
- if err != nil {
- return nil, err
- }
-
- defer file.Close()
-
- return readIni(file, filename)
-}
-
-func readIni(contents io.Reader, filename string) (*ini, error) {
- ret := &ini{
- File: filename,
- Sections: make(map[string]iniSection),
- }
-
- reader := bufio.NewReader(contents)
-
- // Empty global section
- section := make(iniSection, 0, 10)
- sectionname := ""
-
- ret.Sections[sectionname] = section
-
- var lineno uint
-
- for {
- line, err := readFullLine(reader)
-
- if err == io.EOF {
- break
- } else if err != nil {
- return nil, err
- }
-
- lineno++
- line = strings.TrimSpace(line)
-
- // Skip empty lines and lines starting with ; (comments)
- if len(line) == 0 || line[0] == ';' || line[0] == '#' {
- continue
- }
-
- if line[0] == '[' {
- if line[0] != '[' || line[len(line)-1] != ']' {
- return nil, &IniError{
- Message: "malformed section header",
- File: filename,
- LineNumber: lineno,
- }
- }
-
- name := strings.TrimSpace(line[1 : len(line)-1])
-
- if len(name) == 0 {
- return nil, &IniError{
- Message: "empty section name",
- File: filename,
- LineNumber: lineno,
- }
- }
-
- sectionname = name
- section = ret.Sections[name]
-
- if section == nil {
- section = make(iniSection, 0, 10)
- ret.Sections[name] = section
- }
-
- continue
- }
-
- // Parse option here
- keyval := strings.SplitN(line, "=", 2)
-
- if len(keyval) != 2 {
- return nil, &IniError{
- Message: fmt.Sprintf("malformed key=value (%s)", line),
- File: filename,
- LineNumber: lineno,
- }
- }
-
- name := strings.TrimSpace(keyval[0])
- value := strings.TrimSpace(keyval[1])
- quoted := false
-
- if len(value) != 0 && value[0] == '"' {
- if v, err := strconv.Unquote(value); err == nil {
- value = v
-
- quoted = true
- } else {
- return nil, &IniError{
- Message: err.Error(),
- File: filename,
- LineNumber: lineno,
- }
- }
- }
-
- section = append(section, iniValue{
- Name: name,
- Value: value,
- Quoted: quoted,
- LineNumber: lineno,
- })
-
- ret.Sections[sectionname] = section
- }
-
- return ret, nil
-}
-
-func (i *IniParser) matchingGroups(name string) []*Group {
- if len(name) == 0 {
- var ret []*Group
-
- i.parser.eachGroup(func(g *Group) {
- ret = append(ret, g)
- })
-
- return ret
- }
-
- g := i.parser.groupByName(name)
-
- if g != nil {
- return []*Group{g}
- }
-
- return nil
-}
-
-func (i *IniParser) parse(ini *ini) error {
- p := i.parser
-
- var quotesLookup = make(map[*Option]bool)
-
- for name, section := range ini.Sections {
- groups := i.matchingGroups(name)
-
- if len(groups) == 0 {
- return newErrorf(ErrUnknownGroup, "could not find option group `%s'", name)
- }
-
- for _, inival := range section {
- var opt *Option
-
- for _, group := range groups {
- opt = group.optionByName(inival.Name, func(o *Option, n string) bool {
- return strings.ToLower(o.tag.Get("ini-name")) == strings.ToLower(n)
- })
-
- if opt != nil && len(opt.tag.Get("no-ini")) != 0 {
- opt = nil
- }
-
- if opt != nil {
- break
- }
- }
-
- if opt == nil {
- if (p.Options & IgnoreUnknown) == None {
- return &IniError{
- Message: fmt.Sprintf("unknown option: %s", inival.Name),
- File: ini.File,
- LineNumber: inival.LineNumber,
- }
- }
-
- continue
- }
-
- // ini value is ignored if override is set and
- // value was previously set from non default
- if i.ParseAsDefaults && !opt.isSetDefault {
- continue
- }
-
- pval := &inival.Value
-
- if !opt.canArgument() && len(inival.Value) == 0 {
- pval = nil
- } else {
- if opt.value.Type().Kind() == reflect.Map {
- parts := strings.SplitN(inival.Value, ":", 2)
-
- // only handle unquoting
- if len(parts) == 2 && parts[1][0] == '"' {
- if v, err := strconv.Unquote(parts[1]); err == nil {
- parts[1] = v
-
- inival.Quoted = true
- } else {
- return &IniError{
- Message: err.Error(),
- File: ini.File,
- LineNumber: inival.LineNumber,
- }
- }
-
- s := parts[0] + ":" + parts[1]
-
- pval = &s
- }
- }
- }
-
- if err := opt.set(pval); err != nil {
- return &IniError{
- Message: err.Error(),
- File: ini.File,
- LineNumber: inival.LineNumber,
- }
- }
-
- // either all INI values are quoted or only values who need quoting
- if _, ok := quotesLookup[opt]; !inival.Quoted || !ok {
- quotesLookup[opt] = inival.Quoted
- }
-
- opt.tag.Set("_read-ini-name", inival.Name)
- }
- }
-
- for opt, quoted := range quotesLookup {
- opt.iniQuote = quoted
- }
-
- return nil
-}
diff --git a/vendor/github.com/jessevdk/go-flags/man.go b/vendor/github.com/jessevdk/go-flags/man.go
deleted file mode 100644
index 0cb114e7..00000000
--- a/vendor/github.com/jessevdk/go-flags/man.go
+++ /dev/null
@@ -1,205 +0,0 @@
-package flags
-
-import (
- "fmt"
- "io"
- "runtime"
- "strings"
- "time"
-)
-
-func manQuote(s string) string {
- return strings.Replace(s, "\\", "\\\\", -1)
-}
-
-func formatForMan(wr io.Writer, s string) {
- for {
- idx := strings.IndexRune(s, '`')
-
- if idx < 0 {
- fmt.Fprintf(wr, "%s", manQuote(s))
- break
- }
-
- fmt.Fprintf(wr, "%s", manQuote(s[:idx]))
-
- s = s[idx+1:]
- idx = strings.IndexRune(s, '\'')
-
- if idx < 0 {
- fmt.Fprintf(wr, "%s", manQuote(s))
- break
- }
-
- fmt.Fprintf(wr, "\\fB%s\\fP", manQuote(s[:idx]))
- s = s[idx+1:]
- }
-}
-
-func writeManPageOptions(wr io.Writer, grp *Group) {
- grp.eachGroup(func(group *Group) {
- if group.Hidden || len(group.options) == 0 {
- return
- }
-
- // If the parent (grp) has any subgroups, display their descriptions as
- // subsection headers similar to the output of --help.
- if group.ShortDescription != "" && len(grp.groups) > 0 {
- fmt.Fprintf(wr, ".SS %s\n", group.ShortDescription)
-
- if group.LongDescription != "" {
- formatForMan(wr, group.LongDescription)
- fmt.Fprintln(wr, "")
- }
- }
-
- for _, opt := range group.options {
- if !opt.canCli() || opt.Hidden {
- continue
- }
-
- fmt.Fprintln(wr, ".TP")
- fmt.Fprintf(wr, "\\fB")
-
- if opt.ShortName != 0 {
- fmt.Fprintf(wr, "\\fB\\-%c\\fR", opt.ShortName)
- }
-
- if len(opt.LongName) != 0 {
- if opt.ShortName != 0 {
- fmt.Fprintf(wr, ", ")
- }
-
- fmt.Fprintf(wr, "\\fB\\-\\-%s\\fR", manQuote(opt.LongNameWithNamespace()))
- }
-
- if len(opt.ValueName) != 0 || opt.OptionalArgument {
- if opt.OptionalArgument {
- fmt.Fprintf(wr, " [\\fI%s=%s\\fR]", manQuote(opt.ValueName), manQuote(strings.Join(quoteV(opt.OptionalValue), ", ")))
- } else {
- fmt.Fprintf(wr, " \\fI%s\\fR", manQuote(opt.ValueName))
- }
- }
-
- if len(opt.Default) != 0 {
- fmt.Fprintf(wr, " ", manQuote(strings.Join(quoteV(opt.Default), ", ")))
- } else if len(opt.EnvDefaultKey) != 0 {
- if runtime.GOOS == "windows" {
- fmt.Fprintf(wr, " ", manQuote(opt.EnvDefaultKey))
- } else {
- fmt.Fprintf(wr, " ", manQuote(opt.EnvDefaultKey))
- }
- }
-
- if opt.Required {
- fmt.Fprintf(wr, " (\\fIrequired\\fR)")
- }
-
- fmt.Fprintln(wr, "\\fP")
-
- if len(opt.Description) != 0 {
- formatForMan(wr, opt.Description)
- fmt.Fprintln(wr, "")
- }
- }
- })
-}
-
-func writeManPageSubcommands(wr io.Writer, name string, root *Command) {
- commands := root.sortedVisibleCommands()
-
- for _, c := range commands {
- var nn string
-
- if c.Hidden {
- continue
- }
-
- if len(name) != 0 {
- nn = name + " " + c.Name
- } else {
- nn = c.Name
- }
-
- writeManPageCommand(wr, nn, root, c)
- }
-}
-
-func writeManPageCommand(wr io.Writer, name string, root *Command, command *Command) {
- fmt.Fprintf(wr, ".SS %s\n", name)
- fmt.Fprintln(wr, command.ShortDescription)
-
- if len(command.LongDescription) > 0 {
- fmt.Fprintln(wr, "")
-
- cmdstart := fmt.Sprintf("The %s command", manQuote(command.Name))
-
- if strings.HasPrefix(command.LongDescription, cmdstart) {
- fmt.Fprintf(wr, "The \\fI%s\\fP command", manQuote(command.Name))
-
- formatForMan(wr, command.LongDescription[len(cmdstart):])
- fmt.Fprintln(wr, "")
- } else {
- formatForMan(wr, command.LongDescription)
- fmt.Fprintln(wr, "")
- }
- }
-
- var usage string
- if us, ok := command.data.(Usage); ok {
- usage = us.Usage()
- } else if command.hasCliOptions() {
- usage = fmt.Sprintf("[%s-OPTIONS]", command.Name)
- }
-
- var pre string
- if root.hasCliOptions() {
- pre = fmt.Sprintf("%s [OPTIONS] %s", root.Name, command.Name)
- } else {
- pre = fmt.Sprintf("%s %s", root.Name, command.Name)
- }
-
- if len(usage) > 0 {
- fmt.Fprintf(wr, "\n\\fBUsage\\fP: %s %s\n.TP\n", manQuote(pre), manQuote(usage))
- }
-
- if len(command.Aliases) > 0 {
- fmt.Fprintf(wr, "\n\\fBAliases\\fP: %s\n\n", manQuote(strings.Join(command.Aliases, ", ")))
- }
-
- writeManPageOptions(wr, command.Group)
- writeManPageSubcommands(wr, name, command)
-}
-
-// WriteManPage writes a basic man page in groff format to the specified
-// writer.
-func (p *Parser) WriteManPage(wr io.Writer) {
- t := time.Now()
-
- fmt.Fprintf(wr, ".TH %s 1 \"%s\"\n", manQuote(p.Name), t.Format("2 January 2006"))
- fmt.Fprintln(wr, ".SH NAME")
- fmt.Fprintf(wr, "%s \\- %s\n", manQuote(p.Name), manQuote(p.ShortDescription))
- fmt.Fprintln(wr, ".SH SYNOPSIS")
-
- usage := p.Usage
-
- if len(usage) == 0 {
- usage = "[OPTIONS]"
- }
-
- fmt.Fprintf(wr, "\\fB%s\\fP %s\n", manQuote(p.Name), manQuote(usage))
- fmt.Fprintln(wr, ".SH DESCRIPTION")
-
- formatForMan(wr, p.LongDescription)
- fmt.Fprintln(wr, "")
-
- fmt.Fprintln(wr, ".SH OPTIONS")
-
- writeManPageOptions(wr, p.Command.Group)
-
- if len(p.visibleCommands()) > 0 {
- fmt.Fprintln(wr, ".SH COMMANDS")
-
- writeManPageSubcommands(wr, "", p.Command)
- }
-}
diff --git a/vendor/github.com/jessevdk/go-flags/multitag.go b/vendor/github.com/jessevdk/go-flags/multitag.go
deleted file mode 100644
index 96bb1a31..00000000
--- a/vendor/github.com/jessevdk/go-flags/multitag.go
+++ /dev/null
@@ -1,140 +0,0 @@
-package flags
-
-import (
- "strconv"
-)
-
-type multiTag struct {
- value string
- cache map[string][]string
-}
-
-func newMultiTag(v string) multiTag {
- return multiTag{
- value: v,
- }
-}
-
-func (x *multiTag) scan() (map[string][]string, error) {
- v := x.value
-
- ret := make(map[string][]string)
-
- // This is mostly copied from reflect.StructTag.Get
- for v != "" {
- i := 0
-
- // Skip whitespace
- for i < len(v) && v[i] == ' ' {
- i++
- }
-
- v = v[i:]
-
- if v == "" {
- break
- }
-
- // Scan to colon to find key
- i = 0
-
- for i < len(v) && v[i] != ' ' && v[i] != ':' && v[i] != '"' {
- i++
- }
-
- if i >= len(v) {
- return nil, newErrorf(ErrTag, "expected `:' after key name, but got end of tag (in `%v`)", x.value)
- }
-
- if v[i] != ':' {
- return nil, newErrorf(ErrTag, "expected `:' after key name, but got `%v' (in `%v`)", v[i], x.value)
- }
-
- if i+1 >= len(v) {
- return nil, newErrorf(ErrTag, "expected `\"' to start tag value at end of tag (in `%v`)", x.value)
- }
-
- if v[i+1] != '"' {
- return nil, newErrorf(ErrTag, "expected `\"' to start tag value, but got `%v' (in `%v`)", v[i+1], x.value)
- }
-
- name := v[:i]
- v = v[i+1:]
-
- // Scan quoted string to find value
- i = 1
-
- for i < len(v) && v[i] != '"' {
- if v[i] == '\n' {
- return nil, newErrorf(ErrTag, "unexpected newline in tag value `%v' (in `%v`)", name, x.value)
- }
-
- if v[i] == '\\' {
- i++
- }
- i++
- }
-
- if i >= len(v) {
- return nil, newErrorf(ErrTag, "expected end of tag value `\"' at end of tag (in `%v`)", x.value)
- }
-
- val, err := strconv.Unquote(v[:i+1])
-
- if err != nil {
- return nil, newErrorf(ErrTag, "Malformed value of tag `%v:%v` => %v (in `%v`)", name, v[:i+1], err, x.value)
- }
-
- v = v[i+1:]
-
- ret[name] = append(ret[name], val)
- }
-
- return ret, nil
-}
-
-func (x *multiTag) Parse() error {
- vals, err := x.scan()
- x.cache = vals
-
- return err
-}
-
-func (x *multiTag) cached() map[string][]string {
- if x.cache == nil {
- cache, _ := x.scan()
-
- if cache == nil {
- cache = make(map[string][]string)
- }
-
- x.cache = cache
- }
-
- return x.cache
-}
-
-func (x *multiTag) Get(key string) string {
- c := x.cached()
-
- if v, ok := c[key]; ok {
- return v[len(v)-1]
- }
-
- return ""
-}
-
-func (x *multiTag) GetMany(key string) []string {
- c := x.cached()
- return c[key]
-}
-
-func (x *multiTag) Set(key string, value string) {
- c := x.cached()
- c[key] = []string{value}
-}
-
-func (x *multiTag) SetMany(key string, value []string) {
- c := x.cached()
- c[key] = value
-}
diff --git a/vendor/github.com/jessevdk/go-flags/option.go b/vendor/github.com/jessevdk/go-flags/option.go
deleted file mode 100644
index 5f852501..00000000
--- a/vendor/github.com/jessevdk/go-flags/option.go
+++ /dev/null
@@ -1,459 +0,0 @@
-package flags
-
-import (
- "bytes"
- "fmt"
- "os"
- "reflect"
- "strings"
- "unicode/utf8"
-)
-
-// Option flag information. Contains a description of the option, short and
-// long name as well as a default value and whether an argument for this
-// flag is optional.
-type Option struct {
- // The description of the option flag. This description is shown
- // automatically in the built-in help.
- Description string
-
- // The short name of the option (a single character). If not 0, the
- // option flag can be 'activated' using -. Either ShortName
- // or LongName needs to be non-empty.
- ShortName rune
-
- // The long name of the option. If not "", the option flag can be
- // activated using --. Either ShortName or LongName needs
- // to be non-empty.
- LongName string
-
- // The default value of the option.
- Default []string
-
- // The optional environment default value key name.
- EnvDefaultKey string
-
- // The optional delimiter string for EnvDefaultKey values.
- EnvDefaultDelim string
-
- // If true, specifies that the argument to an option flag is optional.
- // When no argument to the flag is specified on the command line, the
- // value of OptionalValue will be set in the field this option represents.
- // This is only valid for non-boolean options.
- OptionalArgument bool
-
- // The optional value of the option. The optional value is used when
- // the option flag is marked as having an OptionalArgument. This means
- // that when the flag is specified, but no option argument is given,
- // the value of the field this option represents will be set to
- // OptionalValue. This is only valid for non-boolean options.
- OptionalValue []string
-
- // If true, the option _must_ be specified on the command line. If the
- // option is not specified, the parser will generate an ErrRequired type
- // error.
- Required bool
-
- // A name for the value of an option shown in the Help as --flag [ValueName]
- ValueName string
-
- // A mask value to show in the help instead of the default value. This
- // is useful for hiding sensitive information in the help, such as
- // passwords.
- DefaultMask string
-
- // If non empty, only a certain set of values is allowed for an option.
- Choices []string
-
- // If true, the option is not displayed in the help or man page
- Hidden bool
-
- // The group which the option belongs to
- group *Group
-
- // The struct field which the option represents.
- field reflect.StructField
-
- // The struct field value which the option represents.
- value reflect.Value
-
- // Determines if the option will be always quoted in the INI output
- iniQuote bool
-
- tag multiTag
- isSet bool
- isSetDefault bool
- preventDefault bool
-
- defaultLiteral string
-}
-
-// LongNameWithNamespace returns the option's long name with the group namespaces
-// prepended by walking up the option's group tree. Namespaces and the long name
-// itself are separated by the parser's namespace delimiter. If the long name is
-// empty an empty string is returned.
-func (option *Option) LongNameWithNamespace() string {
- if len(option.LongName) == 0 {
- return ""
- }
-
- // fetch the namespace delimiter from the parser which is always at the
- // end of the group hierarchy
- namespaceDelimiter := ""
- g := option.group
-
- for {
- if p, ok := g.parent.(*Parser); ok {
- namespaceDelimiter = p.NamespaceDelimiter
-
- break
- }
-
- switch i := g.parent.(type) {
- case *Command:
- g = i.Group
- case *Group:
- g = i
- }
- }
-
- // concatenate long name with namespace
- longName := option.LongName
- g = option.group
-
- for g != nil {
- if g.Namespace != "" {
- longName = g.Namespace + namespaceDelimiter + longName
- }
-
- switch i := g.parent.(type) {
- case *Command:
- g = i.Group
- case *Group:
- g = i
- case *Parser:
- g = nil
- }
- }
-
- return longName
-}
-
-// String converts an option to a human friendly readable string describing the
-// option.
-func (option *Option) String() string {
- var s string
- var short string
-
- if option.ShortName != 0 {
- data := make([]byte, utf8.RuneLen(option.ShortName))
- utf8.EncodeRune(data, option.ShortName)
- short = string(data)
-
- if len(option.LongName) != 0 {
- s = fmt.Sprintf("%s%s, %s%s",
- string(defaultShortOptDelimiter), short,
- defaultLongOptDelimiter, option.LongNameWithNamespace())
- } else {
- s = fmt.Sprintf("%s%s", string(defaultShortOptDelimiter), short)
- }
- } else if len(option.LongName) != 0 {
- s = fmt.Sprintf("%s%s", defaultLongOptDelimiter, option.LongNameWithNamespace())
- }
-
- return s
-}
-
-// Value returns the option value as an interface{}.
-func (option *Option) Value() interface{} {
- return option.value.Interface()
-}
-
-// Field returns the reflect struct field of the option.
-func (option *Option) Field() reflect.StructField {
- return option.field
-}
-
-// IsSet returns true if option has been set
-func (option *Option) IsSet() bool {
- return option.isSet
-}
-
-// IsSetDefault returns true if option has been set via the default option tag
-func (option *Option) IsSetDefault() bool {
- return option.isSetDefault
-}
-
-// Set the value of an option to the specified value. An error will be returned
-// if the specified value could not be converted to the corresponding option
-// value type.
-func (option *Option) set(value *string) error {
- kind := option.value.Type().Kind()
-
- if (kind == reflect.Map || kind == reflect.Slice) && !option.isSet {
- option.empty()
- }
-
- option.isSet = true
- option.preventDefault = true
-
- if len(option.Choices) != 0 {
- found := false
-
- for _, choice := range option.Choices {
- if choice == *value {
- found = true
- break
- }
- }
-
- if !found {
- allowed := strings.Join(option.Choices[0:len(option.Choices)-1], ", ")
-
- if len(option.Choices) > 1 {
- allowed += " or " + option.Choices[len(option.Choices)-1]
- }
-
- return newErrorf(ErrInvalidChoice,
- "Invalid value `%s' for option `%s'. Allowed values are: %s",
- *value, option, allowed)
- }
- }
-
- if option.isFunc() {
- return option.call(value)
- } else if value != nil {
- return convert(*value, option.value, option.tag)
- }
-
- return convert("", option.value, option.tag)
-}
-
-func (option *Option) canCli() bool {
- return option.ShortName != 0 || len(option.LongName) != 0
-}
-
-func (option *Option) canArgument() bool {
- if u := option.isUnmarshaler(); u != nil {
- return true
- }
-
- return !option.isBool()
-}
-
-func (option *Option) emptyValue() reflect.Value {
- tp := option.value.Type()
-
- if tp.Kind() == reflect.Map {
- return reflect.MakeMap(tp)
- }
-
- return reflect.Zero(tp)
-}
-
-func (option *Option) empty() {
- if !option.isFunc() {
- option.value.Set(option.emptyValue())
- }
-}
-
-func (option *Option) clearDefault() {
- usedDefault := option.Default
-
- if envKey := option.EnvDefaultKey; envKey != "" {
- if value, ok := os.LookupEnv(envKey); ok {
- if option.EnvDefaultDelim != "" {
- usedDefault = strings.Split(value,
- option.EnvDefaultDelim)
- } else {
- usedDefault = []string{value}
- }
- }
- }
-
- option.isSetDefault = true
-
- if len(usedDefault) > 0 {
- option.empty()
-
- for _, d := range usedDefault {
- option.set(&d)
- option.isSetDefault = true
- }
- } else {
- tp := option.value.Type()
-
- switch tp.Kind() {
- case reflect.Map:
- if option.value.IsNil() {
- option.empty()
- }
- case reflect.Slice:
- if option.value.IsNil() {
- option.empty()
- }
- }
- }
-}
-
-func (option *Option) valueIsDefault() bool {
- // Check if the value of the option corresponds to its
- // default value
- emptyval := option.emptyValue()
-
- checkvalptr := reflect.New(emptyval.Type())
- checkval := reflect.Indirect(checkvalptr)
-
- checkval.Set(emptyval)
-
- if len(option.Default) != 0 {
- for _, v := range option.Default {
- convert(v, checkval, option.tag)
- }
- }
-
- return reflect.DeepEqual(option.value.Interface(), checkval.Interface())
-}
-
-func (option *Option) isUnmarshaler() Unmarshaler {
- v := option.value
-
- for {
- if !v.CanInterface() {
- break
- }
-
- i := v.Interface()
-
- if u, ok := i.(Unmarshaler); ok {
- return u
- }
-
- if !v.CanAddr() {
- break
- }
-
- v = v.Addr()
- }
-
- return nil
-}
-
-func (option *Option) isBool() bool {
- tp := option.value.Type()
-
- for {
- switch tp.Kind() {
- case reflect.Slice, reflect.Ptr:
- tp = tp.Elem()
- case reflect.Bool:
- return true
- case reflect.Func:
- return tp.NumIn() == 0
- default:
- return false
- }
- }
-}
-
-func (option *Option) isSignedNumber() bool {
- tp := option.value.Type()
-
- for {
- switch tp.Kind() {
- case reflect.Slice, reflect.Ptr:
- tp = tp.Elem()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Float32, reflect.Float64:
- return true
- default:
- return false
- }
- }
-}
-
-func (option *Option) isFunc() bool {
- return option.value.Type().Kind() == reflect.Func
-}
-
-func (option *Option) call(value *string) error {
- var retval []reflect.Value
-
- if value == nil {
- retval = option.value.Call(nil)
- } else {
- tp := option.value.Type().In(0)
-
- val := reflect.New(tp)
- val = reflect.Indirect(val)
-
- if err := convert(*value, val, option.tag); err != nil {
- return err
- }
-
- retval = option.value.Call([]reflect.Value{val})
- }
-
- if len(retval) == 1 && retval[0].Type() == reflect.TypeOf((*error)(nil)).Elem() {
- if retval[0].Interface() == nil {
- return nil
- }
-
- return retval[0].Interface().(error)
- }
-
- return nil
-}
-
-func (option *Option) updateDefaultLiteral() {
- defs := option.Default
- def := ""
-
- if len(defs) == 0 && option.canArgument() {
- var showdef bool
-
- switch option.field.Type.Kind() {
- case reflect.Func, reflect.Ptr:
- showdef = !option.value.IsNil()
- case reflect.Slice, reflect.String, reflect.Array:
- showdef = option.value.Len() > 0
- case reflect.Map:
- showdef = !option.value.IsNil() && option.value.Len() > 0
- default:
- zeroval := reflect.Zero(option.field.Type)
- showdef = !reflect.DeepEqual(zeroval.Interface(), option.value.Interface())
- }
-
- if showdef {
- def, _ = convertToString(option.value, option.tag)
- }
- } else if len(defs) != 0 {
- l := len(defs) - 1
-
- for i := 0; i < l; i++ {
- def += quoteIfNeeded(defs[i]) + ", "
- }
-
- def += quoteIfNeeded(defs[l])
- }
-
- option.defaultLiteral = def
-}
-
-func (option *Option) shortAndLongName() string {
- ret := &bytes.Buffer{}
-
- if option.ShortName != 0 {
- ret.WriteRune(defaultShortOptDelimiter)
- ret.WriteRune(option.ShortName)
- }
-
- if len(option.LongName) != 0 {
- if option.ShortName != 0 {
- ret.WriteRune('/')
- }
-
- ret.WriteString(option.LongName)
- }
-
- return ret.String()
-}
diff --git a/vendor/github.com/jessevdk/go-flags/optstyle_other.go b/vendor/github.com/jessevdk/go-flags/optstyle_other.go
deleted file mode 100644
index 56dfdae1..00000000
--- a/vendor/github.com/jessevdk/go-flags/optstyle_other.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// +build !windows forceposix
-
-package flags
-
-import (
- "strings"
-)
-
-const (
- defaultShortOptDelimiter = '-'
- defaultLongOptDelimiter = "--"
- defaultNameArgDelimiter = '='
-)
-
-func argumentStartsOption(arg string) bool {
- return len(arg) > 0 && arg[0] == '-'
-}
-
-func argumentIsOption(arg string) bool {
- if len(arg) > 1 && arg[0] == '-' && arg[1] != '-' {
- return true
- }
-
- if len(arg) > 2 && arg[0] == '-' && arg[1] == '-' && arg[2] != '-' {
- return true
- }
-
- return false
-}
-
-// stripOptionPrefix returns the option without the prefix and whether or
-// not the option is a long option or not.
-func stripOptionPrefix(optname string) (prefix string, name string, islong bool) {
- if strings.HasPrefix(optname, "--") {
- return "--", optname[2:], true
- } else if strings.HasPrefix(optname, "-") {
- return "-", optname[1:], false
- }
-
- return "", optname, false
-}
-
-// splitOption attempts to split the passed option into a name and an argument.
-// When there is no argument specified, nil will be returned for it.
-func splitOption(prefix string, option string, islong bool) (string, string, *string) {
- pos := strings.Index(option, "=")
-
- if (islong && pos >= 0) || (!islong && pos == 1) {
- rest := option[pos+1:]
- return option[:pos], "=", &rest
- }
-
- return option, "", nil
-}
-
-// addHelpGroup adds a new group that contains default help parameters.
-func (c *Command) addHelpGroup(showHelp func() error) *Group {
- var help struct {
- ShowHelp func() error `short:"h" long:"help" description:"Show this help message"`
- }
-
- help.ShowHelp = showHelp
- ret, _ := c.AddGroup("Help Options", "", &help)
- ret.isBuiltinHelp = true
-
- return ret
-}
diff --git a/vendor/github.com/jessevdk/go-flags/optstyle_windows.go b/vendor/github.com/jessevdk/go-flags/optstyle_windows.go
deleted file mode 100644
index f3f28aee..00000000
--- a/vendor/github.com/jessevdk/go-flags/optstyle_windows.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// +build !forceposix
-
-package flags
-
-import (
- "strings"
-)
-
-// Windows uses a front slash for both short and long options. Also it uses
-// a colon for name/argument delimter.
-const (
- defaultShortOptDelimiter = '/'
- defaultLongOptDelimiter = "/"
- defaultNameArgDelimiter = ':'
-)
-
-func argumentStartsOption(arg string) bool {
- return len(arg) > 0 && (arg[0] == '-' || arg[0] == '/')
-}
-
-func argumentIsOption(arg string) bool {
- // Windows-style options allow front slash for the option
- // delimiter.
- if len(arg) > 1 && arg[0] == '/' {
- return true
- }
-
- if len(arg) > 1 && arg[0] == '-' && arg[1] != '-' {
- return true
- }
-
- if len(arg) > 2 && arg[0] == '-' && arg[1] == '-' && arg[2] != '-' {
- return true
- }
-
- return false
-}
-
-// stripOptionPrefix returns the option without the prefix and whether or
-// not the option is a long option or not.
-func stripOptionPrefix(optname string) (prefix string, name string, islong bool) {
- // Determine if the argument is a long option or not. Windows
- // typically supports both long and short options with a single
- // front slash as the option delimiter, so handle this situation
- // nicely.
- possplit := 0
-
- if strings.HasPrefix(optname, "--") {
- possplit = 2
- islong = true
- } else if strings.HasPrefix(optname, "-") {
- possplit = 1
- islong = false
- } else if strings.HasPrefix(optname, "/") {
- possplit = 1
- islong = len(optname) > 2
- }
-
- return optname[:possplit], optname[possplit:], islong
-}
-
-// splitOption attempts to split the passed option into a name and an argument.
-// When there is no argument specified, nil will be returned for it.
-func splitOption(prefix string, option string, islong bool) (string, string, *string) {
- if len(option) == 0 {
- return option, "", nil
- }
-
- // Windows typically uses a colon for the option name and argument
- // delimiter while POSIX typically uses an equals. Support both styles,
- // but don't allow the two to be mixed. That is to say /foo:bar and
- // --foo=bar are acceptable, but /foo=bar and --foo:bar are not.
- var pos int
- var sp string
-
- if prefix == "/" {
- sp = ":"
- pos = strings.Index(option, sp)
- } else if len(prefix) > 0 {
- sp = "="
- pos = strings.Index(option, sp)
- }
-
- if (islong && pos >= 0) || (!islong && pos == 1) {
- rest := option[pos+1:]
- return option[:pos], sp, &rest
- }
-
- return option, "", nil
-}
-
-// addHelpGroup adds a new group that contains default help parameters.
-func (c *Command) addHelpGroup(showHelp func() error) *Group {
- // Windows CLI applications typically use /? for help, so make both
- // that available as well as the POSIX style h and help.
- var help struct {
- ShowHelpWindows func() error `short:"?" description:"Show this help message"`
- ShowHelpPosix func() error `short:"h" long:"help" description:"Show this help message"`
- }
-
- help.ShowHelpWindows = showHelp
- help.ShowHelpPosix = showHelp
-
- ret, _ := c.AddGroup("Help Options", "", &help)
- ret.isBuiltinHelp = true
-
- return ret
-}
diff --git a/vendor/github.com/jessevdk/go-flags/parser.go b/vendor/github.com/jessevdk/go-flags/parser.go
deleted file mode 100644
index 0a7922a0..00000000
--- a/vendor/github.com/jessevdk/go-flags/parser.go
+++ /dev/null
@@ -1,700 +0,0 @@
-// Copyright 2012 Jesse van den Kieboom. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package flags
-
-import (
- "bytes"
- "fmt"
- "os"
- "path"
- "sort"
- "strings"
- "unicode/utf8"
-)
-
-// A Parser provides command line option parsing. It can contain several
-// option groups each with their own set of options.
-type Parser struct {
- // Embedded, see Command for more information
- *Command
-
- // A usage string to be displayed in the help message.
- Usage string
-
- // Option flags changing the behavior of the parser.
- Options Options
-
- // NamespaceDelimiter separates group namespaces and option long names
- NamespaceDelimiter string
-
- // UnknownOptionsHandler is a function which gets called when the parser
- // encounters an unknown option. The function receives the unknown option
- // name, a SplitArgument which specifies its value if set with an argument
- // separator, and the remaining command line arguments.
- // It should return a new list of remaining arguments to continue parsing,
- // or an error to indicate a parse failure.
- UnknownOptionHandler func(option string, arg SplitArgument, args []string) ([]string, error)
-
- // CompletionHandler is a function gets called to handle the completion of
- // items. By default, the items are printed and the application is exited.
- // You can override this default behavior by specifying a custom CompletionHandler.
- CompletionHandler func(items []Completion)
-
- // CommandHandler is a function that gets called to handle execution of a
- // command. By default, the command will simply be executed. This can be
- // overridden to perform certain actions (such as applying global flags)
- // just before the command is executed. Note that if you override the
- // handler it is your responsibility to call the command.Execute function.
- //
- // The command passed into CommandHandler may be nil in case there is no
- // command to be executed when parsing has finished.
- CommandHandler func(command Commander, args []string) error
-
- internalError error
-}
-
-// SplitArgument represents the argument value of an option that was passed using
-// an argument separator.
-type SplitArgument interface {
- // String returns the option's value as a string, and a boolean indicating
- // if the option was present.
- Value() (string, bool)
-}
-
-type strArgument struct {
- value *string
-}
-
-func (s strArgument) Value() (string, bool) {
- if s.value == nil {
- return "", false
- }
-
- return *s.value, true
-}
-
-// Options provides parser options that change the behavior of the option
-// parser.
-type Options uint
-
-const (
- // None indicates no options.
- None Options = 0
-
- // HelpFlag adds a default Help Options group to the parser containing
- // -h and --help options. When either -h or --help is specified on the
- // command line, the parser will return the special error of type
- // ErrHelp. When PrintErrors is also specified, then the help message
- // will also be automatically printed to os.Stdout.
- HelpFlag = 1 << iota
-
- // PassDoubleDash passes all arguments after a double dash, --, as
- // remaining command line arguments (i.e. they will not be parsed for
- // flags).
- PassDoubleDash
-
- // IgnoreUnknown ignores any unknown options and passes them as
- // remaining command line arguments instead of generating an error.
- IgnoreUnknown
-
- // PrintErrors prints any errors which occurred during parsing to
- // os.Stderr. In the special case of ErrHelp, the message will be printed
- // to os.Stdout.
- PrintErrors
-
- // PassAfterNonOption passes all arguments after the first non option
- // as remaining command line arguments. This is equivalent to strict
- // POSIX processing.
- PassAfterNonOption
-
- // Default is a convenient default set of options which should cover
- // most of the uses of the flags package.
- Default = HelpFlag | PrintErrors | PassDoubleDash
-)
-
-type parseState struct {
- arg string
- args []string
- retargs []string
- positional []*Arg
- err error
-
- command *Command
- lookup lookup
-}
-
-// Parse is a convenience function to parse command line options with default
-// settings. The provided data is a pointer to a struct representing the
-// default option group (named "Application Options"). For more control, use
-// flags.NewParser.
-func Parse(data interface{}) ([]string, error) {
- return NewParser(data, Default).Parse()
-}
-
-// ParseArgs is a convenience function to parse command line options with default
-// settings. The provided data is a pointer to a struct representing the
-// default option group (named "Application Options"). The args argument is
-// the list of command line arguments to parse. If you just want to parse the
-// default program command line arguments (i.e. os.Args), then use flags.Parse
-// instead. For more control, use flags.NewParser.
-func ParseArgs(data interface{}, args []string) ([]string, error) {
- return NewParser(data, Default).ParseArgs(args)
-}
-
-// NewParser creates a new parser. It uses os.Args[0] as the application
-// name and then calls Parser.NewNamedParser (see Parser.NewNamedParser for
-// more details). The provided data is a pointer to a struct representing the
-// default option group (named "Application Options"), or nil if the default
-// group should not be added. The options parameter specifies a set of options
-// for the parser.
-func NewParser(data interface{}, options Options) *Parser {
- p := NewNamedParser(path.Base(os.Args[0]), options)
-
- if data != nil {
- g, err := p.AddGroup("Application Options", "", data)
-
- if err == nil {
- g.parent = p
- }
-
- p.internalError = err
- }
-
- return p
-}
-
-// NewNamedParser creates a new parser. The appname is used to display the
-// executable name in the built-in help message. Option groups and commands can
-// be added to this parser by using AddGroup and AddCommand.
-func NewNamedParser(appname string, options Options) *Parser {
- p := &Parser{
- Command: newCommand(appname, "", "", nil),
- Options: options,
- NamespaceDelimiter: ".",
- }
-
- p.Command.parent = p
-
- return p
-}
-
-// Parse parses the command line arguments from os.Args using Parser.ParseArgs.
-// For more detailed information see ParseArgs.
-func (p *Parser) Parse() ([]string, error) {
- return p.ParseArgs(os.Args[1:])
-}
-
-// ParseArgs parses the command line arguments according to the option groups that
-// were added to the parser. On successful parsing of the arguments, the
-// remaining, non-option, arguments (if any) are returned. The returned error
-// indicates a parsing error and can be used with PrintError to display
-// contextual information on where the error occurred exactly.
-//
-// When the common help group has been added (AddHelp) and either -h or --help
-// was specified in the command line arguments, a help message will be
-// automatically printed if the PrintErrors option is enabled.
-// Furthermore, the special error type ErrHelp is returned.
-// It is up to the caller to exit the program if so desired.
-func (p *Parser) ParseArgs(args []string) ([]string, error) {
- if p.internalError != nil {
- return nil, p.internalError
- }
-
- p.eachOption(func(c *Command, g *Group, option *Option) {
- option.isSet = false
- option.isSetDefault = false
- option.updateDefaultLiteral()
- })
-
- // Add built-in help group to all commands if necessary
- if (p.Options & HelpFlag) != None {
- p.addHelpGroups(p.showBuiltinHelp)
- }
-
- compval := os.Getenv("GO_FLAGS_COMPLETION")
-
- if len(compval) != 0 {
- comp := &completion{parser: p}
- items := comp.complete(args)
-
- if p.CompletionHandler != nil {
- p.CompletionHandler(items)
- } else {
- comp.print(items, compval == "verbose")
- os.Exit(0)
- }
-
- return nil, nil
- }
-
- s := &parseState{
- args: args,
- retargs: make([]string, 0, len(args)),
- }
-
- p.fillParseState(s)
-
- for !s.eof() {
- arg := s.pop()
-
- // When PassDoubleDash is set and we encounter a --, then
- // simply append all the rest as arguments and break out
- if (p.Options&PassDoubleDash) != None && arg == "--" {
- s.addArgs(s.args...)
- break
- }
-
- if !argumentIsOption(arg) {
- // Note: this also sets s.err, so we can just check for
- // nil here and use s.err later
- if p.parseNonOption(s) != nil {
- break
- }
-
- continue
- }
-
- var err error
-
- prefix, optname, islong := stripOptionPrefix(arg)
- optname, _, argument := splitOption(prefix, optname, islong)
-
- if islong {
- err = p.parseLong(s, optname, argument)
- } else {
- err = p.parseShort(s, optname, argument)
- }
-
- if err != nil {
- ignoreUnknown := (p.Options & IgnoreUnknown) != None
- parseErr := wrapError(err)
-
- if parseErr.Type != ErrUnknownFlag || (!ignoreUnknown && p.UnknownOptionHandler == nil) {
- s.err = parseErr
- break
- }
-
- if ignoreUnknown {
- s.addArgs(arg)
- } else if p.UnknownOptionHandler != nil {
- modifiedArgs, err := p.UnknownOptionHandler(optname, strArgument{argument}, s.args)
-
- if err != nil {
- s.err = err
- break
- }
-
- s.args = modifiedArgs
- }
- }
- }
-
- if s.err == nil {
- p.eachOption(func(c *Command, g *Group, option *Option) {
- if option.preventDefault {
- return
- }
-
- option.clearDefault()
- })
-
- s.checkRequired(p)
- }
-
- var reterr error
-
- if s.err != nil {
- reterr = s.err
- } else if len(s.command.commands) != 0 && !s.command.SubcommandsOptional {
- reterr = s.estimateCommand()
- } else if cmd, ok := s.command.data.(Commander); ok {
- if p.CommandHandler != nil {
- reterr = p.CommandHandler(cmd, s.retargs)
- } else {
- reterr = cmd.Execute(s.retargs)
- }
- } else if p.CommandHandler != nil {
- reterr = p.CommandHandler(nil, s.retargs)
- }
-
- if reterr != nil {
- var retargs []string
-
- if ourErr, ok := reterr.(*Error); !ok || ourErr.Type != ErrHelp {
- retargs = append([]string{s.arg}, s.args...)
- } else {
- retargs = s.args
- }
-
- return retargs, p.printError(reterr)
- }
-
- return s.retargs, nil
-}
-
-func (p *parseState) eof() bool {
- return len(p.args) == 0
-}
-
-func (p *parseState) pop() string {
- if p.eof() {
- return ""
- }
-
- p.arg = p.args[0]
- p.args = p.args[1:]
-
- return p.arg
-}
-
-func (p *parseState) peek() string {
- if p.eof() {
- return ""
- }
-
- return p.args[0]
-}
-
-func (p *parseState) checkRequired(parser *Parser) error {
- c := parser.Command
-
- var required []*Option
-
- for c != nil {
- c.eachGroup(func(g *Group) {
- for _, option := range g.options {
- if !option.isSet && option.Required {
- required = append(required, option)
- }
- }
- })
-
- c = c.Active
- }
-
- if len(required) == 0 {
- if len(p.positional) > 0 {
- var reqnames []string
-
- for _, arg := range p.positional {
- argRequired := (!arg.isRemaining() && p.command.ArgsRequired) || arg.Required != -1 || arg.RequiredMaximum != -1
-
- if !argRequired {
- continue
- }
-
- if arg.isRemaining() {
- if arg.value.Len() < arg.Required {
- var arguments string
-
- if arg.Required > 1 {
- arguments = "arguments, but got only " + fmt.Sprintf("%d", arg.value.Len())
- } else {
- arguments = "argument"
- }
-
- reqnames = append(reqnames, "`"+arg.Name+" (at least "+fmt.Sprintf("%d", arg.Required)+" "+arguments+")`")
- } else if arg.RequiredMaximum != -1 && arg.value.Len() > arg.RequiredMaximum {
- if arg.RequiredMaximum == 0 {
- reqnames = append(reqnames, "`"+arg.Name+" (zero arguments)`")
- } else {
- var arguments string
-
- if arg.RequiredMaximum > 1 {
- arguments = "arguments, but got " + fmt.Sprintf("%d", arg.value.Len())
- } else {
- arguments = "argument"
- }
-
- reqnames = append(reqnames, "`"+arg.Name+" (at most "+fmt.Sprintf("%d", arg.RequiredMaximum)+" "+arguments+")`")
- }
- }
- } else {
- reqnames = append(reqnames, "`"+arg.Name+"`")
- }
- }
-
- if len(reqnames) == 0 {
- return nil
- }
-
- var msg string
-
- if len(reqnames) == 1 {
- msg = fmt.Sprintf("the required argument %s was not provided", reqnames[0])
- } else {
- msg = fmt.Sprintf("the required arguments %s and %s were not provided",
- strings.Join(reqnames[:len(reqnames)-1], ", "), reqnames[len(reqnames)-1])
- }
-
- p.err = newError(ErrRequired, msg)
- return p.err
- }
-
- return nil
- }
-
- names := make([]string, 0, len(required))
-
- for _, k := range required {
- names = append(names, "`"+k.String()+"'")
- }
-
- sort.Strings(names)
-
- var msg string
-
- if len(names) == 1 {
- msg = fmt.Sprintf("the required flag %s was not specified", names[0])
- } else {
- msg = fmt.Sprintf("the required flags %s and %s were not specified",
- strings.Join(names[:len(names)-1], ", "), names[len(names)-1])
- }
-
- p.err = newError(ErrRequired, msg)
- return p.err
-}
-
-func (p *parseState) estimateCommand() error {
- commands := p.command.sortedVisibleCommands()
- cmdnames := make([]string, len(commands))
-
- for i, v := range commands {
- cmdnames[i] = v.Name
- }
-
- var msg string
- var errtype ErrorType
-
- if len(p.retargs) != 0 {
- c, l := closestChoice(p.retargs[0], cmdnames)
- msg = fmt.Sprintf("Unknown command `%s'", p.retargs[0])
- errtype = ErrUnknownCommand
-
- if float32(l)/float32(len(c)) < 0.5 {
- msg = fmt.Sprintf("%s, did you mean `%s'?", msg, c)
- } else if len(cmdnames) == 1 {
- msg = fmt.Sprintf("%s. You should use the %s command",
- msg,
- cmdnames[0])
- } else if len(cmdnames) > 1 {
- msg = fmt.Sprintf("%s. Please specify one command of: %s or %s",
- msg,
- strings.Join(cmdnames[:len(cmdnames)-1], ", "),
- cmdnames[len(cmdnames)-1])
- }
- } else {
- errtype = ErrCommandRequired
-
- if len(cmdnames) == 1 {
- msg = fmt.Sprintf("Please specify the %s command", cmdnames[0])
- } else if len(cmdnames) > 1 {
- msg = fmt.Sprintf("Please specify one command of: %s or %s",
- strings.Join(cmdnames[:len(cmdnames)-1], ", "),
- cmdnames[len(cmdnames)-1])
- }
- }
-
- return newError(errtype, msg)
-}
-
-func (p *Parser) parseOption(s *parseState, name string, option *Option, canarg bool, argument *string) (err error) {
- if !option.canArgument() {
- if argument != nil {
- return newErrorf(ErrNoArgumentForBool, "bool flag `%s' cannot have an argument", option)
- }
-
- err = option.set(nil)
- } else if argument != nil || (canarg && !s.eof()) {
- var arg string
-
- if argument != nil {
- arg = *argument
- } else {
- arg = s.pop()
-
- if argumentIsOption(arg) && !(option.isSignedNumber() && len(arg) > 1 && arg[0] == '-' && arg[1] >= '0' && arg[1] <= '9') {
- return newErrorf(ErrExpectedArgument, "expected argument for flag `%s', but got option `%s'", option, arg)
- } else if p.Options&PassDoubleDash != 0 && arg == "--" {
- return newErrorf(ErrExpectedArgument, "expected argument for flag `%s', but got double dash `--'", option)
- }
- }
-
- if option.tag.Get("unquote") != "false" {
- arg, err = unquoteIfPossible(arg)
- }
-
- if err == nil {
- err = option.set(&arg)
- }
- } else if option.OptionalArgument {
- option.empty()
-
- for _, v := range option.OptionalValue {
- err = option.set(&v)
-
- if err != nil {
- break
- }
- }
- } else {
- err = newErrorf(ErrExpectedArgument, "expected argument for flag `%s'", option)
- }
-
- if err != nil {
- if _, ok := err.(*Error); !ok {
- err = newErrorf(ErrMarshal, "invalid argument for flag `%s' (expected %s): %s",
- option,
- option.value.Type(),
- err.Error())
- }
- }
-
- return err
-}
-
-func (p *Parser) parseLong(s *parseState, name string, argument *string) error {
- if option := s.lookup.longNames[name]; option != nil {
- // Only long options that are required can consume an argument
- // from the argument list
- canarg := !option.OptionalArgument
-
- return p.parseOption(s, name, option, canarg, argument)
- }
-
- return newErrorf(ErrUnknownFlag, "unknown flag `%s'", name)
-}
-
-func (p *Parser) splitShortConcatArg(s *parseState, optname string) (string, *string) {
- c, n := utf8.DecodeRuneInString(optname)
-
- if n == len(optname) {
- return optname, nil
- }
-
- first := string(c)
-
- if option := s.lookup.shortNames[first]; option != nil && option.canArgument() {
- arg := optname[n:]
- return first, &arg
- }
-
- return optname, nil
-}
-
-func (p *Parser) parseShort(s *parseState, optname string, argument *string) error {
- if argument == nil {
- optname, argument = p.splitShortConcatArg(s, optname)
- }
-
- for i, c := range optname {
- shortname := string(c)
-
- if option := s.lookup.shortNames[shortname]; option != nil {
- // Only the last short argument can consume an argument from
- // the arguments list, and only if it's non optional
- canarg := (i+utf8.RuneLen(c) == len(optname)) && !option.OptionalArgument
-
- if err := p.parseOption(s, shortname, option, canarg, argument); err != nil {
- return err
- }
- } else {
- return newErrorf(ErrUnknownFlag, "unknown flag `%s'", shortname)
- }
-
- // Only the first option can have a concatted argument, so just
- // clear argument here
- argument = nil
- }
-
- return nil
-}
-
-func (p *parseState) addArgs(args ...string) error {
- for len(p.positional) > 0 && len(args) > 0 {
- arg := p.positional[0]
-
- if err := convert(args[0], arg.value, arg.tag); err != nil {
- p.err = err
- return err
- }
-
- if !arg.isRemaining() {
- p.positional = p.positional[1:]
- }
-
- args = args[1:]
- }
-
- p.retargs = append(p.retargs, args...)
- return nil
-}
-
-func (p *Parser) parseNonOption(s *parseState) error {
- if len(s.positional) > 0 {
- return s.addArgs(s.arg)
- }
-
- if len(s.command.commands) > 0 && len(s.retargs) == 0 {
- if cmd := s.lookup.commands[s.arg]; cmd != nil {
- s.command.Active = cmd
- cmd.fillParseState(s)
-
- return nil
- } else if !s.command.SubcommandsOptional {
- s.addArgs(s.arg)
- return newErrorf(ErrUnknownCommand, "Unknown command `%s'", s.arg)
- }
- }
-
- if (p.Options & PassAfterNonOption) != None {
- // If PassAfterNonOption is set then all remaining arguments
- // are considered positional
- if err := s.addArgs(s.arg); err != nil {
- return err
- }
-
- if err := s.addArgs(s.args...); err != nil {
- return err
- }
-
- s.args = []string{}
- } else {
- return s.addArgs(s.arg)
- }
-
- return nil
-}
-
-func (p *Parser) showBuiltinHelp() error {
- var b bytes.Buffer
-
- p.WriteHelp(&b)
- return newError(ErrHelp, b.String())
-}
-
-func (p *Parser) printError(err error) error {
- if err != nil && (p.Options&PrintErrors) != None {
- flagsErr, ok := err.(*Error)
-
- if ok && flagsErr.Type == ErrHelp {
- fmt.Fprintln(os.Stdout, err)
- } else {
- fmt.Fprintln(os.Stderr, err)
- }
- }
-
- return err
-}
-
-func (p *Parser) clearIsSet() {
- p.eachCommand(func(c *Command) {
- c.eachGroup(func(g *Group) {
- for _, option := range g.options {
- option.isSet = false
- }
- })
- }, true)
-}
diff --git a/vendor/github.com/jessevdk/go-flags/termsize.go b/vendor/github.com/jessevdk/go-flags/termsize.go
deleted file mode 100644
index 1ca6a850..00000000
--- a/vendor/github.com/jessevdk/go-flags/termsize.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// +build !windows,!plan9,!solaris,!appengine
-
-package flags
-
-import (
- "syscall"
- "unsafe"
-)
-
-type winsize struct {
- row, col uint16
- xpixel, ypixel uint16
-}
-
-func getTerminalColumns() int {
- ws := winsize{}
-
- if tIOCGWINSZ != 0 {
- syscall.Syscall(syscall.SYS_IOCTL,
- uintptr(0),
- uintptr(tIOCGWINSZ),
- uintptr(unsafe.Pointer(&ws)))
-
- return int(ws.col)
- }
-
- return 80
-}
diff --git a/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go b/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go
deleted file mode 100644
index 3d5385b0..00000000
--- a/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build windows plan9 solaris appengine
-
-package flags
-
-func getTerminalColumns() int {
- return 80
-}
diff --git a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_bsdish.go b/vendor/github.com/jessevdk/go-flags/tiocgwinsz_bsdish.go
deleted file mode 100644
index fcc11860..00000000
--- a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_bsdish.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build darwin freebsd netbsd openbsd
-
-package flags
-
-const (
- tIOCGWINSZ = 0x40087468
-)
diff --git a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_linux.go b/vendor/github.com/jessevdk/go-flags/tiocgwinsz_linux.go
deleted file mode 100644
index e3975e28..00000000
--- a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_linux.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build linux
-
-package flags
-
-const (
- tIOCGWINSZ = 0x5413
-)
diff --git a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_other.go b/vendor/github.com/jessevdk/go-flags/tiocgwinsz_other.go
deleted file mode 100644
index 30821515..00000000
--- a/vendor/github.com/jessevdk/go-flags/tiocgwinsz_other.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build !darwin,!freebsd,!netbsd,!openbsd,!linux
-
-package flags
-
-const (
- tIOCGWINSZ = 0
-)
diff --git a/vendor/github.com/kevinburke/ssh_config/.gitattributes b/vendor/github.com/kevinburke/ssh_config/.gitattributes
deleted file mode 100644
index 44db5818..00000000
--- a/vendor/github.com/kevinburke/ssh_config/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-testdata/dos-lines eol=crlf
diff --git a/vendor/github.com/kevinburke/ssh_config/.gitignore b/vendor/github.com/kevinburke/ssh_config/.gitignore
deleted file mode 100644
index a6ef824c..00000000
--- a/vendor/github.com/kevinburke/ssh_config/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bazel-*
diff --git a/vendor/github.com/kevinburke/ssh_config/.travis.yml b/vendor/github.com/kevinburke/ssh_config/.travis.yml
deleted file mode 100644
index 8b5964dd..00000000
--- a/vendor/github.com/kevinburke/ssh_config/.travis.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-go_import_path: github.com/kevinburke/ssh_config
-
-language: go
-
-go:
- - 1.9.x
- - 1.10.x
- - 1.11.x
- - master
-
-before_script:
- - go get -u ./...
-
-script:
- - make race-test
diff --git a/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt b/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt
deleted file mode 100644
index 51b98f89..00000000
--- a/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-Eugene Terentev
-Kevin Burke
-Sergey Lukjanov
-Wayne Ashley Berry
diff --git a/vendor/github.com/kevinburke/ssh_config/LICENSE b/vendor/github.com/kevinburke/ssh_config/LICENSE
deleted file mode 100644
index b9a770ac..00000000
--- a/vendor/github.com/kevinburke/ssh_config/LICENSE
+++ /dev/null
@@ -1,49 +0,0 @@
-Copyright (c) 2017 Kevin Burke.
-
-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.
-
-===================
-
-The lexer and parser borrow heavily from github.com/pelletier/go-toml. The
-license for that project is copied below.
-
-The MIT License (MIT)
-
-Copyright (c) 2013 - 2017 Thomas Pelletier, Eric Anderton
-
-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.
diff --git a/vendor/github.com/kevinburke/ssh_config/Makefile b/vendor/github.com/kevinburke/ssh_config/Makefile
deleted file mode 100644
index 90c3a286..00000000
--- a/vendor/github.com/kevinburke/ssh_config/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-BUMP_VERSION := $(GOPATH)/bin/bump_version
-MEGACHECK := $(GOPATH)/bin/megacheck
-WRITE_MAILMAP := $(GOPATH)/bin/write_mailmap
-
-IGNORES := 'github.com/kevinburke/ssh_config/config.go:U1000 github.com/kevinburke/ssh_config/config.go:S1002 github.com/kevinburke/ssh_config/token.go:U1000'
-
-$(MEGACHECK):
- go get honnef.co/go/tools/cmd/megacheck
-
-lint: $(MEGACHECK)
- go vet ./...
- $(MEGACHECK) --ignore=$(IGNORES) ./...
-
-test: lint
- @# the timeout helps guard against infinite recursion
- go test -timeout=250ms ./...
-
-race-test: lint
- go test -timeout=500ms -race ./...
-
-$(BUMP_VERSION):
- go get -u github.com/kevinburke/bump_version
-
-release: test | $(BUMP_VERSION)
- $(BUMP_VERSION) minor config.go
-
-force: ;
-
-AUTHORS.txt: force | $(WRITE_MAILMAP)
- $(WRITE_MAILMAP) > AUTHORS.txt
-
-authors: AUTHORS.txt
diff --git a/vendor/github.com/kevinburke/ssh_config/README.md b/vendor/github.com/kevinburke/ssh_config/README.md
deleted file mode 100644
index 52cc1eac..00000000
--- a/vendor/github.com/kevinburke/ssh_config/README.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# ssh_config
-
-This is a Go parser for `ssh_config` files. Importantly, this parser attempts
-to preserve comments in a given file, so you can manipulate a `ssh_config` file
-from a program, if your heart desires.
-
-It's designed to be used with the excellent
-[x/crypto/ssh](https://golang.org/x/crypto/ssh) package, which handles SSH
-negotiation but isn't very easy to configure.
-
-The `ssh_config` `Get()` and `GetStrict()` functions will attempt to read values
-from `$HOME/.ssh/config` and fall back to `/etc/ssh/ssh_config`. The first
-argument is the host name to match on, and the second argument is the key you
-want to retrieve.
-
-```go
-port := ssh_config.Get("myhost", "Port")
-```
-
-You can also load a config file and read values from it.
-
-```go
-var config = `
-Host *.test
- Compression yes
-`
-
-cfg, err := ssh_config.Decode(strings.NewReader(config))
-fmt.Println(cfg.Get("example.test", "Port"))
-```
-
-Some SSH arguments have default values - for example, the default value for
-`KeyboardAuthentication` is `"yes"`. If you call Get(), and no value for the
-given Host/keyword pair exists in the config, we'll return a default for the
-keyword if one exists.
-
-### Manipulating SSH config files
-
-Here's how you can manipulate an SSH config file, and then write it back to
-disk.
-
-```go
-f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
-cfg, _ := ssh_config.Decode(f)
-for _, host := range cfg.Hosts {
- fmt.Println("patterns:", host.Patterns)
- for _, node := range host.Nodes {
- // Manipulate the nodes as you see fit, or use a type switch to
- // distinguish between Empty, KV, and Include nodes.
- fmt.Println(node.String())
- }
-}
-
-// Print the config to stdout:
-fmt.Println(cfg.String())
-```
-
-## Spec compliance
-
-Wherever possible we try to implement the specification as documented in
-the `ssh_config` manpage. Unimplemented features should be present in the
-[issues][issues] list.
-
-Notably, the `Match` directive is currently unsupported.
-
-[issues]: https://github.com/kevinburke/ssh_config/issues
-
-## Errata
-
-This is the second [comment-preserving configuration parser][blog] I've written, after
-[an /etc/hosts parser][hostsfile]. Eventually, I will write one for every Linux
-file format.
-
-[blog]: https://kev.inburke.com/kevin/more-comment-preserving-configuration-parsers/
-[hostsfile]: https://github.com/kevinburke/hostsfile
-
-## Donating
-
-Donations free up time to make improvements to the library, and respond to
-bug reports. You can send donations via Paypal's "Send Money" feature to
-kev@inburke.com. Donations are not tax deductible in the USA.
diff --git a/vendor/github.com/kevinburke/ssh_config/config.go b/vendor/github.com/kevinburke/ssh_config/config.go
deleted file mode 100644
index f400cef9..00000000
--- a/vendor/github.com/kevinburke/ssh_config/config.go
+++ /dev/null
@@ -1,639 +0,0 @@
-// Package ssh_config provides tools for manipulating SSH config files.
-//
-// Importantly, this parser attempts to preserve comments in a given file, so
-// you can manipulate a `ssh_config` file from a program, if your heart desires.
-//
-// The Get() and GetStrict() functions will attempt to read values from
-// $HOME/.ssh/config, falling back to /etc/ssh/ssh_config. The first argument is
-// the host name to match on ("example.com"), and the second argument is the key
-// you want to retrieve ("Port"). The keywords are case insensitive.
-//
-// port := ssh_config.Get("myhost", "Port")
-//
-// You can also manipulate an SSH config file and then print it or write it back
-// to disk.
-//
-// f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
-// cfg, _ := ssh_config.Decode(f)
-// for _, host := range cfg.Hosts {
-// fmt.Println("patterns:", host.Patterns)
-// for _, node := range host.Nodes {
-// fmt.Println(node.String())
-// }
-// }
-//
-// // Write the cfg back to disk:
-// fmt.Println(cfg.String())
-//
-// BUG: the Match directive is currently unsupported; parsing a config with
-// a Match directive will trigger an error.
-package ssh_config
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "os"
- osuser "os/user"
- "path/filepath"
- "regexp"
- "runtime"
- "strings"
- "sync"
-)
-
-const version = "0.5"
-
-type configFinder func() string
-
-// UserSettings checks ~/.ssh and /etc/ssh for configuration files. The config
-// files are parsed and cached the first time Get() or GetStrict() is called.
-type UserSettings struct {
- IgnoreErrors bool
- systemConfig *Config
- systemConfigFinder configFinder
- userConfig *Config
- userConfigFinder configFinder
- loadConfigs sync.Once
- onceErr error
-}
-
-func homedir() string {
- user, err := osuser.Current()
- if err == nil {
- return user.HomeDir
- } else {
- return os.Getenv("HOME")
- }
-}
-
-func userConfigFinder() string {
- return filepath.Join(homedir(), ".ssh", "config")
-}
-
-// DefaultUserSettings is the default UserSettings and is used by Get and
-// GetStrict. It checks both $HOME/.ssh/config and /etc/ssh/ssh_config for keys,
-// and it will return parse errors (if any) instead of swallowing them.
-var DefaultUserSettings = &UserSettings{
- IgnoreErrors: false,
- systemConfigFinder: systemConfigFinder,
- userConfigFinder: userConfigFinder,
-}
-
-func systemConfigFinder() string {
- return filepath.Join("/", "etc", "ssh", "ssh_config")
-}
-
-func findVal(c *Config, alias, key string) (string, error) {
- if c == nil {
- return "", nil
- }
- val, err := c.Get(alias, key)
- if err != nil || val == "" {
- return "", err
- }
- if err := validate(key, val); err != nil {
- return "", err
- }
- return val, nil
-}
-
-// Get finds the first value for key within a declaration that matches the
-// alias. Get returns the empty string if no value was found, or if IgnoreErrors
-// is false and we could not parse the configuration file. Use GetStrict to
-// disambiguate the latter cases.
-//
-// The match for key is case insensitive.
-//
-// Get is a wrapper around DefaultUserSettings.Get.
-func Get(alias, key string) string {
- return DefaultUserSettings.Get(alias, key)
-}
-
-// GetStrict finds the first value for key within a declaration that matches the
-// alias. If key has a default value and no matching configuration is found, the
-// default will be returned. For more information on default values and the way
-// patterns are matched, see the manpage for ssh_config.
-//
-// error will be non-nil if and only if a user's configuration file or the
-// system configuration file could not be parsed, and u.IgnoreErrors is false.
-//
-// GetStrict is a wrapper around DefaultUserSettings.GetStrict.
-func GetStrict(alias, key string) (string, error) {
- return DefaultUserSettings.GetStrict(alias, key)
-}
-
-// Get finds the first value for key within a declaration that matches the
-// alias. Get returns the empty string if no value was found, or if IgnoreErrors
-// is false and we could not parse the configuration file. Use GetStrict to
-// disambiguate the latter cases.
-//
-// The match for key is case insensitive.
-func (u *UserSettings) Get(alias, key string) string {
- val, err := u.GetStrict(alias, key)
- if err != nil {
- return ""
- }
- return val
-}
-
-// GetStrict finds the first value for key within a declaration that matches the
-// alias. If key has a default value and no matching configuration is found, the
-// default will be returned. For more information on default values and the way
-// patterns are matched, see the manpage for ssh_config.
-//
-// error will be non-nil if and only if a user's configuration file or the
-// system configuration file could not be parsed, and u.IgnoreErrors is false.
-func (u *UserSettings) GetStrict(alias, key string) (string, error) {
- u.loadConfigs.Do(func() {
- // can't parse user file, that's ok.
- var filename string
- if u.userConfigFinder == nil {
- filename = userConfigFinder()
- } else {
- filename = u.userConfigFinder()
- }
- var err error
- u.userConfig, err = parseFile(filename)
- if err != nil && os.IsNotExist(err) == false {
- u.onceErr = err
- return
- }
- if u.systemConfigFinder == nil {
- filename = systemConfigFinder()
- } else {
- filename = u.systemConfigFinder()
- }
- u.systemConfig, err = parseFile(filename)
- if err != nil && os.IsNotExist(err) == false {
- u.onceErr = err
- return
- }
- })
- if u.onceErr != nil && u.IgnoreErrors == false {
- return "", u.onceErr
- }
- val, err := findVal(u.userConfig, alias, key)
- if err != nil || val != "" {
- return val, err
- }
- val2, err2 := findVal(u.systemConfig, alias, key)
- if err2 != nil || val2 != "" {
- return val2, err2
- }
- return Default(key), nil
-}
-
-func parseFile(filename string) (*Config, error) {
- return parseWithDepth(filename, 0)
-}
-
-func parseWithDepth(filename string, depth uint8) (*Config, error) {
- f, err := os.Open(filename)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- return decode(f, isSystem(filename), depth)
-}
-
-func isSystem(filename string) bool {
- // TODO i'm not sure this is the best way to detect a system repo
- return strings.HasPrefix(filepath.Clean(filename), "/etc/ssh")
-}
-
-// Decode reads r into a Config, or returns an error if r could not be parsed as
-// an SSH config file.
-func Decode(r io.Reader) (*Config, error) {
- return decode(r, false, 0)
-}
-
-func decode(r io.Reader, system bool, depth uint8) (c *Config, err error) {
- defer func() {
- if r := recover(); r != nil {
- if _, ok := r.(runtime.Error); ok {
- panic(r)
- }
- if e, ok := r.(error); ok && e == ErrDepthExceeded {
- err = e
- return
- }
- err = errors.New(r.(string))
- }
- }()
-
- c = parseSSH(lexSSH(r), system, depth)
- return c, err
-}
-
-// Config represents an SSH config file.
-type Config struct {
- // A list of hosts to match against. The file begins with an implicit
- // "Host *" declaration matching all hosts.
- Hosts []*Host
- depth uint8
- position Position
-}
-
-// Get finds the first value in the configuration that matches the alias and
-// contains key. Get returns the empty string if no value was found, or if the
-// Config contains an invalid conditional Include value.
-//
-// The match for key is case insensitive.
-func (c *Config) Get(alias, key string) (string, error) {
- lowerKey := strings.ToLower(key)
- for _, host := range c.Hosts {
- if !host.Matches(alias) {
- continue
- }
- for _, node := range host.Nodes {
- switch t := node.(type) {
- case *Empty:
- continue
- case *KV:
- // "keys are case insensitive" per the spec
- lkey := strings.ToLower(t.Key)
- if lkey == "match" {
- panic("can't handle Match directives")
- }
- if lkey == lowerKey {
- return t.Value, nil
- }
- case *Include:
- val := t.Get(alias, key)
- if val != "" {
- return val, nil
- }
- default:
- return "", fmt.Errorf("unknown Node type %v", t)
- }
- }
- }
- return "", nil
-}
-
-// String returns a string representation of the Config file.
-func (c Config) String() string {
- return marshal(c).String()
-}
-
-func (c Config) MarshalText() ([]byte, error) {
- return marshal(c).Bytes(), nil
-}
-
-func marshal(c Config) *bytes.Buffer {
- var buf bytes.Buffer
- for i := range c.Hosts {
- buf.WriteString(c.Hosts[i].String())
- }
- return &buf
-}
-
-// Pattern is a pattern in a Host declaration. Patterns are read-only values;
-// create a new one with NewPattern().
-type Pattern struct {
- str string // Its appearance in the file, not the value that gets compiled.
- regex *regexp.Regexp
- not bool // True if this is a negated match
-}
-
-// String prints the string representation of the pattern.
-func (p Pattern) String() string {
- return p.str
-}
-
-// Copied from regexp.go with * and ? removed.
-var specialBytes = []byte(`\.+()|[]{}^$`)
-
-func special(b byte) bool {
- return bytes.IndexByte(specialBytes, b) >= 0
-}
-
-// NewPattern creates a new Pattern for matching hosts. NewPattern("*") creates
-// a Pattern that matches all hosts.
-//
-// From the manpage, a pattern consists of zero or more non-whitespace
-// characters, `*' (a wildcard that matches zero or more characters), or `?' (a
-// wildcard that matches exactly one character). For example, to specify a set
-// of declarations for any host in the ".co.uk" set of domains, the following
-// pattern could be used:
-//
-// Host *.co.uk
-//
-// The following pattern would match any host in the 192.168.0.[0-9] network range:
-//
-// Host 192.168.0.?
-func NewPattern(s string) (*Pattern, error) {
- if s == "" {
- return nil, errors.New("ssh_config: empty pattern")
- }
- negated := false
- if s[0] == '!' {
- negated = true
- s = s[1:]
- }
- var buf bytes.Buffer
- buf.WriteByte('^')
- for i := 0; i < len(s); i++ {
- // A byte loop is correct because all metacharacters are ASCII.
- switch b := s[i]; b {
- case '*':
- buf.WriteString(".*")
- case '?':
- buf.WriteString(".?")
- default:
- // borrowing from QuoteMeta here.
- if special(b) {
- buf.WriteByte('\\')
- }
- buf.WriteByte(b)
- }
- }
- buf.WriteByte('$')
- r, err := regexp.Compile(buf.String())
- if err != nil {
- return nil, err
- }
- return &Pattern{str: s, regex: r, not: negated}, nil
-}
-
-// Host describes a Host directive and the keywords that follow it.
-type Host struct {
- // A list of host patterns that should match this host.
- Patterns []*Pattern
- // A Node is either a key/value pair or a comment line.
- Nodes []Node
- // EOLComment is the comment (if any) terminating the Host line.
- EOLComment string
- hasEquals bool
- leadingSpace uint16 // TODO: handle spaces vs tabs here.
- // The file starts with an implicit "Host *" declaration.
- implicit bool
-}
-
-// Matches returns true if the Host matches for the given alias. For
-// a description of the rules that provide a match, see the manpage for
-// ssh_config.
-func (h *Host) Matches(alias string) bool {
- found := false
- for i := range h.Patterns {
- if h.Patterns[i].regex.MatchString(alias) {
- if h.Patterns[i].not == true {
- // Negated match. "A pattern entry may be negated by prefixing
- // it with an exclamation mark (`!'). If a negated entry is
- // matched, then the Host entry is ignored, regardless of
- // whether any other patterns on the line match. Negated matches
- // are therefore useful to provide exceptions for wildcard
- // matches."
- return false
- }
- found = true
- }
- }
- return found
-}
-
-// String prints h as it would appear in a config file. Minor tweaks may be
-// present in the whitespace in the printed file.
-func (h *Host) String() string {
- var buf bytes.Buffer
- if h.implicit == false {
- buf.WriteString(strings.Repeat(" ", int(h.leadingSpace)))
- buf.WriteString("Host")
- if h.hasEquals {
- buf.WriteString(" = ")
- } else {
- buf.WriteString(" ")
- }
- for i, pat := range h.Patterns {
- buf.WriteString(pat.String())
- if i < len(h.Patterns)-1 {
- buf.WriteString(" ")
- }
- }
- if h.EOLComment != "" {
- buf.WriteString(" #")
- buf.WriteString(h.EOLComment)
- }
- buf.WriteByte('\n')
- }
- for i := range h.Nodes {
- buf.WriteString(h.Nodes[i].String())
- buf.WriteByte('\n')
- }
- return buf.String()
-}
-
-// Node represents a line in a Config.
-type Node interface {
- Pos() Position
- String() string
-}
-
-// KV is a line in the config file that contains a key, a value, and possibly
-// a comment.
-type KV struct {
- Key string
- Value string
- Comment string
- hasEquals bool
- leadingSpace uint16 // Space before the key. TODO handle spaces vs tabs.
- position Position
-}
-
-// Pos returns k's Position.
-func (k *KV) Pos() Position {
- return k.position
-}
-
-// String prints k as it was parsed in the config file. There may be slight
-// changes to the whitespace between values.
-func (k *KV) String() string {
- if k == nil {
- return ""
- }
- equals := " "
- if k.hasEquals {
- equals = " = "
- }
- line := fmt.Sprintf("%s%s%s%s", strings.Repeat(" ", int(k.leadingSpace)), k.Key, equals, k.Value)
- if k.Comment != "" {
- line += " #" + k.Comment
- }
- return line
-}
-
-// Empty is a line in the config file that contains only whitespace or comments.
-type Empty struct {
- Comment string
- leadingSpace uint16 // TODO handle spaces vs tabs.
- position Position
-}
-
-// Pos returns e's Position.
-func (e *Empty) Pos() Position {
- return e.position
-}
-
-// String prints e as it was parsed in the config file.
-func (e *Empty) String() string {
- if e == nil {
- return ""
- }
- if e.Comment == "" {
- return ""
- }
- return fmt.Sprintf("%s#%s", strings.Repeat(" ", int(e.leadingSpace)), e.Comment)
-}
-
-// Include holds the result of an Include directive, including the config files
-// that have been parsed as part of that directive. At most 5 levels of Include
-// statements will be parsed.
-type Include struct {
- // Comment is the contents of any comment at the end of the Include
- // statement.
- Comment string
- parsed bool
- // an include directive can include several different files, and wildcards
- directives []string
-
- mu sync.Mutex
- // 1:1 mapping between matches and keys in files array; matches preserves
- // ordering
- matches []string
- // actual filenames are listed here
- files map[string]*Config
- leadingSpace uint16
- position Position
- depth uint8
- hasEquals bool
-}
-
-const maxRecurseDepth = 5
-
-// ErrDepthExceeded is returned if too many Include directives are parsed.
-// Usually this indicates a recursive loop (an Include directive pointing to the
-// file it contains).
-var ErrDepthExceeded = errors.New("ssh_config: max recurse depth exceeded")
-
-func removeDups(arr []string) []string {
- // Use map to record duplicates as we find them.
- encountered := make(map[string]bool, len(arr))
- result := make([]string, 0)
-
- for v := range arr {
- if encountered[arr[v]] == false {
- encountered[arr[v]] = true
- result = append(result, arr[v])
- }
- }
- return result
-}
-
-// NewInclude creates a new Include with a list of file globs to include.
-// Configuration files are parsed greedily (e.g. as soon as this function runs).
-// Any error encountered while parsing nested configuration files will be
-// returned.
-func NewInclude(directives []string, hasEquals bool, pos Position, comment string, system bool, depth uint8) (*Include, error) {
- if depth > maxRecurseDepth {
- return nil, ErrDepthExceeded
- }
- inc := &Include{
- Comment: comment,
- directives: directives,
- files: make(map[string]*Config),
- position: pos,
- leadingSpace: uint16(pos.Col) - 1,
- depth: depth,
- hasEquals: hasEquals,
- }
- // no need for inc.mu.Lock() since nothing else can access this inc
- matches := make([]string, 0)
- for i := range directives {
- var path string
- if filepath.IsAbs(directives[i]) {
- path = directives[i]
- } else if system {
- path = filepath.Join("/etc/ssh", directives[i])
- } else {
- path = filepath.Join(homedir(), ".ssh", directives[i])
- }
- theseMatches, err := filepath.Glob(path)
- if err != nil {
- return nil, err
- }
- matches = append(matches, theseMatches...)
- }
- matches = removeDups(matches)
- inc.matches = matches
- for i := range matches {
- config, err := parseWithDepth(matches[i], depth)
- if err != nil {
- return nil, err
- }
- inc.files[matches[i]] = config
- }
- return inc, nil
-}
-
-// Pos returns the position of the Include directive in the larger file.
-func (i *Include) Pos() Position {
- return i.position
-}
-
-// Get finds the first value in the Include statement matching the alias and the
-// given key.
-func (inc *Include) Get(alias, key string) string {
- inc.mu.Lock()
- defer inc.mu.Unlock()
- // TODO: we search files in any order which is not correct
- for i := range inc.matches {
- cfg := inc.files[inc.matches[i]]
- if cfg == nil {
- panic("nil cfg")
- }
- val, err := cfg.Get(alias, key)
- if err == nil && val != "" {
- return val
- }
- }
- return ""
-}
-
-// String prints out a string representation of this Include directive. Note
-// included Config files are not printed as part of this representation.
-func (inc *Include) String() string {
- equals := " "
- if inc.hasEquals {
- equals = " = "
- }
- line := fmt.Sprintf("%sInclude%s%s", strings.Repeat(" ", int(inc.leadingSpace)), equals, strings.Join(inc.directives, " "))
- if inc.Comment != "" {
- line += " #" + inc.Comment
- }
- return line
-}
-
-var matchAll *Pattern
-
-func init() {
- var err error
- matchAll, err = NewPattern("*")
- if err != nil {
- panic(err)
- }
-}
-
-func newConfig() *Config {
- return &Config{
- Hosts: []*Host{
- &Host{
- implicit: true,
- Patterns: []*Pattern{matchAll},
- Nodes: make([]Node, 0),
- },
- },
- depth: 0,
- }
-}
diff --git a/vendor/github.com/kevinburke/ssh_config/lexer.go b/vendor/github.com/kevinburke/ssh_config/lexer.go
deleted file mode 100644
index b0c6a865..00000000
--- a/vendor/github.com/kevinburke/ssh_config/lexer.go
+++ /dev/null
@@ -1,241 +0,0 @@
-package ssh_config
-
-import (
- "io"
-
- buffruneio "github.com/pelletier/go-buffruneio"
-)
-
-// Define state functions
-type sshLexStateFn func() sshLexStateFn
-
-type sshLexer struct {
- input *buffruneio.Reader // Textual source
- buffer []rune // Runes composing the current token
- tokens chan token
- line uint32
- col uint16
- endbufferLine uint32
- endbufferCol uint16
-}
-
-func (s *sshLexer) lexComment(previousState sshLexStateFn) sshLexStateFn {
- return func() sshLexStateFn {
- growingString := ""
- for next := s.peek(); next != '\n' && next != eof; next = s.peek() {
- if next == '\r' && s.follow("\r\n") {
- break
- }
- growingString += string(next)
- s.next()
- }
- s.emitWithValue(tokenComment, growingString)
- s.skip()
- return previousState
- }
-}
-
-// lex the space after an equals sign in a function
-func (s *sshLexer) lexRspace() sshLexStateFn {
- for {
- next := s.peek()
- if !isSpace(next) {
- break
- }
- s.skip()
- }
- return s.lexRvalue
-}
-
-func (s *sshLexer) lexEquals() sshLexStateFn {
- for {
- next := s.peek()
- if next == '=' {
- s.emit(tokenEquals)
- s.skip()
- return s.lexRspace
- }
- // TODO error handling here; newline eof etc.
- if !isSpace(next) {
- break
- }
- s.skip()
- }
- return s.lexRvalue
-}
-
-func (s *sshLexer) lexKey() sshLexStateFn {
- growingString := ""
-
- for r := s.peek(); isKeyChar(r); r = s.peek() {
- // simplified a lot here
- if isSpace(r) || r == '=' {
- s.emitWithValue(tokenKey, growingString)
- s.skip()
- return s.lexEquals
- }
- growingString += string(r)
- s.next()
- }
- s.emitWithValue(tokenKey, growingString)
- return s.lexEquals
-}
-
-func (s *sshLexer) lexRvalue() sshLexStateFn {
- growingString := ""
- for {
- next := s.peek()
- switch next {
- case '\r':
- if s.follow("\r\n") {
- s.emitWithValue(tokenString, growingString)
- s.skip()
- return s.lexVoid
- }
- case '\n':
- s.emitWithValue(tokenString, growingString)
- s.skip()
- return s.lexVoid
- case '#':
- s.emitWithValue(tokenString, growingString)
- s.skip()
- return s.lexComment(s.lexVoid)
- case eof:
- s.next()
- }
- if next == eof {
- break
- }
- growingString += string(next)
- s.next()
- }
- s.emit(tokenEOF)
- return nil
-}
-
-func (s *sshLexer) read() rune {
- r, _, err := s.input.ReadRune()
- if err != nil {
- panic(err)
- }
- if r == '\n' {
- s.endbufferLine++
- s.endbufferCol = 1
- } else {
- s.endbufferCol++
- }
- return r
-}
-
-func (s *sshLexer) next() rune {
- r := s.read()
-
- if r != eof {
- s.buffer = append(s.buffer, r)
- }
- return r
-}
-
-func (s *sshLexer) lexVoid() sshLexStateFn {
- for {
- next := s.peek()
- switch next {
- case '#':
- s.skip()
- return s.lexComment(s.lexVoid)
- case '\r':
- fallthrough
- case '\n':
- s.emit(tokenEmptyLine)
- s.skip()
- continue
- }
-
- if isSpace(next) {
- s.skip()
- }
-
- if isKeyStartChar(next) {
- return s.lexKey
- }
-
- // removed IsKeyStartChar and lexKey. probably will need to readd
-
- if next == eof {
- s.next()
- break
- }
- }
-
- s.emit(tokenEOF)
- return nil
-}
-
-func (s *sshLexer) ignore() {
- s.buffer = make([]rune, 0)
- s.line = s.endbufferLine
- s.col = s.endbufferCol
-}
-
-func (s *sshLexer) skip() {
- s.next()
- s.ignore()
-}
-
-func (s *sshLexer) emit(t tokenType) {
- s.emitWithValue(t, string(s.buffer))
-}
-
-func (s *sshLexer) emitWithValue(t tokenType, value string) {
- tok := token{
- Position: Position{s.line, s.col},
- typ: t,
- val: value,
- }
- s.tokens <- tok
- s.ignore()
-}
-
-func (s *sshLexer) peek() rune {
- r, _, err := s.input.ReadRune()
- if err != nil {
- panic(err)
- }
- s.input.UnreadRune()
- return r
-}
-
-func (s *sshLexer) follow(next string) bool {
- for _, expectedRune := range next {
- r, _, err := s.input.ReadRune()
- defer s.input.UnreadRune()
- if err != nil {
- panic(err)
- }
- if expectedRune != r {
- return false
- }
- }
- return true
-}
-
-func (s *sshLexer) run() {
- for state := s.lexVoid; state != nil; {
- state = state()
- }
- close(s.tokens)
-}
-
-func lexSSH(input io.Reader) chan token {
- bufferedInput := buffruneio.NewReader(input)
- l := &sshLexer{
- input: bufferedInput,
- tokens: make(chan token),
- line: 1,
- col: 1,
- endbufferLine: 1,
- endbufferCol: 1,
- }
- go l.run()
- return l.tokens
-}
diff --git a/vendor/github.com/kevinburke/ssh_config/parser.go b/vendor/github.com/kevinburke/ssh_config/parser.go
deleted file mode 100644
index 02745b4b..00000000
--- a/vendor/github.com/kevinburke/ssh_config/parser.go
+++ /dev/null
@@ -1,185 +0,0 @@
-package ssh_config
-
-import (
- "fmt"
- "strings"
-)
-
-type sshParser struct {
- flow chan token
- config *Config
- tokensBuffer []token
- currentTable []string
- seenTableKeys []string
- // /etc/ssh parser or local parser - used to find the default for relative
- // filepaths in the Include directive
- system bool
- depth uint8
-}
-
-type sshParserStateFn func() sshParserStateFn
-
-// Formats and panics an error message based on a token
-func (p *sshParser) raiseErrorf(tok *token, msg string, args ...interface{}) {
- // TODO this format is ugly
- panic(tok.Position.String() + ": " + fmt.Sprintf(msg, args...))
-}
-
-func (p *sshParser) raiseError(tok *token, err error) {
- if err == ErrDepthExceeded {
- panic(err)
- }
- // TODO this format is ugly
- panic(tok.Position.String() + ": " + err.Error())
-}
-
-func (p *sshParser) run() {
- for state := p.parseStart; state != nil; {
- state = state()
- }
-}
-
-func (p *sshParser) peek() *token {
- if len(p.tokensBuffer) != 0 {
- return &(p.tokensBuffer[0])
- }
-
- tok, ok := <-p.flow
- if !ok {
- return nil
- }
- p.tokensBuffer = append(p.tokensBuffer, tok)
- return &tok
-}
-
-func (p *sshParser) getToken() *token {
- if len(p.tokensBuffer) != 0 {
- tok := p.tokensBuffer[0]
- p.tokensBuffer = p.tokensBuffer[1:]
- return &tok
- }
- tok, ok := <-p.flow
- if !ok {
- return nil
- }
- return &tok
-}
-
-func (p *sshParser) parseStart() sshParserStateFn {
- tok := p.peek()
-
- // end of stream, parsing is finished
- if tok == nil {
- return nil
- }
-
- switch tok.typ {
- case tokenComment, tokenEmptyLine:
- return p.parseComment
- case tokenKey:
- return p.parseKV
- case tokenEOF:
- return nil
- default:
- p.raiseErrorf(tok, fmt.Sprintf("unexpected token %q\n", tok))
- }
- return nil
-}
-
-func (p *sshParser) parseKV() sshParserStateFn {
- key := p.getToken()
- hasEquals := false
- val := p.getToken()
- if val.typ == tokenEquals {
- hasEquals = true
- val = p.getToken()
- }
- comment := ""
- tok := p.peek()
- if tok == nil {
- tok = &token{typ: tokenEOF}
- }
- if tok.typ == tokenComment && tok.Position.Line == val.Position.Line {
- tok = p.getToken()
- comment = tok.val
- }
- if strings.ToLower(key.val) == "match" {
- // https://github.com/kevinburke/ssh_config/issues/6
- p.raiseErrorf(val, "ssh_config: Match directive parsing is unsupported")
- return nil
- }
- if strings.ToLower(key.val) == "host" {
- strPatterns := strings.Split(val.val, " ")
- patterns := make([]*Pattern, 0)
- for i := range strPatterns {
- if strPatterns[i] == "" {
- continue
- }
- pat, err := NewPattern(strPatterns[i])
- if err != nil {
- p.raiseErrorf(val, "Invalid host pattern: %v", err)
- return nil
- }
- patterns = append(patterns, pat)
- }
- p.config.Hosts = append(p.config.Hosts, &Host{
- Patterns: patterns,
- Nodes: make([]Node, 0),
- EOLComment: comment,
- hasEquals: hasEquals,
- })
- return p.parseStart
- }
- lastHost := p.config.Hosts[len(p.config.Hosts)-1]
- if strings.ToLower(key.val) == "include" {
- inc, err := NewInclude(strings.Split(val.val, " "), hasEquals, key.Position, comment, p.system, p.depth+1)
- if err == ErrDepthExceeded {
- p.raiseError(val, err)
- return nil
- }
- if err != nil {
- p.raiseErrorf(val, "Error parsing Include directive: %v", err)
- return nil
- }
- lastHost.Nodes = append(lastHost.Nodes, inc)
- return p.parseStart
- }
- kv := &KV{
- Key: key.val,
- Value: val.val,
- Comment: comment,
- hasEquals: hasEquals,
- leadingSpace: uint16(key.Position.Col) - 1,
- position: key.Position,
- }
- lastHost.Nodes = append(lastHost.Nodes, kv)
- return p.parseStart
-}
-
-func (p *sshParser) parseComment() sshParserStateFn {
- comment := p.getToken()
- lastHost := p.config.Hosts[len(p.config.Hosts)-1]
- lastHost.Nodes = append(lastHost.Nodes, &Empty{
- Comment: comment.val,
- // account for the "#" as well
- leadingSpace: comment.Position.Col - 2,
- position: comment.Position,
- })
- return p.parseStart
-}
-
-func parseSSH(flow chan token, system bool, depth uint8) *Config {
- result := newConfig()
- result.position = Position{1, 1}
- parser := &sshParser{
- flow: flow,
- config: result,
- tokensBuffer: make([]token, 0),
- currentTable: make([]string, 0),
- seenTableKeys: make([]string, 0),
- system: system,
- depth: depth,
- }
- parser.run()
- return result
-}
diff --git a/vendor/github.com/kevinburke/ssh_config/position.go b/vendor/github.com/kevinburke/ssh_config/position.go
deleted file mode 100644
index 7304bc3b..00000000
--- a/vendor/github.com/kevinburke/ssh_config/position.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package ssh_config
-
-import "fmt"
-
-// Position of a document element within a SSH document.
-//
-// Line and Col are both 1-indexed positions for the element's line number and
-// column number, respectively. Values of zero or less will cause Invalid(),
-// to return true.
-type Position struct {
- Line uint32 // line within the document
- Col uint16 // column within the line
-}
-
-// String representation of the position.
-// Displays 1-indexed line and column numbers.
-func (p Position) String() string {
- return fmt.Sprintf("(%d, %d)", p.Line, p.Col)
-}
-
-// Invalid returns whether or not the position is valid (i.e. with negative or
-// null values)
-func (p Position) Invalid() bool {
- return p.Line <= 0 || p.Col <= 0
-}
diff --git a/vendor/github.com/kevinburke/ssh_config/token.go b/vendor/github.com/kevinburke/ssh_config/token.go
deleted file mode 100644
index a0ecbb2b..00000000
--- a/vendor/github.com/kevinburke/ssh_config/token.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package ssh_config
-
-import "fmt"
-
-type token struct {
- Position
- typ tokenType
- val string
-}
-
-func (t token) String() string {
- switch t.typ {
- case tokenEOF:
- return "EOF"
- }
- return fmt.Sprintf("%q", t.val)
-}
-
-type tokenType int
-
-const (
- eof = -(iota + 1)
-)
-
-const (
- tokenError tokenType = iota
- tokenEOF
- tokenEmptyLine
- tokenComment
- tokenKey
- tokenEquals
- tokenString
-)
-
-func isSpace(r rune) bool {
- return r == ' ' || r == '\t'
-}
-
-func isKeyStartChar(r rune) bool {
- return !(isSpace(r) || r == '\r' || r == '\n' || r == eof)
-}
-
-// I'm not sure that this is correct
-func isKeyChar(r rune) bool {
- // Keys start with the first character that isn't whitespace or [ and end
- // with the last non-whitespace character before the equals sign. Keys
- // cannot contain a # character."
- return !(r == '\r' || r == '\n' || r == eof || r == '=')
-}
diff --git a/vendor/github.com/kevinburke/ssh_config/validators.go b/vendor/github.com/kevinburke/ssh_config/validators.go
deleted file mode 100644
index 29fab6a9..00000000
--- a/vendor/github.com/kevinburke/ssh_config/validators.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package ssh_config
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// Default returns the default value for the given keyword, for example "22" if
-// the keyword is "Port". Default returns the empty string if the keyword has no
-// default, or if the keyword is unknown. Keyword matching is case-insensitive.
-//
-// Default values are provided by OpenSSH_7.4p1 on a Mac.
-func Default(keyword string) string {
- return defaults[strings.ToLower(keyword)]
-}
-
-// Arguments where the value must be "yes" or "no" and *only* yes or no.
-var yesnos = map[string]bool{
- strings.ToLower("BatchMode"): true,
- strings.ToLower("CanonicalizeFallbackLocal"): true,
- strings.ToLower("ChallengeResponseAuthentication"): true,
- strings.ToLower("CheckHostIP"): true,
- strings.ToLower("ClearAllForwardings"): true,
- strings.ToLower("Compression"): true,
- strings.ToLower("EnableSSHKeysign"): true,
- strings.ToLower("ExitOnForwardFailure"): true,
- strings.ToLower("ForwardAgent"): true,
- strings.ToLower("ForwardX11"): true,
- strings.ToLower("ForwardX11Trusted"): true,
- strings.ToLower("GatewayPorts"): true,
- strings.ToLower("GSSAPIAuthentication"): true,
- strings.ToLower("GSSAPIDelegateCredentials"): true,
- strings.ToLower("HostbasedAuthentication"): true,
- strings.ToLower("IdentitiesOnly"): true,
- strings.ToLower("KbdInteractiveAuthentication"): true,
- strings.ToLower("NoHostAuthenticationForLocalhost"): true,
- strings.ToLower("PasswordAuthentication"): true,
- strings.ToLower("PermitLocalCommand"): true,
- strings.ToLower("PubkeyAuthentication"): true,
- strings.ToLower("RhostsRSAAuthentication"): true,
- strings.ToLower("RSAAuthentication"): true,
- strings.ToLower("StreamLocalBindUnlink"): true,
- strings.ToLower("TCPKeepAlive"): true,
- strings.ToLower("UseKeychain"): true,
- strings.ToLower("UsePrivilegedPort"): true,
- strings.ToLower("VisualHostKey"): true,
-}
-
-var uints = map[string]bool{
- strings.ToLower("CanonicalizeMaxDots"): true,
- strings.ToLower("CompressionLevel"): true, // 1 to 9
- strings.ToLower("ConnectionAttempts"): true,
- strings.ToLower("ConnectTimeout"): true,
- strings.ToLower("NumberOfPasswordPrompts"): true,
- strings.ToLower("Port"): true,
- strings.ToLower("ServerAliveCountMax"): true,
- strings.ToLower("ServerAliveInterval"): true,
-}
-
-func mustBeYesOrNo(lkey string) bool {
- return yesnos[lkey]
-}
-
-func mustBeUint(lkey string) bool {
- return uints[lkey]
-}
-
-func validate(key, val string) error {
- lkey := strings.ToLower(key)
- if mustBeYesOrNo(lkey) && (val != "yes" && val != "no") {
- return fmt.Errorf("ssh_config: value for key %q must be 'yes' or 'no', got %q", key, val)
- }
- if mustBeUint(lkey) {
- _, err := strconv.ParseUint(val, 10, 64)
- if err != nil {
- return fmt.Errorf("ssh_config: %v", err)
- }
- }
- return nil
-}
-
-var defaults = map[string]string{
- strings.ToLower("AddKeysToAgent"): "no",
- strings.ToLower("AddressFamily"): "any",
- strings.ToLower("BatchMode"): "no",
- strings.ToLower("CanonicalizeFallbackLocal"): "yes",
- strings.ToLower("CanonicalizeHostname"): "no",
- strings.ToLower("CanonicalizeMaxDots"): "1",
- strings.ToLower("ChallengeResponseAuthentication"): "yes",
- strings.ToLower("CheckHostIP"): "yes",
- // TODO is this still the correct cipher
- strings.ToLower("Cipher"): "3des",
- strings.ToLower("Ciphers"): "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc",
- strings.ToLower("ClearAllForwardings"): "no",
- strings.ToLower("Compression"): "no",
- strings.ToLower("CompressionLevel"): "6",
- strings.ToLower("ConnectionAttempts"): "1",
- strings.ToLower("ControlMaster"): "no",
- strings.ToLower("EnableSSHKeysign"): "no",
- strings.ToLower("EscapeChar"): "~",
- strings.ToLower("ExitOnForwardFailure"): "no",
- strings.ToLower("FingerprintHash"): "sha256",
- strings.ToLower("ForwardAgent"): "no",
- strings.ToLower("ForwardX11"): "no",
- strings.ToLower("ForwardX11Timeout"): "20m",
- strings.ToLower("ForwardX11Trusted"): "no",
- strings.ToLower("GatewayPorts"): "no",
- strings.ToLower("GlobalKnownHostsFile"): "/etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2",
- strings.ToLower("GSSAPIAuthentication"): "no",
- strings.ToLower("GSSAPIDelegateCredentials"): "no",
- strings.ToLower("HashKnownHosts"): "no",
- strings.ToLower("HostbasedAuthentication"): "no",
-
- strings.ToLower("HostbasedKeyTypes"): "ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa",
- strings.ToLower("HostKeyAlgorithms"): "ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa",
- // HostName has a dynamic default (the value passed at the command line).
-
- strings.ToLower("IdentitiesOnly"): "no",
- strings.ToLower("IdentityFile"): "~/.ssh/identity",
-
- // IPQoS has a dynamic default based on interactive or non-interactive
- // sessions.
-
- strings.ToLower("KbdInteractiveAuthentication"): "yes",
-
- strings.ToLower("KexAlgorithms"): "curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1",
- strings.ToLower("LogLevel"): "INFO",
- strings.ToLower("MACs"): "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1",
-
- strings.ToLower("NoHostAuthenticationForLocalhost"): "no",
- strings.ToLower("NumberOfPasswordPrompts"): "3",
- strings.ToLower("PasswordAuthentication"): "yes",
- strings.ToLower("PermitLocalCommand"): "no",
- strings.ToLower("Port"): "22",
-
- strings.ToLower("PreferredAuthentications"): "gssapi-with-mic,hostbased,publickey,keyboard-interactive,password",
- strings.ToLower("Protocol"): "2",
- strings.ToLower("ProxyUseFdpass"): "no",
- strings.ToLower("PubkeyAcceptedKeyTypes"): "ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa",
- strings.ToLower("PubkeyAuthentication"): "yes",
- strings.ToLower("RekeyLimit"): "default none",
- strings.ToLower("RhostsRSAAuthentication"): "no",
- strings.ToLower("RSAAuthentication"): "yes",
-
- strings.ToLower("ServerAliveCountMax"): "3",
- strings.ToLower("ServerAliveInterval"): "0",
- strings.ToLower("StreamLocalBindMask"): "0177",
- strings.ToLower("StreamLocalBindUnlink"): "no",
- strings.ToLower("StrictHostKeyChecking"): "ask",
- strings.ToLower("TCPKeepAlive"): "yes",
- strings.ToLower("Tunnel"): "no",
- strings.ToLower("TunnelDevice"): "any:any",
- strings.ToLower("UpdateHostKeys"): "no",
- strings.ToLower("UseKeychain"): "no",
- strings.ToLower("UsePrivilegedPort"): "no",
-
- strings.ToLower("UserKnownHostsFile"): "~/.ssh/known_hosts ~/.ssh/known_hosts2",
- strings.ToLower("VerifyHostKeyDNS"): "no",
- strings.ToLower("VisualHostKey"): "no",
- strings.ToLower("XAuthLocation"): "/usr/X11R6/bin/xauth",
-}
diff --git a/vendor/github.com/mitchellh/go-homedir/LICENSE b/vendor/github.com/mitchellh/go-homedir/LICENSE
deleted file mode 100644
index f9c841a5..00000000
--- a/vendor/github.com/mitchellh/go-homedir/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Mitchell Hashimoto
-
-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.
diff --git a/vendor/github.com/mitchellh/go-homedir/README.md b/vendor/github.com/mitchellh/go-homedir/README.md
deleted file mode 100644
index d70706d5..00000000
--- a/vendor/github.com/mitchellh/go-homedir/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# go-homedir
-
-This is a Go library for detecting the user's home directory without
-the use of cgo, so the library can be used in cross-compilation environments.
-
-Usage is incredibly simple, just call `homedir.Dir()` to get the home directory
-for a user, and `homedir.Expand()` to expand the `~` in a path to the home
-directory.
-
-**Why not just use `os/user`?** The built-in `os/user` package requires
-cgo on Darwin systems. This means that any Go code that uses that package
-cannot cross compile. But 99% of the time the use for `os/user` is just to
-retrieve the home directory, which we can do for the current user without
-cgo. This library does that, enabling cross-compilation.
diff --git a/vendor/github.com/mitchellh/go-homedir/go.mod b/vendor/github.com/mitchellh/go-homedir/go.mod
deleted file mode 100644
index 7efa09a0..00000000
--- a/vendor/github.com/mitchellh/go-homedir/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/mitchellh/go-homedir
diff --git a/vendor/github.com/mitchellh/go-homedir/homedir.go b/vendor/github.com/mitchellh/go-homedir/homedir.go
deleted file mode 100644
index fb87bef9..00000000
--- a/vendor/github.com/mitchellh/go-homedir/homedir.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package homedir
-
-import (
- "bytes"
- "errors"
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "strconv"
- "strings"
- "sync"
-)
-
-// DisableCache will disable caching of the home directory. Caching is enabled
-// by default.
-var DisableCache bool
-
-var homedirCache string
-var cacheLock sync.RWMutex
-
-// Dir returns the home directory for the executing user.
-//
-// This uses an OS-specific method for discovering the home directory.
-// An error is returned if a home directory cannot be detected.
-func Dir() (string, error) {
- if !DisableCache {
- cacheLock.RLock()
- cached := homedirCache
- cacheLock.RUnlock()
- if cached != "" {
- return cached, nil
- }
- }
-
- cacheLock.Lock()
- defer cacheLock.Unlock()
-
- var result string
- var err error
- if runtime.GOOS == "windows" {
- result, err = dirWindows()
- } else {
- // Unix-like system, so just assume Unix
- result, err = dirUnix()
- }
-
- if err != nil {
- return "", err
- }
- homedirCache = result
- return result, nil
-}
-
-// Expand expands the path to include the home directory if the path
-// is prefixed with `~`. If it isn't prefixed with `~`, the path is
-// returned as-is.
-func Expand(path string) (string, error) {
- if len(path) == 0 {
- return path, nil
- }
-
- if path[0] != '~' {
- return path, nil
- }
-
- if len(path) > 1 && path[1] != '/' && path[1] != '\\' {
- return "", errors.New("cannot expand user-specific home dir")
- }
-
- dir, err := Dir()
- if err != nil {
- return "", err
- }
-
- return filepath.Join(dir, path[1:]), nil
-}
-
-func dirUnix() (string, error) {
- homeEnv := "HOME"
- if runtime.GOOS == "plan9" {
- // On plan9, env vars are lowercase.
- homeEnv = "home"
- }
-
- // First prefer the HOME environmental variable
- if home := os.Getenv(homeEnv); home != "" {
- return home, nil
- }
-
- var stdout bytes.Buffer
-
- // If that fails, try OS specific commands
- if runtime.GOOS == "darwin" {
- cmd := exec.Command("sh", "-c", `dscl -q . -read /Users/"$(whoami)" NFSHomeDirectory | sed 's/^[^ ]*: //'`)
- cmd.Stdout = &stdout
- if err := cmd.Run(); err == nil {
- result := strings.TrimSpace(stdout.String())
- if result != "" {
- return result, nil
- }
- }
- } else {
- cmd := exec.Command("getent", "passwd", strconv.Itoa(os.Getuid()))
- cmd.Stdout = &stdout
- if err := cmd.Run(); err != nil {
- // If the error is ErrNotFound, we ignore it. Otherwise, return it.
- if err != exec.ErrNotFound {
- return "", err
- }
- } else {
- if passwd := strings.TrimSpace(stdout.String()); passwd != "" {
- // username:password:uid:gid:gecos:home:shell
- passwdParts := strings.SplitN(passwd, ":", 7)
- if len(passwdParts) > 5 {
- return passwdParts[5], nil
- }
- }
- }
- }
-
- // If all else fails, try the shell
- stdout.Reset()
- cmd := exec.Command("sh", "-c", "cd && pwd")
- cmd.Stdout = &stdout
- if err := cmd.Run(); err != nil {
- return "", err
- }
-
- result := strings.TrimSpace(stdout.String())
- if result == "" {
- return "", errors.New("blank output when reading home directory")
- }
-
- return result, nil
-}
-
-func dirWindows() (string, error) {
- // First prefer the HOME environmental variable
- if home := os.Getenv("HOME"); home != "" {
- return home, nil
- }
-
- // Prefer standard environment variable USERPROFILE
- if home := os.Getenv("USERPROFILE"); home != "" {
- return home, nil
- }
-
- drive := os.Getenv("HOMEDRIVE")
- path := os.Getenv("HOMEPATH")
- home := drive + path
- if drive == "" || path == "" {
- return "", errors.New("HOMEDRIVE, HOMEPATH, or USERPROFILE are blank")
- }
-
- return home, nil
-}
diff --git a/vendor/github.com/pelletier/go-buffruneio/.gitignore b/vendor/github.com/pelletier/go-buffruneio/.gitignore
deleted file mode 100644
index c56069fe..00000000
--- a/vendor/github.com/pelletier/go-buffruneio/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.test
\ No newline at end of file
diff --git a/vendor/github.com/pelletier/go-buffruneio/.travis.yml b/vendor/github.com/pelletier/go-buffruneio/.travis.yml
deleted file mode 100644
index 9720442c..00000000
--- a/vendor/github.com/pelletier/go-buffruneio/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-sudo: false
-go:
- - 1.3.3
- - 1.4.3
- - 1.5.3
- - tip
diff --git a/vendor/github.com/pelletier/go-buffruneio/README.md b/vendor/github.com/pelletier/go-buffruneio/README.md
deleted file mode 100644
index ff608b3a..00000000
--- a/vendor/github.com/pelletier/go-buffruneio/README.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# buffruneio
-
-[](https://travis-ci.org/pelletier/go-buffruneio)
-[](https://godoc.org/github.com/pelletier/go-buffruneio)
-
-Buffruneio is a wrapper around bufio to provide buffered runes access with
-unlimited unreads.
-
-```go
-import "github.com/pelletier/go-buffruneio"
-```
-
-## Examples
-
-```go
-import (
- "fmt"
- "github.com/pelletier/go-buffruneio"
- "strings"
-)
-
-reader := buffruneio.NewReader(strings.NewReader("abcd"))
-fmt.Println(reader.ReadRune()) // 'a'
-fmt.Println(reader.ReadRune()) // 'b'
-fmt.Println(reader.ReadRune()) // 'c'
-reader.UnreadRune()
-reader.UnreadRune()
-fmt.Println(reader.ReadRune()) // 'b'
-fmt.Println(reader.ReadRune()) // 'c'
-```
-
-## Documentation
-
-The documentation and additional examples are available at
-[godoc.org](http://godoc.org/github.com/pelletier/go-buffruneio).
-
-## Contribute
-
-Feel free to report bugs and patches using GitHub's pull requests system on
-[pelletier/go-toml](https://github.com/pelletier/go-buffruneio). Any feedback is
-much appreciated!
-
-## LICENSE
-
-Copyright (c) 2016 Thomas Pelletier
-
-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.
diff --git a/vendor/github.com/pelletier/go-buffruneio/buffruneio.go b/vendor/github.com/pelletier/go-buffruneio/buffruneio.go
deleted file mode 100644
index 4e6d6ea6..00000000
--- a/vendor/github.com/pelletier/go-buffruneio/buffruneio.go
+++ /dev/null
@@ -1,117 +0,0 @@
-// Package buffruneio is a wrapper around bufio to provide buffered runes access with unlimited unreads.
-package buffruneio
-
-import (
- "bufio"
- "container/list"
- "errors"
- "io"
-)
-
-// Rune to indicate end of file.
-const (
- EOF = -(iota + 1)
-)
-
-// ErrNoRuneToUnread is returned by UnreadRune() when the read index is already at the beginning of the buffer.
-var ErrNoRuneToUnread = errors.New("no rune to unwind")
-
-// Reader implements runes buffering for an io.Reader object.
-type Reader struct {
- buffer *list.List
- current *list.Element
- input *bufio.Reader
-}
-
-// NewReader returns a new Reader.
-func NewReader(rd io.Reader) *Reader {
- return &Reader{
- buffer: list.New(),
- input: bufio.NewReader(rd),
- }
-}
-
-type runeWithSize struct {
- r rune
- size int
-}
-
-func (rd *Reader) feedBuffer() error {
- r, size, err := rd.input.ReadRune()
-
- if err != nil {
- if err != io.EOF {
- return err
- }
- r = EOF
- }
-
- newRuneWithSize := runeWithSize{r, size}
-
- rd.buffer.PushBack(newRuneWithSize)
- if rd.current == nil {
- rd.current = rd.buffer.Back()
- }
- return nil
-}
-
-// ReadRune reads the next rune from buffer, or from the underlying reader if needed.
-func (rd *Reader) ReadRune() (rune, int, error) {
- if rd.current == rd.buffer.Back() || rd.current == nil {
- err := rd.feedBuffer()
- if err != nil {
- return EOF, 0, err
- }
- }
-
- runeWithSize := rd.current.Value.(runeWithSize)
- rd.current = rd.current.Next()
- return runeWithSize.r, runeWithSize.size, nil
-}
-
-// UnreadRune pushes back the previously read rune in the buffer, extending it if needed.
-func (rd *Reader) UnreadRune() error {
- if rd.current == rd.buffer.Front() {
- return ErrNoRuneToUnread
- }
- if rd.current == nil {
- rd.current = rd.buffer.Back()
- } else {
- rd.current = rd.current.Prev()
- }
- return nil
-}
-
-// Forget removes runes stored before the current stream position index.
-func (rd *Reader) Forget() {
- if rd.current == nil {
- rd.current = rd.buffer.Back()
- }
- for ; rd.current != rd.buffer.Front(); rd.buffer.Remove(rd.current.Prev()) {
- }
-}
-
-// PeekRune returns at most the next n runes, reading from the uderlying source if
-// needed. Does not move the current index. It includes EOF if reached.
-func (rd *Reader) PeekRunes(n int) []rune {
- res := make([]rune, 0, n)
- cursor := rd.current
- for i := 0; i < n; i++ {
- if cursor == nil {
- err := rd.feedBuffer()
- if err != nil {
- return res
- }
- cursor = rd.buffer.Back()
- }
- if cursor != nil {
- r := cursor.Value.(runeWithSize).r
- res = append(res, r)
- if r == EOF {
- return res
- }
- cursor = cursor.Next()
- }
- }
- return res
-}
diff --git a/vendor/github.com/sergi/go-diff/AUTHORS b/vendor/github.com/sergi/go-diff/AUTHORS
deleted file mode 100644
index 2d7bb2bf..00000000
--- a/vendor/github.com/sergi/go-diff/AUTHORS
+++ /dev/null
@@ -1,25 +0,0 @@
-# This is the official list of go-diff authors for copyright purposes.
-# This file is distinct from the CONTRIBUTORS files.
-# See the latter for an explanation.
-
-# Names should be added to this file as
-# Name or Organization
-# The email address is not required for organizations.
-
-# Please keep the list sorted.
-
-Danny Yoo
-James Kolb
-Jonathan Amsterdam
-Markus Zimmermann
-Matt Kovars
-Örjan Persson
-Osman Masood
-Robert Carlsen
-Rory Flynn
-Sergi Mansilla
-Shatrugna Sadhu
-Shawn Smith
-Stas Maksimov
-Tor Arvid Lund
-Zac Bergquist
diff --git a/vendor/github.com/sergi/go-diff/CONTRIBUTORS b/vendor/github.com/sergi/go-diff/CONTRIBUTORS
deleted file mode 100644
index 369e3d55..00000000
--- a/vendor/github.com/sergi/go-diff/CONTRIBUTORS
+++ /dev/null
@@ -1,32 +0,0 @@
-# This is the official list of people who can contribute
-# (and typically have contributed) code to the go-diff
-# repository.
-#
-# The AUTHORS file lists the copyright holders; this file
-# lists people. For example, ACME Inc. employees would be listed here
-# but not in AUTHORS, because ACME Inc. would hold the copyright.
-#
-# When adding J Random Contributor's name to this file,
-# either J's name or J's organization's name should be
-# added to the AUTHORS file.
-#
-# Names should be added to this file like so:
-# Name
-#
-# Please keep the list sorted.
-
-Danny Yoo
-James Kolb
-Jonathan Amsterdam
-Markus Zimmermann
-Matt Kovars
-Örjan Persson
-Osman Masood
-Robert Carlsen
-Rory Flynn
-Sergi Mansilla
-Shatrugna Sadhu
-Shawn Smith
-Stas Maksimov
-Tor Arvid Lund
-Zac Bergquist
diff --git a/vendor/github.com/sergi/go-diff/LICENSE b/vendor/github.com/sergi/go-diff/LICENSE
deleted file mode 100644
index 937942c2..00000000
--- a/vendor/github.com/sergi/go-diff/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2012-2016 The go-diff Authors. All rights reserved.
-
-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.
-
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go
deleted file mode 100644
index 82ad7bc8..00000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go
+++ /dev/null
@@ -1,1344 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "bytes"
- "errors"
- "fmt"
- "html"
- "math"
- "net/url"
- "regexp"
- "strconv"
- "strings"
- "time"
- "unicode/utf8"
-)
-
-// Operation defines the operation of a diff item.
-type Operation int8
-
-const (
- // DiffDelete item represents a delete diff.
- DiffDelete Operation = -1
- // DiffInsert item represents an insert diff.
- DiffInsert Operation = 1
- // DiffEqual item represents an equal diff.
- DiffEqual Operation = 0
-)
-
-// Diff represents one diff operation
-type Diff struct {
- Type Operation
- Text string
-}
-
-func splice(slice []Diff, index int, amount int, elements ...Diff) []Diff {
- return append(slice[:index], append(elements, slice[index+amount:]...)...)
-}
-
-// DiffMain finds the differences between two texts.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-func (dmp *DiffMatchPatch) DiffMain(text1, text2 string, checklines bool) []Diff {
- return dmp.DiffMainRunes([]rune(text1), []rune(text2), checklines)
-}
-
-// DiffMainRunes finds the differences between two rune sequences.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-func (dmp *DiffMatchPatch) DiffMainRunes(text1, text2 []rune, checklines bool) []Diff {
- var deadline time.Time
- if dmp.DiffTimeout > 0 {
- deadline = time.Now().Add(dmp.DiffTimeout)
- }
- return dmp.diffMainRunes(text1, text2, checklines, deadline)
-}
-
-func (dmp *DiffMatchPatch) diffMainRunes(text1, text2 []rune, checklines bool, deadline time.Time) []Diff {
- if runesEqual(text1, text2) {
- var diffs []Diff
- if len(text1) > 0 {
- diffs = append(diffs, Diff{DiffEqual, string(text1)})
- }
- return diffs
- }
- // Trim off common prefix (speedup).
- commonlength := commonPrefixLength(text1, text2)
- commonprefix := text1[:commonlength]
- text1 = text1[commonlength:]
- text2 = text2[commonlength:]
-
- // Trim off common suffix (speedup).
- commonlength = commonSuffixLength(text1, text2)
- commonsuffix := text1[len(text1)-commonlength:]
- text1 = text1[:len(text1)-commonlength]
- text2 = text2[:len(text2)-commonlength]
-
- // Compute the diff on the middle block.
- diffs := dmp.diffCompute(text1, text2, checklines, deadline)
-
- // Restore the prefix and suffix.
- if len(commonprefix) != 0 {
- diffs = append([]Diff{Diff{DiffEqual, string(commonprefix)}}, diffs...)
- }
- if len(commonsuffix) != 0 {
- diffs = append(diffs, Diff{DiffEqual, string(commonsuffix)})
- }
-
- return dmp.DiffCleanupMerge(diffs)
-}
-
-// diffCompute finds the differences between two rune slices. Assumes that the texts do not have any common prefix or suffix.
-func (dmp *DiffMatchPatch) diffCompute(text1, text2 []rune, checklines bool, deadline time.Time) []Diff {
- diffs := []Diff{}
- if len(text1) == 0 {
- // Just add some text (speedup).
- return append(diffs, Diff{DiffInsert, string(text2)})
- } else if len(text2) == 0 {
- // Just delete some text (speedup).
- return append(diffs, Diff{DiffDelete, string(text1)})
- }
-
- var longtext, shorttext []rune
- if len(text1) > len(text2) {
- longtext = text1
- shorttext = text2
- } else {
- longtext = text2
- shorttext = text1
- }
-
- if i := runesIndex(longtext, shorttext); i != -1 {
- op := DiffInsert
- // Swap insertions for deletions if diff is reversed.
- if len(text1) > len(text2) {
- op = DiffDelete
- }
- // Shorter text is inside the longer text (speedup).
- return []Diff{
- Diff{op, string(longtext[:i])},
- Diff{DiffEqual, string(shorttext)},
- Diff{op, string(longtext[i+len(shorttext):])},
- }
- } else if len(shorttext) == 1 {
- // Single character string.
- // After the previous speedup, the character can't be an equality.
- return []Diff{
- Diff{DiffDelete, string(text1)},
- Diff{DiffInsert, string(text2)},
- }
- // Check to see if the problem can be split in two.
- } else if hm := dmp.diffHalfMatch(text1, text2); hm != nil {
- // A half-match was found, sort out the return data.
- text1A := hm[0]
- text1B := hm[1]
- text2A := hm[2]
- text2B := hm[3]
- midCommon := hm[4]
- // Send both pairs off for separate processing.
- diffsA := dmp.diffMainRunes(text1A, text2A, checklines, deadline)
- diffsB := dmp.diffMainRunes(text1B, text2B, checklines, deadline)
- // Merge the results.
- return append(diffsA, append([]Diff{Diff{DiffEqual, string(midCommon)}}, diffsB...)...)
- } else if checklines && len(text1) > 100 && len(text2) > 100 {
- return dmp.diffLineMode(text1, text2, deadline)
- }
- return dmp.diffBisect(text1, text2, deadline)
-}
-
-// diffLineMode does a quick line-level diff on both []runes, then rediff the parts for greater accuracy. This speedup can produce non-minimal diffs.
-func (dmp *DiffMatchPatch) diffLineMode(text1, text2 []rune, deadline time.Time) []Diff {
- // Scan the text on a line-by-line basis first.
- text1, text2, linearray := dmp.diffLinesToRunes(text1, text2)
-
- diffs := dmp.diffMainRunes(text1, text2, false, deadline)
-
- // Convert the diff back to original text.
- diffs = dmp.DiffCharsToLines(diffs, linearray)
- // Eliminate freak matches (e.g. blank lines)
- diffs = dmp.DiffCleanupSemantic(diffs)
-
- // Rediff any replacement blocks, this time character-by-character.
- // Add a dummy entry at the end.
- diffs = append(diffs, Diff{DiffEqual, ""})
-
- pointer := 0
- countDelete := 0
- countInsert := 0
-
- // NOTE: Rune slices are slower than using strings in this case.
- textDelete := ""
- textInsert := ""
-
- for pointer < len(diffs) {
- switch diffs[pointer].Type {
- case DiffInsert:
- countInsert++
- textInsert += diffs[pointer].Text
- case DiffDelete:
- countDelete++
- textDelete += diffs[pointer].Text
- case DiffEqual:
- // Upon reaching an equality, check for prior redundancies.
- if countDelete >= 1 && countInsert >= 1 {
- // Delete the offending records and add the merged ones.
- diffs = splice(diffs, pointer-countDelete-countInsert,
- countDelete+countInsert)
-
- pointer = pointer - countDelete - countInsert
- a := dmp.diffMainRunes([]rune(textDelete), []rune(textInsert), false, deadline)
- for j := len(a) - 1; j >= 0; j-- {
- diffs = splice(diffs, pointer, 0, a[j])
- }
- pointer = pointer + len(a)
- }
-
- countInsert = 0
- countDelete = 0
- textDelete = ""
- textInsert = ""
- }
- pointer++
- }
-
- return diffs[:len(diffs)-1] // Remove the dummy entry at the end.
-}
-
-// DiffBisect finds the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-// See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
-func (dmp *DiffMatchPatch) DiffBisect(text1, text2 string, deadline time.Time) []Diff {
- // Unused in this code, but retained for interface compatibility.
- return dmp.diffBisect([]rune(text1), []rune(text2), deadline)
-}
-
-// diffBisect finds the 'middle snake' of a diff, splits the problem in two and returns the recursively constructed diff.
-// See Myers's 1986 paper: An O(ND) Difference Algorithm and Its Variations.
-func (dmp *DiffMatchPatch) diffBisect(runes1, runes2 []rune, deadline time.Time) []Diff {
- // Cache the text lengths to prevent multiple calls.
- runes1Len, runes2Len := len(runes1), len(runes2)
-
- maxD := (runes1Len + runes2Len + 1) / 2
- vOffset := maxD
- vLength := 2 * maxD
-
- v1 := make([]int, vLength)
- v2 := make([]int, vLength)
- for i := range v1 {
- v1[i] = -1
- v2[i] = -1
- }
- v1[vOffset+1] = 0
- v2[vOffset+1] = 0
-
- delta := runes1Len - runes2Len
- // If the total number of characters is odd, then the front path will collide with the reverse path.
- front := (delta%2 != 0)
- // Offsets for start and end of k loop. Prevents mapping of space beyond the grid.
- k1start := 0
- k1end := 0
- k2start := 0
- k2end := 0
- for d := 0; d < maxD; d++ {
- // Bail out if deadline is reached.
- if !deadline.IsZero() && time.Now().After(deadline) {
- break
- }
-
- // Walk the front path one step.
- for k1 := -d + k1start; k1 <= d-k1end; k1 += 2 {
- k1Offset := vOffset + k1
- var x1 int
-
- if k1 == -d || (k1 != d && v1[k1Offset-1] < v1[k1Offset+1]) {
- x1 = v1[k1Offset+1]
- } else {
- x1 = v1[k1Offset-1] + 1
- }
-
- y1 := x1 - k1
- for x1 < runes1Len && y1 < runes2Len {
- if runes1[x1] != runes2[y1] {
- break
- }
- x1++
- y1++
- }
- v1[k1Offset] = x1
- if x1 > runes1Len {
- // Ran off the right of the graph.
- k1end += 2
- } else if y1 > runes2Len {
- // Ran off the bottom of the graph.
- k1start += 2
- } else if front {
- k2Offset := vOffset + delta - k1
- if k2Offset >= 0 && k2Offset < vLength && v2[k2Offset] != -1 {
- // Mirror x2 onto top-left coordinate system.
- x2 := runes1Len - v2[k2Offset]
- if x1 >= x2 {
- // Overlap detected.
- return dmp.diffBisectSplit(runes1, runes2, x1, y1, deadline)
- }
- }
- }
- }
- // Walk the reverse path one step.
- for k2 := -d + k2start; k2 <= d-k2end; k2 += 2 {
- k2Offset := vOffset + k2
- var x2 int
- if k2 == -d || (k2 != d && v2[k2Offset-1] < v2[k2Offset+1]) {
- x2 = v2[k2Offset+1]
- } else {
- x2 = v2[k2Offset-1] + 1
- }
- var y2 = x2 - k2
- for x2 < runes1Len && y2 < runes2Len {
- if runes1[runes1Len-x2-1] != runes2[runes2Len-y2-1] {
- break
- }
- x2++
- y2++
- }
- v2[k2Offset] = x2
- if x2 > runes1Len {
- // Ran off the left of the graph.
- k2end += 2
- } else if y2 > runes2Len {
- // Ran off the top of the graph.
- k2start += 2
- } else if !front {
- k1Offset := vOffset + delta - k2
- if k1Offset >= 0 && k1Offset < vLength && v1[k1Offset] != -1 {
- x1 := v1[k1Offset]
- y1 := vOffset + x1 - k1Offset
- // Mirror x2 onto top-left coordinate system.
- x2 = runes1Len - x2
- if x1 >= x2 {
- // Overlap detected.
- return dmp.diffBisectSplit(runes1, runes2, x1, y1, deadline)
- }
- }
- }
- }
- }
- // Diff took too long and hit the deadline or number of diffs equals number of characters, no commonality at all.
- return []Diff{
- Diff{DiffDelete, string(runes1)},
- Diff{DiffInsert, string(runes2)},
- }
-}
-
-func (dmp *DiffMatchPatch) diffBisectSplit(runes1, runes2 []rune, x, y int,
- deadline time.Time) []Diff {
- runes1a := runes1[:x]
- runes2a := runes2[:y]
- runes1b := runes1[x:]
- runes2b := runes2[y:]
-
- // Compute both diffs serially.
- diffs := dmp.diffMainRunes(runes1a, runes2a, false, deadline)
- diffsb := dmp.diffMainRunes(runes1b, runes2b, false, deadline)
-
- return append(diffs, diffsb...)
-}
-
-// DiffLinesToChars splits two texts into a list of strings, and educes the texts to a string of hashes where each Unicode character represents one line.
-// It's slightly faster to call DiffLinesToRunes first, followed by DiffMainRunes.
-func (dmp *DiffMatchPatch) DiffLinesToChars(text1, text2 string) (string, string, []string) {
- chars1, chars2, lineArray := dmp.DiffLinesToRunes(text1, text2)
- return string(chars1), string(chars2), lineArray
-}
-
-// DiffLinesToRunes splits two texts into a list of runes. Each rune represents one line.
-func (dmp *DiffMatchPatch) DiffLinesToRunes(text1, text2 string) ([]rune, []rune, []string) {
- // '\x00' is a valid character, but various debuggers don't like it. So we'll insert a junk entry to avoid generating a null character.
- lineArray := []string{""} // e.g. lineArray[4] == 'Hello\n'
- lineHash := map[string]int{} // e.g. lineHash['Hello\n'] == 4
-
- chars1 := dmp.diffLinesToRunesMunge(text1, &lineArray, lineHash)
- chars2 := dmp.diffLinesToRunesMunge(text2, &lineArray, lineHash)
-
- return chars1, chars2, lineArray
-}
-
-func (dmp *DiffMatchPatch) diffLinesToRunes(text1, text2 []rune) ([]rune, []rune, []string) {
- return dmp.DiffLinesToRunes(string(text1), string(text2))
-}
-
-// diffLinesToRunesMunge splits a text into an array of strings, and reduces the texts to a []rune where each Unicode character represents one line.
-// We use strings instead of []runes as input mainly because you can't use []rune as a map key.
-func (dmp *DiffMatchPatch) diffLinesToRunesMunge(text string, lineArray *[]string, lineHash map[string]int) []rune {
- // Walk the text, pulling out a substring for each line. text.split('\n') would would temporarily double our memory footprint. Modifying text would create many large strings to garbage collect.
- lineStart := 0
- lineEnd := -1
- runes := []rune{}
-
- for lineEnd < len(text)-1 {
- lineEnd = indexOf(text, "\n", lineStart)
-
- if lineEnd == -1 {
- lineEnd = len(text) - 1
- }
-
- line := text[lineStart : lineEnd+1]
- lineStart = lineEnd + 1
- lineValue, ok := lineHash[line]
-
- if ok {
- runes = append(runes, rune(lineValue))
- } else {
- *lineArray = append(*lineArray, line)
- lineHash[line] = len(*lineArray) - 1
- runes = append(runes, rune(len(*lineArray)-1))
- }
- }
-
- return runes
-}
-
-// DiffCharsToLines rehydrates the text in a diff from a string of line hashes to real lines of text.
-func (dmp *DiffMatchPatch) DiffCharsToLines(diffs []Diff, lineArray []string) []Diff {
- hydrated := make([]Diff, 0, len(diffs))
- for _, aDiff := range diffs {
- chars := aDiff.Text
- text := make([]string, len(chars))
-
- for i, r := range chars {
- text[i] = lineArray[r]
- }
-
- aDiff.Text = strings.Join(text, "")
- hydrated = append(hydrated, aDiff)
- }
- return hydrated
-}
-
-// DiffCommonPrefix determines the common prefix length of two strings.
-func (dmp *DiffMatchPatch) DiffCommonPrefix(text1, text2 string) int {
- // Unused in this code, but retained for interface compatibility.
- return commonPrefixLength([]rune(text1), []rune(text2))
-}
-
-// DiffCommonSuffix determines the common suffix length of two strings.
-func (dmp *DiffMatchPatch) DiffCommonSuffix(text1, text2 string) int {
- // Unused in this code, but retained for interface compatibility.
- return commonSuffixLength([]rune(text1), []rune(text2))
-}
-
-// commonPrefixLength returns the length of the common prefix of two rune slices.
-func commonPrefixLength(text1, text2 []rune) int {
- short, long := text1, text2
- if len(short) > len(long) {
- short, long = long, short
- }
- for i, r := range short {
- if r != long[i] {
- return i
- }
- }
- return len(short)
-}
-
-// commonSuffixLength returns the length of the common suffix of two rune slices.
-func commonSuffixLength(text1, text2 []rune) int {
- n := min(len(text1), len(text2))
- for i := 0; i < n; i++ {
- if text1[len(text1)-i-1] != text2[len(text2)-i-1] {
- return i
- }
- }
- return n
-
- // TODO research and benchmark this, why is it not activated? https://github.com/sergi/go-diff/issues/54
- // Binary search.
- // Performance analysis: http://neil.fraser.name/news/2007/10/09/
- /*
- pointermin := 0
- pointermax := math.Min(len(text1), len(text2))
- pointermid := pointermax
- pointerend := 0
- for pointermin < pointermid {
- if text1[len(text1)-pointermid:len(text1)-pointerend] ==
- text2[len(text2)-pointermid:len(text2)-pointerend] {
- pointermin = pointermid
- pointerend = pointermin
- } else {
- pointermax = pointermid
- }
- pointermid = math.Floor((pointermax-pointermin)/2 + pointermin)
- }
- return pointermid
- */
-}
-
-// DiffCommonOverlap determines if the suffix of one string is the prefix of another.
-func (dmp *DiffMatchPatch) DiffCommonOverlap(text1 string, text2 string) int {
- // Cache the text lengths to prevent multiple calls.
- text1Length := len(text1)
- text2Length := len(text2)
- // Eliminate the null case.
- if text1Length == 0 || text2Length == 0 {
- return 0
- }
- // Truncate the longer string.
- if text1Length > text2Length {
- text1 = text1[text1Length-text2Length:]
- } else if text1Length < text2Length {
- text2 = text2[0:text1Length]
- }
- textLength := int(math.Min(float64(text1Length), float64(text2Length)))
- // Quick check for the worst case.
- if text1 == text2 {
- return textLength
- }
-
- // Start by looking for a single character match and increase length until no match is found. Performance analysis: http://neil.fraser.name/news/2010/11/04/
- best := 0
- length := 1
- for {
- pattern := text1[textLength-length:]
- found := strings.Index(text2, pattern)
- if found == -1 {
- break
- }
- length += found
- if found == 0 || text1[textLength-length:] == text2[0:length] {
- best = length
- length++
- }
- }
-
- return best
-}
-
-// DiffHalfMatch checks whether the two texts share a substring which is at least half the length of the longer text. This speedup can produce non-minimal diffs.
-func (dmp *DiffMatchPatch) DiffHalfMatch(text1, text2 string) []string {
- // Unused in this code, but retained for interface compatibility.
- runeSlices := dmp.diffHalfMatch([]rune(text1), []rune(text2))
- if runeSlices == nil {
- return nil
- }
-
- result := make([]string, len(runeSlices))
- for i, r := range runeSlices {
- result[i] = string(r)
- }
- return result
-}
-
-func (dmp *DiffMatchPatch) diffHalfMatch(text1, text2 []rune) [][]rune {
- if dmp.DiffTimeout <= 0 {
- // Don't risk returning a non-optimal diff if we have unlimited time.
- return nil
- }
-
- var longtext, shorttext []rune
- if len(text1) > len(text2) {
- longtext = text1
- shorttext = text2
- } else {
- longtext = text2
- shorttext = text1
- }
-
- if len(longtext) < 4 || len(shorttext)*2 < len(longtext) {
- return nil // Pointless.
- }
-
- // First check if the second quarter is the seed for a half-match.
- hm1 := dmp.diffHalfMatchI(longtext, shorttext, int(float64(len(longtext)+3)/4))
-
- // Check again based on the third quarter.
- hm2 := dmp.diffHalfMatchI(longtext, shorttext, int(float64(len(longtext)+1)/2))
-
- hm := [][]rune{}
- if hm1 == nil && hm2 == nil {
- return nil
- } else if hm2 == nil {
- hm = hm1
- } else if hm1 == nil {
- hm = hm2
- } else {
- // Both matched. Select the longest.
- if len(hm1[4]) > len(hm2[4]) {
- hm = hm1
- } else {
- hm = hm2
- }
- }
-
- // A half-match was found, sort out the return data.
- if len(text1) > len(text2) {
- return hm
- }
-
- return [][]rune{hm[2], hm[3], hm[0], hm[1], hm[4]}
-}
-
-// diffHalfMatchI checks if a substring of shorttext exist within longtext such that the substring is at least half the length of longtext?
-// Returns a slice containing the prefix of longtext, the suffix of longtext, the prefix of shorttext, the suffix of shorttext and the common middle, or null if there was no match.
-func (dmp *DiffMatchPatch) diffHalfMatchI(l, s []rune, i int) [][]rune {
- var bestCommonA []rune
- var bestCommonB []rune
- var bestCommonLen int
- var bestLongtextA []rune
- var bestLongtextB []rune
- var bestShorttextA []rune
- var bestShorttextB []rune
-
- // Start with a 1/4 length substring at position i as a seed.
- seed := l[i : i+len(l)/4]
-
- for j := runesIndexOf(s, seed, 0); j != -1; j = runesIndexOf(s, seed, j+1) {
- prefixLength := commonPrefixLength(l[i:], s[j:])
- suffixLength := commonSuffixLength(l[:i], s[:j])
-
- if bestCommonLen < suffixLength+prefixLength {
- bestCommonA = s[j-suffixLength : j]
- bestCommonB = s[j : j+prefixLength]
- bestCommonLen = len(bestCommonA) + len(bestCommonB)
- bestLongtextA = l[:i-suffixLength]
- bestLongtextB = l[i+prefixLength:]
- bestShorttextA = s[:j-suffixLength]
- bestShorttextB = s[j+prefixLength:]
- }
- }
-
- if bestCommonLen*2 < len(l) {
- return nil
- }
-
- return [][]rune{
- bestLongtextA,
- bestLongtextB,
- bestShorttextA,
- bestShorttextB,
- append(bestCommonA, bestCommonB...),
- }
-}
-
-// DiffCleanupSemantic reduces the number of edits by eliminating semantically trivial equalities.
-func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff {
- changes := false
- // Stack of indices where equalities are found.
- type equality struct {
- data int
- next *equality
- }
- var equalities *equality
-
- var lastequality string
- // Always equal to diffs[equalities[equalitiesLength - 1]][1]
- var pointer int // Index of current position.
- // Number of characters that changed prior to the equality.
- var lengthInsertions1, lengthDeletions1 int
- // Number of characters that changed after the equality.
- var lengthInsertions2, lengthDeletions2 int
-
- for pointer < len(diffs) {
- if diffs[pointer].Type == DiffEqual {
- // Equality found.
-
- equalities = &equality{
- data: pointer,
- next: equalities,
- }
- lengthInsertions1 = lengthInsertions2
- lengthDeletions1 = lengthDeletions2
- lengthInsertions2 = 0
- lengthDeletions2 = 0
- lastequality = diffs[pointer].Text
- } else {
- // An insertion or deletion.
-
- if diffs[pointer].Type == DiffInsert {
- lengthInsertions2 += len(diffs[pointer].Text)
- } else {
- lengthDeletions2 += len(diffs[pointer].Text)
- }
- // Eliminate an equality that is smaller or equal to the edits on both sides of it.
- difference1 := int(math.Max(float64(lengthInsertions1), float64(lengthDeletions1)))
- difference2 := int(math.Max(float64(lengthInsertions2), float64(lengthDeletions2)))
- if len(lastequality) > 0 &&
- (len(lastequality) <= difference1) &&
- (len(lastequality) <= difference2) {
- // Duplicate record.
- insPoint := equalities.data
- diffs = append(
- diffs[:insPoint],
- append([]Diff{Diff{DiffDelete, lastequality}}, diffs[insPoint:]...)...)
-
- // Change second copy to insert.
- diffs[insPoint+1].Type = DiffInsert
- // Throw away the equality we just deleted.
- equalities = equalities.next
-
- if equalities != nil {
- equalities = equalities.next
- }
- if equalities != nil {
- pointer = equalities.data
- } else {
- pointer = -1
- }
-
- lengthInsertions1 = 0 // Reset the counters.
- lengthDeletions1 = 0
- lengthInsertions2 = 0
- lengthDeletions2 = 0
- lastequality = ""
- changes = true
- }
- }
- pointer++
- }
-
- // Normalize the diff.
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
- diffs = dmp.DiffCleanupSemanticLossless(diffs)
- // Find any overlaps between deletions and insertions.
- // e.g: abcxxxxxxdef
- // -> abcxxxdef
- // e.g: xxxabcdefxxx
- // -> defxxxabc
- // Only extract an overlap if it is as big as the edit ahead or behind it.
- pointer = 1
- for pointer < len(diffs) {
- if diffs[pointer-1].Type == DiffDelete &&
- diffs[pointer].Type == DiffInsert {
- deletion := diffs[pointer-1].Text
- insertion := diffs[pointer].Text
- overlapLength1 := dmp.DiffCommonOverlap(deletion, insertion)
- overlapLength2 := dmp.DiffCommonOverlap(insertion, deletion)
- if overlapLength1 >= overlapLength2 {
- if float64(overlapLength1) >= float64(len(deletion))/2 ||
- float64(overlapLength1) >= float64(len(insertion))/2 {
-
- // Overlap found. Insert an equality and trim the surrounding edits.
- diffs = append(
- diffs[:pointer],
- append([]Diff{Diff{DiffEqual, insertion[:overlapLength1]}}, diffs[pointer:]...)...)
-
- diffs[pointer-1].Text =
- deletion[0 : len(deletion)-overlapLength1]
- diffs[pointer+1].Text = insertion[overlapLength1:]
- pointer++
- }
- } else {
- if float64(overlapLength2) >= float64(len(deletion))/2 ||
- float64(overlapLength2) >= float64(len(insertion))/2 {
- // Reverse overlap found. Insert an equality and swap and trim the surrounding edits.
- overlap := Diff{DiffEqual, deletion[:overlapLength2]}
- diffs = append(
- diffs[:pointer],
- append([]Diff{overlap}, diffs[pointer:]...)...)
-
- diffs[pointer-1].Type = DiffInsert
- diffs[pointer-1].Text = insertion[0 : len(insertion)-overlapLength2]
- diffs[pointer+1].Type = DiffDelete
- diffs[pointer+1].Text = deletion[overlapLength2:]
- pointer++
- }
- }
- pointer++
- }
- pointer++
- }
-
- return diffs
-}
-
-// Define some regex patterns for matching boundaries.
-var (
- nonAlphaNumericRegex = regexp.MustCompile(`[^a-zA-Z0-9]`)
- whitespaceRegex = regexp.MustCompile(`\s`)
- linebreakRegex = regexp.MustCompile(`[\r\n]`)
- blanklineEndRegex = regexp.MustCompile(`\n\r?\n$`)
- blanklineStartRegex = regexp.MustCompile(`^\r?\n\r?\n`)
-)
-
-// diffCleanupSemanticScore computes a score representing whether the internal boundary falls on logical boundaries.
-// Scores range from 6 (best) to 0 (worst). Closure, but does not reference any external variables.
-func diffCleanupSemanticScore(one, two string) int {
- if len(one) == 0 || len(two) == 0 {
- // Edges are the best.
- return 6
- }
-
- // Each port of this function behaves slightly differently due to subtle differences in each language's definition of things like 'whitespace'. Since this function's purpose is largely cosmetic, the choice has been made to use each language's native features rather than force total conformity.
- rune1, _ := utf8.DecodeLastRuneInString(one)
- rune2, _ := utf8.DecodeRuneInString(two)
- char1 := string(rune1)
- char2 := string(rune2)
-
- nonAlphaNumeric1 := nonAlphaNumericRegex.MatchString(char1)
- nonAlphaNumeric2 := nonAlphaNumericRegex.MatchString(char2)
- whitespace1 := nonAlphaNumeric1 && whitespaceRegex.MatchString(char1)
- whitespace2 := nonAlphaNumeric2 && whitespaceRegex.MatchString(char2)
- lineBreak1 := whitespace1 && linebreakRegex.MatchString(char1)
- lineBreak2 := whitespace2 && linebreakRegex.MatchString(char2)
- blankLine1 := lineBreak1 && blanklineEndRegex.MatchString(one)
- blankLine2 := lineBreak2 && blanklineEndRegex.MatchString(two)
-
- if blankLine1 || blankLine2 {
- // Five points for blank lines.
- return 5
- } else if lineBreak1 || lineBreak2 {
- // Four points for line breaks.
- return 4
- } else if nonAlphaNumeric1 && !whitespace1 && whitespace2 {
- // Three points for end of sentences.
- return 3
- } else if whitespace1 || whitespace2 {
- // Two points for whitespace.
- return 2
- } else if nonAlphaNumeric1 || nonAlphaNumeric2 {
- // One point for non-alphanumeric.
- return 1
- }
- return 0
-}
-
-// DiffCleanupSemanticLossless looks for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary.
-// E.g: The cat came. -> The cat came.
-func (dmp *DiffMatchPatch) DiffCleanupSemanticLossless(diffs []Diff) []Diff {
- pointer := 1
-
- // Intentionally ignore the first and last element (don't need checking).
- for pointer < len(diffs)-1 {
- if diffs[pointer-1].Type == DiffEqual &&
- diffs[pointer+1].Type == DiffEqual {
-
- // This is a single edit surrounded by equalities.
- equality1 := diffs[pointer-1].Text
- edit := diffs[pointer].Text
- equality2 := diffs[pointer+1].Text
-
- // First, shift the edit as far left as possible.
- commonOffset := dmp.DiffCommonSuffix(equality1, edit)
- if commonOffset > 0 {
- commonString := edit[len(edit)-commonOffset:]
- equality1 = equality1[0 : len(equality1)-commonOffset]
- edit = commonString + edit[:len(edit)-commonOffset]
- equality2 = commonString + equality2
- }
-
- // Second, step character by character right, looking for the best fit.
- bestEquality1 := equality1
- bestEdit := edit
- bestEquality2 := equality2
- bestScore := diffCleanupSemanticScore(equality1, edit) +
- diffCleanupSemanticScore(edit, equality2)
-
- for len(edit) != 0 && len(equality2) != 0 {
- _, sz := utf8.DecodeRuneInString(edit)
- if len(equality2) < sz || edit[:sz] != equality2[:sz] {
- break
- }
- equality1 += edit[:sz]
- edit = edit[sz:] + equality2[:sz]
- equality2 = equality2[sz:]
- score := diffCleanupSemanticScore(equality1, edit) +
- diffCleanupSemanticScore(edit, equality2)
- // The >= encourages trailing rather than leading whitespace on edits.
- if score >= bestScore {
- bestScore = score
- bestEquality1 = equality1
- bestEdit = edit
- bestEquality2 = equality2
- }
- }
-
- if diffs[pointer-1].Text != bestEquality1 {
- // We have an improvement, save it back to the diff.
- if len(bestEquality1) != 0 {
- diffs[pointer-1].Text = bestEquality1
- } else {
- diffs = splice(diffs, pointer-1, 1)
- pointer--
- }
-
- diffs[pointer].Text = bestEdit
- if len(bestEquality2) != 0 {
- diffs[pointer+1].Text = bestEquality2
- } else {
- diffs = append(diffs[:pointer+1], diffs[pointer+2:]...)
- pointer--
- }
- }
- }
- pointer++
- }
-
- return diffs
-}
-
-// DiffCleanupEfficiency reduces the number of edits by eliminating operationally trivial equalities.
-func (dmp *DiffMatchPatch) DiffCleanupEfficiency(diffs []Diff) []Diff {
- changes := false
- // Stack of indices where equalities are found.
- type equality struct {
- data int
- next *equality
- }
- var equalities *equality
- // Always equal to equalities[equalitiesLength-1][1]
- lastequality := ""
- pointer := 0 // Index of current position.
- // Is there an insertion operation before the last equality.
- preIns := false
- // Is there a deletion operation before the last equality.
- preDel := false
- // Is there an insertion operation after the last equality.
- postIns := false
- // Is there a deletion operation after the last equality.
- postDel := false
- for pointer < len(diffs) {
- if diffs[pointer].Type == DiffEqual { // Equality found.
- if len(diffs[pointer].Text) < dmp.DiffEditCost &&
- (postIns || postDel) {
- // Candidate found.
- equalities = &equality{
- data: pointer,
- next: equalities,
- }
- preIns = postIns
- preDel = postDel
- lastequality = diffs[pointer].Text
- } else {
- // Not a candidate, and can never become one.
- equalities = nil
- lastequality = ""
- }
- postIns = false
- postDel = false
- } else { // An insertion or deletion.
- if diffs[pointer].Type == DiffDelete {
- postDel = true
- } else {
- postIns = true
- }
-
- // Five types to be split:
- // ABXYCD
- // AXCD
- // ABXC
- // AXCD
- // ABXC
- var sumPres int
- if preIns {
- sumPres++
- }
- if preDel {
- sumPres++
- }
- if postIns {
- sumPres++
- }
- if postDel {
- sumPres++
- }
- if len(lastequality) > 0 &&
- ((preIns && preDel && postIns && postDel) ||
- ((len(lastequality) < dmp.DiffEditCost/2) && sumPres == 3)) {
-
- insPoint := equalities.data
-
- // Duplicate record.
- diffs = append(diffs[:insPoint],
- append([]Diff{Diff{DiffDelete, lastequality}}, diffs[insPoint:]...)...)
-
- // Change second copy to insert.
- diffs[insPoint+1].Type = DiffInsert
- // Throw away the equality we just deleted.
- equalities = equalities.next
- lastequality = ""
-
- if preIns && preDel {
- // No changes made which could affect previous entry, keep going.
- postIns = true
- postDel = true
- equalities = nil
- } else {
- if equalities != nil {
- equalities = equalities.next
- }
- if equalities != nil {
- pointer = equalities.data
- } else {
- pointer = -1
- }
- postIns = false
- postDel = false
- }
- changes = true
- }
- }
- pointer++
- }
-
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
-
- return diffs
-}
-
-// DiffCleanupMerge reorders and merges like edit sections. Merge equalities.
-// Any edit section can move as long as it doesn't cross an equality.
-func (dmp *DiffMatchPatch) DiffCleanupMerge(diffs []Diff) []Diff {
- // Add a dummy entry at the end.
- diffs = append(diffs, Diff{DiffEqual, ""})
- pointer := 0
- countDelete := 0
- countInsert := 0
- commonlength := 0
- textDelete := []rune(nil)
- textInsert := []rune(nil)
-
- for pointer < len(diffs) {
- switch diffs[pointer].Type {
- case DiffInsert:
- countInsert++
- textInsert = append(textInsert, []rune(diffs[pointer].Text)...)
- pointer++
- break
- case DiffDelete:
- countDelete++
- textDelete = append(textDelete, []rune(diffs[pointer].Text)...)
- pointer++
- break
- case DiffEqual:
- // Upon reaching an equality, check for prior redundancies.
- if countDelete+countInsert > 1 {
- if countDelete != 0 && countInsert != 0 {
- // Factor out any common prefixies.
- commonlength = commonPrefixLength(textInsert, textDelete)
- if commonlength != 0 {
- x := pointer - countDelete - countInsert
- if x > 0 && diffs[x-1].Type == DiffEqual {
- diffs[x-1].Text += string(textInsert[:commonlength])
- } else {
- diffs = append([]Diff{Diff{DiffEqual, string(textInsert[:commonlength])}}, diffs...)
- pointer++
- }
- textInsert = textInsert[commonlength:]
- textDelete = textDelete[commonlength:]
- }
- // Factor out any common suffixies.
- commonlength = commonSuffixLength(textInsert, textDelete)
- if commonlength != 0 {
- insertIndex := len(textInsert) - commonlength
- deleteIndex := len(textDelete) - commonlength
- diffs[pointer].Text = string(textInsert[insertIndex:]) + diffs[pointer].Text
- textInsert = textInsert[:insertIndex]
- textDelete = textDelete[:deleteIndex]
- }
- }
- // Delete the offending records and add the merged ones.
- if countDelete == 0 {
- diffs = splice(diffs, pointer-countInsert,
- countDelete+countInsert,
- Diff{DiffInsert, string(textInsert)})
- } else if countInsert == 0 {
- diffs = splice(diffs, pointer-countDelete,
- countDelete+countInsert,
- Diff{DiffDelete, string(textDelete)})
- } else {
- diffs = splice(diffs, pointer-countDelete-countInsert,
- countDelete+countInsert,
- Diff{DiffDelete, string(textDelete)},
- Diff{DiffInsert, string(textInsert)})
- }
-
- pointer = pointer - countDelete - countInsert + 1
- if countDelete != 0 {
- pointer++
- }
- if countInsert != 0 {
- pointer++
- }
- } else if pointer != 0 && diffs[pointer-1].Type == DiffEqual {
- // Merge this equality with the previous one.
- diffs[pointer-1].Text += diffs[pointer].Text
- diffs = append(diffs[:pointer], diffs[pointer+1:]...)
- } else {
- pointer++
- }
- countInsert = 0
- countDelete = 0
- textDelete = nil
- textInsert = nil
- break
- }
- }
-
- if len(diffs[len(diffs)-1].Text) == 0 {
- diffs = diffs[0 : len(diffs)-1] // Remove the dummy entry at the end.
- }
-
- // Second pass: look for single edits surrounded on both sides by equalities which can be shifted sideways to eliminate an equality. E.g: ABAC -> ABAC
- changes := false
- pointer = 1
- // Intentionally ignore the first and last element (don't need checking).
- for pointer < (len(diffs) - 1) {
- if diffs[pointer-1].Type == DiffEqual &&
- diffs[pointer+1].Type == DiffEqual {
- // This is a single edit surrounded by equalities.
- if strings.HasSuffix(diffs[pointer].Text, diffs[pointer-1].Text) {
- // Shift the edit over the previous equality.
- diffs[pointer].Text = diffs[pointer-1].Text +
- diffs[pointer].Text[:len(diffs[pointer].Text)-len(diffs[pointer-1].Text)]
- diffs[pointer+1].Text = diffs[pointer-1].Text + diffs[pointer+1].Text
- diffs = splice(diffs, pointer-1, 1)
- changes = true
- } else if strings.HasPrefix(diffs[pointer].Text, diffs[pointer+1].Text) {
- // Shift the edit over the next equality.
- diffs[pointer-1].Text += diffs[pointer+1].Text
- diffs[pointer].Text =
- diffs[pointer].Text[len(diffs[pointer+1].Text):] + diffs[pointer+1].Text
- diffs = splice(diffs, pointer+1, 1)
- changes = true
- }
- }
- pointer++
- }
-
- // If shifts were made, the diff needs reordering and another shift sweep.
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
-
- return diffs
-}
-
-// DiffXIndex returns the equivalent location in s2.
-func (dmp *DiffMatchPatch) DiffXIndex(diffs []Diff, loc int) int {
- chars1 := 0
- chars2 := 0
- lastChars1 := 0
- lastChars2 := 0
- lastDiff := Diff{}
- for i := 0; i < len(diffs); i++ {
- aDiff := diffs[i]
- if aDiff.Type != DiffInsert {
- // Equality or deletion.
- chars1 += len(aDiff.Text)
- }
- if aDiff.Type != DiffDelete {
- // Equality or insertion.
- chars2 += len(aDiff.Text)
- }
- if chars1 > loc {
- // Overshot the location.
- lastDiff = aDiff
- break
- }
- lastChars1 = chars1
- lastChars2 = chars2
- }
- if lastDiff.Type == DiffDelete {
- // The location was deleted.
- return lastChars2
- }
- // Add the remaining character length.
- return lastChars2 + (loc - lastChars1)
-}
-
-// DiffPrettyHtml converts a []Diff into a pretty HTML report.
-// It is intended as an example from which to write one's own display functions.
-func (dmp *DiffMatchPatch) DiffPrettyHtml(diffs []Diff) string {
- var buff bytes.Buffer
- for _, diff := range diffs {
- text := strings.Replace(html.EscapeString(diff.Text), "\n", "¶
", -1)
- switch diff.Type {
- case DiffInsert:
- _, _ = buff.WriteString("")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("")
- case DiffDelete:
- _, _ = buff.WriteString("")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("")
- case DiffEqual:
- _, _ = buff.WriteString("")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("")
- }
- }
- return buff.String()
-}
-
-// DiffPrettyText converts a []Diff into a colored text report.
-func (dmp *DiffMatchPatch) DiffPrettyText(diffs []Diff) string {
- var buff bytes.Buffer
- for _, diff := range diffs {
- text := diff.Text
-
- switch diff.Type {
- case DiffInsert:
- _, _ = buff.WriteString("\x1b[32m")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("\x1b[0m")
- case DiffDelete:
- _, _ = buff.WriteString("\x1b[31m")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("\x1b[0m")
- case DiffEqual:
- _, _ = buff.WriteString(text)
- }
- }
-
- return buff.String()
-}
-
-// DiffText1 computes and returns the source text (all equalities and deletions).
-func (dmp *DiffMatchPatch) DiffText1(diffs []Diff) string {
- //StringBuilder text = new StringBuilder()
- var text bytes.Buffer
-
- for _, aDiff := range diffs {
- if aDiff.Type != DiffInsert {
- _, _ = text.WriteString(aDiff.Text)
- }
- }
- return text.String()
-}
-
-// DiffText2 computes and returns the destination text (all equalities and insertions).
-func (dmp *DiffMatchPatch) DiffText2(diffs []Diff) string {
- var text bytes.Buffer
-
- for _, aDiff := range diffs {
- if aDiff.Type != DiffDelete {
- _, _ = text.WriteString(aDiff.Text)
- }
- }
- return text.String()
-}
-
-// DiffLevenshtein computes the Levenshtein distance that is the number of inserted, deleted or substituted characters.
-func (dmp *DiffMatchPatch) DiffLevenshtein(diffs []Diff) int {
- levenshtein := 0
- insertions := 0
- deletions := 0
-
- for _, aDiff := range diffs {
- switch aDiff.Type {
- case DiffInsert:
- insertions += len(aDiff.Text)
- case DiffDelete:
- deletions += len(aDiff.Text)
- case DiffEqual:
- // A deletion and an insertion is one substitution.
- levenshtein += max(insertions, deletions)
- insertions = 0
- deletions = 0
- }
- }
-
- levenshtein += max(insertions, deletions)
- return levenshtein
-}
-
-// DiffToDelta crushes the diff into an encoded string which describes the operations required to transform text1 into text2.
-// E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using %xx notation.
-func (dmp *DiffMatchPatch) DiffToDelta(diffs []Diff) string {
- var text bytes.Buffer
- for _, aDiff := range diffs {
- switch aDiff.Type {
- case DiffInsert:
- _, _ = text.WriteString("+")
- _, _ = text.WriteString(strings.Replace(url.QueryEscape(aDiff.Text), "+", " ", -1))
- _, _ = text.WriteString("\t")
- break
- case DiffDelete:
- _, _ = text.WriteString("-")
- _, _ = text.WriteString(strconv.Itoa(utf8.RuneCountInString(aDiff.Text)))
- _, _ = text.WriteString("\t")
- break
- case DiffEqual:
- _, _ = text.WriteString("=")
- _, _ = text.WriteString(strconv.Itoa(utf8.RuneCountInString(aDiff.Text)))
- _, _ = text.WriteString("\t")
- break
- }
- }
- delta := text.String()
- if len(delta) != 0 {
- // Strip off trailing tab character.
- delta = delta[0 : utf8.RuneCountInString(delta)-1]
- delta = unescaper.Replace(delta)
- }
- return delta
-}
-
-// DiffFromDelta given the original text1, and an encoded string which describes the operations required to transform text1 into text2, comAdde the full diff.
-func (dmp *DiffMatchPatch) DiffFromDelta(text1 string, delta string) (diffs []Diff, err error) {
- i := 0
- runes := []rune(text1)
-
- for _, token := range strings.Split(delta, "\t") {
- if len(token) == 0 {
- // Blank tokens are ok (from a trailing \t).
- continue
- }
-
- // Each token begins with a one character parameter which specifies the operation of this token (delete, insert, equality).
- param := token[1:]
-
- switch op := token[0]; op {
- case '+':
- // Decode would Diff all "+" to " "
- param = strings.Replace(param, "+", "%2b", -1)
- param, err = url.QueryUnescape(param)
- if err != nil {
- return nil, err
- }
- if !utf8.ValidString(param) {
- return nil, fmt.Errorf("invalid UTF-8 token: %q", param)
- }
-
- diffs = append(diffs, Diff{DiffInsert, param})
- case '=', '-':
- n, err := strconv.ParseInt(param, 10, 0)
- if err != nil {
- return nil, err
- } else if n < 0 {
- return nil, errors.New("Negative number in DiffFromDelta: " + param)
- }
-
- i += int(n)
- // Break out if we are out of bounds, go1.6 can't handle this very well
- if i > len(runes) {
- break
- }
- // Remember that string slicing is by byte - we want by rune here.
- text := string(runes[i-int(n) : i])
-
- if op == '=' {
- diffs = append(diffs, Diff{DiffEqual, text})
- } else {
- diffs = append(diffs, Diff{DiffDelete, text})
- }
- default:
- // Anything else is an error.
- return nil, errors.New("Invalid diff operation in DiffFromDelta: " + string(token[0]))
- }
- }
-
- if i != len(runes) {
- return nil, fmt.Errorf("Delta length (%v) is different from source text length (%v)", i, len(text1))
- }
-
- return diffs, nil
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/diffmatchpatch.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/diffmatchpatch.go
deleted file mode 100644
index d3acc32c..00000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/diffmatchpatch.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-// Package diffmatchpatch offers robust algorithms to perform the operations required for synchronizing plain text.
-package diffmatchpatch
-
-import (
- "time"
-)
-
-// DiffMatchPatch holds the configuration for diff-match-patch operations.
-type DiffMatchPatch struct {
- // Number of seconds to map a diff before giving up (0 for infinity).
- DiffTimeout time.Duration
- // Cost of an empty edit operation in terms of edit characters.
- DiffEditCost int
- // How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match).
- MatchDistance int
- // When deleting a large block of text (over ~64 characters), how close do the contents have to be to match the expected contents. (0.0 = perfection, 1.0 = very loose). Note that MatchThreshold controls how closely the end points of a delete need to match.
- PatchDeleteThreshold float64
- // Chunk size for context length.
- PatchMargin int
- // The number of bits in an int.
- MatchMaxBits int
- // At what point is no match declared (0.0 = perfection, 1.0 = very loose).
- MatchThreshold float64
-}
-
-// New creates a new DiffMatchPatch object with default parameters.
-func New() *DiffMatchPatch {
- // Defaults.
- return &DiffMatchPatch{
- DiffTimeout: time.Second,
- DiffEditCost: 4,
- MatchThreshold: 0.5,
- MatchDistance: 1000,
- PatchDeleteThreshold: 0.5,
- PatchMargin: 4,
- MatchMaxBits: 32,
- }
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/match.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/match.go
deleted file mode 100644
index 17374e10..00000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/match.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "math"
-)
-
-// MatchMain locates the best instance of 'pattern' in 'text' near 'loc'.
-// Returns -1 if no match found.
-func (dmp *DiffMatchPatch) MatchMain(text, pattern string, loc int) int {
- // Check for null inputs not needed since null can't be passed in C#.
-
- loc = int(math.Max(0, math.Min(float64(loc), float64(len(text)))))
- if text == pattern {
- // Shortcut (potentially not guaranteed by the algorithm)
- return 0
- } else if len(text) == 0 {
- // Nothing to match.
- return -1
- } else if loc+len(pattern) <= len(text) && text[loc:loc+len(pattern)] == pattern {
- // Perfect match at the perfect spot! (Includes case of null pattern)
- return loc
- }
- // Do a fuzzy compare.
- return dmp.MatchBitap(text, pattern, loc)
-}
-
-// MatchBitap locates the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm.
-// Returns -1 if no match was found.
-func (dmp *DiffMatchPatch) MatchBitap(text, pattern string, loc int) int {
- // Initialise the alphabet.
- s := dmp.MatchAlphabet(pattern)
-
- // Highest score beyond which we give up.
- scoreThreshold := dmp.MatchThreshold
- // Is there a nearby exact match? (speedup)
- bestLoc := indexOf(text, pattern, loc)
- if bestLoc != -1 {
- scoreThreshold = math.Min(dmp.matchBitapScore(0, bestLoc, loc,
- pattern), scoreThreshold)
- // What about in the other direction? (speedup)
- bestLoc = lastIndexOf(text, pattern, loc+len(pattern))
- if bestLoc != -1 {
- scoreThreshold = math.Min(dmp.matchBitapScore(0, bestLoc, loc,
- pattern), scoreThreshold)
- }
- }
-
- // Initialise the bit arrays.
- matchmask := 1 << uint((len(pattern) - 1))
- bestLoc = -1
-
- var binMin, binMid int
- binMax := len(pattern) + len(text)
- lastRd := []int{}
- for d := 0; d < len(pattern); d++ {
- // Scan for the best match; each iteration allows for one more error. Run a binary search to determine how far from 'loc' we can stray at this error level.
- binMin = 0
- binMid = binMax
- for binMin < binMid {
- if dmp.matchBitapScore(d, loc+binMid, loc, pattern) <= scoreThreshold {
- binMin = binMid
- } else {
- binMax = binMid
- }
- binMid = (binMax-binMin)/2 + binMin
- }
- // Use the result from this iteration as the maximum for the next.
- binMax = binMid
- start := int(math.Max(1, float64(loc-binMid+1)))
- finish := int(math.Min(float64(loc+binMid), float64(len(text))) + float64(len(pattern)))
-
- rd := make([]int, finish+2)
- rd[finish+1] = (1 << uint(d)) - 1
-
- for j := finish; j >= start; j-- {
- var charMatch int
- if len(text) <= j-1 {
- // Out of range.
- charMatch = 0
- } else if _, ok := s[text[j-1]]; !ok {
- charMatch = 0
- } else {
- charMatch = s[text[j-1]]
- }
-
- if d == 0 {
- // First pass: exact match.
- rd[j] = ((rd[j+1] << 1) | 1) & charMatch
- } else {
- // Subsequent passes: fuzzy match.
- rd[j] = ((rd[j+1]<<1)|1)&charMatch | (((lastRd[j+1] | lastRd[j]) << 1) | 1) | lastRd[j+1]
- }
- if (rd[j] & matchmask) != 0 {
- score := dmp.matchBitapScore(d, j-1, loc, pattern)
- // This match will almost certainly be better than any existing match. But check anyway.
- if score <= scoreThreshold {
- // Told you so.
- scoreThreshold = score
- bestLoc = j - 1
- if bestLoc > loc {
- // When passing loc, don't exceed our current distance from loc.
- start = int(math.Max(1, float64(2*loc-bestLoc)))
- } else {
- // Already passed loc, downhill from here on in.
- break
- }
- }
- }
- }
- if dmp.matchBitapScore(d+1, loc, loc, pattern) > scoreThreshold {
- // No hope for a (better) match at greater error levels.
- break
- }
- lastRd = rd
- }
- return bestLoc
-}
-
-// matchBitapScore computes and returns the score for a match with e errors and x location.
-func (dmp *DiffMatchPatch) matchBitapScore(e, x, loc int, pattern string) float64 {
- accuracy := float64(e) / float64(len(pattern))
- proximity := math.Abs(float64(loc - x))
- if dmp.MatchDistance == 0 {
- // Dodge divide by zero error.
- if proximity == 0 {
- return accuracy
- }
-
- return 1.0
- }
- return accuracy + (proximity / float64(dmp.MatchDistance))
-}
-
-// MatchAlphabet initialises the alphabet for the Bitap algorithm.
-func (dmp *DiffMatchPatch) MatchAlphabet(pattern string) map[byte]int {
- s := map[byte]int{}
- charPattern := []byte(pattern)
- for _, c := range charPattern {
- _, ok := s[c]
- if !ok {
- s[c] = 0
- }
- }
- i := 0
-
- for _, c := range charPattern {
- value := s[c] | int(uint(1)< y {
- return x
- }
- return y
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go
deleted file mode 100644
index 223c43c4..00000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go
+++ /dev/null
@@ -1,556 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "bytes"
- "errors"
- "math"
- "net/url"
- "regexp"
- "strconv"
- "strings"
-)
-
-// Patch represents one patch operation.
-type Patch struct {
- diffs []Diff
- Start1 int
- Start2 int
- Length1 int
- Length2 int
-}
-
-// String emulates GNU diff's format.
-// Header: @@ -382,8 +481,9 @@
-// Indices are printed as 1-based, not 0-based.
-func (p *Patch) String() string {
- var coords1, coords2 string
-
- if p.Length1 == 0 {
- coords1 = strconv.Itoa(p.Start1) + ",0"
- } else if p.Length1 == 1 {
- coords1 = strconv.Itoa(p.Start1 + 1)
- } else {
- coords1 = strconv.Itoa(p.Start1+1) + "," + strconv.Itoa(p.Length1)
- }
-
- if p.Length2 == 0 {
- coords2 = strconv.Itoa(p.Start2) + ",0"
- } else if p.Length2 == 1 {
- coords2 = strconv.Itoa(p.Start2 + 1)
- } else {
- coords2 = strconv.Itoa(p.Start2+1) + "," + strconv.Itoa(p.Length2)
- }
-
- var text bytes.Buffer
- _, _ = text.WriteString("@@ -" + coords1 + " +" + coords2 + " @@\n")
-
- // Escape the body of the patch with %xx notation.
- for _, aDiff := range p.diffs {
- switch aDiff.Type {
- case DiffInsert:
- _, _ = text.WriteString("+")
- case DiffDelete:
- _, _ = text.WriteString("-")
- case DiffEqual:
- _, _ = text.WriteString(" ")
- }
-
- _, _ = text.WriteString(strings.Replace(url.QueryEscape(aDiff.Text), "+", " ", -1))
- _, _ = text.WriteString("\n")
- }
-
- return unescaper.Replace(text.String())
-}
-
-// PatchAddContext increases the context until it is unique, but doesn't let the pattern expand beyond MatchMaxBits.
-func (dmp *DiffMatchPatch) PatchAddContext(patch Patch, text string) Patch {
- if len(text) == 0 {
- return patch
- }
-
- pattern := text[patch.Start2 : patch.Start2+patch.Length1]
- padding := 0
-
- // Look for the first and last matches of pattern in text. If two different matches are found, increase the pattern length.
- for strings.Index(text, pattern) != strings.LastIndex(text, pattern) &&
- len(pattern) < dmp.MatchMaxBits-2*dmp.PatchMargin {
- padding += dmp.PatchMargin
- maxStart := max(0, patch.Start2-padding)
- minEnd := min(len(text), patch.Start2+patch.Length1+padding)
- pattern = text[maxStart:minEnd]
- }
- // Add one chunk for good luck.
- padding += dmp.PatchMargin
-
- // Add the prefix.
- prefix := text[max(0, patch.Start2-padding):patch.Start2]
- if len(prefix) != 0 {
- patch.diffs = append([]Diff{Diff{DiffEqual, prefix}}, patch.diffs...)
- }
- // Add the suffix.
- suffix := text[patch.Start2+patch.Length1 : min(len(text), patch.Start2+patch.Length1+padding)]
- if len(suffix) != 0 {
- patch.diffs = append(patch.diffs, Diff{DiffEqual, suffix})
- }
-
- // Roll back the start points.
- patch.Start1 -= len(prefix)
- patch.Start2 -= len(prefix)
- // Extend the lengths.
- patch.Length1 += len(prefix) + len(suffix)
- patch.Length2 += len(prefix) + len(suffix)
-
- return patch
-}
-
-// PatchMake computes a list of patches.
-func (dmp *DiffMatchPatch) PatchMake(opt ...interface{}) []Patch {
- if len(opt) == 1 {
- diffs, _ := opt[0].([]Diff)
- text1 := dmp.DiffText1(diffs)
- return dmp.PatchMake(text1, diffs)
- } else if len(opt) == 2 {
- text1 := opt[0].(string)
- switch t := opt[1].(type) {
- case string:
- diffs := dmp.DiffMain(text1, t, true)
- if len(diffs) > 2 {
- diffs = dmp.DiffCleanupSemantic(diffs)
- diffs = dmp.DiffCleanupEfficiency(diffs)
- }
- return dmp.PatchMake(text1, diffs)
- case []Diff:
- return dmp.patchMake2(text1, t)
- }
- } else if len(opt) == 3 {
- return dmp.PatchMake(opt[0], opt[2])
- }
- return []Patch{}
-}
-
-// patchMake2 computes a list of patches to turn text1 into text2.
-// text2 is not provided, diffs are the delta between text1 and text2.
-func (dmp *DiffMatchPatch) patchMake2(text1 string, diffs []Diff) []Patch {
- // Check for null inputs not needed since null can't be passed in C#.
- patches := []Patch{}
- if len(diffs) == 0 {
- return patches // Get rid of the null case.
- }
-
- patch := Patch{}
- charCount1 := 0 // Number of characters into the text1 string.
- charCount2 := 0 // Number of characters into the text2 string.
- // Start with text1 (prepatchText) and apply the diffs until we arrive at text2 (postpatchText). We recreate the patches one by one to determine context info.
- prepatchText := text1
- postpatchText := text1
-
- for i, aDiff := range diffs {
- if len(patch.diffs) == 0 && aDiff.Type != DiffEqual {
- // A new patch starts here.
- patch.Start1 = charCount1
- patch.Start2 = charCount2
- }
-
- switch aDiff.Type {
- case DiffInsert:
- patch.diffs = append(patch.diffs, aDiff)
- patch.Length2 += len(aDiff.Text)
- postpatchText = postpatchText[:charCount2] +
- aDiff.Text + postpatchText[charCount2:]
- case DiffDelete:
- patch.Length1 += len(aDiff.Text)
- patch.diffs = append(patch.diffs, aDiff)
- postpatchText = postpatchText[:charCount2] + postpatchText[charCount2+len(aDiff.Text):]
- case DiffEqual:
- if len(aDiff.Text) <= 2*dmp.PatchMargin &&
- len(patch.diffs) != 0 && i != len(diffs)-1 {
- // Small equality inside a patch.
- patch.diffs = append(patch.diffs, aDiff)
- patch.Length1 += len(aDiff.Text)
- patch.Length2 += len(aDiff.Text)
- }
- if len(aDiff.Text) >= 2*dmp.PatchMargin {
- // Time for a new patch.
- if len(patch.diffs) != 0 {
- patch = dmp.PatchAddContext(patch, prepatchText)
- patches = append(patches, patch)
- patch = Patch{}
- // Unlike Unidiff, our patch lists have a rolling context. http://code.google.com/p/google-diff-match-patch/wiki/Unidiff Update prepatch text & pos to reflect the application of the just completed patch.
- prepatchText = postpatchText
- charCount1 = charCount2
- }
- }
- }
-
- // Update the current character count.
- if aDiff.Type != DiffInsert {
- charCount1 += len(aDiff.Text)
- }
- if aDiff.Type != DiffDelete {
- charCount2 += len(aDiff.Text)
- }
- }
-
- // Pick up the leftover patch if not empty.
- if len(patch.diffs) != 0 {
- patch = dmp.PatchAddContext(patch, prepatchText)
- patches = append(patches, patch)
- }
-
- return patches
-}
-
-// PatchDeepCopy returns an array that is identical to a given an array of patches.
-func (dmp *DiffMatchPatch) PatchDeepCopy(patches []Patch) []Patch {
- patchesCopy := []Patch{}
- for _, aPatch := range patches {
- patchCopy := Patch{}
- for _, aDiff := range aPatch.diffs {
- patchCopy.diffs = append(patchCopy.diffs, Diff{
- aDiff.Type,
- aDiff.Text,
- })
- }
- patchCopy.Start1 = aPatch.Start1
- patchCopy.Start2 = aPatch.Start2
- patchCopy.Length1 = aPatch.Length1
- patchCopy.Length2 = aPatch.Length2
- patchesCopy = append(patchesCopy, patchCopy)
- }
- return patchesCopy
-}
-
-// PatchApply merges a set of patches onto the text. Returns a patched text, as well as an array of true/false values indicating which patches were applied.
-func (dmp *DiffMatchPatch) PatchApply(patches []Patch, text string) (string, []bool) {
- if len(patches) == 0 {
- return text, []bool{}
- }
-
- // Deep copy the patches so that no changes are made to originals.
- patches = dmp.PatchDeepCopy(patches)
-
- nullPadding := dmp.PatchAddPadding(patches)
- text = nullPadding + text + nullPadding
- patches = dmp.PatchSplitMax(patches)
-
- x := 0
- // delta keeps track of the offset between the expected and actual location of the previous patch. If there are patches expected at positions 10 and 20, but the first patch was found at 12, delta is 2 and the second patch has an effective expected position of 22.
- delta := 0
- results := make([]bool, len(patches))
- for _, aPatch := range patches {
- expectedLoc := aPatch.Start2 + delta
- text1 := dmp.DiffText1(aPatch.diffs)
- var startLoc int
- endLoc := -1
- if len(text1) > dmp.MatchMaxBits {
- // PatchSplitMax will only provide an oversized pattern in the case of a monster delete.
- startLoc = dmp.MatchMain(text, text1[:dmp.MatchMaxBits], expectedLoc)
- if startLoc != -1 {
- endLoc = dmp.MatchMain(text,
- text1[len(text1)-dmp.MatchMaxBits:], expectedLoc+len(text1)-dmp.MatchMaxBits)
- if endLoc == -1 || startLoc >= endLoc {
- // Can't find valid trailing context. Drop this patch.
- startLoc = -1
- }
- }
- } else {
- startLoc = dmp.MatchMain(text, text1, expectedLoc)
- }
- if startLoc == -1 {
- // No match found. :(
- results[x] = false
- // Subtract the delta for this failed patch from subsequent patches.
- delta -= aPatch.Length2 - aPatch.Length1
- } else {
- // Found a match. :)
- results[x] = true
- delta = startLoc - expectedLoc
- var text2 string
- if endLoc == -1 {
- text2 = text[startLoc:int(math.Min(float64(startLoc+len(text1)), float64(len(text))))]
- } else {
- text2 = text[startLoc:int(math.Min(float64(endLoc+dmp.MatchMaxBits), float64(len(text))))]
- }
- if text1 == text2 {
- // Perfect match, just shove the Replacement text in.
- text = text[:startLoc] + dmp.DiffText2(aPatch.diffs) + text[startLoc+len(text1):]
- } else {
- // Imperfect match. Run a diff to get a framework of equivalent indices.
- diffs := dmp.DiffMain(text1, text2, false)
- if len(text1) > dmp.MatchMaxBits && float64(dmp.DiffLevenshtein(diffs))/float64(len(text1)) > dmp.PatchDeleteThreshold {
- // The end points match, but the content is unacceptably bad.
- results[x] = false
- } else {
- diffs = dmp.DiffCleanupSemanticLossless(diffs)
- index1 := 0
- for _, aDiff := range aPatch.diffs {
- if aDiff.Type != DiffEqual {
- index2 := dmp.DiffXIndex(diffs, index1)
- if aDiff.Type == DiffInsert {
- // Insertion
- text = text[:startLoc+index2] + aDiff.Text + text[startLoc+index2:]
- } else if aDiff.Type == DiffDelete {
- // Deletion
- startIndex := startLoc + index2
- text = text[:startIndex] +
- text[startIndex+dmp.DiffXIndex(diffs, index1+len(aDiff.Text))-index2:]
- }
- }
- if aDiff.Type != DiffDelete {
- index1 += len(aDiff.Text)
- }
- }
- }
- }
- }
- x++
- }
- // Strip the padding off.
- text = text[len(nullPadding) : len(nullPadding)+(len(text)-2*len(nullPadding))]
- return text, results
-}
-
-// PatchAddPadding adds some padding on text start and end so that edges can match something.
-// Intended to be called only from within patchApply.
-func (dmp *DiffMatchPatch) PatchAddPadding(patches []Patch) string {
- paddingLength := dmp.PatchMargin
- nullPadding := ""
- for x := 1; x <= paddingLength; x++ {
- nullPadding += string(x)
- }
-
- // Bump all the patches forward.
- for i := range patches {
- patches[i].Start1 += paddingLength
- patches[i].Start2 += paddingLength
- }
-
- // Add some padding on start of first diff.
- if len(patches[0].diffs) == 0 || patches[0].diffs[0].Type != DiffEqual {
- // Add nullPadding equality.
- patches[0].diffs = append([]Diff{Diff{DiffEqual, nullPadding}}, patches[0].diffs...)
- patches[0].Start1 -= paddingLength // Should be 0.
- patches[0].Start2 -= paddingLength // Should be 0.
- patches[0].Length1 += paddingLength
- patches[0].Length2 += paddingLength
- } else if paddingLength > len(patches[0].diffs[0].Text) {
- // Grow first equality.
- extraLength := paddingLength - len(patches[0].diffs[0].Text)
- patches[0].diffs[0].Text = nullPadding[len(patches[0].diffs[0].Text):] + patches[0].diffs[0].Text
- patches[0].Start1 -= extraLength
- patches[0].Start2 -= extraLength
- patches[0].Length1 += extraLength
- patches[0].Length2 += extraLength
- }
-
- // Add some padding on end of last diff.
- last := len(patches) - 1
- if len(patches[last].diffs) == 0 || patches[last].diffs[len(patches[last].diffs)-1].Type != DiffEqual {
- // Add nullPadding equality.
- patches[last].diffs = append(patches[last].diffs, Diff{DiffEqual, nullPadding})
- patches[last].Length1 += paddingLength
- patches[last].Length2 += paddingLength
- } else if paddingLength > len(patches[last].diffs[len(patches[last].diffs)-1].Text) {
- // Grow last equality.
- lastDiff := patches[last].diffs[len(patches[last].diffs)-1]
- extraLength := paddingLength - len(lastDiff.Text)
- patches[last].diffs[len(patches[last].diffs)-1].Text += nullPadding[:extraLength]
- patches[last].Length1 += extraLength
- patches[last].Length2 += extraLength
- }
-
- return nullPadding
-}
-
-// PatchSplitMax looks through the patches and breaks up any which are longer than the maximum limit of the match algorithm.
-// Intended to be called only from within patchApply.
-func (dmp *DiffMatchPatch) PatchSplitMax(patches []Patch) []Patch {
- patchSize := dmp.MatchMaxBits
- for x := 0; x < len(patches); x++ {
- if patches[x].Length1 <= patchSize {
- continue
- }
- bigpatch := patches[x]
- // Remove the big old patch.
- patches = append(patches[:x], patches[x+1:]...)
- x--
-
- Start1 := bigpatch.Start1
- Start2 := bigpatch.Start2
- precontext := ""
- for len(bigpatch.diffs) != 0 {
- // Create one of several smaller patches.
- patch := Patch{}
- empty := true
- patch.Start1 = Start1 - len(precontext)
- patch.Start2 = Start2 - len(precontext)
- if len(precontext) != 0 {
- patch.Length1 = len(precontext)
- patch.Length2 = len(precontext)
- patch.diffs = append(patch.diffs, Diff{DiffEqual, precontext})
- }
- for len(bigpatch.diffs) != 0 && patch.Length1 < patchSize-dmp.PatchMargin {
- diffType := bigpatch.diffs[0].Type
- diffText := bigpatch.diffs[0].Text
- if diffType == DiffInsert {
- // Insertions are harmless.
- patch.Length2 += len(diffText)
- Start2 += len(diffText)
- patch.diffs = append(patch.diffs, bigpatch.diffs[0])
- bigpatch.diffs = bigpatch.diffs[1:]
- empty = false
- } else if diffType == DiffDelete && len(patch.diffs) == 1 && patch.diffs[0].Type == DiffEqual && len(diffText) > 2*patchSize {
- // This is a large deletion. Let it pass in one chunk.
- patch.Length1 += len(diffText)
- Start1 += len(diffText)
- empty = false
- patch.diffs = append(patch.diffs, Diff{diffType, diffText})
- bigpatch.diffs = bigpatch.diffs[1:]
- } else {
- // Deletion or equality. Only take as much as we can stomach.
- diffText = diffText[:min(len(diffText), patchSize-patch.Length1-dmp.PatchMargin)]
-
- patch.Length1 += len(diffText)
- Start1 += len(diffText)
- if diffType == DiffEqual {
- patch.Length2 += len(diffText)
- Start2 += len(diffText)
- } else {
- empty = false
- }
- patch.diffs = append(patch.diffs, Diff{diffType, diffText})
- if diffText == bigpatch.diffs[0].Text {
- bigpatch.diffs = bigpatch.diffs[1:]
- } else {
- bigpatch.diffs[0].Text =
- bigpatch.diffs[0].Text[len(diffText):]
- }
- }
- }
- // Compute the head context for the next patch.
- precontext = dmp.DiffText2(patch.diffs)
- precontext = precontext[max(0, len(precontext)-dmp.PatchMargin):]
-
- postcontext := ""
- // Append the end context for this patch.
- if len(dmp.DiffText1(bigpatch.diffs)) > dmp.PatchMargin {
- postcontext = dmp.DiffText1(bigpatch.diffs)[:dmp.PatchMargin]
- } else {
- postcontext = dmp.DiffText1(bigpatch.diffs)
- }
-
- if len(postcontext) != 0 {
- patch.Length1 += len(postcontext)
- patch.Length2 += len(postcontext)
- if len(patch.diffs) != 0 && patch.diffs[len(patch.diffs)-1].Type == DiffEqual {
- patch.diffs[len(patch.diffs)-1].Text += postcontext
- } else {
- patch.diffs = append(patch.diffs, Diff{DiffEqual, postcontext})
- }
- }
- if !empty {
- x++
- patches = append(patches[:x], append([]Patch{patch}, patches[x:]...)...)
- }
- }
- }
- return patches
-}
-
-// PatchToText takes a list of patches and returns a textual representation.
-func (dmp *DiffMatchPatch) PatchToText(patches []Patch) string {
- var text bytes.Buffer
- for _, aPatch := range patches {
- _, _ = text.WriteString(aPatch.String())
- }
- return text.String()
-}
-
-// PatchFromText parses a textual representation of patches and returns a List of Patch objects.
-func (dmp *DiffMatchPatch) PatchFromText(textline string) ([]Patch, error) {
- patches := []Patch{}
- if len(textline) == 0 {
- return patches, nil
- }
- text := strings.Split(textline, "\n")
- textPointer := 0
- patchHeader := regexp.MustCompile("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$")
-
- var patch Patch
- var sign uint8
- var line string
- for textPointer < len(text) {
-
- if !patchHeader.MatchString(text[textPointer]) {
- return patches, errors.New("Invalid patch string: " + text[textPointer])
- }
-
- patch = Patch{}
- m := patchHeader.FindStringSubmatch(text[textPointer])
-
- patch.Start1, _ = strconv.Atoi(m[1])
- if len(m[2]) == 0 {
- patch.Start1--
- patch.Length1 = 1
- } else if m[2] == "0" {
- patch.Length1 = 0
- } else {
- patch.Start1--
- patch.Length1, _ = strconv.Atoi(m[2])
- }
-
- patch.Start2, _ = strconv.Atoi(m[3])
-
- if len(m[4]) == 0 {
- patch.Start2--
- patch.Length2 = 1
- } else if m[4] == "0" {
- patch.Length2 = 0
- } else {
- patch.Start2--
- patch.Length2, _ = strconv.Atoi(m[4])
- }
- textPointer++
-
- for textPointer < len(text) {
- if len(text[textPointer]) > 0 {
- sign = text[textPointer][0]
- } else {
- textPointer++
- continue
- }
-
- line = text[textPointer][1:]
- line = strings.Replace(line, "+", "%2b", -1)
- line, _ = url.QueryUnescape(line)
- if sign == '-' {
- // Deletion.
- patch.diffs = append(patch.diffs, Diff{DiffDelete, line})
- } else if sign == '+' {
- // Insertion.
- patch.diffs = append(patch.diffs, Diff{DiffInsert, line})
- } else if sign == ' ' {
- // Minor equality.
- patch.diffs = append(patch.diffs, Diff{DiffEqual, line})
- } else if sign == '@' {
- // Start of next patch.
- break
- } else {
- // WTF?
- return patches, errors.New("Invalid patch mode '" + string(sign) + "' in: " + string(line))
- }
- textPointer++
- }
-
- patches = append(patches, patch)
- }
- return patches, nil
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/stringutil.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/stringutil.go
deleted file mode 100644
index 265f29cc..00000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/stringutil.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "strings"
- "unicode/utf8"
-)
-
-// unescaper unescapes selected chars for compatibility with JavaScript's encodeURI.
-// In speed critical applications this could be dropped since the receiving application will certainly decode these fine. Note that this function is case-sensitive. Thus "%3F" would not be unescaped. But this is ok because it is only called with the output of HttpUtility.UrlEncode which returns lowercase hex. Example: "%3f" -> "?", "%24" -> "$", etc.
-var unescaper = strings.NewReplacer(
- "%21", "!", "%7E", "~", "%27", "'",
- "%28", "(", "%29", ")", "%3B", ";",
- "%2F", "/", "%3F", "?", "%3A", ":",
- "%40", "@", "%26", "&", "%3D", "=",
- "%2B", "+", "%24", "$", "%2C", ",", "%23", "#", "%2A", "*")
-
-// indexOf returns the first index of pattern in str, starting at str[i].
-func indexOf(str string, pattern string, i int) int {
- if i > len(str)-1 {
- return -1
- }
- if i <= 0 {
- return strings.Index(str, pattern)
- }
- ind := strings.Index(str[i:], pattern)
- if ind == -1 {
- return -1
- }
- return ind + i
-}
-
-// lastIndexOf returns the last index of pattern in str, starting at str[i].
-func lastIndexOf(str string, pattern string, i int) int {
- if i < 0 {
- return -1
- }
- if i >= len(str) {
- return strings.LastIndex(str, pattern)
- }
- _, size := utf8.DecodeRuneInString(str[i:])
- return strings.LastIndex(str[:i+size], pattern)
-}
-
-// runesIndexOf returns the index of pattern in target, starting at target[i].
-func runesIndexOf(target, pattern []rune, i int) int {
- if i > len(target)-1 {
- return -1
- }
- if i <= 0 {
- return runesIndex(target, pattern)
- }
- ind := runesIndex(target[i:], pattern)
- if ind == -1 {
- return -1
- }
- return ind + i
-}
-
-func runesEqual(r1, r2 []rune) bool {
- if len(r1) != len(r2) {
- return false
- }
- for i, c := range r1 {
- if c != r2[i] {
- return false
- }
- }
- return true
-}
-
-// runesIndex is the equivalent of strings.Index for rune slices.
-func runesIndex(r1, r2 []rune) int {
- last := len(r1) - len(r2)
- for i := 0; i <= last; i++ {
- if runesEqual(r1[i:i+len(r2)], r2) {
- return i
- }
- }
- return -1
-}
diff --git a/vendor/github.com/sirupsen/logrus/.gitignore b/vendor/github.com/sirupsen/logrus/.gitignore
deleted file mode 100644
index 66be63a0..00000000
--- a/vendor/github.com/sirupsen/logrus/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-logrus
diff --git a/vendor/github.com/sirupsen/logrus/.travis.yml b/vendor/github.com/sirupsen/logrus/.travis.yml
deleted file mode 100644
index 2f19b4a7..00000000
--- a/vendor/github.com/sirupsen/logrus/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: go
-go:
- - 1.9.x
- - 1.10.x
-env:
- - GOMAXPROCS=4 GORACE=halt_on_error=1
-install:
- - go get github.com/stretchr/testify/assert
- - go get gopkg.in/gemnasium/logrus-airbrake-hook.v2
- - go get golang.org/x/sys/unix
- - go get golang.org/x/sys/windows
-script:
- - go test -race -v ./...
diff --git a/vendor/github.com/sirupsen/logrus/CHANGELOG.md b/vendor/github.com/sirupsen/logrus/CHANGELOG.md
deleted file mode 100644
index 1bd1deb2..00000000
--- a/vendor/github.com/sirupsen/logrus/CHANGELOG.md
+++ /dev/null
@@ -1,123 +0,0 @@
-# 1.0.5
-
-* Fix hooks race (#707)
-* Fix panic deadlock (#695)
-
-# 1.0.4
-
-* Fix race when adding hooks (#612)
-* Fix terminal check in AppEngine (#635)
-
-# 1.0.3
-
-* Replace example files with testable examples
-
-# 1.0.2
-
-* bug: quote non-string values in text formatter (#583)
-* Make (*Logger) SetLevel a public method
-
-# 1.0.1
-
-* bug: fix escaping in text formatter (#575)
-
-# 1.0.0
-
-* Officially changed name to lower-case
-* bug: colors on Windows 10 (#541)
-* bug: fix race in accessing level (#512)
-
-# 0.11.5
-
-* feature: add writer and writerlevel to entry (#372)
-
-# 0.11.4
-
-* bug: fix undefined variable on solaris (#493)
-
-# 0.11.3
-
-* formatter: configure quoting of empty values (#484)
-* formatter: configure quoting character (default is `"`) (#484)
-* bug: fix not importing io correctly in non-linux environments (#481)
-
-# 0.11.2
-
-* bug: fix windows terminal detection (#476)
-
-# 0.11.1
-
-* bug: fix tty detection with custom out (#471)
-
-# 0.11.0
-
-* performance: Use bufferpool to allocate (#370)
-* terminal: terminal detection for app-engine (#343)
-* feature: exit handler (#375)
-
-# 0.10.0
-
-* feature: Add a test hook (#180)
-* feature: `ParseLevel` is now case-insensitive (#326)
-* feature: `FieldLogger` interface that generalizes `Logger` and `Entry` (#308)
-* performance: avoid re-allocations on `WithFields` (#335)
-
-# 0.9.0
-
-* logrus/text_formatter: don't emit empty msg
-* logrus/hooks/airbrake: move out of main repository
-* logrus/hooks/sentry: move out of main repository
-* logrus/hooks/papertrail: move out of main repository
-* logrus/hooks/bugsnag: move out of main repository
-* logrus/core: run tests with `-race`
-* logrus/core: detect TTY based on `stderr`
-* logrus/core: support `WithError` on logger
-* logrus/core: Solaris support
-
-# 0.8.7
-
-* logrus/core: fix possible race (#216)
-* logrus/doc: small typo fixes and doc improvements
-
-
-# 0.8.6
-
-* hooks/raven: allow passing an initialized client
-
-# 0.8.5
-
-* logrus/core: revert #208
-
-# 0.8.4
-
-* formatter/text: fix data race (#218)
-
-# 0.8.3
-
-* logrus/core: fix entry log level (#208)
-* logrus/core: improve performance of text formatter by 40%
-* logrus/core: expose `LevelHooks` type
-* logrus/core: add support for DragonflyBSD and NetBSD
-* formatter/text: print structs more verbosely
-
-# 0.8.2
-
-* logrus: fix more Fatal family functions
-
-# 0.8.1
-
-* logrus: fix not exiting on `Fatalf` and `Fatalln`
-
-# 0.8.0
-
-* logrus: defaults to stderr instead of stdout
-* hooks/sentry: add special field for `*http.Request`
-* formatter/text: ignore Windows for colors
-
-# 0.7.3
-
-* formatter/\*: allow configuration of timestamp layout
-
-# 0.7.2
-
-* formatter/text: Add configuration option for time format (#158)
diff --git a/vendor/github.com/sirupsen/logrus/LICENSE b/vendor/github.com/sirupsen/logrus/LICENSE
deleted file mode 100644
index f090cb42..00000000
--- a/vendor/github.com/sirupsen/logrus/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Simon Eskildsen
-
-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.
diff --git a/vendor/github.com/sirupsen/logrus/README.md b/vendor/github.com/sirupsen/logrus/README.md
deleted file mode 100644
index 072e99be..00000000
--- a/vendor/github.com/sirupsen/logrus/README.md
+++ /dev/null
@@ -1,461 +0,0 @@
-# Logrus
[](https://travis-ci.org/sirupsen/logrus) [](https://godoc.org/github.com/sirupsen/logrus)
-
-Logrus is a structured logger for Go (golang), completely API compatible with
-the standard library logger.
-
-**Seeing weird case-sensitive problems?** It's in the past been possible to
-import Logrus as both upper- and lower-case. Due to the Go package environment,
-this caused issues in the community and we needed a standard. Some environments
-experienced problems with the upper-case variant, so the lower-case was decided.
-Everything using `logrus` will need to use the lower-case:
-`github.com/sirupsen/logrus`. Any package that isn't, should be changed.
-
-To fix Glide, see [these
-comments](https://github.com/sirupsen/logrus/issues/553#issuecomment-306591437).
-For an in-depth explanation of the casing issue, see [this
-comment](https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276).
-
-**Are you interested in assisting in maintaining Logrus?** Currently I have a
-lot of obligations, and I am unable to provide Logrus with the maintainership it
-needs. If you'd like to help, please reach out to me at `simon at author's
-username dot com`.
-
-Nicely color-coded in development (when a TTY is attached, otherwise just
-plain text):
-
-
-
-With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash
-or Splunk:
-
-```json
-{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the
-ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"}
-
-{"level":"warning","msg":"The group's number increased tremendously!",
-"number":122,"omg":true,"time":"2014-03-10 19:57:38.562471297 -0400 EDT"}
-
-{"animal":"walrus","level":"info","msg":"A giant walrus appears!",
-"size":10,"time":"2014-03-10 19:57:38.562500591 -0400 EDT"}
-
-{"animal":"walrus","level":"info","msg":"Tremendously sized cow enters the ocean.",
-"size":9,"time":"2014-03-10 19:57:38.562527896 -0400 EDT"}
-
-{"level":"fatal","msg":"The ice breaks!","number":100,"omg":true,
-"time":"2014-03-10 19:57:38.562543128 -0400 EDT"}
-```
-
-With the default `log.SetFormatter(&log.TextFormatter{})` when a TTY is not
-attached, the output is compatible with the
-[logfmt](http://godoc.org/github.com/kr/logfmt) format:
-
-```text
-time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8
-time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10
-time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true
-time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4
-time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009
-time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true
-exit status 1
-```
-
-#### Case-sensitivity
-
-The organization's name was changed to lower-case--and this will not be changed
-back. If you are getting import conflicts due to case sensitivity, please use
-the lower-case import: `github.com/sirupsen/logrus`.
-
-#### Example
-
-The simplest way to use Logrus is simply the package-level exported logger:
-
-```go
-package main
-
-import (
- log "github.com/sirupsen/logrus"
-)
-
-func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- }).Info("A walrus appears")
-}
-```
-
-Note that it's completely api-compatible with the stdlib logger, so you can
-replace your `log` imports everywhere with `log "github.com/sirupsen/logrus"`
-and you'll now have the flexibility of Logrus. You can customize it all you
-want:
-
-```go
-package main
-
-import (
- "os"
- log "github.com/sirupsen/logrus"
-)
-
-func init() {
- // Log as JSON instead of the default ASCII formatter.
- log.SetFormatter(&log.JSONFormatter{})
-
- // Output to stdout instead of the default stderr
- // Can be any io.Writer, see below for File example
- log.SetOutput(os.Stdout)
-
- // Only log the warning severity or above.
- log.SetLevel(log.WarnLevel)
-}
-
-func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- "size": 10,
- }).Info("A group of walrus emerges from the ocean")
-
- log.WithFields(log.Fields{
- "omg": true,
- "number": 122,
- }).Warn("The group's number increased tremendously!")
-
- log.WithFields(log.Fields{
- "omg": true,
- "number": 100,
- }).Fatal("The ice breaks!")
-
- // A common pattern is to re-use fields between logging statements by re-using
- // the logrus.Entry returned from WithFields()
- contextLogger := log.WithFields(log.Fields{
- "common": "this is a common field",
- "other": "I also should be logged always",
- })
-
- contextLogger.Info("I'll be logged with common and other field")
- contextLogger.Info("Me too")
-}
-```
-
-For more advanced usage such as logging to multiple locations from the same
-application, you can also create an instance of the `logrus` Logger:
-
-```go
-package main
-
-import (
- "os"
- "github.com/sirupsen/logrus"
-)
-
-// Create a new instance of the logger. You can have any number of instances.
-var log = logrus.New()
-
-func main() {
- // The API for setting attributes is a little different than the package level
- // exported logger. See Godoc.
- log.Out = os.Stdout
-
- // You could set this to any `io.Writer` such as a file
- // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666)
- // if err == nil {
- // log.Out = file
- // } else {
- // log.Info("Failed to log to file, using default stderr")
- // }
-
- log.WithFields(logrus.Fields{
- "animal": "walrus",
- "size": 10,
- }).Info("A group of walrus emerges from the ocean")
-}
-```
-
-#### Fields
-
-Logrus encourages careful, structured logging through logging fields instead of
-long, unparseable error messages. For example, instead of: `log.Fatalf("Failed
-to send event %s to topic %s with key %d")`, you should log the much more
-discoverable:
-
-```go
-log.WithFields(log.Fields{
- "event": event,
- "topic": topic,
- "key": key,
-}).Fatal("Failed to send event")
-```
-
-We've found this API forces you to think about logging in a way that produces
-much more useful logging messages. We've been in countless situations where just
-a single added field to a log statement that was already there would've saved us
-hours. The `WithFields` call is optional.
-
-In general, with Logrus using any of the `printf`-family functions should be
-seen as a hint you should add a field, however, you can still use the
-`printf`-family functions with Logrus.
-
-#### Default Fields
-
-Often it's helpful to have fields _always_ attached to log statements in an
-application or parts of one. For example, you may want to always log the
-`request_id` and `user_ip` in the context of a request. Instead of writing
-`log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})` on
-every line, you can create a `logrus.Entry` to pass around instead:
-
-```go
-requestLogger := log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})
-requestLogger.Info("something happened on that request") # will log request_id and user_ip
-requestLogger.Warn("something not great happened")
-```
-
-#### Hooks
-
-You can add hooks for logging levels. For example to send errors to an exception
-tracking service on `Error`, `Fatal` and `Panic`, info to StatsD or log to
-multiple places simultaneously, e.g. syslog.
-
-Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in
-`init`:
-
-```go
-import (
- log "github.com/sirupsen/logrus"
- "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "airbrake"
- logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
- "log/syslog"
-)
-
-func init() {
-
- // Use the Airbrake hook to report errors that have Error severity or above to
- // an exception tracker. You can create custom hooks, see the Hooks section.
- log.AddHook(airbrake.NewHook(123, "xyz", "production"))
-
- hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
- if err != nil {
- log.Error("Unable to connect to local syslog daemon")
- } else {
- log.AddHook(hook)
- }
-}
-```
-Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md).
-
-A list of currently known of service hook can be found in this wiki [page](https://github.com/sirupsen/logrus/wiki/Hooks)
-
-
-#### Level logging
-
-Logrus has six logging levels: Debug, Info, Warning, Error, Fatal and Panic.
-
-```go
-log.Debug("Useful debugging information.")
-log.Info("Something noteworthy happened!")
-log.Warn("You should probably take a look at this.")
-log.Error("Something failed but I'm not quitting.")
-// Calls os.Exit(1) after logging
-log.Fatal("Bye.")
-// Calls panic() after logging
-log.Panic("I'm bailing.")
-```
-
-You can set the logging level on a `Logger`, then it will only log entries with
-that severity or anything above it:
-
-```go
-// Will log anything that is info or above (warn, error, fatal, panic). Default.
-log.SetLevel(log.InfoLevel)
-```
-
-It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose
-environment if your application has that.
-
-#### Entries
-
-Besides the fields added with `WithField` or `WithFields` some fields are
-automatically added to all logging events:
-
-1. `time`. The timestamp when the entry was created.
-2. `msg`. The logging message passed to `{Info,Warn,Error,Fatal,Panic}` after
- the `AddFields` call. E.g. `Failed to send event.`
-3. `level`. The logging level. E.g. `info`.
-
-#### Environments
-
-Logrus has no notion of environment.
-
-If you wish for hooks and formatters to only be used in specific environments,
-you should handle that yourself. For example, if your application has a global
-variable `Environment`, which is a string representation of the environment you
-could do:
-
-```go
-import (
- log "github.com/sirupsen/logrus"
-)
-
-init() {
- // do something here to set environment depending on an environment variable
- // or command-line flag
- if Environment == "production" {
- log.SetFormatter(&log.JSONFormatter{})
- } else {
- // The TextFormatter is default, you don't actually have to do this.
- log.SetFormatter(&log.TextFormatter{})
- }
-}
-```
-
-This configuration is how `logrus` was intended to be used, but JSON in
-production is mostly only useful if you do log aggregation with tools like
-Splunk or Logstash.
-
-#### Formatters
-
-The built-in logging formatters are:
-
-* `logrus.TextFormatter`. Logs the event in colors if stdout is a tty, otherwise
- without colors.
- * *Note:* to force colored output when there is no TTY, set the `ForceColors`
- field to `true`. To force no colored output even if there is a TTY set the
- `DisableColors` field to `true`. For Windows, see
- [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable).
- * When colors are enabled, levels are truncated to 4 characters by default. To disable
- truncation set the `DisableLevelTruncation` field to `true`.
- * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#TextFormatter).
-* `logrus.JSONFormatter`. Logs fields as JSON.
- * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#JSONFormatter).
-
-Third party logging formatters:
-
-* [`FluentdFormatter`](https://github.com/joonix/log). Formats entries that can be parsed by Kubernetes and Google Container Engine.
-* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events.
-* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout.
-* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦.
-
-You can define your formatter by implementing the `Formatter` interface,
-requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a
-`Fields` type (`map[string]interface{}`) with all your fields as well as the
-default ones (see Entries section above):
-
-```go
-type MyJSONFormatter struct {
-}
-
-log.SetFormatter(new(MyJSONFormatter))
-
-func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) {
- // Note this doesn't include Time, Level and Message which are available on
- // the Entry. Consult `godoc` on information about those fields or read the
- // source of the official loggers.
- serialized, err := json.Marshal(entry.Data)
- if err != nil {
- return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
- }
- return append(serialized, '\n'), nil
-}
-```
-
-#### Logger as an `io.Writer`
-
-Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it.
-
-```go
-w := logger.Writer()
-defer w.Close()
-
-srv := http.Server{
- // create a stdlib log.Logger that writes to
- // logrus.Logger.
- ErrorLog: log.New(w, "", 0),
-}
-```
-
-Each line written to that writer will be printed the usual way, using formatters
-and hooks. The level for those entries is `info`.
-
-This means that we can override the standard library logger easily:
-
-```go
-logger := logrus.New()
-logger.Formatter = &logrus.JSONFormatter{}
-
-// Use logrus for standard log output
-// Note that `log` here references stdlib's log
-// Not logrus imported under the name `log`.
-log.SetOutput(logger.Writer())
-```
-
-#### Rotation
-
-Log rotation is not provided with Logrus. Log rotation should be done by an
-external program (like `logrotate(8)`) that can compress and delete old log
-entries. It should not be a feature of the application-level logger.
-
-#### Tools
-
-| Tool | Description |
-| ---- | ----------- |
-|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.|
-|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper around Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) |
-
-#### Testing
-
-Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides:
-
-* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook
-* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any):
-
-```go
-import(
- "github.com/sirupsen/logrus"
- "github.com/sirupsen/logrus/hooks/test"
- "github.com/stretchr/testify/assert"
- "testing"
-)
-
-func TestSomething(t*testing.T){
- logger, hook := test.NewNullLogger()
- logger.Error("Helloerror")
-
- assert.Equal(t, 1, len(hook.Entries))
- assert.Equal(t, logrus.ErrorLevel, hook.LastEntry().Level)
- assert.Equal(t, "Helloerror", hook.LastEntry().Message)
-
- hook.Reset()
- assert.Nil(t, hook.LastEntry())
-}
-```
-
-#### Fatal handlers
-
-Logrus can register one or more functions that will be called when any `fatal`
-level message is logged. The registered handlers will be executed before
-logrus performs a `os.Exit(1)`. This behavior may be helpful if callers need
-to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted.
-
-```
-...
-handler := func() {
- // gracefully shutdown something...
-}
-logrus.RegisterExitHandler(handler)
-...
-```
-
-#### Thread safety
-
-By default, Logger is protected by a mutex for concurrent writes. The mutex is held when calling hooks and writing logs.
-If you are sure such locking is not needed, you can call logger.SetNoLock() to disable the locking.
-
-Situation when locking is not needed includes:
-
-* You have no hooks registered, or hooks calling is already thread-safe.
-
-* Writing to logger.Out is already thread-safe, for example:
-
- 1) logger.Out is protected by locks.
-
- 2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing)
-
- (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/)
diff --git a/vendor/github.com/sirupsen/logrus/alt_exit.go b/vendor/github.com/sirupsen/logrus/alt_exit.go
deleted file mode 100644
index 8af90637..00000000
--- a/vendor/github.com/sirupsen/logrus/alt_exit.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package logrus
-
-// The following code was sourced and modified from the
-// https://github.com/tebeka/atexit package governed by the following license:
-//
-// Copyright (c) 2012 Miki Tebeka .
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy of
-// this software and associated documentation files (the "Software"), to deal in
-// the Software without restriction, including without limitation the rights to
-// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-// the Software, and to permit persons to whom the Software is furnished to do so,
-// subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import (
- "fmt"
- "os"
-)
-
-var handlers = []func(){}
-
-func runHandler(handler func()) {
- defer func() {
- if err := recover(); err != nil {
- fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err)
- }
- }()
-
- handler()
-}
-
-func runHandlers() {
- for _, handler := range handlers {
- runHandler(handler)
- }
-}
-
-// Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code)
-func Exit(code int) {
- runHandlers()
- os.Exit(code)
-}
-
-// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke
-// all handlers. The handlers will also be invoked when any Fatal log entry is
-// made.
-//
-// This method is useful when a caller wishes to use logrus to log a fatal
-// message but also needs to gracefully shutdown. An example usecase could be
-// closing database connections, or sending a alert that the application is
-// closing.
-func RegisterExitHandler(handler func()) {
- handlers = append(handlers, handler)
-}
diff --git a/vendor/github.com/sirupsen/logrus/appveyor.yml b/vendor/github.com/sirupsen/logrus/appveyor.yml
deleted file mode 100644
index 96c2ce15..00000000
--- a/vendor/github.com/sirupsen/logrus/appveyor.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-version: "{build}"
-platform: x64
-clone_folder: c:\gopath\src\github.com\sirupsen\logrus
-environment:
- GOPATH: c:\gopath
-branches:
- only:
- - master
-install:
- - set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
- - go version
-build_script:
- - go get -t
- - go test
diff --git a/vendor/github.com/sirupsen/logrus/doc.go b/vendor/github.com/sirupsen/logrus/doc.go
deleted file mode 100644
index da67aba0..00000000
--- a/vendor/github.com/sirupsen/logrus/doc.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
-
-
-The simplest way to use Logrus is simply the package-level exported logger:
-
- package main
-
- import (
- log "github.com/sirupsen/logrus"
- )
-
- func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- "number": 1,
- "size": 10,
- }).Info("A walrus appears")
- }
-
-Output:
- time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10
-
-For a full guide visit https://github.com/sirupsen/logrus
-*/
-package logrus
diff --git a/vendor/github.com/sirupsen/logrus/entry.go b/vendor/github.com/sirupsen/logrus/entry.go
deleted file mode 100644
index 473bd1a0..00000000
--- a/vendor/github.com/sirupsen/logrus/entry.go
+++ /dev/null
@@ -1,300 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "fmt"
- "os"
- "sync"
- "time"
-)
-
-var bufferPool *sync.Pool
-
-func init() {
- bufferPool = &sync.Pool{
- New: func() interface{} {
- return new(bytes.Buffer)
- },
- }
-}
-
-// Defines the key when adding errors using WithError.
-var ErrorKey = "error"
-
-// An entry is the final or intermediate Logrus logging entry. It contains all
-// the fields passed with WithField{,s}. It's finally logged when Debug, Info,
-// Warn, Error, Fatal or Panic is called on it. These objects can be reused and
-// passed around as much as you wish to avoid field duplication.
-type Entry struct {
- Logger *Logger
-
- // Contains all the fields set by the user.
- Data Fields
-
- // Time at which the log entry was created
- Time time.Time
-
- // Level the log entry was logged at: Debug, Info, Warn, Error, Fatal or Panic
- // This field will be set on entry firing and the value will be equal to the one in Logger struct field.
- Level Level
-
- // Message passed to Debug, Info, Warn, Error, Fatal or Panic
- Message string
-
- // When formatter is called in entry.log(), an Buffer may be set to entry
- Buffer *bytes.Buffer
-}
-
-func NewEntry(logger *Logger) *Entry {
- return &Entry{
- Logger: logger,
- // Default is five fields, give a little extra room
- Data: make(Fields, 5),
- }
-}
-
-// Returns the string representation from the reader and ultimately the
-// formatter.
-func (entry *Entry) String() (string, error) {
- serialized, err := entry.Logger.Formatter.Format(entry)
- if err != nil {
- return "", err
- }
- str := string(serialized)
- return str, nil
-}
-
-// Add an error as single field (using the key defined in ErrorKey) to the Entry.
-func (entry *Entry) WithError(err error) *Entry {
- return entry.WithField(ErrorKey, err)
-}
-
-// Add a single field to the Entry.
-func (entry *Entry) WithField(key string, value interface{}) *Entry {
- return entry.WithFields(Fields{key: value})
-}
-
-// Add a map of fields to the Entry.
-func (entry *Entry) WithFields(fields Fields) *Entry {
- data := make(Fields, len(entry.Data)+len(fields))
- for k, v := range entry.Data {
- data[k] = v
- }
- for k, v := range fields {
- data[k] = v
- }
- return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time}
-}
-
-// Overrides the time of the Entry.
-func (entry *Entry) WithTime(t time.Time) *Entry {
- return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t}
-}
-
-// This function is not declared with a pointer value because otherwise
-// race conditions will occur when using multiple goroutines
-func (entry Entry) log(level Level, msg string) {
- var buffer *bytes.Buffer
-
- // Default to now, but allow users to override if they want.
- //
- // We don't have to worry about polluting future calls to Entry#log()
- // with this assignment because this function is declared with a
- // non-pointer receiver.
- if entry.Time.IsZero() {
- entry.Time = time.Now()
- }
-
- entry.Level = level
- entry.Message = msg
-
- entry.fireHooks()
-
- buffer = bufferPool.Get().(*bytes.Buffer)
- buffer.Reset()
- defer bufferPool.Put(buffer)
- entry.Buffer = buffer
-
- entry.write()
-
- entry.Buffer = nil
-
- // To avoid Entry#log() returning a value that only would make sense for
- // panic() to use in Entry#Panic(), we avoid the allocation by checking
- // directly here.
- if level <= PanicLevel {
- panic(&entry)
- }
-}
-
-func (entry *Entry) fireHooks() {
- entry.Logger.mu.Lock()
- defer entry.Logger.mu.Unlock()
- err := entry.Logger.Hooks.Fire(entry.Level, entry)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
- }
-}
-
-func (entry *Entry) write() {
- serialized, err := entry.Logger.Formatter.Format(entry)
- entry.Logger.mu.Lock()
- defer entry.Logger.mu.Unlock()
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
- } else {
- _, err = entry.Logger.Out.Write(serialized)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
- }
- }
-}
-
-func (entry *Entry) Debug(args ...interface{}) {
- if entry.Logger.level() >= DebugLevel {
- entry.log(DebugLevel, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Print(args ...interface{}) {
- entry.Info(args...)
-}
-
-func (entry *Entry) Info(args ...interface{}) {
- if entry.Logger.level() >= InfoLevel {
- entry.log(InfoLevel, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Warn(args ...interface{}) {
- if entry.Logger.level() >= WarnLevel {
- entry.log(WarnLevel, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Warning(args ...interface{}) {
- entry.Warn(args...)
-}
-
-func (entry *Entry) Error(args ...interface{}) {
- if entry.Logger.level() >= ErrorLevel {
- entry.log(ErrorLevel, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Fatal(args ...interface{}) {
- if entry.Logger.level() >= FatalLevel {
- entry.log(FatalLevel, fmt.Sprint(args...))
- }
- Exit(1)
-}
-
-func (entry *Entry) Panic(args ...interface{}) {
- if entry.Logger.level() >= PanicLevel {
- entry.log(PanicLevel, fmt.Sprint(args...))
- }
- panic(fmt.Sprint(args...))
-}
-
-// Entry Printf family functions
-
-func (entry *Entry) Debugf(format string, args ...interface{}) {
- if entry.Logger.level() >= DebugLevel {
- entry.Debug(fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Infof(format string, args ...interface{}) {
- if entry.Logger.level() >= InfoLevel {
- entry.Info(fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Printf(format string, args ...interface{}) {
- entry.Infof(format, args...)
-}
-
-func (entry *Entry) Warnf(format string, args ...interface{}) {
- if entry.Logger.level() >= WarnLevel {
- entry.Warn(fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Warningf(format string, args ...interface{}) {
- entry.Warnf(format, args...)
-}
-
-func (entry *Entry) Errorf(format string, args ...interface{}) {
- if entry.Logger.level() >= ErrorLevel {
- entry.Error(fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Fatalf(format string, args ...interface{}) {
- if entry.Logger.level() >= FatalLevel {
- entry.Fatal(fmt.Sprintf(format, args...))
- }
- Exit(1)
-}
-
-func (entry *Entry) Panicf(format string, args ...interface{}) {
- if entry.Logger.level() >= PanicLevel {
- entry.Panic(fmt.Sprintf(format, args...))
- }
-}
-
-// Entry Println family functions
-
-func (entry *Entry) Debugln(args ...interface{}) {
- if entry.Logger.level() >= DebugLevel {
- entry.Debug(entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Infoln(args ...interface{}) {
- if entry.Logger.level() >= InfoLevel {
- entry.Info(entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Println(args ...interface{}) {
- entry.Infoln(args...)
-}
-
-func (entry *Entry) Warnln(args ...interface{}) {
- if entry.Logger.level() >= WarnLevel {
- entry.Warn(entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Warningln(args ...interface{}) {
- entry.Warnln(args...)
-}
-
-func (entry *Entry) Errorln(args ...interface{}) {
- if entry.Logger.level() >= ErrorLevel {
- entry.Error(entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Fatalln(args ...interface{}) {
- if entry.Logger.level() >= FatalLevel {
- entry.Fatal(entry.sprintlnn(args...))
- }
- Exit(1)
-}
-
-func (entry *Entry) Panicln(args ...interface{}) {
- if entry.Logger.level() >= PanicLevel {
- entry.Panic(entry.sprintlnn(args...))
- }
-}
-
-// Sprintlnn => Sprint no newline. This is to get the behavior of how
-// fmt.Sprintln where spaces are always added between operands, regardless of
-// their type. Instead of vendoring the Sprintln implementation to spare a
-// string allocation, we do the simplest thing.
-func (entry *Entry) sprintlnn(args ...interface{}) string {
- msg := fmt.Sprintln(args...)
- return msg[:len(msg)-1]
-}
diff --git a/vendor/github.com/sirupsen/logrus/exported.go b/vendor/github.com/sirupsen/logrus/exported.go
deleted file mode 100644
index eb612a6f..00000000
--- a/vendor/github.com/sirupsen/logrus/exported.go
+++ /dev/null
@@ -1,201 +0,0 @@
-package logrus
-
-import (
- "io"
- "time"
-)
-
-var (
- // std is the name of the standard logger in stdlib `log`
- std = New()
-)
-
-func StandardLogger() *Logger {
- return std
-}
-
-// SetOutput sets the standard logger output.
-func SetOutput(out io.Writer) {
- std.SetOutput(out)
-}
-
-// SetFormatter sets the standard logger formatter.
-func SetFormatter(formatter Formatter) {
- std.mu.Lock()
- defer std.mu.Unlock()
- std.Formatter = formatter
-}
-
-// SetLevel sets the standard logger level.
-func SetLevel(level Level) {
- std.mu.Lock()
- defer std.mu.Unlock()
- std.SetLevel(level)
-}
-
-// GetLevel returns the standard logger level.
-func GetLevel() Level {
- std.mu.Lock()
- defer std.mu.Unlock()
- return std.level()
-}
-
-// AddHook adds a hook to the standard logger hooks.
-func AddHook(hook Hook) {
- std.mu.Lock()
- defer std.mu.Unlock()
- std.Hooks.Add(hook)
-}
-
-// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
-func WithError(err error) *Entry {
- return std.WithField(ErrorKey, err)
-}
-
-// WithField creates an entry from the standard logger and adds a field to
-// it. If you want multiple fields, use `WithFields`.
-//
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
-// or Panic on the Entry it returns.
-func WithField(key string, value interface{}) *Entry {
- return std.WithField(key, value)
-}
-
-// WithFields creates an entry from the standard logger and adds multiple
-// fields to it. This is simply a helper for `WithField`, invoking it
-// once for each field.
-//
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
-// or Panic on the Entry it returns.
-func WithFields(fields Fields) *Entry {
- return std.WithFields(fields)
-}
-
-// WithTime creats an entry from the standard logger and overrides the time of
-// logs generated with it.
-//
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
-// or Panic on the Entry it returns.
-func WithTime(t time.Time) *Entry {
- return std.WithTime(t)
-}
-
-// Debug logs a message at level Debug on the standard logger.
-func Debug(args ...interface{}) {
- std.Debug(args...)
-}
-
-// Print logs a message at level Info on the standard logger.
-func Print(args ...interface{}) {
- std.Print(args...)
-}
-
-// Info logs a message at level Info on the standard logger.
-func Info(args ...interface{}) {
- std.Info(args...)
-}
-
-// Warn logs a message at level Warn on the standard logger.
-func Warn(args ...interface{}) {
- std.Warn(args...)
-}
-
-// Warning logs a message at level Warn on the standard logger.
-func Warning(args ...interface{}) {
- std.Warning(args...)
-}
-
-// Error logs a message at level Error on the standard logger.
-func Error(args ...interface{}) {
- std.Error(args...)
-}
-
-// Panic logs a message at level Panic on the standard logger.
-func Panic(args ...interface{}) {
- std.Panic(args...)
-}
-
-// Fatal logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
-func Fatal(args ...interface{}) {
- std.Fatal(args...)
-}
-
-// Debugf logs a message at level Debug on the standard logger.
-func Debugf(format string, args ...interface{}) {
- std.Debugf(format, args...)
-}
-
-// Printf logs a message at level Info on the standard logger.
-func Printf(format string, args ...interface{}) {
- std.Printf(format, args...)
-}
-
-// Infof logs a message at level Info on the standard logger.
-func Infof(format string, args ...interface{}) {
- std.Infof(format, args...)
-}
-
-// Warnf logs a message at level Warn on the standard logger.
-func Warnf(format string, args ...interface{}) {
- std.Warnf(format, args...)
-}
-
-// Warningf logs a message at level Warn on the standard logger.
-func Warningf(format string, args ...interface{}) {
- std.Warningf(format, args...)
-}
-
-// Errorf logs a message at level Error on the standard logger.
-func Errorf(format string, args ...interface{}) {
- std.Errorf(format, args...)
-}
-
-// Panicf logs a message at level Panic on the standard logger.
-func Panicf(format string, args ...interface{}) {
- std.Panicf(format, args...)
-}
-
-// Fatalf logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
-func Fatalf(format string, args ...interface{}) {
- std.Fatalf(format, args...)
-}
-
-// Debugln logs a message at level Debug on the standard logger.
-func Debugln(args ...interface{}) {
- std.Debugln(args...)
-}
-
-// Println logs a message at level Info on the standard logger.
-func Println(args ...interface{}) {
- std.Println(args...)
-}
-
-// Infoln logs a message at level Info on the standard logger.
-func Infoln(args ...interface{}) {
- std.Infoln(args...)
-}
-
-// Warnln logs a message at level Warn on the standard logger.
-func Warnln(args ...interface{}) {
- std.Warnln(args...)
-}
-
-// Warningln logs a message at level Warn on the standard logger.
-func Warningln(args ...interface{}) {
- std.Warningln(args...)
-}
-
-// Errorln logs a message at level Error on the standard logger.
-func Errorln(args ...interface{}) {
- std.Errorln(args...)
-}
-
-// Panicln logs a message at level Panic on the standard logger.
-func Panicln(args ...interface{}) {
- std.Panicln(args...)
-}
-
-// Fatalln logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
-func Fatalln(args ...interface{}) {
- std.Fatalln(args...)
-}
diff --git a/vendor/github.com/sirupsen/logrus/formatter.go b/vendor/github.com/sirupsen/logrus/formatter.go
deleted file mode 100644
index 83c74947..00000000
--- a/vendor/github.com/sirupsen/logrus/formatter.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package logrus
-
-import "time"
-
-const defaultTimestampFormat = time.RFC3339
-
-// The Formatter interface is used to implement a custom Formatter. It takes an
-// `Entry`. It exposes all the fields, including the default ones:
-//
-// * `entry.Data["msg"]`. The message passed from Info, Warn, Error ..
-// * `entry.Data["time"]`. The timestamp.
-// * `entry.Data["level"]. The level the entry was logged at.
-//
-// Any additional fields added with `WithField` or `WithFields` are also in
-// `entry.Data`. Format is expected to return an array of bytes which are then
-// logged to `logger.Out`.
-type Formatter interface {
- Format(*Entry) ([]byte, error)
-}
-
-// This is to not silently overwrite `time`, `msg` and `level` fields when
-// dumping it. If this code wasn't there doing:
-//
-// logrus.WithField("level", 1).Info("hello")
-//
-// Would just silently drop the user provided level. Instead with this code
-// it'll logged as:
-//
-// {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."}
-//
-// It's not exported because it's still using Data in an opinionated way. It's to
-// avoid code duplication between the two default formatters.
-func prefixFieldClashes(data Fields, fieldMap FieldMap) {
- timeKey := fieldMap.resolve(FieldKeyTime)
- if t, ok := data[timeKey]; ok {
- data["fields."+timeKey] = t
- delete(data, timeKey)
- }
-
- msgKey := fieldMap.resolve(FieldKeyMsg)
- if m, ok := data[msgKey]; ok {
- data["fields."+msgKey] = m
- delete(data, msgKey)
- }
-
- levelKey := fieldMap.resolve(FieldKeyLevel)
- if l, ok := data[levelKey]; ok {
- data["fields."+levelKey] = l
- delete(data, levelKey)
- }
-}
diff --git a/vendor/github.com/sirupsen/logrus/hooks.go b/vendor/github.com/sirupsen/logrus/hooks.go
deleted file mode 100644
index 3f151cdc..00000000
--- a/vendor/github.com/sirupsen/logrus/hooks.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package logrus
-
-// A hook to be fired when logging on the logging levels returned from
-// `Levels()` on your implementation of the interface. Note that this is not
-// fired in a goroutine or a channel with workers, you should handle such
-// functionality yourself if your call is non-blocking and you don't wish for
-// the logging calls for levels returned from `Levels()` to block.
-type Hook interface {
- Levels() []Level
- Fire(*Entry) error
-}
-
-// Internal type for storing the hooks on a logger instance.
-type LevelHooks map[Level][]Hook
-
-// Add a hook to an instance of logger. This is called with
-// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface.
-func (hooks LevelHooks) Add(hook Hook) {
- for _, level := range hook.Levels() {
- hooks[level] = append(hooks[level], hook)
- }
-}
-
-// Fire all the hooks for the passed level. Used by `entry.log` to fire
-// appropriate hooks for a log entry.
-func (hooks LevelHooks) Fire(level Level, entry *Entry) error {
- for _, hook := range hooks[level] {
- if err := hook.Fire(entry); err != nil {
- return err
- }
- }
-
- return nil
-}
diff --git a/vendor/github.com/sirupsen/logrus/json_formatter.go b/vendor/github.com/sirupsen/logrus/json_formatter.go
deleted file mode 100644
index dab17610..00000000
--- a/vendor/github.com/sirupsen/logrus/json_formatter.go
+++ /dev/null
@@ -1,89 +0,0 @@
-package logrus
-
-import (
- "encoding/json"
- "fmt"
-)
-
-type fieldKey string
-
-// FieldMap allows customization of the key names for default fields.
-type FieldMap map[fieldKey]string
-
-// Default key names for the default fields
-const (
- FieldKeyMsg = "msg"
- FieldKeyLevel = "level"
- FieldKeyTime = "time"
-)
-
-func (f FieldMap) resolve(key fieldKey) string {
- if k, ok := f[key]; ok {
- return k
- }
-
- return string(key)
-}
-
-// JSONFormatter formats logs into parsable json
-type JSONFormatter struct {
- // TimestampFormat sets the format used for marshaling timestamps.
- TimestampFormat string
-
- // DisableTimestamp allows disabling automatic timestamps in output
- DisableTimestamp bool
-
- // DataKey allows users to put all the log entry parameters into a nested dictionary at a given key.
- DataKey string
-
- // FieldMap allows users to customize the names of keys for default fields.
- // As an example:
- // formatter := &JSONFormatter{
- // FieldMap: FieldMap{
- // FieldKeyTime: "@timestamp",
- // FieldKeyLevel: "@level",
- // FieldKeyMsg: "@message",
- // },
- // }
- FieldMap FieldMap
-}
-
-// Format renders a single log entry
-func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
- data := make(Fields, len(entry.Data)+3)
- for k, v := range entry.Data {
- switch v := v.(type) {
- case error:
- // Otherwise errors are ignored by `encoding/json`
- // https://github.com/sirupsen/logrus/issues/137
- data[k] = v.Error()
- default:
- data[k] = v
- }
- }
-
- if f.DataKey != "" {
- newData := make(Fields, 4)
- newData[f.DataKey] = data
- data = newData
- }
-
- prefixFieldClashes(data, f.FieldMap)
-
- timestampFormat := f.TimestampFormat
- if timestampFormat == "" {
- timestampFormat = defaultTimestampFormat
- }
-
- if !f.DisableTimestamp {
- data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat)
- }
- data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message
- data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String()
-
- serialized, err := json.Marshal(data)
- if err != nil {
- return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
- }
- return append(serialized, '\n'), nil
-}
diff --git a/vendor/github.com/sirupsen/logrus/logger.go b/vendor/github.com/sirupsen/logrus/logger.go
deleted file mode 100644
index 342f7977..00000000
--- a/vendor/github.com/sirupsen/logrus/logger.go
+++ /dev/null
@@ -1,337 +0,0 @@
-package logrus
-
-import (
- "io"
- "os"
- "sync"
- "sync/atomic"
- "time"
-)
-
-type Logger struct {
- // The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
- // file, or leave it default which is `os.Stderr`. You can also set this to
- // something more adventorous, such as logging to Kafka.
- Out io.Writer
- // Hooks for the logger instance. These allow firing events based on logging
- // levels and log entries. For example, to send errors to an error tracking
- // service, log to StatsD or dump the core on fatal errors.
- Hooks LevelHooks
- // All log entries pass through the formatter before logged to Out. The
- // included formatters are `TextFormatter` and `JSONFormatter` for which
- // TextFormatter is the default. In development (when a TTY is attached) it
- // logs with colors, but to a file it wouldn't. You can easily implement your
- // own that implements the `Formatter` interface, see the `README` or included
- // formatters for examples.
- Formatter Formatter
- // The logging level the logger should log at. This is typically (and defaults
- // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
- // logged.
- Level Level
- // Used to sync writing to the log. Locking is enabled by Default
- mu MutexWrap
- // Reusable empty entry
- entryPool sync.Pool
-}
-
-type MutexWrap struct {
- lock sync.Mutex
- disabled bool
-}
-
-func (mw *MutexWrap) Lock() {
- if !mw.disabled {
- mw.lock.Lock()
- }
-}
-
-func (mw *MutexWrap) Unlock() {
- if !mw.disabled {
- mw.lock.Unlock()
- }
-}
-
-func (mw *MutexWrap) Disable() {
- mw.disabled = true
-}
-
-// Creates a new logger. Configuration should be set by changing `Formatter`,
-// `Out` and `Hooks` directly on the default logger instance. You can also just
-// instantiate your own:
-//
-// var log = &Logger{
-// Out: os.Stderr,
-// Formatter: new(JSONFormatter),
-// Hooks: make(LevelHooks),
-// Level: logrus.DebugLevel,
-// }
-//
-// It's recommended to make this a global instance called `log`.
-func New() *Logger {
- return &Logger{
- Out: os.Stderr,
- Formatter: new(TextFormatter),
- Hooks: make(LevelHooks),
- Level: InfoLevel,
- }
-}
-
-func (logger *Logger) newEntry() *Entry {
- entry, ok := logger.entryPool.Get().(*Entry)
- if ok {
- return entry
- }
- return NewEntry(logger)
-}
-
-func (logger *Logger) releaseEntry(entry *Entry) {
- logger.entryPool.Put(entry)
-}
-
-// Adds a field to the log entry, note that it doesn't log until you call
-// Debug, Print, Info, Warn, Error, Fatal or Panic. It only creates a log entry.
-// If you want multiple fields, use `WithFields`.
-func (logger *Logger) WithField(key string, value interface{}) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithField(key, value)
-}
-
-// Adds a struct of fields to the log entry. All it does is call `WithField` for
-// each `Field`.
-func (logger *Logger) WithFields(fields Fields) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithFields(fields)
-}
-
-// Add an error as single field to the log entry. All it does is call
-// `WithError` for the given `error`.
-func (logger *Logger) WithError(err error) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithError(err)
-}
-
-// Overrides the time of the log entry.
-func (logger *Logger) WithTime(t time.Time) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithTime(t)
-}
-
-func (logger *Logger) Debugf(format string, args ...interface{}) {
- if logger.level() >= DebugLevel {
- entry := logger.newEntry()
- entry.Debugf(format, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Infof(format string, args ...interface{}) {
- if logger.level() >= InfoLevel {
- entry := logger.newEntry()
- entry.Infof(format, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Printf(format string, args ...interface{}) {
- entry := logger.newEntry()
- entry.Printf(format, args...)
- logger.releaseEntry(entry)
-}
-
-func (logger *Logger) Warnf(format string, args ...interface{}) {
- if logger.level() >= WarnLevel {
- entry := logger.newEntry()
- entry.Warnf(format, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Warningf(format string, args ...interface{}) {
- if logger.level() >= WarnLevel {
- entry := logger.newEntry()
- entry.Warnf(format, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Errorf(format string, args ...interface{}) {
- if logger.level() >= ErrorLevel {
- entry := logger.newEntry()
- entry.Errorf(format, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Fatalf(format string, args ...interface{}) {
- if logger.level() >= FatalLevel {
- entry := logger.newEntry()
- entry.Fatalf(format, args...)
- logger.releaseEntry(entry)
- }
- Exit(1)
-}
-
-func (logger *Logger) Panicf(format string, args ...interface{}) {
- if logger.level() >= PanicLevel {
- entry := logger.newEntry()
- entry.Panicf(format, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Debug(args ...interface{}) {
- if logger.level() >= DebugLevel {
- entry := logger.newEntry()
- entry.Debug(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Info(args ...interface{}) {
- if logger.level() >= InfoLevel {
- entry := logger.newEntry()
- entry.Info(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Print(args ...interface{}) {
- entry := logger.newEntry()
- entry.Info(args...)
- logger.releaseEntry(entry)
-}
-
-func (logger *Logger) Warn(args ...interface{}) {
- if logger.level() >= WarnLevel {
- entry := logger.newEntry()
- entry.Warn(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Warning(args ...interface{}) {
- if logger.level() >= WarnLevel {
- entry := logger.newEntry()
- entry.Warn(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Error(args ...interface{}) {
- if logger.level() >= ErrorLevel {
- entry := logger.newEntry()
- entry.Error(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Fatal(args ...interface{}) {
- if logger.level() >= FatalLevel {
- entry := logger.newEntry()
- entry.Fatal(args...)
- logger.releaseEntry(entry)
- }
- Exit(1)
-}
-
-func (logger *Logger) Panic(args ...interface{}) {
- if logger.level() >= PanicLevel {
- entry := logger.newEntry()
- entry.Panic(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Debugln(args ...interface{}) {
- if logger.level() >= DebugLevel {
- entry := logger.newEntry()
- entry.Debugln(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Infoln(args ...interface{}) {
- if logger.level() >= InfoLevel {
- entry := logger.newEntry()
- entry.Infoln(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Println(args ...interface{}) {
- entry := logger.newEntry()
- entry.Println(args...)
- logger.releaseEntry(entry)
-}
-
-func (logger *Logger) Warnln(args ...interface{}) {
- if logger.level() >= WarnLevel {
- entry := logger.newEntry()
- entry.Warnln(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Warningln(args ...interface{}) {
- if logger.level() >= WarnLevel {
- entry := logger.newEntry()
- entry.Warnln(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Errorln(args ...interface{}) {
- if logger.level() >= ErrorLevel {
- entry := logger.newEntry()
- entry.Errorln(args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Fatalln(args ...interface{}) {
- if logger.level() >= FatalLevel {
- entry := logger.newEntry()
- entry.Fatalln(args...)
- logger.releaseEntry(entry)
- }
- Exit(1)
-}
-
-func (logger *Logger) Panicln(args ...interface{}) {
- if logger.level() >= PanicLevel {
- entry := logger.newEntry()
- entry.Panicln(args...)
- logger.releaseEntry(entry)
- }
-}
-
-//When file is opened with appending mode, it's safe to
-//write concurrently to a file (within 4k message on Linux).
-//In these cases user can choose to disable the lock.
-func (logger *Logger) SetNoLock() {
- logger.mu.Disable()
-}
-
-func (logger *Logger) level() Level {
- return Level(atomic.LoadUint32((*uint32)(&logger.Level)))
-}
-
-func (logger *Logger) SetLevel(level Level) {
- atomic.StoreUint32((*uint32)(&logger.Level), uint32(level))
-}
-
-func (logger *Logger) SetOutput(out io.Writer) {
- logger.mu.Lock()
- defer logger.mu.Unlock()
- logger.Out = out
-}
-
-func (logger *Logger) AddHook(hook Hook) {
- logger.mu.Lock()
- defer logger.mu.Unlock()
- logger.Hooks.Add(hook)
-}
diff --git a/vendor/github.com/sirupsen/logrus/logrus.go b/vendor/github.com/sirupsen/logrus/logrus.go
deleted file mode 100644
index dd389997..00000000
--- a/vendor/github.com/sirupsen/logrus/logrus.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package logrus
-
-import (
- "fmt"
- "log"
- "strings"
-)
-
-// Fields type, used to pass to `WithFields`.
-type Fields map[string]interface{}
-
-// Level type
-type Level uint32
-
-// Convert the Level to a string. E.g. PanicLevel becomes "panic".
-func (level Level) String() string {
- switch level {
- case DebugLevel:
- return "debug"
- case InfoLevel:
- return "info"
- case WarnLevel:
- return "warning"
- case ErrorLevel:
- return "error"
- case FatalLevel:
- return "fatal"
- case PanicLevel:
- return "panic"
- }
-
- return "unknown"
-}
-
-// ParseLevel takes a string level and returns the Logrus log level constant.
-func ParseLevel(lvl string) (Level, error) {
- switch strings.ToLower(lvl) {
- case "panic":
- return PanicLevel, nil
- case "fatal":
- return FatalLevel, nil
- case "error":
- return ErrorLevel, nil
- case "warn", "warning":
- return WarnLevel, nil
- case "info":
- return InfoLevel, nil
- case "debug":
- return DebugLevel, nil
- }
-
- var l Level
- return l, fmt.Errorf("not a valid logrus Level: %q", lvl)
-}
-
-// A constant exposing all logging levels
-var AllLevels = []Level{
- PanicLevel,
- FatalLevel,
- ErrorLevel,
- WarnLevel,
- InfoLevel,
- DebugLevel,
-}
-
-// These are the different logging levels. You can set the logging level to log
-// on your instance of logger, obtained with `logrus.New()`.
-const (
- // PanicLevel level, highest level of severity. Logs and then calls panic with the
- // message passed to Debug, Info, ...
- PanicLevel Level = iota
- // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the
- // logging level is set to Panic.
- FatalLevel
- // ErrorLevel level. Logs. Used for errors that should definitely be noted.
- // Commonly used for hooks to send errors to an error tracking service.
- ErrorLevel
- // WarnLevel level. Non-critical entries that deserve eyes.
- WarnLevel
- // InfoLevel level. General operational entries about what's going on inside the
- // application.
- InfoLevel
- // DebugLevel level. Usually only enabled when debugging. Very verbose logging.
- DebugLevel
-)
-
-// Won't compile if StdLogger can't be realized by a log.Logger
-var (
- _ StdLogger = &log.Logger{}
- _ StdLogger = &Entry{}
- _ StdLogger = &Logger{}
-)
-
-// StdLogger is what your logrus-enabled library should take, that way
-// it'll accept a stdlib logger and a logrus logger. There's no standard
-// interface, this is the closest we get, unfortunately.
-type StdLogger interface {
- Print(...interface{})
- Printf(string, ...interface{})
- Println(...interface{})
-
- Fatal(...interface{})
- Fatalf(string, ...interface{})
- Fatalln(...interface{})
-
- Panic(...interface{})
- Panicf(string, ...interface{})
- Panicln(...interface{})
-}
-
-// The FieldLogger interface generalizes the Entry and Logger types
-type FieldLogger interface {
- WithField(key string, value interface{}) *Entry
- WithFields(fields Fields) *Entry
- WithError(err error) *Entry
-
- Debugf(format string, args ...interface{})
- Infof(format string, args ...interface{})
- Printf(format string, args ...interface{})
- Warnf(format string, args ...interface{})
- Warningf(format string, args ...interface{})
- Errorf(format string, args ...interface{})
- Fatalf(format string, args ...interface{})
- Panicf(format string, args ...interface{})
-
- Debug(args ...interface{})
- Info(args ...interface{})
- Print(args ...interface{})
- Warn(args ...interface{})
- Warning(args ...interface{})
- Error(args ...interface{})
- Fatal(args ...interface{})
- Panic(args ...interface{})
-
- Debugln(args ...interface{})
- Infoln(args ...interface{})
- Println(args ...interface{})
- Warnln(args ...interface{})
- Warningln(args ...interface{})
- Errorln(args ...interface{})
- Fatalln(args ...interface{})
- Panicln(args ...interface{})
-}
diff --git a/vendor/github.com/sirupsen/logrus/terminal_bsd.go b/vendor/github.com/sirupsen/logrus/terminal_bsd.go
deleted file mode 100644
index 4880d13d..00000000
--- a/vendor/github.com/sirupsen/logrus/terminal_bsd.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build darwin freebsd openbsd netbsd dragonfly
-// +build !appengine,!gopherjs
-
-package logrus
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TIOCGETA
-
-type Termios unix.Termios
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go
deleted file mode 100644
index 3de08e80..00000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build appengine gopherjs
-
-package logrus
-
-import (
- "io"
-)
-
-func checkIfTerminal(w io.Writer) bool {
- return true
-}
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go
deleted file mode 100644
index 067047a1..00000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build !appengine,!gopherjs
-
-package logrus
-
-import (
- "io"
- "os"
-
- "golang.org/x/crypto/ssh/terminal"
-)
-
-func checkIfTerminal(w io.Writer) bool {
- switch v := w.(type) {
- case *os.File:
- return terminal.IsTerminal(int(v.Fd()))
- default:
- return false
- }
-}
diff --git a/vendor/github.com/sirupsen/logrus/terminal_linux.go b/vendor/github.com/sirupsen/logrus/terminal_linux.go
deleted file mode 100644
index f29a0097..00000000
--- a/vendor/github.com/sirupsen/logrus/terminal_linux.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Based on ssh/terminal:
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine,!gopherjs
-
-package logrus
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TCGETS
-
-type Termios unix.Termios
diff --git a/vendor/github.com/sirupsen/logrus/text_formatter.go b/vendor/github.com/sirupsen/logrus/text_formatter.go
deleted file mode 100644
index 3e550403..00000000
--- a/vendor/github.com/sirupsen/logrus/text_formatter.go
+++ /dev/null
@@ -1,195 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "fmt"
- "sort"
- "strings"
- "sync"
- "time"
-)
-
-const (
- nocolor = 0
- red = 31
- green = 32
- yellow = 33
- blue = 36
- gray = 37
-)
-
-var (
- baseTimestamp time.Time
- emptyFieldMap FieldMap
-)
-
-func init() {
- baseTimestamp = time.Now()
-}
-
-// TextFormatter formats logs into text
-type TextFormatter struct {
- // Set to true to bypass checking for a TTY before outputting colors.
- ForceColors bool
-
- // Force disabling colors.
- DisableColors bool
-
- // Disable timestamp logging. useful when output is redirected to logging
- // system that already adds timestamps.
- DisableTimestamp bool
-
- // Enable logging the full timestamp when a TTY is attached instead of just
- // the time passed since beginning of execution.
- FullTimestamp bool
-
- // TimestampFormat to use for display when a full timestamp is printed
- TimestampFormat string
-
- // The fields are sorted by default for a consistent output. For applications
- // that log extremely frequently and don't use the JSON formatter this may not
- // be desired.
- DisableSorting bool
-
- // Disables the truncation of the level text to 4 characters.
- DisableLevelTruncation bool
-
- // QuoteEmptyFields will wrap empty fields in quotes if true
- QuoteEmptyFields bool
-
- // Whether the logger's out is to a terminal
- isTerminal bool
-
- // FieldMap allows users to customize the names of keys for default fields.
- // As an example:
- // formatter := &TextFormatter{
- // FieldMap: FieldMap{
- // FieldKeyTime: "@timestamp",
- // FieldKeyLevel: "@level",
- // FieldKeyMsg: "@message"}}
- FieldMap FieldMap
-
- sync.Once
-}
-
-func (f *TextFormatter) init(entry *Entry) {
- if entry.Logger != nil {
- f.isTerminal = checkIfTerminal(entry.Logger.Out)
- }
-}
-
-// Format renders a single log entry
-func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
- prefixFieldClashes(entry.Data, f.FieldMap)
-
- keys := make([]string, 0, len(entry.Data))
- for k := range entry.Data {
- keys = append(keys, k)
- }
-
- if !f.DisableSorting {
- sort.Strings(keys)
- }
-
- var b *bytes.Buffer
- if entry.Buffer != nil {
- b = entry.Buffer
- } else {
- b = &bytes.Buffer{}
- }
-
- f.Do(func() { f.init(entry) })
-
- isColored := (f.ForceColors || f.isTerminal) && !f.DisableColors
-
- timestampFormat := f.TimestampFormat
- if timestampFormat == "" {
- timestampFormat = defaultTimestampFormat
- }
- if isColored {
- f.printColored(b, entry, keys, timestampFormat)
- } else {
- if !f.DisableTimestamp {
- f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyTime), entry.Time.Format(timestampFormat))
- }
- f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyLevel), entry.Level.String())
- if entry.Message != "" {
- f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyMsg), entry.Message)
- }
- for _, key := range keys {
- f.appendKeyValue(b, key, entry.Data[key])
- }
- }
-
- b.WriteByte('\n')
- return b.Bytes(), nil
-}
-
-func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) {
- var levelColor int
- switch entry.Level {
- case DebugLevel:
- levelColor = gray
- case WarnLevel:
- levelColor = yellow
- case ErrorLevel, FatalLevel, PanicLevel:
- levelColor = red
- default:
- levelColor = blue
- }
-
- levelText := strings.ToUpper(entry.Level.String())
- if !f.DisableLevelTruncation {
- levelText = levelText[0:4]
- }
-
- if f.DisableTimestamp {
- fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m %-44s ", levelColor, levelText, entry.Message)
- } else if !f.FullTimestamp {
- fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), entry.Message)
- } else {
- fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message)
- }
- for _, k := range keys {
- v := entry.Data[k]
- fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k)
- f.appendValue(b, v)
- }
-}
-
-func (f *TextFormatter) needsQuoting(text string) bool {
- if f.QuoteEmptyFields && len(text) == 0 {
- return true
- }
- for _, ch := range text {
- if !((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '@' || ch == '^' || ch == '+') {
- return true
- }
- }
- return false
-}
-
-func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
- if b.Len() > 0 {
- b.WriteByte(' ')
- }
- b.WriteString(key)
- b.WriteByte('=')
- f.appendValue(b, value)
-}
-
-func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) {
- stringVal, ok := value.(string)
- if !ok {
- stringVal = fmt.Sprint(value)
- }
-
- if !f.needsQuoting(stringVal) {
- b.WriteString(stringVal)
- } else {
- b.WriteString(fmt.Sprintf("%q", stringVal))
- }
-}
diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go
deleted file mode 100644
index 7bdebedc..00000000
--- a/vendor/github.com/sirupsen/logrus/writer.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package logrus
-
-import (
- "bufio"
- "io"
- "runtime"
-)
-
-func (logger *Logger) Writer() *io.PipeWriter {
- return logger.WriterLevel(InfoLevel)
-}
-
-func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
- return NewEntry(logger).WriterLevel(level)
-}
-
-func (entry *Entry) Writer() *io.PipeWriter {
- return entry.WriterLevel(InfoLevel)
-}
-
-func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
- reader, writer := io.Pipe()
-
- var printFunc func(args ...interface{})
-
- switch level {
- case DebugLevel:
- printFunc = entry.Debug
- case InfoLevel:
- printFunc = entry.Info
- case WarnLevel:
- printFunc = entry.Warn
- case ErrorLevel:
- printFunc = entry.Error
- case FatalLevel:
- printFunc = entry.Fatal
- case PanicLevel:
- printFunc = entry.Panic
- default:
- printFunc = entry.Print
- }
-
- go entry.writerScanner(reader, printFunc)
- runtime.SetFinalizer(writer, writerFinalizer)
-
- return writer
-}
-
-func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
- scanner := bufio.NewScanner(reader)
- for scanner.Scan() {
- printFunc(scanner.Text())
- }
- if err := scanner.Err(); err != nil {
- entry.Errorf("Error while reading from Writer: %s", err)
- }
- reader.Close()
-}
-
-func writerFinalizer(writer *io.PipeWriter) {
- writer.Close()
-}
diff --git a/vendor/github.com/src-d/gcfg/LICENSE b/vendor/github.com/src-d/gcfg/LICENSE
deleted file mode 100644
index 87a5cede..00000000
--- a/vendor/github.com/src-d/gcfg/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2012 Péter Surányi. Portions Copyright (c) 2009 The Go
-Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-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.
diff --git a/vendor/github.com/src-d/gcfg/README b/vendor/github.com/src-d/gcfg/README
deleted file mode 100644
index 1ff233a5..00000000
--- a/vendor/github.com/src-d/gcfg/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Gcfg reads INI-style configuration files into Go structs;
-supports user-defined types and subsections.
-
-Package docs: https://godoc.org/gopkg.in/gcfg.v1
diff --git a/vendor/github.com/src-d/gcfg/doc.go b/vendor/github.com/src-d/gcfg/doc.go
deleted file mode 100644
index 2edcb41a..00000000
--- a/vendor/github.com/src-d/gcfg/doc.go
+++ /dev/null
@@ -1,145 +0,0 @@
-// Package gcfg reads "INI-style" text-based configuration files with
-// "name=value" pairs grouped into sections (gcfg files).
-//
-// This package is still a work in progress; see the sections below for planned
-// changes.
-//
-// Syntax
-//
-// The syntax is based on that used by git config:
-// http://git-scm.com/docs/git-config#_syntax .
-// There are some (planned) differences compared to the git config format:
-// - improve data portability:
-// - must be encoded in UTF-8 (for now) and must not contain the 0 byte
-// - include and "path" type is not supported
-// (path type may be implementable as a user-defined type)
-// - internationalization
-// - section and variable names can contain unicode letters, unicode digits
-// (as defined in http://golang.org/ref/spec#Characters ) and hyphens
-// (U+002D), starting with a unicode letter
-// - disallow potentially ambiguous or misleading definitions:
-// - `[sec.sub]` format is not allowed (deprecated in gitconfig)
-// - `[sec ""]` is not allowed
-// - use `[sec]` for section name "sec" and empty subsection name
-// - (planned) within a single file, definitions must be contiguous for each:
-// - section: '[secA]' -> '[secB]' -> '[secA]' is an error
-// - subsection: '[sec "A"]' -> '[sec "B"]' -> '[sec "A"]' is an error
-// - multivalued variable: 'multi=a' -> 'other=x' -> 'multi=b' is an error
-//
-// Data structure
-//
-// The functions in this package read values into a user-defined struct.
-// Each section corresponds to a struct field in the config struct, and each
-// variable in a section corresponds to a data field in the section struct.
-// The mapping of each section or variable name to fields is done either based
-// on the "gcfg" struct tag or by matching the name of the section or variable,
-// ignoring case. In the latter case, hyphens '-' in section and variable names
-// correspond to underscores '_' in field names.
-// Fields must be exported; to use a section or variable name starting with a
-// letter that is neither upper- or lower-case, prefix the field name with 'X'.
-// (See https://code.google.com/p/go/issues/detail?id=5763#c4 .)
-//
-// For sections with subsections, the corresponding field in config must be a
-// map, rather than a struct, with string keys and pointer-to-struct values.
-// Values for subsection variables are stored in the map with the subsection
-// name used as the map key.
-// (Note that unlike section and variable names, subsection names are case
-// sensitive.)
-// When using a map, and there is a section with the same section name but
-// without a subsection name, its values are stored with the empty string used
-// as the key.
-// It is possible to provide default values for subsections in the section
-// "default-" (or by setting values in the corresponding struct
-// field "Default_").
-//
-// The functions in this package panic if config is not a pointer to a struct,
-// or when a field is not of a suitable type (either a struct or a map with
-// string keys and pointer-to-struct values).
-//
-// Parsing of values
-//
-// The section structs in the config struct may contain single-valued or
-// multi-valued variables. Variables of unnamed slice type (that is, a type
-// starting with `[]`) are treated as multi-value; all others (including named
-// slice types) are treated as single-valued variables.
-//
-// Single-valued variables are handled based on the type as follows.
-// Unnamed pointer types (that is, types starting with `*`) are dereferenced,
-// and if necessary, a new instance is allocated.
-//
-// For types implementing the encoding.TextUnmarshaler interface, the
-// UnmarshalText method is used to set the value. Implementing this method is
-// the recommended way for parsing user-defined types.
-//
-// For fields of string kind, the value string is assigned to the field, after
-// unquoting and unescaping as needed.
-// For fields of bool kind, the field is set to true if the value is "true",
-// "yes", "on" or "1", and set to false if the value is "false", "no", "off" or
-// "0", ignoring case. In addition, single-valued bool fields can be specified
-// with a "blank" value (variable name without equals sign and value); in such
-// case the value is set to true.
-//
-// Predefined integer types [u]int(|8|16|32|64) and big.Int are parsed as
-// decimal or hexadecimal (if having '0x' prefix). (This is to prevent
-// unintuitively handling zero-padded numbers as octal.) Other types having
-// [u]int* as the underlying type, such as os.FileMode and uintptr allow
-// decimal, hexadecimal, or octal values.
-// Parsing mode for integer types can be overridden using the struct tag option
-// ",int=mode" where mode is a combination of the 'd', 'h', and 'o' characters
-// (each standing for decimal, hexadecimal, and octal, respectively.)
-//
-// All other types are parsed using fmt.Sscanf with the "%v" verb.
-//
-// For multi-valued variables, each individual value is parsed as above and
-// appended to the slice. If the first value is specified as a "blank" value
-// (variable name without equals sign and value), a new slice is allocated;
-// that is any values previously set in the slice will be ignored.
-//
-// The types subpackage for provides helpers for parsing "enum-like" and integer
-// types.
-//
-// Error handling
-//
-// There are 3 types of errors:
-//
-// - programmer errors / panics:
-// - invalid configuration structure
-// - data errors:
-// - fatal errors:
-// - invalid configuration syntax
-// - warnings:
-// - data that doesn't belong to any part of the config structure
-//
-// Programmer errors trigger panics. These are should be fixed by the programmer
-// before releasing code that uses gcfg.
-//
-// Data errors cause gcfg to return a non-nil error value. This includes the
-// case when there are extra unknown key-value definitions in the configuration
-// data (extra data).
-// However, in some occasions it is desirable to be able to proceed in
-// situations when the only data error is that of extra data.
-// These errors are handled at a different (warning) priority and can be
-// filtered out programmatically. To ignore extra data warnings, wrap the
-// gcfg.Read*Into invocation into a call to gcfg.FatalOnly.
-//
-// TODO
-//
-// The following is a list of changes under consideration:
-// - documentation
-// - self-contained syntax documentation
-// - more practical examples
-// - move TODOs to issue tracker (eventually)
-// - syntax
-// - reconsider valid escape sequences
-// (gitconfig doesn't support \r in value, \t in subsection name, etc.)
-// - reading / parsing gcfg files
-// - define internal representation structure
-// - support multiple inputs (readers, strings, files)
-// - support declaring encoding (?)
-// - support varying fields sets for subsections (?)
-// - writing gcfg files
-// - error handling
-// - make error context accessible programmatically?
-// - limit input size?
-//
-package gcfg // import "github.com/src-d/gcfg"
diff --git a/vendor/github.com/src-d/gcfg/errors.go b/vendor/github.com/src-d/gcfg/errors.go
deleted file mode 100644
index 853c7602..00000000
--- a/vendor/github.com/src-d/gcfg/errors.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package gcfg
-
-import (
- "gopkg.in/warnings.v0"
-)
-
-// FatalOnly filters the results of a Read*Into invocation and returns only
-// fatal errors. That is, errors (warnings) indicating data for unknown
-// sections / variables is ignored. Example invocation:
-//
-// err := gcfg.FatalOnly(gcfg.ReadFileInto(&cfg, configFile))
-// if err != nil {
-// ...
-//
-func FatalOnly(err error) error {
- return warnings.FatalOnly(err)
-}
-
-func isFatal(err error) bool {
- _, ok := err.(extraData)
- return !ok
-}
-
-type extraData struct {
- section string
- subsection *string
- variable *string
-}
-
-func (e extraData) Error() string {
- s := "can't store data at section \"" + e.section + "\""
- if e.subsection != nil {
- s += ", subsection \"" + *e.subsection + "\""
- }
- if e.variable != nil {
- s += ", variable \"" + *e.variable + "\""
- }
- return s
-}
-
-var _ error = extraData{}
diff --git a/vendor/github.com/src-d/gcfg/go1_0.go b/vendor/github.com/src-d/gcfg/go1_0.go
deleted file mode 100644
index 66702107..00000000
--- a/vendor/github.com/src-d/gcfg/go1_0.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build !go1.2
-
-package gcfg
-
-type textUnmarshaler interface {
- UnmarshalText(text []byte) error
-}
diff --git a/vendor/github.com/src-d/gcfg/go1_2.go b/vendor/github.com/src-d/gcfg/go1_2.go
deleted file mode 100644
index 6f5843bc..00000000
--- a/vendor/github.com/src-d/gcfg/go1_2.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// +build go1.2
-
-package gcfg
-
-import (
- "encoding"
-)
-
-type textUnmarshaler encoding.TextUnmarshaler
diff --git a/vendor/github.com/src-d/gcfg/read.go b/vendor/github.com/src-d/gcfg/read.go
deleted file mode 100644
index ea014f1b..00000000
--- a/vendor/github.com/src-d/gcfg/read.go
+++ /dev/null
@@ -1,273 +0,0 @@
-package gcfg
-
-import (
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "strings"
-
- "github.com/src-d/gcfg/scanner"
- "github.com/src-d/gcfg/token"
- "gopkg.in/warnings.v0"
-)
-
-var unescape = map[rune]rune{'\\': '\\', '"': '"', 'n': '\n', 't': '\t'}
-
-// no error: invalid literals should be caught by scanner
-func unquote(s string) string {
- u, q, esc := make([]rune, 0, len(s)), false, false
- for _, c := range s {
- if esc {
- uc, ok := unescape[c]
- switch {
- case ok:
- u = append(u, uc)
- fallthrough
- case !q && c == '\n':
- esc = false
- continue
- }
- panic("invalid escape sequence")
- }
- switch c {
- case '"':
- q = !q
- case '\\':
- esc = true
- default:
- u = append(u, c)
- }
- }
- if q {
- panic("missing end quote")
- }
- if esc {
- panic("invalid escape sequence")
- }
- return string(u)
-}
-
-func read(c *warnings.Collector, callback func(string,string,string,string,bool)error,
- fset *token.FileSet, file *token.File, src []byte) error {
- //
- var s scanner.Scanner
- var errs scanner.ErrorList
- s.Init(file, src, func(p token.Position, m string) { errs.Add(p, m) }, 0)
- sect, sectsub := "", ""
- pos, tok, lit := s.Scan()
- errfn := func(msg string) error {
- return fmt.Errorf("%s: %s", fset.Position(pos), msg)
- }
- for {
- if errs.Len() > 0 {
- if err := c.Collect(errs.Err()); err != nil {
- return err
- }
- }
- switch tok {
- case token.EOF:
- return nil
- case token.EOL, token.COMMENT:
- pos, tok, lit = s.Scan()
- case token.LBRACK:
- pos, tok, lit = s.Scan()
- if errs.Len() > 0 {
- if err := c.Collect(errs.Err()); err != nil {
- return err
- }
- }
- if tok != token.IDENT {
- if err := c.Collect(errfn("expected section name")); err != nil {
- return err
- }
- }
- sect, sectsub = lit, ""
- pos, tok, lit = s.Scan()
- if errs.Len() > 0 {
- if err := c.Collect(errs.Err()); err != nil {
- return err
- }
- }
- if tok == token.STRING {
- sectsub = unquote(lit)
- if sectsub == "" {
- if err := c.Collect(errfn("empty subsection name")); err != nil {
- return err
- }
- }
- pos, tok, lit = s.Scan()
- if errs.Len() > 0 {
- if err := c.Collect(errs.Err()); err != nil {
- return err
- }
- }
- }
- if tok != token.RBRACK {
- if sectsub == "" {
- if err := c.Collect(errfn("expected subsection name or right bracket")); err != nil {
- return err
- }
- }
- if err := c.Collect(errfn("expected right bracket")); err != nil {
- return err
- }
- }
- pos, tok, lit = s.Scan()
- if tok != token.EOL && tok != token.EOF && tok != token.COMMENT {
- if err := c.Collect(errfn("expected EOL, EOF, or comment")); err != nil {
- return err
- }
- }
- // If a section/subsection header was found, ensure a
- // container object is created, even if there are no
- // variables further down.
- err := c.Collect(callback(sect, sectsub, "", "", true))
- if err != nil {
- return err
- }
- case token.IDENT:
- if sect == "" {
- if err := c.Collect(errfn("expected section header")); err != nil {
- return err
- }
- }
- n := lit
- pos, tok, lit = s.Scan()
- if errs.Len() > 0 {
- return errs.Err()
- }
- blank, v := tok == token.EOF || tok == token.EOL || tok == token.COMMENT, ""
- if !blank {
- if tok != token.ASSIGN {
- if err := c.Collect(errfn("expected '='")); err != nil {
- return err
- }
- }
- pos, tok, lit = s.Scan()
- if errs.Len() > 0 {
- if err := c.Collect(errs.Err()); err != nil {
- return err
- }
- }
- if tok != token.STRING {
- if err := c.Collect(errfn("expected value")); err != nil {
- return err
- }
- }
- v = unquote(lit)
- pos, tok, lit = s.Scan()
- if errs.Len() > 0 {
- if err := c.Collect(errs.Err()); err != nil {
- return err
- }
- }
- if tok != token.EOL && tok != token.EOF && tok != token.COMMENT {
- if err := c.Collect(errfn("expected EOL, EOF, or comment")); err != nil {
- return err
- }
- }
- }
- err := c.Collect(callback(sect, sectsub, n, v, blank))
- if err != nil {
- return err
- }
- default:
- if sect == "" {
- if err := c.Collect(errfn("expected section header")); err != nil {
- return err
- }
- }
- if err := c.Collect(errfn("expected section header or variable declaration")); err != nil {
- return err
- }
- }
- }
- panic("never reached")
-}
-
-func readInto(config interface{}, fset *token.FileSet, file *token.File,
- src []byte) error {
- //
- c := warnings.NewCollector(isFatal)
- firstPassCallback := func(s string, ss string, k string, v string, bv bool) error {
- return set(c, config, s, ss, k, v, bv, false)
- }
- err := read(c, firstPassCallback, fset, file, src)
- if err != nil {
- return err
- }
- secondPassCallback := func(s string, ss string, k string, v string, bv bool) error {
- return set(c, config, s, ss, k, v, bv, true)
- }
- err = read(c, secondPassCallback, fset, file, src)
- if err != nil {
- return err
- }
- return c.Done()
-}
-
-// ReadWithCallback reads gcfg formatted data from reader and calls
-// callback with each section and option found.
-//
-// Callback is called with section, subsection, option key, option value
-// and blank value flag as arguments.
-//
-// When a section is found, callback is called with nil subsection, option key
-// and option value.
-//
-// When a subsection is found, callback is called with nil option key and
-// option value.
-//
-// If blank value flag is true, it means that the value was not set for an option
-// (as opposed to set to empty string).
-//
-// If callback returns an error, ReadWithCallback terminates with an error too.
-func ReadWithCallback(reader io.Reader, callback func(string,string,string,string,bool)error) error {
- src, err := ioutil.ReadAll(reader)
- if err != nil {
- return err
- }
-
- fset := token.NewFileSet()
- file := fset.AddFile("", fset.Base(), len(src))
- c := warnings.NewCollector(isFatal)
-
- return read(c, callback, fset, file, src)
-}
-
-// ReadInto reads gcfg formatted data from reader and sets the values into the
-// corresponding fields in config.
-func ReadInto(config interface{}, reader io.Reader) error {
- src, err := ioutil.ReadAll(reader)
- if err != nil {
- return err
- }
- fset := token.NewFileSet()
- file := fset.AddFile("", fset.Base(), len(src))
- return readInto(config, fset, file, src)
-}
-
-// ReadStringInto reads gcfg formatted data from str and sets the values into
-// the corresponding fields in config.
-func ReadStringInto(config interface{}, str string) error {
- r := strings.NewReader(str)
- return ReadInto(config, r)
-}
-
-// ReadFileInto reads gcfg formatted data from the file filename and sets the
-// values into the corresponding fields in config.
-func ReadFileInto(config interface{}, filename string) error {
- f, err := os.Open(filename)
- if err != nil {
- return err
- }
- defer f.Close()
- src, err := ioutil.ReadAll(f)
- if err != nil {
- return err
- }
- fset := token.NewFileSet()
- file := fset.AddFile(filename, fset.Base(), len(src))
- return readInto(config, fset, file, src)
-}
diff --git a/vendor/github.com/src-d/gcfg/scanner/errors.go b/vendor/github.com/src-d/gcfg/scanner/errors.go
deleted file mode 100644
index f3fcecac..00000000
--- a/vendor/github.com/src-d/gcfg/scanner/errors.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package scanner
-
-import (
- "fmt"
- "io"
- "sort"
-)
-
-import (
- "github.com/src-d/gcfg/token"
-)
-
-// In an ErrorList, an error is represented by an *Error.
-// The position Pos, if valid, points to the beginning of
-// the offending token, and the error condition is described
-// by Msg.
-//
-type Error struct {
- Pos token.Position
- Msg string
-}
-
-// Error implements the error interface.
-func (e Error) Error() string {
- if e.Pos.Filename != "" || e.Pos.IsValid() {
- // don't print ""
- // TODO(gri) reconsider the semantics of Position.IsValid
- return e.Pos.String() + ": " + e.Msg
- }
- return e.Msg
-}
-
-// ErrorList is a list of *Errors.
-// The zero value for an ErrorList is an empty ErrorList ready to use.
-//
-type ErrorList []*Error
-
-// Add adds an Error with given position and error message to an ErrorList.
-func (p *ErrorList) Add(pos token.Position, msg string) {
- *p = append(*p, &Error{pos, msg})
-}
-
-// Reset resets an ErrorList to no errors.
-func (p *ErrorList) Reset() { *p = (*p)[0:0] }
-
-// ErrorList implements the sort Interface.
-func (p ErrorList) Len() int { return len(p) }
-func (p ErrorList) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p ErrorList) Less(i, j int) bool {
- e := &p[i].Pos
- f := &p[j].Pos
- if e.Filename < f.Filename {
- return true
- }
- if e.Filename == f.Filename {
- return e.Offset < f.Offset
- }
- return false
-}
-
-// Sort sorts an ErrorList. *Error entries are sorted by position,
-// other errors are sorted by error message, and before any *Error
-// entry.
-//
-func (p ErrorList) Sort() {
- sort.Sort(p)
-}
-
-// RemoveMultiples sorts an ErrorList and removes all but the first error per line.
-func (p *ErrorList) RemoveMultiples() {
- sort.Sort(p)
- var last token.Position // initial last.Line is != any legal error line
- i := 0
- for _, e := range *p {
- if e.Pos.Filename != last.Filename || e.Pos.Line != last.Line {
- last = e.Pos
- (*p)[i] = e
- i++
- }
- }
- (*p) = (*p)[0:i]
-}
-
-// An ErrorList implements the error interface.
-func (p ErrorList) Error() string {
- switch len(p) {
- case 0:
- return "no errors"
- case 1:
- return p[0].Error()
- }
- return fmt.Sprintf("%s (and %d more errors)", p[0], len(p)-1)
-}
-
-// Err returns an error equivalent to this error list.
-// If the list is empty, Err returns nil.
-func (p ErrorList) Err() error {
- if len(p) == 0 {
- return nil
- }
- return p
-}
-
-// PrintError is a utility function that prints a list of errors to w,
-// one error per line, if the err parameter is an ErrorList. Otherwise
-// it prints the err string.
-//
-func PrintError(w io.Writer, err error) {
- if list, ok := err.(ErrorList); ok {
- for _, e := range list {
- fmt.Fprintf(w, "%s\n", e)
- }
- } else if err != nil {
- fmt.Fprintf(w, "%s\n", err)
- }
-}
diff --git a/vendor/github.com/src-d/gcfg/scanner/scanner.go b/vendor/github.com/src-d/gcfg/scanner/scanner.go
deleted file mode 100644
index f1586764..00000000
--- a/vendor/github.com/src-d/gcfg/scanner/scanner.go
+++ /dev/null
@@ -1,342 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package scanner implements a scanner for gcfg configuration text.
-// It takes a []byte as source which can then be tokenized
-// through repeated calls to the Scan method.
-//
-// Note that the API for the scanner package may change to accommodate new
-// features or implementation changes in gcfg.
-//
-package scanner
-
-import (
- "fmt"
- "path/filepath"
- "unicode"
- "unicode/utf8"
-)
-
-import (
- "github.com/src-d/gcfg/token"
-)
-
-// An ErrorHandler may be provided to Scanner.Init. If a syntax error is
-// encountered and a handler was installed, the handler is called with a
-// position and an error message. The position points to the beginning of
-// the offending token.
-//
-type ErrorHandler func(pos token.Position, msg string)
-
-// A Scanner holds the scanner's internal state while processing
-// a given text. It can be allocated as part of another data
-// structure but must be initialized via Init before use.
-//
-type Scanner struct {
- // immutable state
- file *token.File // source file handle
- dir string // directory portion of file.Name()
- src []byte // source
- err ErrorHandler // error reporting; or nil
- mode Mode // scanning mode
-
- // scanning state
- ch rune // current character
- offset int // character offset
- rdOffset int // reading offset (position after current character)
- lineOffset int // current line offset
- nextVal bool // next token is expected to be a value
-
- // public state - ok to modify
- ErrorCount int // number of errors encountered
-}
-
-// Read the next Unicode char into s.ch.
-// s.ch < 0 means end-of-file.
-//
-func (s *Scanner) next() {
- if s.rdOffset < len(s.src) {
- s.offset = s.rdOffset
- if s.ch == '\n' {
- s.lineOffset = s.offset
- s.file.AddLine(s.offset)
- }
- r, w := rune(s.src[s.rdOffset]), 1
- switch {
- case r == 0:
- s.error(s.offset, "illegal character NUL")
- case r >= 0x80:
- // not ASCII
- r, w = utf8.DecodeRune(s.src[s.rdOffset:])
- if r == utf8.RuneError && w == 1 {
- s.error(s.offset, "illegal UTF-8 encoding")
- }
- }
- s.rdOffset += w
- s.ch = r
- } else {
- s.offset = len(s.src)
- if s.ch == '\n' {
- s.lineOffset = s.offset
- s.file.AddLine(s.offset)
- }
- s.ch = -1 // eof
- }
-}
-
-// A mode value is a set of flags (or 0).
-// They control scanner behavior.
-//
-type Mode uint
-
-const (
- ScanComments Mode = 1 << iota // return comments as COMMENT tokens
-)
-
-// Init prepares the scanner s to tokenize the text src by setting the
-// scanner at the beginning of src. The scanner uses the file set file
-// for position information and it adds line information for each line.
-// It is ok to re-use the same file when re-scanning the same file as
-// line information which is already present is ignored. Init causes a
-// panic if the file size does not match the src size.
-//
-// Calls to Scan will invoke the error handler err if they encounter a
-// syntax error and err is not nil. Also, for each error encountered,
-// the Scanner field ErrorCount is incremented by one. The mode parameter
-// determines how comments are handled.
-//
-// Note that Init may call err if there is an error in the first character
-// of the file.
-//
-func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode Mode) {
- // Explicitly initialize all fields since a scanner may be reused.
- if file.Size() != len(src) {
- panic(fmt.Sprintf("file size (%d) does not match src len (%d)", file.Size(), len(src)))
- }
- s.file = file
- s.dir, _ = filepath.Split(file.Name())
- s.src = src
- s.err = err
- s.mode = mode
-
- s.ch = ' '
- s.offset = 0
- s.rdOffset = 0
- s.lineOffset = 0
- s.ErrorCount = 0
- s.nextVal = false
-
- s.next()
-}
-
-func (s *Scanner) error(offs int, msg string) {
- if s.err != nil {
- s.err(s.file.Position(s.file.Pos(offs)), msg)
- }
- s.ErrorCount++
-}
-
-func (s *Scanner) scanComment() string {
- // initial [;#] already consumed
- offs := s.offset - 1 // position of initial [;#]
-
- for s.ch != '\n' && s.ch >= 0 {
- s.next()
- }
- return string(s.src[offs:s.offset])
-}
-
-func isLetter(ch rune) bool {
- return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch >= 0x80 && unicode.IsLetter(ch)
-}
-
-func isDigit(ch rune) bool {
- return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch)
-}
-
-func (s *Scanner) scanIdentifier() string {
- offs := s.offset
- for isLetter(s.ch) || isDigit(s.ch) || s.ch == '-' {
- s.next()
- }
- return string(s.src[offs:s.offset])
-}
-
-func (s *Scanner) scanEscape(val bool) {
- offs := s.offset
- ch := s.ch
- s.next() // always make progress
- switch ch {
- case '\\', '"':
- // ok
- case 'n', 't':
- if val {
- break // ok
- }
- fallthrough
- default:
- s.error(offs, "unknown escape sequence")
- }
-}
-
-func (s *Scanner) scanString() string {
- // '"' opening already consumed
- offs := s.offset - 1
-
- for s.ch != '"' {
- ch := s.ch
- s.next()
- if ch == '\n' || ch < 0 {
- s.error(offs, "string not terminated")
- break
- }
- if ch == '\\' {
- s.scanEscape(false)
- }
- }
-
- s.next()
-
- return string(s.src[offs:s.offset])
-}
-
-func stripCR(b []byte) []byte {
- c := make([]byte, len(b))
- i := 0
- for _, ch := range b {
- if ch != '\r' {
- c[i] = ch
- i++
- }
- }
- return c[:i]
-}
-
-func (s *Scanner) scanValString() string {
- offs := s.offset
-
- hasCR := false
- end := offs
- inQuote := false
-loop:
- for inQuote || s.ch >= 0 && s.ch != '\n' && s.ch != ';' && s.ch != '#' {
- ch := s.ch
- s.next()
- switch {
- case inQuote && ch == '\\':
- s.scanEscape(true)
- case !inQuote && ch == '\\':
- if s.ch == '\r' {
- hasCR = true
- s.next()
- }
- if s.ch != '\n' {
- s.error(offs, "unquoted '\\' must be followed by new line")
- break loop
- }
- s.next()
- case ch == '"':
- inQuote = !inQuote
- case ch == '\r':
- hasCR = true
- case ch < 0 || inQuote && ch == '\n':
- s.error(offs, "string not terminated")
- break loop
- }
- if inQuote || !isWhiteSpace(ch) {
- end = s.offset
- }
- }
-
- lit := s.src[offs:end]
- if hasCR {
- lit = stripCR(lit)
- }
-
- return string(lit)
-}
-
-func isWhiteSpace(ch rune) bool {
- return ch == ' ' || ch == '\t' || ch == '\r'
-}
-
-func (s *Scanner) skipWhitespace() {
- for isWhiteSpace(s.ch) {
- s.next()
- }
-}
-
-// Scan scans the next token and returns the token position, the token,
-// and its literal string if applicable. The source end is indicated by
-// token.EOF.
-//
-// If the returned token is a literal (token.IDENT, token.STRING) or
-// token.COMMENT, the literal string has the corresponding value.
-//
-// If the returned token is token.ILLEGAL, the literal string is the
-// offending character.
-//
-// In all other cases, Scan returns an empty literal string.
-//
-// For more tolerant parsing, Scan will return a valid token if
-// possible even if a syntax error was encountered. Thus, even
-// if the resulting token sequence contains no illegal tokens,
-// a client may not assume that no error occurred. Instead it
-// must check the scanner's ErrorCount or the number of calls
-// of the error handler, if there was one installed.
-//
-// Scan adds line information to the file added to the file
-// set with Init. Token positions are relative to that file
-// and thus relative to the file set.
-//
-func (s *Scanner) Scan() (pos token.Pos, tok token.Token, lit string) {
-scanAgain:
- s.skipWhitespace()
-
- // current token start
- pos = s.file.Pos(s.offset)
-
- // determine token value
- switch ch := s.ch; {
- case s.nextVal:
- lit = s.scanValString()
- tok = token.STRING
- s.nextVal = false
- case isLetter(ch):
- lit = s.scanIdentifier()
- tok = token.IDENT
- default:
- s.next() // always make progress
- switch ch {
- case -1:
- tok = token.EOF
- case '\n':
- tok = token.EOL
- case '"':
- tok = token.STRING
- lit = s.scanString()
- case '[':
- tok = token.LBRACK
- case ']':
- tok = token.RBRACK
- case ';', '#':
- // comment
- lit = s.scanComment()
- if s.mode&ScanComments == 0 {
- // skip comment
- goto scanAgain
- }
- tok = token.COMMENT
- case '=':
- tok = token.ASSIGN
- s.nextVal = true
- default:
- s.error(s.file.Offset(pos), fmt.Sprintf("illegal character %#U", ch))
- tok = token.ILLEGAL
- lit = string(ch)
- }
- }
-
- return
-}
diff --git a/vendor/github.com/src-d/gcfg/set.go b/vendor/github.com/src-d/gcfg/set.go
deleted file mode 100644
index 771258f0..00000000
--- a/vendor/github.com/src-d/gcfg/set.go
+++ /dev/null
@@ -1,332 +0,0 @@
-package gcfg
-
-import (
- "bytes"
- "encoding/gob"
- "fmt"
- "math/big"
- "reflect"
- "strings"
- "unicode"
- "unicode/utf8"
-
- "github.com/src-d/gcfg/types"
- "gopkg.in/warnings.v0"
-)
-
-type tag struct {
- ident string
- intMode string
-}
-
-func newTag(ts string) tag {
- t := tag{}
- s := strings.Split(ts, ",")
- t.ident = s[0]
- for _, tse := range s[1:] {
- if strings.HasPrefix(tse, "int=") {
- t.intMode = tse[len("int="):]
- }
- }
- return t
-}
-
-func fieldFold(v reflect.Value, name string) (reflect.Value, tag) {
- var n string
- r0, _ := utf8.DecodeRuneInString(name)
- if unicode.IsLetter(r0) && !unicode.IsLower(r0) && !unicode.IsUpper(r0) {
- n = "X"
- }
- n += strings.Replace(name, "-", "_", -1)
- f, ok := v.Type().FieldByNameFunc(func(fieldName string) bool {
- if !v.FieldByName(fieldName).CanSet() {
- return false
- }
- f, _ := v.Type().FieldByName(fieldName)
- t := newTag(f.Tag.Get("gcfg"))
- if t.ident != "" {
- return strings.EqualFold(t.ident, name)
- }
- return strings.EqualFold(n, fieldName)
- })
- if !ok {
- return reflect.Value{}, tag{}
- }
- return v.FieldByName(f.Name), newTag(f.Tag.Get("gcfg"))
-}
-
-type setter func(destp interface{}, blank bool, val string, t tag) error
-
-var errUnsupportedType = fmt.Errorf("unsupported type")
-var errBlankUnsupported = fmt.Errorf("blank value not supported for type")
-
-var setters = []setter{
- typeSetter, textUnmarshalerSetter, kindSetter, scanSetter,
-}
-
-func textUnmarshalerSetter(d interface{}, blank bool, val string, t tag) error {
- dtu, ok := d.(textUnmarshaler)
- if !ok {
- return errUnsupportedType
- }
- if blank {
- return errBlankUnsupported
- }
- return dtu.UnmarshalText([]byte(val))
-}
-
-func boolSetter(d interface{}, blank bool, val string, t tag) error {
- if blank {
- reflect.ValueOf(d).Elem().Set(reflect.ValueOf(true))
- return nil
- }
- b, err := types.ParseBool(val)
- if err == nil {
- reflect.ValueOf(d).Elem().Set(reflect.ValueOf(b))
- }
- return err
-}
-
-func intMode(mode string) types.IntMode {
- var m types.IntMode
- if strings.ContainsAny(mode, "dD") {
- m |= types.Dec
- }
- if strings.ContainsAny(mode, "hH") {
- m |= types.Hex
- }
- if strings.ContainsAny(mode, "oO") {
- m |= types.Oct
- }
- return m
-}
-
-var typeModes = map[reflect.Type]types.IntMode{
- reflect.TypeOf(int(0)): types.Dec | types.Hex,
- reflect.TypeOf(int8(0)): types.Dec | types.Hex,
- reflect.TypeOf(int16(0)): types.Dec | types.Hex,
- reflect.TypeOf(int32(0)): types.Dec | types.Hex,
- reflect.TypeOf(int64(0)): types.Dec | types.Hex,
- reflect.TypeOf(uint(0)): types.Dec | types.Hex,
- reflect.TypeOf(uint8(0)): types.Dec | types.Hex,
- reflect.TypeOf(uint16(0)): types.Dec | types.Hex,
- reflect.TypeOf(uint32(0)): types.Dec | types.Hex,
- reflect.TypeOf(uint64(0)): types.Dec | types.Hex,
- // use default mode (allow dec/hex/oct) for uintptr type
- reflect.TypeOf(big.Int{}): types.Dec | types.Hex,
-}
-
-func intModeDefault(t reflect.Type) types.IntMode {
- m, ok := typeModes[t]
- if !ok {
- m = types.Dec | types.Hex | types.Oct
- }
- return m
-}
-
-func intSetter(d interface{}, blank bool, val string, t tag) error {
- if blank {
- return errBlankUnsupported
- }
- mode := intMode(t.intMode)
- if mode == 0 {
- mode = intModeDefault(reflect.TypeOf(d).Elem())
- }
- return types.ParseInt(d, val, mode)
-}
-
-func stringSetter(d interface{}, blank bool, val string, t tag) error {
- if blank {
- return errBlankUnsupported
- }
- dsp, ok := d.(*string)
- if !ok {
- return errUnsupportedType
- }
- *dsp = val
- return nil
-}
-
-var kindSetters = map[reflect.Kind]setter{
- reflect.String: stringSetter,
- reflect.Bool: boolSetter,
- reflect.Int: intSetter,
- reflect.Int8: intSetter,
- reflect.Int16: intSetter,
- reflect.Int32: intSetter,
- reflect.Int64: intSetter,
- reflect.Uint: intSetter,
- reflect.Uint8: intSetter,
- reflect.Uint16: intSetter,
- reflect.Uint32: intSetter,
- reflect.Uint64: intSetter,
- reflect.Uintptr: intSetter,
-}
-
-var typeSetters = map[reflect.Type]setter{
- reflect.TypeOf(big.Int{}): intSetter,
-}
-
-func typeSetter(d interface{}, blank bool, val string, tt tag) error {
- t := reflect.ValueOf(d).Type().Elem()
- setter, ok := typeSetters[t]
- if !ok {
- return errUnsupportedType
- }
- return setter(d, blank, val, tt)
-}
-
-func kindSetter(d interface{}, blank bool, val string, tt tag) error {
- k := reflect.ValueOf(d).Type().Elem().Kind()
- setter, ok := kindSetters[k]
- if !ok {
- return errUnsupportedType
- }
- return setter(d, blank, val, tt)
-}
-
-func scanSetter(d interface{}, blank bool, val string, tt tag) error {
- if blank {
- return errBlankUnsupported
- }
- return types.ScanFully(d, val, 'v')
-}
-
-func newValue(c *warnings.Collector, sect string, vCfg reflect.Value,
- vType reflect.Type) (reflect.Value, error) {
- //
- pv := reflect.New(vType)
- dfltName := "default-" + sect
- dfltField, _ := fieldFold(vCfg, dfltName)
- var err error
- if dfltField.IsValid() {
- b := bytes.NewBuffer(nil)
- ge := gob.NewEncoder(b)
- if err = c.Collect(ge.EncodeValue(dfltField)); err != nil {
- return pv, err
- }
- gd := gob.NewDecoder(bytes.NewReader(b.Bytes()))
- if err = c.Collect(gd.DecodeValue(pv.Elem())); err != nil {
- return pv, err
- }
- }
- return pv, nil
-}
-
-func set(c *warnings.Collector, cfg interface{}, sect, sub, name string,
- value string, blankValue bool, subsectPass bool) error {
- //
- vPCfg := reflect.ValueOf(cfg)
- if vPCfg.Kind() != reflect.Ptr || vPCfg.Elem().Kind() != reflect.Struct {
- panic(fmt.Errorf("config must be a pointer to a struct"))
- }
- vCfg := vPCfg.Elem()
- vSect, _ := fieldFold(vCfg, sect)
- if !vSect.IsValid() {
- err := extraData{section: sect}
- return c.Collect(err)
- }
- isSubsect := vSect.Kind() == reflect.Map
- if subsectPass != isSubsect {
- return nil
- }
- if isSubsect {
- vst := vSect.Type()
- if vst.Key().Kind() != reflect.String ||
- vst.Elem().Kind() != reflect.Ptr ||
- vst.Elem().Elem().Kind() != reflect.Struct {
- panic(fmt.Errorf("map field for section must have string keys and "+
- " pointer-to-struct values: section %q", sect))
- }
- if vSect.IsNil() {
- vSect.Set(reflect.MakeMap(vst))
- }
- k := reflect.ValueOf(sub)
- pv := vSect.MapIndex(k)
- if !pv.IsValid() {
- vType := vSect.Type().Elem().Elem()
- var err error
- if pv, err = newValue(c, sect, vCfg, vType); err != nil {
- return err
- }
- vSect.SetMapIndex(k, pv)
- }
- vSect = pv.Elem()
- } else if vSect.Kind() != reflect.Struct {
- panic(fmt.Errorf("field for section must be a map or a struct: "+
- "section %q", sect))
- } else if sub != "" {
- err := extraData{section: sect, subsection: &sub}
- return c.Collect(err)
- }
- // Empty name is a special value, meaning that only the
- // section/subsection object is to be created, with no values set.
- if name == "" {
- return nil
- }
- vVar, t := fieldFold(vSect, name)
- if !vVar.IsValid() {
- var err error
- if isSubsect {
- err = extraData{section: sect, subsection: &sub, variable: &name}
- } else {
- err = extraData{section: sect, variable: &name}
- }
- return c.Collect(err)
- }
- // vVal is either single-valued var, or newly allocated value within multi-valued var
- var vVal reflect.Value
- // multi-value if unnamed slice type
- isMulti := vVar.Type().Name() == "" && vVar.Kind() == reflect.Slice ||
- vVar.Type().Name() == "" && vVar.Kind() == reflect.Ptr && vVar.Type().Elem().Name() == "" && vVar.Type().Elem().Kind() == reflect.Slice
- if isMulti && vVar.Kind() == reflect.Ptr {
- if vVar.IsNil() {
- vVar.Set(reflect.New(vVar.Type().Elem()))
- }
- vVar = vVar.Elem()
- }
- if isMulti && blankValue {
- vVar.Set(reflect.Zero(vVar.Type()))
- return nil
- }
- if isMulti {
- vVal = reflect.New(vVar.Type().Elem()).Elem()
- } else {
- vVal = vVar
- }
- isDeref := vVal.Type().Name() == "" && vVal.Type().Kind() == reflect.Ptr
- isNew := isDeref && vVal.IsNil()
- // vAddr is address of value to set (dereferenced & allocated as needed)
- var vAddr reflect.Value
- switch {
- case isNew:
- vAddr = reflect.New(vVal.Type().Elem())
- case isDeref && !isNew:
- vAddr = vVal
- default:
- vAddr = vVal.Addr()
- }
- vAddrI := vAddr.Interface()
- err, ok := error(nil), false
- for _, s := range setters {
- err = s(vAddrI, blankValue, value, t)
- if err == nil {
- ok = true
- break
- }
- if err != errUnsupportedType {
- return err
- }
- }
- if !ok {
- // in case all setters returned errUnsupportedType
- return err
- }
- if isNew { // set reference if it was dereferenced and newly allocated
- vVal.Set(vAddr)
- }
- if isMulti { // append if multi-valued
- vVar.Set(reflect.Append(vVar, vVal))
- }
- return nil
-}
diff --git a/vendor/github.com/src-d/gcfg/token/position.go b/vendor/github.com/src-d/gcfg/token/position.go
deleted file mode 100644
index fc45c1e7..00000000
--- a/vendor/github.com/src-d/gcfg/token/position.go
+++ /dev/null
@@ -1,435 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// TODO(gri) consider making this a separate package outside the go directory.
-
-package token
-
-import (
- "fmt"
- "sort"
- "sync"
-)
-
-// -----------------------------------------------------------------------------
-// Positions
-
-// Position describes an arbitrary source position
-// including the file, line, and column location.
-// A Position is valid if the line number is > 0.
-//
-type Position struct {
- Filename string // filename, if any
- Offset int // offset, starting at 0
- Line int // line number, starting at 1
- Column int // column number, starting at 1 (character count)
-}
-
-// IsValid returns true if the position is valid.
-func (pos *Position) IsValid() bool { return pos.Line > 0 }
-
-// String returns a string in one of several forms:
-//
-// file:line:column valid position with file name
-// line:column valid position without file name
-// file invalid position with file name
-// - invalid position without file name
-//
-func (pos Position) String() string {
- s := pos.Filename
- if pos.IsValid() {
- if s != "" {
- s += ":"
- }
- s += fmt.Sprintf("%d:%d", pos.Line, pos.Column)
- }
- if s == "" {
- s = "-"
- }
- return s
-}
-
-// Pos is a compact encoding of a source position within a file set.
-// It can be converted into a Position for a more convenient, but much
-// larger, representation.
-//
-// The Pos value for a given file is a number in the range [base, base+size],
-// where base and size are specified when adding the file to the file set via
-// AddFile.
-//
-// To create the Pos value for a specific source offset, first add
-// the respective file to the current file set (via FileSet.AddFile)
-// and then call File.Pos(offset) for that file. Given a Pos value p
-// for a specific file set fset, the corresponding Position value is
-// obtained by calling fset.Position(p).
-//
-// Pos values can be compared directly with the usual comparison operators:
-// If two Pos values p and q are in the same file, comparing p and q is
-// equivalent to comparing the respective source file offsets. If p and q
-// are in different files, p < q is true if the file implied by p was added
-// to the respective file set before the file implied by q.
-//
-type Pos int
-
-// The zero value for Pos is NoPos; there is no file and line information
-// associated with it, and NoPos().IsValid() is false. NoPos is always
-// smaller than any other Pos value. The corresponding Position value
-// for NoPos is the zero value for Position.
-//
-const NoPos Pos = 0
-
-// IsValid returns true if the position is valid.
-func (p Pos) IsValid() bool {
- return p != NoPos
-}
-
-// -----------------------------------------------------------------------------
-// File
-
-// A File is a handle for a file belonging to a FileSet.
-// A File has a name, size, and line offset table.
-//
-type File struct {
- set *FileSet
- name string // file name as provided to AddFile
- base int // Pos value range for this file is [base...base+size]
- size int // file size as provided to AddFile
-
- // lines and infos are protected by set.mutex
- lines []int
- infos []lineInfo
-}
-
-// Name returns the file name of file f as registered with AddFile.
-func (f *File) Name() string {
- return f.name
-}
-
-// Base returns the base offset of file f as registered with AddFile.
-func (f *File) Base() int {
- return f.base
-}
-
-// Size returns the size of file f as registered with AddFile.
-func (f *File) Size() int {
- return f.size
-}
-
-// LineCount returns the number of lines in file f.
-func (f *File) LineCount() int {
- f.set.mutex.RLock()
- n := len(f.lines)
- f.set.mutex.RUnlock()
- return n
-}
-
-// AddLine adds the line offset for a new line.
-// The line offset must be larger than the offset for the previous line
-// and smaller than the file size; otherwise the line offset is ignored.
-//
-func (f *File) AddLine(offset int) {
- f.set.mutex.Lock()
- if i := len(f.lines); (i == 0 || f.lines[i-1] < offset) && offset < f.size {
- f.lines = append(f.lines, offset)
- }
- f.set.mutex.Unlock()
-}
-
-// SetLines sets the line offsets for a file and returns true if successful.
-// The line offsets are the offsets of the first character of each line;
-// for instance for the content "ab\nc\n" the line offsets are {0, 3}.
-// An empty file has an empty line offset table.
-// Each line offset must be larger than the offset for the previous line
-// and smaller than the file size; otherwise SetLines fails and returns
-// false.
-//
-func (f *File) SetLines(lines []int) bool {
- // verify validity of lines table
- size := f.size
- for i, offset := range lines {
- if i > 0 && offset <= lines[i-1] || size <= offset {
- return false
- }
- }
-
- // set lines table
- f.set.mutex.Lock()
- f.lines = lines
- f.set.mutex.Unlock()
- return true
-}
-
-// SetLinesForContent sets the line offsets for the given file content.
-func (f *File) SetLinesForContent(content []byte) {
- var lines []int
- line := 0
- for offset, b := range content {
- if line >= 0 {
- lines = append(lines, line)
- }
- line = -1
- if b == '\n' {
- line = offset + 1
- }
- }
-
- // set lines table
- f.set.mutex.Lock()
- f.lines = lines
- f.set.mutex.Unlock()
-}
-
-// A lineInfo object describes alternative file and line number
-// information (such as provided via a //line comment in a .go
-// file) for a given file offset.
-type lineInfo struct {
- // fields are exported to make them accessible to gob
- Offset int
- Filename string
- Line int
-}
-
-// AddLineInfo adds alternative file and line number information for
-// a given file offset. The offset must be larger than the offset for
-// the previously added alternative line info and smaller than the
-// file size; otherwise the information is ignored.
-//
-// AddLineInfo is typically used to register alternative position
-// information for //line filename:line comments in source files.
-//
-func (f *File) AddLineInfo(offset int, filename string, line int) {
- f.set.mutex.Lock()
- if i := len(f.infos); i == 0 || f.infos[i-1].Offset < offset && offset < f.size {
- f.infos = append(f.infos, lineInfo{offset, filename, line})
- }
- f.set.mutex.Unlock()
-}
-
-// Pos returns the Pos value for the given file offset;
-// the offset must be <= f.Size().
-// f.Pos(f.Offset(p)) == p.
-//
-func (f *File) Pos(offset int) Pos {
- if offset > f.size {
- panic("illegal file offset")
- }
- return Pos(f.base + offset)
-}
-
-// Offset returns the offset for the given file position p;
-// p must be a valid Pos value in that file.
-// f.Offset(f.Pos(offset)) == offset.
-//
-func (f *File) Offset(p Pos) int {
- if int(p) < f.base || int(p) > f.base+f.size {
- panic("illegal Pos value")
- }
- return int(p) - f.base
-}
-
-// Line returns the line number for the given file position p;
-// p must be a Pos value in that file or NoPos.
-//
-func (f *File) Line(p Pos) int {
- // TODO(gri) this can be implemented much more efficiently
- return f.Position(p).Line
-}
-
-func searchLineInfos(a []lineInfo, x int) int {
- return sort.Search(len(a), func(i int) bool { return a[i].Offset > x }) - 1
-}
-
-// info returns the file name, line, and column number for a file offset.
-func (f *File) info(offset int) (filename string, line, column int) {
- filename = f.name
- if i := searchInts(f.lines, offset); i >= 0 {
- line, column = i+1, offset-f.lines[i]+1
- }
- if len(f.infos) > 0 {
- // almost no files have extra line infos
- if i := searchLineInfos(f.infos, offset); i >= 0 {
- alt := &f.infos[i]
- filename = alt.Filename
- if i := searchInts(f.lines, alt.Offset); i >= 0 {
- line += alt.Line - i - 1
- }
- }
- }
- return
-}
-
-func (f *File) position(p Pos) (pos Position) {
- offset := int(p) - f.base
- pos.Offset = offset
- pos.Filename, pos.Line, pos.Column = f.info(offset)
- return
-}
-
-// Position returns the Position value for the given file position p;
-// p must be a Pos value in that file or NoPos.
-//
-func (f *File) Position(p Pos) (pos Position) {
- if p != NoPos {
- if int(p) < f.base || int(p) > f.base+f.size {
- panic("illegal Pos value")
- }
- pos = f.position(p)
- }
- return
-}
-
-// -----------------------------------------------------------------------------
-// FileSet
-
-// A FileSet represents a set of source files.
-// Methods of file sets are synchronized; multiple goroutines
-// may invoke them concurrently.
-//
-type FileSet struct {
- mutex sync.RWMutex // protects the file set
- base int // base offset for the next file
- files []*File // list of files in the order added to the set
- last *File // cache of last file looked up
-}
-
-// NewFileSet creates a new file set.
-func NewFileSet() *FileSet {
- s := new(FileSet)
- s.base = 1 // 0 == NoPos
- return s
-}
-
-// Base returns the minimum base offset that must be provided to
-// AddFile when adding the next file.
-//
-func (s *FileSet) Base() int {
- s.mutex.RLock()
- b := s.base
- s.mutex.RUnlock()
- return b
-
-}
-
-// AddFile adds a new file with a given filename, base offset, and file size
-// to the file set s and returns the file. Multiple files may have the same
-// name. The base offset must not be smaller than the FileSet's Base(), and
-// size must not be negative.
-//
-// Adding the file will set the file set's Base() value to base + size + 1
-// as the minimum base value for the next file. The following relationship
-// exists between a Pos value p for a given file offset offs:
-//
-// int(p) = base + offs
-//
-// with offs in the range [0, size] and thus p in the range [base, base+size].
-// For convenience, File.Pos may be used to create file-specific position
-// values from a file offset.
-//
-func (s *FileSet) AddFile(filename string, base, size int) *File {
- s.mutex.Lock()
- defer s.mutex.Unlock()
- if base < s.base || size < 0 {
- panic("illegal base or size")
- }
- // base >= s.base && size >= 0
- f := &File{s, filename, base, size, []int{0}, nil}
- base += size + 1 // +1 because EOF also has a position
- if base < 0 {
- panic("token.Pos offset overflow (> 2G of source code in file set)")
- }
- // add the file to the file set
- s.base = base
- s.files = append(s.files, f)
- s.last = f
- return f
-}
-
-// Iterate calls f for the files in the file set in the order they were added
-// until f returns false.
-//
-func (s *FileSet) Iterate(f func(*File) bool) {
- for i := 0; ; i++ {
- var file *File
- s.mutex.RLock()
- if i < len(s.files) {
- file = s.files[i]
- }
- s.mutex.RUnlock()
- if file == nil || !f(file) {
- break
- }
- }
-}
-
-func searchFiles(a []*File, x int) int {
- return sort.Search(len(a), func(i int) bool { return a[i].base > x }) - 1
-}
-
-func (s *FileSet) file(p Pos) *File {
- // common case: p is in last file
- if f := s.last; f != nil && f.base <= int(p) && int(p) <= f.base+f.size {
- return f
- }
- // p is not in last file - search all files
- if i := searchFiles(s.files, int(p)); i >= 0 {
- f := s.files[i]
- // f.base <= int(p) by definition of searchFiles
- if int(p) <= f.base+f.size {
- s.last = f
- return f
- }
- }
- return nil
-}
-
-// File returns the file that contains the position p.
-// If no such file is found (for instance for p == NoPos),
-// the result is nil.
-//
-func (s *FileSet) File(p Pos) (f *File) {
- if p != NoPos {
- s.mutex.RLock()
- f = s.file(p)
- s.mutex.RUnlock()
- }
- return
-}
-
-// Position converts a Pos in the fileset into a general Position.
-func (s *FileSet) Position(p Pos) (pos Position) {
- if p != NoPos {
- s.mutex.RLock()
- if f := s.file(p); f != nil {
- pos = f.position(p)
- }
- s.mutex.RUnlock()
- }
- return
-}
-
-// -----------------------------------------------------------------------------
-// Helper functions
-
-func searchInts(a []int, x int) int {
- // This function body is a manually inlined version of:
- //
- // return sort.Search(len(a), func(i int) bool { return a[i] > x }) - 1
- //
- // With better compiler optimizations, this may not be needed in the
- // future, but at the moment this change improves the go/printer
- // benchmark performance by ~30%. This has a direct impact on the
- // speed of gofmt and thus seems worthwhile (2011-04-29).
- // TODO(gri): Remove this when compilers have caught up.
- i, j := 0, len(a)
- for i < j {
- h := i + (j-i)/2 // avoid overflow when computing h
- // i ≤ h < j
- if a[h] <= x {
- i = h + 1
- } else {
- j = h
- }
- }
- return i - 1
-}
diff --git a/vendor/github.com/src-d/gcfg/token/serialize.go b/vendor/github.com/src-d/gcfg/token/serialize.go
deleted file mode 100644
index 4adc8f9e..00000000
--- a/vendor/github.com/src-d/gcfg/token/serialize.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package token
-
-type serializedFile struct {
- // fields correspond 1:1 to fields with same (lower-case) name in File
- Name string
- Base int
- Size int
- Lines []int
- Infos []lineInfo
-}
-
-type serializedFileSet struct {
- Base int
- Files []serializedFile
-}
-
-// Read calls decode to deserialize a file set into s; s must not be nil.
-func (s *FileSet) Read(decode func(interface{}) error) error {
- var ss serializedFileSet
- if err := decode(&ss); err != nil {
- return err
- }
-
- s.mutex.Lock()
- s.base = ss.Base
- files := make([]*File, len(ss.Files))
- for i := 0; i < len(ss.Files); i++ {
- f := &ss.Files[i]
- files[i] = &File{s, f.Name, f.Base, f.Size, f.Lines, f.Infos}
- }
- s.files = files
- s.last = nil
- s.mutex.Unlock()
-
- return nil
-}
-
-// Write calls encode to serialize the file set s.
-func (s *FileSet) Write(encode func(interface{}) error) error {
- var ss serializedFileSet
-
- s.mutex.Lock()
- ss.Base = s.base
- files := make([]serializedFile, len(s.files))
- for i, f := range s.files {
- files[i] = serializedFile{f.name, f.base, f.size, f.lines, f.infos}
- }
- ss.Files = files
- s.mutex.Unlock()
-
- return encode(ss)
-}
diff --git a/vendor/github.com/src-d/gcfg/token/token.go b/vendor/github.com/src-d/gcfg/token/token.go
deleted file mode 100644
index b3c7c83f..00000000
--- a/vendor/github.com/src-d/gcfg/token/token.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package token defines constants representing the lexical tokens of the gcfg
-// configuration syntax and basic operations on tokens (printing, predicates).
-//
-// Note that the API for the token package may change to accommodate new
-// features or implementation changes in gcfg.
-//
-package token
-
-import "strconv"
-
-// Token is the set of lexical tokens of the gcfg configuration syntax.
-type Token int
-
-// The list of tokens.
-const (
- // Special tokens
- ILLEGAL Token = iota
- EOF
- COMMENT
-
- literal_beg
- // Identifiers and basic type literals
- // (these tokens stand for classes of literals)
- IDENT // section-name, variable-name
- STRING // "subsection-name", variable value
- literal_end
-
- operator_beg
- // Operators and delimiters
- ASSIGN // =
- LBRACK // [
- RBRACK // ]
- EOL // \n
- operator_end
-)
-
-var tokens = [...]string{
- ILLEGAL: "ILLEGAL",
-
- EOF: "EOF",
- COMMENT: "COMMENT",
-
- IDENT: "IDENT",
- STRING: "STRING",
-
- ASSIGN: "=",
- LBRACK: "[",
- RBRACK: "]",
- EOL: "\n",
-}
-
-// String returns the string corresponding to the token tok.
-// For operators and delimiters, the string is the actual token character
-// sequence (e.g., for the token ASSIGN, the string is "="). For all other
-// tokens the string corresponds to the token constant name (e.g. for the
-// token IDENT, the string is "IDENT").
-//
-func (tok Token) String() string {
- s := ""
- if 0 <= tok && tok < Token(len(tokens)) {
- s = tokens[tok]
- }
- if s == "" {
- s = "token(" + strconv.Itoa(int(tok)) + ")"
- }
- return s
-}
-
-// Predicates
-
-// IsLiteral returns true for tokens corresponding to identifiers
-// and basic type literals; it returns false otherwise.
-//
-func (tok Token) IsLiteral() bool { return literal_beg < tok && tok < literal_end }
-
-// IsOperator returns true for tokens corresponding to operators and
-// delimiters; it returns false otherwise.
-//
-func (tok Token) IsOperator() bool { return operator_beg < tok && tok < operator_end }
diff --git a/vendor/github.com/src-d/gcfg/types/bool.go b/vendor/github.com/src-d/gcfg/types/bool.go
deleted file mode 100644
index 8dcae0d8..00000000
--- a/vendor/github.com/src-d/gcfg/types/bool.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package types
-
-// BoolValues defines the name and value mappings for ParseBool.
-var BoolValues = map[string]interface{}{
- "true": true, "yes": true, "on": true, "1": true,
- "false": false, "no": false, "off": false, "0": false,
-}
-
-var boolParser = func() *EnumParser {
- ep := &EnumParser{}
- ep.AddVals(BoolValues)
- return ep
-}()
-
-// ParseBool parses bool values according to the definitions in BoolValues.
-// Parsing is case-insensitive.
-func ParseBool(s string) (bool, error) {
- v, err := boolParser.Parse(s)
- if err != nil {
- return false, err
- }
- return v.(bool), nil
-}
diff --git a/vendor/github.com/src-d/gcfg/types/doc.go b/vendor/github.com/src-d/gcfg/types/doc.go
deleted file mode 100644
index 9f9c345f..00000000
--- a/vendor/github.com/src-d/gcfg/types/doc.go
+++ /dev/null
@@ -1,4 +0,0 @@
-// Package types defines helpers for type conversions.
-//
-// The API for this package is not finalized yet.
-package types
diff --git a/vendor/github.com/src-d/gcfg/types/enum.go b/vendor/github.com/src-d/gcfg/types/enum.go
deleted file mode 100644
index 1a0c7ef4..00000000
--- a/vendor/github.com/src-d/gcfg/types/enum.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package types
-
-import (
- "fmt"
- "reflect"
- "strings"
-)
-
-// EnumParser parses "enum" values; i.e. a predefined set of strings to
-// predefined values.
-type EnumParser struct {
- Type string // type name; if not set, use type of first value added
- CaseMatch bool // if true, matching of strings is case-sensitive
- // PrefixMatch bool
- vals map[string]interface{}
-}
-
-// AddVals adds strings and values to an EnumParser.
-func (ep *EnumParser) AddVals(vals map[string]interface{}) {
- if ep.vals == nil {
- ep.vals = make(map[string]interface{})
- }
- for k, v := range vals {
- if ep.Type == "" {
- ep.Type = reflect.TypeOf(v).Name()
- }
- if !ep.CaseMatch {
- k = strings.ToLower(k)
- }
- ep.vals[k] = v
- }
-}
-
-// Parse parses the string and returns the value or an error.
-func (ep EnumParser) Parse(s string) (interface{}, error) {
- if !ep.CaseMatch {
- s = strings.ToLower(s)
- }
- v, ok := ep.vals[s]
- if !ok {
- return false, fmt.Errorf("failed to parse %s %#q", ep.Type, s)
- }
- return v, nil
-}
diff --git a/vendor/github.com/src-d/gcfg/types/int.go b/vendor/github.com/src-d/gcfg/types/int.go
deleted file mode 100644
index af7e75c1..00000000
--- a/vendor/github.com/src-d/gcfg/types/int.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package types
-
-import (
- "fmt"
- "strings"
-)
-
-// An IntMode is a mode for parsing integer values, representing a set of
-// accepted bases.
-type IntMode uint8
-
-// IntMode values for ParseInt; can be combined using binary or.
-const (
- Dec IntMode = 1 << iota
- Hex
- Oct
-)
-
-// String returns a string representation of IntMode; e.g. `IntMode(Dec|Hex)`.
-func (m IntMode) String() string {
- var modes []string
- if m&Dec != 0 {
- modes = append(modes, "Dec")
- }
- if m&Hex != 0 {
- modes = append(modes, "Hex")
- }
- if m&Oct != 0 {
- modes = append(modes, "Oct")
- }
- return "IntMode(" + strings.Join(modes, "|") + ")"
-}
-
-var errIntAmbig = fmt.Errorf("ambiguous integer value; must include '0' prefix")
-
-func prefix0(val string) bool {
- return strings.HasPrefix(val, "0") || strings.HasPrefix(val, "-0")
-}
-
-func prefix0x(val string) bool {
- return strings.HasPrefix(val, "0x") || strings.HasPrefix(val, "-0x")
-}
-
-// ParseInt parses val using mode into intptr, which must be a pointer to an
-// integer kind type. Non-decimal value require prefix `0` or `0x` in the cases
-// when mode permits ambiguity of base; otherwise the prefix can be omitted.
-func ParseInt(intptr interface{}, val string, mode IntMode) error {
- val = strings.TrimSpace(val)
- verb := byte(0)
- switch mode {
- case Dec:
- verb = 'd'
- case Dec + Hex:
- if prefix0x(val) {
- verb = 'v'
- } else {
- verb = 'd'
- }
- case Dec + Oct:
- if prefix0(val) && !prefix0x(val) {
- verb = 'v'
- } else {
- verb = 'd'
- }
- case Dec + Hex + Oct:
- verb = 'v'
- case Hex:
- if prefix0x(val) {
- verb = 'v'
- } else {
- verb = 'x'
- }
- case Oct:
- verb = 'o'
- case Hex + Oct:
- if prefix0(val) {
- verb = 'v'
- } else {
- return errIntAmbig
- }
- }
- if verb == 0 {
- panic("unsupported mode")
- }
- return ScanFully(intptr, val, verb)
-}
diff --git a/vendor/github.com/src-d/gcfg/types/scan.go b/vendor/github.com/src-d/gcfg/types/scan.go
deleted file mode 100644
index db2f6ed3..00000000
--- a/vendor/github.com/src-d/gcfg/types/scan.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package types
-
-import (
- "fmt"
- "io"
- "reflect"
-)
-
-// ScanFully uses fmt.Sscanf with verb to fully scan val into ptr.
-func ScanFully(ptr interface{}, val string, verb byte) error {
- t := reflect.ValueOf(ptr).Elem().Type()
- // attempt to read extra bytes to make sure the value is consumed
- var b []byte
- n, err := fmt.Sscanf(val, "%"+string(verb)+"%s", ptr, &b)
- switch {
- case n < 1 || n == 1 && err != io.EOF:
- return fmt.Errorf("failed to parse %q as %v: %v", val, t, err)
- case n > 1:
- return fmt.Errorf("failed to parse %q as %v: extra characters %q", val, t, string(b))
- }
- // n == 1 && err == io.EOF
- return nil
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/.gitignore b/vendor/github.com/xanzy/go-gitlab/.gitignore
deleted file mode 100644
index 0c9e3298..00000000
--- a/vendor/github.com/xanzy/go-gitlab/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-.idea
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/xanzy/go-gitlab/.travis.yml b/vendor/github.com/xanzy/go-gitlab/.travis.yml
deleted file mode 100644
index ba6c6c71..00000000
--- a/vendor/github.com/xanzy/go-gitlab/.travis.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-language: go
-
-go:
- - 1.8.x
- - 1.9.x
- - 1.10.x
- - master
-
-stages:
- - lint
- - test
-
-jobs:
- include:
- - stage: lint
- script:
- - go get golang.org/x/lint/golint
- - golint -set_exit_status
- - go vet -v
- - stage: test
- script:
- - go test -v
-
-matrix:
- allow_failures:
- - go: master
- fast_finish: true
diff --git a/vendor/github.com/xanzy/go-gitlab/CHANGELOG.md b/vendor/github.com/xanzy/go-gitlab/CHANGELOG.md
deleted file mode 100644
index 29e93fff..00000000
--- a/vendor/github.com/xanzy/go-gitlab/CHANGELOG.md
+++ /dev/null
@@ -1,27 +0,0 @@
-go-github CHANGELOG
-===================
-
-0.6.0
------
-- Add support for the V4 Gitlab API. This means the older V3 API is no longer fully supported
- with this version. If you still need that version, please use the `f-api-v3` branch.
-
-0.4.0
------
-- Add support to use [`sudo`](https://docs.gitlab.com/ce/api/README.html#sudo) for all API calls.
-- Add support for the Notification Settings API.
-- Add support for the Time Tracking API.
-- Make sure that the error response correctly outputs any returned errors.
-- And a reasonable number of smaller enhanchements and bugfixes.
-
-0.3.0
------
-- Moved the tags related API calls to their own service, following the Gitlab API structure.
-
-0.2.0
------
-- Convert all Option structs to use pointers for their fields.
-
-0.1.0
------
-- Initial release.
diff --git a/vendor/github.com/xanzy/go-gitlab/LICENSE b/vendor/github.com/xanzy/go-gitlab/LICENSE
deleted file mode 100644
index e06d2081..00000000
--- a/vendor/github.com/xanzy/go-gitlab/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- 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.
-
diff --git a/vendor/github.com/xanzy/go-gitlab/README.md b/vendor/github.com/xanzy/go-gitlab/README.md
deleted file mode 100644
index de345b4a..00000000
--- a/vendor/github.com/xanzy/go-gitlab/README.md
+++ /dev/null
@@ -1,171 +0,0 @@
-# go-gitlab
-
-A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way
-
-[](https://travis-ci.org/xanzy/go-gitlab)
-[](https://github.com/xanzy/go-gitlab/blob/master/LICENSE)
-[](https://sourcegraph.com/github.com/xanzy/go-gitlab?badge)
-[](https://godoc.org/github.com/xanzy/go-gitlab)
-[](https://goreportcard.com/report/github.com/xanzy/go-gitlab)
-[](https://github.com/xanzy/go-gitlab/issues)
-
-## NOTE
-
-Release v0.6.0 (released on 25-08-2017) no longer supports the older V3 Gitlab API. If
-you need V3 support, please use the `f-api-v3` branch. This release contains some backwards
-incompatible changes that were needed to fully support the V4 Gitlab API.
-
-## Coverage
-
-This API client package covers most of the existing Gitlab API calls and is updated regularly
-to add new and/or missing endpoints. Currently the following services are supported:
-
-- [x] Award Emojis
-- [x] Branches
-- [x] Broadcast Messages
-- [x] Project-level Variables
-- [x] Group-level Variables
-- [x] Commits
-- [x] Custom Attributes
-- [x] Deployments
-- [x] Deploy Keys
-- [x] Environments
-- [ ] Epics
-- [ ] Epic Issues
-- [x] Events
-- [x] Feature flags
-- [ ] Geo Nodes
-- [x] Gitignores templates
-- [x] GitLab CI Config templates
-- [x] Groups
-- [x] Group Access Requests
-- [x] Group Members
-- [x] Issues
-- [x] Issue Boards
-- [x] Group Issue Boards
-- [x] Jobs
-- [x] Keys
-- [x] Labels
-- [ ] License
-- [x] Merge Requests
-- [x] Merge Request Approvals
-- [x] Project Milestones
-- [x] Group Milestones
-- [x] Namespaces
-- [x] Notes (comments)
-- [ ] Discussions (threaded comments)
-- [x] Notification settings
-- [x] Open source license templates
-- [x] Pages Domains
-- [x] Pipelines
-- [x] Pipeline Triggers
-- [x] Pipeline Schedules
-- [x] Projects (including setting Webhooks)
-- [x] Project Access Requests
-- [x] Project badges
-- [ ] Project import/export
-- [x] Project Members
-- [x] Project Snippets
-- [x] Protected Branches
-- [x] Repositories
-- [x] Repository Files
-- [x] Runners
-- [x] Search
-- [x] Services
-- [x] Settings
-- [x] Sidekiq metrics
-- [x] Session
-- [x] System Hooks
-- [x] Tags
-- [x] Todos
-- [x] Users
-- [x] Validate CI configuration
-- [x] Version
-- [x] Wikis
-
-## Usage
-
-```go
-import "github.com/xanzy/go-gitlab"
-```
-
-Construct a new GitLab client, then use the various services on the client to
-access different parts of the GitLab API. For example, to list all
-users:
-
-```go
-git := gitlab.NewClient(nil, "yourtokengoeshere")
-//git.SetBaseURL("https://git.mydomain.com/api/v3")
-users, _, err := git.Users.ListUsers()
-```
-
-Some API methods have optional parameters that can be passed. For example,
-to list all projects for user "svanharmelen":
-
-```go
-git := gitlab.NewClient(nil)
-opt := &ListProjectsOptions{Search: gitlab.String("svanharmelen")}
-projects, _, err := git.Projects.ListProjects(opt)
-```
-
-### Examples
-
-The [examples](https://github.com/xanzy/go-gitlab/tree/master/examples) directory
-contains a couple for clear examples, of which one is partially listed here as well:
-
-```go
-package main
-
-import (
- "log"
-
- "github.com/xanzy/go-gitlab"
-)
-
-func main() {
- git := gitlab.NewClient(nil, "yourtokengoeshere")
-
- // Create new project
- p := &gitlab.CreateProjectOptions{
- Name: gitlab.String("My Project"),
- Description: gitlab.String("Just a test project to play with"),
- MergeRequestsEnabled: gitlab.Bool(true),
- SnippetsEnabled: gitlab.Bool(true),
- Visibility: gitlab.Visibility(gitlab.PublicVisibility),
- }
- project, _, err := git.Projects.CreateProject(p)
- if err != nil {
- log.Fatal(err)
- }
-
- // Add a new snippet
- s := &gitlab.CreateProjectSnippetOptions{
- Title: gitlab.String("Dummy Snippet"),
- FileName: gitlab.String("snippet.go"),
- Code: gitlab.String("package main...."),
- Visibility: gitlab.Visibility(gitlab.PublicVisibility),
- }
- _, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-For complete usage of go-gitlab, see the full [package docs](https://godoc.org/github.com/xanzy/go-gitlab).
-
-## ToDo
-
-- The biggest thing this package still needs is tests :disappointed:
-
-## Issues
-
-- If you have an issue: report it on the [issue tracker](https://github.com/xanzy/go-gitlab/issues)
-
-## Author
-
-Sander van Harmelen ()
-
-## License
-
-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
diff --git a/vendor/github.com/xanzy/go-gitlab/access_requests.go b/vendor/github.com/xanzy/go-gitlab/access_requests.go
deleted file mode 100644
index 609af9d9..00000000
--- a/vendor/github.com/xanzy/go-gitlab/access_requests.go
+++ /dev/null
@@ -1,237 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// AccessRequest represents a access request for a group or project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html
-type AccessRequest struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- RequestedAt *time.Time `json:"requested_at"`
- AccessLevel AccessLevelValue `json:"access_level"`
-}
-
-// AccessRequestsService handles communication with the project/group
-// access requests related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/access_requests.html
-type AccessRequestsService struct {
- client *Client
-}
-
-// ListAccessRequestsOptions represents the available
-// ListProjectAccessRequests() or ListGroupAccessRequests() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#list-access-requests-for-a-group-or-project
-type ListAccessRequestsOptions ListOptions
-
-// ListProjectAccessRequests gets a list of access requests
-// viewable by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#list-access-requests-for-a-group-or-project
-func (s *AccessRequestsService) ListProjectAccessRequests(pid interface{}, opt *ListAccessRequestsOptions, options ...OptionFunc) ([]*AccessRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/access_requests", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ars []*AccessRequest
- resp, err := s.client.Do(req, &ars)
- if err != nil {
- return nil, resp, err
- }
-
- return ars, resp, err
-}
-
-// ListGroupAccessRequests gets a list of access requests
-// viewable by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#list-access-requests-for-a-group-or-project
-func (s *AccessRequestsService) ListGroupAccessRequests(gid interface{}, opt *ListAccessRequestsOptions, options ...OptionFunc) ([]*AccessRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/access_requests", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ars []*AccessRequest
- resp, err := s.client.Do(req, &ars)
- if err != nil {
- return nil, resp, err
- }
-
- return ars, resp, err
-}
-
-// RequestProjectAccess requests access for the authenticated user
-// to a group or project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#request-access-to-a-group-or-project
-func (s *AccessRequestsService) RequestProjectAccess(pid interface{}, options ...OptionFunc) (*AccessRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/access_requests", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ar := new(AccessRequest)
- resp, err := s.client.Do(req, ar)
- if err != nil {
- return nil, resp, err
- }
-
- return ar, resp, err
-}
-
-// RequestGroupAccess requests access for the authenticated user
-// to a group or project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#request-access-to-a-group-or-project
-func (s *AccessRequestsService) RequestGroupAccess(gid interface{}, options ...OptionFunc) (*AccessRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/access_requests", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ar := new(AccessRequest)
- resp, err := s.client.Do(req, ar)
- if err != nil {
- return nil, resp, err
- }
-
- return ar, resp, err
-}
-
-// ApproveAccessRequestOptions represents the available
-// ApproveProjectAccessRequest() and ApproveGroupAccessRequest() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#approve-an-access-request
-type ApproveAccessRequestOptions struct {
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
-}
-
-// ApproveProjectAccessRequest approves an access request for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#approve-an-access-request
-func (s *AccessRequestsService) ApproveProjectAccessRequest(pid interface{}, user int, opt *ApproveAccessRequestOptions, options ...OptionFunc) (*AccessRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/access_requests/%d/approve", url.QueryEscape(project), user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ar := new(AccessRequest)
- resp, err := s.client.Do(req, ar)
- if err != nil {
- return nil, resp, err
- }
-
- return ar, resp, err
-}
-
-// ApproveGroupAccessRequest approves an access request for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#approve-an-access-request
-func (s *AccessRequestsService) ApproveGroupAccessRequest(gid interface{}, user int, opt *ApproveAccessRequestOptions, options ...OptionFunc) (*AccessRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/access_requests/%d/approve", url.QueryEscape(group), user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ar := new(AccessRequest)
- resp, err := s.client.Do(req, ar)
- if err != nil {
- return nil, resp, err
- }
-
- return ar, resp, err
-}
-
-// DenyProjectAccessRequest denies an access request for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#deny-an-access-request
-func (s *AccessRequestsService) DenyProjectAccessRequest(pid interface{}, user int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/access_requests/%d", url.QueryEscape(project), user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DenyGroupAccessRequest denies an access request for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#deny-an-access-request
-func (s *AccessRequestsService) DenyGroupAccessRequest(gid interface{}, user int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/access_requests/%d", url.QueryEscape(group), user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/award_emojis.go b/vendor/github.com/xanzy/go-gitlab/award_emojis.go
deleted file mode 100644
index d3356092..00000000
--- a/vendor/github.com/xanzy/go-gitlab/award_emojis.go
+++ /dev/null
@@ -1,468 +0,0 @@
-//
-// Copyright 2017, Arkbriar
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// AwardEmojiService handles communication with the emoji awards related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/award_emoji.html
-type AwardEmojiService struct {
- client *Client
-}
-
-// AwardEmoji represents a GitLab Award Emoji.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/award_emoji.html
-type AwardEmoji struct {
- ID int `json:"id"`
- Name string `json:"name"`
- User struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"user"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- AwardableID int `json:"awardable_id"`
- AwardableType string `json:"awardable_type"`
-}
-
-const (
- awardMergeRequest = "merge_requests"
- awardIssue = "issues"
- awardSnippets = "snippets"
-)
-
-// ListAwardEmojiOptions represents the available options for listing emoji
-// for each resources
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html
-type ListAwardEmojiOptions ListOptions
-
-// ListMergeRequestAwardEmoji gets a list of all award emoji on the merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) ListMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmoji(pid, awardMergeRequest, mergeRequestIID, opt, options...)
-}
-
-// ListIssueAwardEmoji gets a list of all award emoji on the issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) ListIssueAwardEmoji(pid interface{}, issueIID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmoji(pid, awardIssue, issueIID, opt, options...)
-}
-
-// ListSnippetAwardEmoji gets a list of all award emoji on the snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) ListSnippetAwardEmoji(pid interface{}, snippetID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmoji(pid, awardSnippets, snippetID, opt, options...)
-}
-
-func (s *AwardEmojiService) listAwardEmoji(pid interface{}, resource string, resourceID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/award_emoji",
- url.QueryEscape(project),
- resource,
- resourceID,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var as []*AwardEmoji
- resp, err := s.client.Do(req, &as)
- if err != nil {
- return nil, resp, err
- }
-
- return as, resp, err
-}
-
-// GetMergeRequestAwardEmoji get an award emoji from merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) GetMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...)
-}
-
-// GetIssueAwardEmoji get an award emoji from issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) GetIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getAwardEmoji(pid, awardIssue, issueIID, awardID, options...)
-}
-
-// GetSnippetAwardEmoji get an award emoji from snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) GetSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getAwardEmoji(pid, awardSnippets, snippetID, awardID, options...)
-}
-
-func (s *AwardEmojiService) getAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/award_emoji/%d",
- url.QueryEscape(project),
- resource,
- resourceID,
- awardID,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(AwardEmoji)
- resp, err := s.client.Do(req, &a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// CreateAwardEmojiOptions represents the available options for awarding emoji
-// for a resource
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
-type CreateAwardEmojiOptions struct {
- Name string `json:"name"`
-}
-
-// CreateMergeRequestAwardEmoji get an award emoji from merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
-func (s *AwardEmojiService) CreateMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmoji(pid, awardMergeRequest, mergeRequestIID, opt, options...)
-}
-
-// CreateIssueAwardEmoji get an award emoji from issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
-func (s *AwardEmojiService) CreateIssueAwardEmoji(pid interface{}, issueIID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmoji(pid, awardIssue, issueIID, opt, options...)
-}
-
-// CreateSnippetAwardEmoji get an award emoji from snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
-func (s *AwardEmojiService) CreateSnippetAwardEmoji(pid interface{}, snippetID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmoji(pid, awardSnippets, snippetID, opt, options...)
-}
-
-func (s *AwardEmojiService) createAwardEmoji(pid interface{}, resource string, resourceID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/award_emoji",
- url.QueryEscape(project),
- resource,
- resourceID,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(AwardEmoji)
- resp, err := s.client.Do(req, &a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// DeleteIssueAwardEmoji delete award emoji on an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
-func (s *AwardEmojiService) DeleteIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmoji(pid, awardMergeRequest, issueIID, awardID, options...)
-}
-
-// DeleteMergeRequestAwardEmoji delete award emoji on a merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
-func (s *AwardEmojiService) DeleteMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...)
-}
-
-// DeleteSnippetAwardEmoji delete award emoji on a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
-func (s *AwardEmojiService) DeleteSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmoji(pid, awardMergeRequest, snippetID, awardID, options...)
-}
-
-// DeleteAwardEmoji Delete an award emoji on the specified resource.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#delete-an-award-emoji
-func (s *AwardEmojiService) deleteAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/award_emoji/%d", url.QueryEscape(project), resource,
- resourceID, awardID)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
- return s.client.Do(req, nil)
-}
-
-// ListIssuesAwardEmojiOnNote gets a list of all award emoji on a note from the
-// issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) ListIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmojiOnNote(pid, awardIssue, issueID, noteID, opt, options...)
-}
-
-// ListMergeRequestAwardEmojiOnNote gets a list of all award emoji on a note
-// from the merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) ListMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, opt, options...)
-}
-
-// ListSnippetAwardEmojiOnNote gets a list of all award emoji on a note from the
-// snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) ListSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, opt, options...)
-}
-
-func (s *AwardEmojiService) listAwardEmojiOnNote(pid interface{}, resources string, ressourceID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji", url.QueryEscape(project), resources,
- ressourceID, noteID)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var as []*AwardEmoji
- resp, err := s.client.Do(req, &as)
- if err != nil {
- return nil, resp, err
- }
-
- return as, resp, err
-}
-
-// GetIssuesAwardEmojiOnNote gets an award emoji on a note from an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) GetIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getSingleNoteAwardEmoji(pid, awardIssue, issueID, noteID, awardID, options...)
-}
-
-// GetMergeRequestAwardEmojiOnNote gets an award emoji on a note from a
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) GetMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getSingleNoteAwardEmoji(pid, awardMergeRequest, mergeRequestIID, noteID, awardID,
- options...)
-}
-
-// GetSnippetAwardEmojiOnNote gets an award emoji on a note from a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) GetSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getSingleNoteAwardEmoji(pid, awardSnippets, snippetIID, noteID, awardID, options...)
-}
-
-func (s *AwardEmojiService) getSingleNoteAwardEmoji(pid interface{}, ressource string, resourceID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji/%d",
- url.QueryEscape(project),
- ressource,
- resourceID,
- noteID,
- awardID,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(AwardEmoji)
- resp, err := s.client.Do(req, &a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// CreateIssuesAwardEmojiOnNote gets an award emoji on a note from an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) CreateIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmojiOnNote(pid, awardIssue, issueID, noteID, opt, options...)
-}
-
-// CreateMergeRequestAwardEmojiOnNote gets an award emoji on a note from a
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) CreateMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, opt, options...)
-}
-
-// CreateSnippetAwardEmojiOnNote gets an award emoji on a note from a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) CreateSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, opt, options...)
-}
-
-// CreateAwardEmojiOnNote award emoji on a note.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
-func (s *AwardEmojiService) createAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji",
- url.QueryEscape(project),
- resource,
- resourceID,
- noteID,
- )
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(AwardEmoji)
- resp, err := s.client.Do(req, &a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// DeleteIssuesAwardEmojiOnNote deletes an award emoji on a note from an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) DeleteIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmojiOnNote(pid, awardIssue, issueID, noteID, awardID, options...)
-}
-
-// DeleteMergeRequestAwardEmojiOnNote deletes an award emoji on a note from a
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) DeleteMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, awardID,
- options...)
-}
-
-// DeleteSnippetAwardEmojiOnNote deletes an award emoji on a note from a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) DeleteSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, awardID, options...)
-}
-
-func (s *AwardEmojiService) deleteAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji/%d",
- url.QueryEscape(project),
- resource,
- resourceID,
- noteID,
- awardID,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/boards.go b/vendor/github.com/xanzy/go-gitlab/boards.go
deleted file mode 100644
index 7579a5bd..00000000
--- a/vendor/github.com/xanzy/go-gitlab/boards.go
+++ /dev/null
@@ -1,261 +0,0 @@
-//
-// Copyright 2015, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// IssueBoardsService handles communication with the issue board related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
-type IssueBoardsService struct {
- client *Client
-}
-
-// IssueBoard represents a GitLab issue board.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
-type IssueBoard struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Project *Project `json:"project"`
- Milestone *Milestone `json:"milestone"`
- Lists []*BoardList `json:"lists"`
-}
-
-func (b IssueBoard) String() string {
- return Stringify(b)
-}
-
-// BoardList represents a GitLab board list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
-type BoardList struct {
- ID int `json:"id"`
- Labels []*Label `json:"labels"`
- Position int `json:"position"`
-}
-
-func (b BoardList) String() string {
- return Stringify(b)
-}
-
-// ListIssueBoardsOptions represents the available ListIssueBoards() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#project-board
-type ListIssueBoardsOptions ListOptions
-
-// ListIssueBoards gets a list of all issue boards in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#project-board
-func (s *IssueBoardsService) ListIssueBoards(pid interface{}, opt *ListIssueBoardsOptions, options ...OptionFunc) ([]*IssueBoard, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var is []*IssueBoard
- resp, err := s.client.Do(req, &is)
- if err != nil {
- return nil, resp, err
- }
-
- return is, resp, err
-}
-
-// GetIssueBoard gets a single issue board of a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#single-board
-func (s *IssueBoardsService) GetIssueBoard(pid interface{}, board int, options ...OptionFunc) (*IssueBoard, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d", url.QueryEscape(project), board)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ib := new(IssueBoard)
- resp, err := s.client.Do(req, ib)
- if err != nil {
- return nil, resp, err
- }
-
- return ib, resp, err
-}
-
-// GetIssueBoardListsOptions represents the available GetIssueBoardLists() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#list-board-lists
-type GetIssueBoardListsOptions ListOptions
-
-// GetIssueBoardLists gets a list of the issue board's lists. Does not include
-// backlog and closed lists.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#list-board-lists
-func (s *IssueBoardsService) GetIssueBoardLists(pid interface{}, board int, opt *GetIssueBoardListsOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists", url.QueryEscape(project), board)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var bl []*BoardList
- resp, err := s.client.Do(req, &bl)
- if err != nil {
- return nil, resp, err
- }
-
- return bl, resp, err
-}
-
-// GetIssueBoardList gets a single issue board list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#single-board-list
-func (s *IssueBoardsService) GetIssueBoardList(pid interface{}, board, list int, options ...OptionFunc) (*BoardList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
- url.QueryEscape(project),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- bl := new(BoardList)
- resp, err := s.client.Do(req, bl)
- if err != nil {
- return nil, resp, err
- }
-
- return bl, resp, err
-}
-
-// CreateIssueBoardListOptions represents the available CreateIssueBoardList()
-// options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#new-board-list
-type CreateIssueBoardListOptions struct {
- LabelID *int `url:"label_id" json:"label_id"`
-}
-
-// CreateIssueBoardList creates a new issue board list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#new-board-list
-func (s *IssueBoardsService) CreateIssueBoardList(pid interface{}, board int, opt *CreateIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists", url.QueryEscape(project), board)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- bl := new(BoardList)
- resp, err := s.client.Do(req, bl)
- if err != nil {
- return nil, resp, err
- }
-
- return bl, resp, err
-}
-
-// UpdateIssueBoardListOptions represents the available UpdateIssueBoardList()
-// options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#edit-board-list
-type UpdateIssueBoardListOptions struct {
- Position *int `url:"position" json:"position"`
-}
-
-// UpdateIssueBoardList updates the position of an existing issue board list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#edit-board-list
-func (s *IssueBoardsService) UpdateIssueBoardList(pid interface{}, board, list int, opt *UpdateIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
- url.QueryEscape(project),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- bl := new(BoardList)
- resp, err := s.client.Do(req, bl)
- if err != nil {
- return nil, resp, err
- }
-
- return bl, resp, err
-}
-
-// DeleteIssueBoardList soft deletes an issue board list. Only for admins and
-// project owners.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/boards.html#delete-a-board-list
-func (s *IssueBoardsService) DeleteIssueBoardList(pid interface{}, board, list int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
- url.QueryEscape(project),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/branches.go b/vendor/github.com/xanzy/go-gitlab/branches.go
deleted file mode 100644
index 3f7bd0cd..00000000
--- a/vendor/github.com/xanzy/go-gitlab/branches.go
+++ /dev/null
@@ -1,238 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// BranchesService handles communication with the branch related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/branches.html
-type BranchesService struct {
- client *Client
-}
-
-// Branch represents a GitLab branch.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/branches.html
-type Branch struct {
- Commit *Commit `json:"commit"`
- Name string `json:"name"`
- Protected bool `json:"protected"`
- Merged bool `json:"merged"`
- DevelopersCanPush bool `json:"developers_can_push"`
- DevelopersCanMerge bool `json:"developers_can_merge"`
-}
-
-func (b Branch) String() string {
- return Stringify(b)
-}
-
-// ListBranchesOptions represents the available ListBranches() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#list-repository-branches
-type ListBranchesOptions ListOptions
-
-// ListBranches gets a list of repository branches from a project, sorted by
-// name alphabetically.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#list-repository-branches
-func (s *BranchesService) ListBranches(pid interface{}, opts *ListBranchesOptions, options ...OptionFunc) ([]*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b []*Branch
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// GetBranch gets a single project repository branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#get-single-repository-branch
-func (s *BranchesService) GetBranch(pid interface{}, branch string, options ...OptionFunc) (*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches/%s", url.QueryEscape(project), url.QueryEscape(branch))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(Branch)
- resp, err := s.client.Do(req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// ProtectBranchOptions represents the available ProtectBranch() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#protect-repository-branch
-type ProtectBranchOptions struct {
- DevelopersCanPush *bool `url:"developers_can_push,omitempty" json:"developers_can_push,omitempty"`
- DevelopersCanMerge *bool `url:"developers_can_merge,omitempty" json:"developers_can_merge,omitempty"`
-}
-
-// ProtectBranch protects a single project repository branch. This is an
-// idempotent function, protecting an already protected repository branch
-// still returns a 200 OK status code.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#protect-repository-branch
-func (s *BranchesService) ProtectBranch(pid interface{}, branch string, opts *ProtectBranchOptions, options ...OptionFunc) (*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches/%s/protect", url.QueryEscape(project), url.QueryEscape(branch))
-
- req, err := s.client.NewRequest("PUT", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(Branch)
- resp, err := s.client.Do(req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// UnprotectBranch unprotects a single project repository branch. This is an
-// idempotent function, unprotecting an already unprotected repository branch
-// still returns a 200 OK status code.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#unprotect-repository-branch
-func (s *BranchesService) UnprotectBranch(pid interface{}, branch string, options ...OptionFunc) (*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches/%s/unprotect", url.QueryEscape(project), url.QueryEscape(branch))
-
- req, err := s.client.NewRequest("PUT", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(Branch)
- resp, err := s.client.Do(req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// CreateBranchOptions represents the available CreateBranch() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#create-repository-branch
-type CreateBranchOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
-}
-
-// CreateBranch creates branch from commit SHA or existing branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#create-repository-branch
-func (s *BranchesService) CreateBranch(pid interface{}, opt *CreateBranchOptions, options ...OptionFunc) (*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(Branch)
- resp, err := s.client.Do(req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// DeleteBranch deletes an existing branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#delete-repository-branch
-func (s *BranchesService) DeleteBranch(pid interface{}, branch string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches/%s", url.QueryEscape(project), url.QueryEscape(branch))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteMergedBranches deletes all branches that are merged into the project's default branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#delete-merged-branches
-func (s *BranchesService) DeleteMergedBranches(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/merged_branches", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go b/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go
deleted file mode 100644
index aee852d4..00000000
--- a/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go
+++ /dev/null
@@ -1,172 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// BroadcastMessagesService handles communication with the broadcast
-// messages methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/broadcast_messages.html
-type BroadcastMessagesService struct {
- client *Client
-}
-
-// BroadcastMessage represents a GitLab issue board.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
-type BroadcastMessage struct {
- Message string `json:"message"`
- StartsAt *time.Time `json:"starts_at"`
- EndsAt *time.Time `json:"ends_at"`
- Color string `json:"color"`
- Font string `json:"font"`
- ID int `json:"id"`
- Active bool `json:"active"`
-}
-
-// ListBroadcastMessagesOptions represents the available ListBroadcastMessages()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
-type ListBroadcastMessagesOptions ListOptions
-
-// ListBroadcastMessages gets a list of all broadcasted messages.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
-func (s *BroadcastMessagesService) ListBroadcastMessages(opt *ListBroadcastMessagesOptions, options ...OptionFunc) ([]*BroadcastMessage, *Response, error) {
- req, err := s.client.NewRequest("GET", "broadcast_messages", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var bs []*BroadcastMessage
- resp, err := s.client.Do(req, &bs)
- if err != nil {
- return nil, resp, err
- }
-
- return bs, resp, err
-}
-
-// GetBroadcastMessage gets a single broadcast message.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-a-specific-broadcast-message
-func (s *BroadcastMessagesService) GetBroadcastMessage(broadcast int, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
- u := fmt.Sprintf("broadcast_messages/%d", broadcast)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(BroadcastMessage)
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// CreateBroadcastMessageOptions represents the available CreateBroadcastMessage()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#create-a-broadcast-message
-type CreateBroadcastMessageOptions struct {
- Message *string `url:"message" json:"message"`
- StartsAt *time.Time `url:"starts_at,omitempty" json:"starts_at,omitempty"`
- EndsAt *time.Time `url:"ends_at,omitempty" json:"ends_at,omitempty"`
- Color *string `url:"color,omitempty" json:"color,omitempty"`
- Font *string `url:"font,omitempty" json:"font,omitempty"`
-}
-
-// CreateBroadcastMessage creates a message to broadcast.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#create-a-broadcast-message
-func (s *BroadcastMessagesService) CreateBroadcastMessage(opt *CreateBroadcastMessageOptions, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
- req, err := s.client.NewRequest("POST", "broadcast_messages", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(BroadcastMessage)
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// UpdateBroadcastMessageOptions represents the available CreateBroadcastMessage()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#update-a-broadcast-message
-type UpdateBroadcastMessageOptions struct {
- Message *string `url:"message,omitempty" json:"message,omitempty"`
- StartsAt *time.Time `url:"starts_at,omitempty" json:"starts_at,omitempty"`
- EndsAt *time.Time `url:"ends_at,omitempty" json:"ends_at,omitempty"`
- Color *string `url:"color,omitempty" json:"color,omitempty"`
- Font *string `url:"font,omitempty" json:"font,omitempty"`
-}
-
-// UpdateBroadcastMessage update a broadcasted message.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#update-a-broadcast-message
-func (s *BroadcastMessagesService) UpdateBroadcastMessage(broadcast int, opt *UpdateBroadcastMessageOptions, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
- u := fmt.Sprintf("broadcast_messages/%d", broadcast)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(BroadcastMessage)
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// DeleteBroadcastMessage deletes a broadcasted message.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#delete-a-broadcast-message
-func (s *BroadcastMessagesService) DeleteBroadcastMessage(broadcast int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("broadcast_messages/%d", broadcast)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/build_variables.go b/vendor/github.com/xanzy/go-gitlab/build_variables.go
deleted file mode 100644
index 8a6c8cdd..00000000
--- a/vendor/github.com/xanzy/go-gitlab/build_variables.go
+++ /dev/null
@@ -1,173 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// BuildVariablesService handles communication with the project variables related methods
-// of the Gitlab API
-//
-// Gitlab API Docs : https://docs.gitlab.com/ce/api/build_variables.html
-type BuildVariablesService struct {
- client *Client
-}
-
-// BuildVariable represents a variable available for each build of the given project
-//
-// Gitlab API Docs : https://docs.gitlab.com/ce/api/build_variables.html
-type BuildVariable struct {
- Key string `json:"key"`
- Value string `json:"value"`
- Protected bool `json:"protected"`
-}
-
-func (v BuildVariable) String() string {
- return Stringify(v)
-}
-
-// ListBuildVariablesOptions are the parameters to ListBuildVariables()
-//
-// Gitlab API Docs:
-// https://docs.gitlab.com/ce/api/build_variables.html#list-project-variables
-type ListBuildVariablesOptions ListOptions
-
-// ListBuildVariables gets the a list of project variables in a project
-//
-// Gitlab API Docs:
-// https://docs.gitlab.com/ce/api/build_variables.html#list-project-variables
-func (s *BuildVariablesService) ListBuildVariables(pid interface{}, opts *ListBuildVariablesOptions, options ...OptionFunc) ([]*BuildVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var v []*BuildVariable
- resp, err := s.client.Do(req, &v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// GetBuildVariable gets a single project variable of a project
-//
-// Gitlab API Docs:
-// https://docs.gitlab.com/ce/api/build_variables.html#show-variable-details
-func (s *BuildVariablesService) GetBuildVariable(pid interface{}, key string, options ...OptionFunc) (*BuildVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s", url.QueryEscape(project), key)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(BuildVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// CreateBuildVariableOptions are the parameters to CreateBuildVariable()
-//
-// Gitlab API Docs:
-// https://docs.gitlab.com/ce/api/build_variables.html#create-variable
-type CreateBuildVariableOptions struct {
- Key *string `url:"key" json:"key"`
- Value *string `url:"value" json:"value"`
- Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
-}
-
-// CreateBuildVariable creates a variable for a given project
-//
-// Gitlab API Docs:
-// https://docs.gitlab.com/ce/api/build_variables.html#create-variable
-func (s *BuildVariablesService) CreateBuildVariable(pid interface{}, opt *CreateBuildVariableOptions, options ...OptionFunc) (*BuildVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(BuildVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// UpdateBuildVariableOptions are the parameters to UpdateBuildVariable()
-//
-// Gitlab API Docs:
-// https://docs.gitlab.com/ce/api/build_variables.html#update-variable
-type UpdateBuildVariableOptions struct {
- Key *string `url:"key" json:"key"`
- Value *string `url:"value" json:"value"`
- Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
-}
-
-// UpdateBuildVariable updates an existing project variable
-// The variable key must exist
-//
-// Gitlab API Docs:
-// https://docs.gitlab.com/ce/api/build_variables.html#update-variable
-func (s *BuildVariablesService) UpdateBuildVariable(pid interface{}, key string, opt *UpdateBuildVariableOptions, options ...OptionFunc) (*BuildVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s", url.QueryEscape(project), key)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(BuildVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// RemoveBuildVariable removes a project variable of a given project identified by its key
-//
-// Gitlab API Docs:
-// https://docs.gitlab.com/ce/api/build_variables.html#remove-variable
-func (s *BuildVariablesService) RemoveBuildVariable(pid interface{}, key string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s", url.QueryEscape(project), key)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go b/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go
deleted file mode 100644
index abd85662..00000000
--- a/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// CIYMLTemplatesService handles communication with the gitlab
-// CI YML templates related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html
-type CIYMLTemplatesService struct {
- client *Client
-}
-
-// CIYMLTemplate represents a GitLab CI YML template.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html
-type CIYMLTemplate struct {
- Name string `json:"name"`
- Content string `json:"content"`
-}
-
-// ListCIYMLTemplatesOptions represents the available ListAllTemplates() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
-type ListCIYMLTemplatesOptions ListOptions
-
-// ListAllTemplates get all GitLab CI YML templates.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#list-gitlab-ci-yml-templates
-func (s *CIYMLTemplatesService) ListAllTemplates(opt *ListCIYMLTemplatesOptions, options ...OptionFunc) ([]*CIYMLTemplate, *Response, error) {
- req, err := s.client.NewRequest("GET", "templates/gitlab_ci_ymls", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cts []*CIYMLTemplate
- resp, err := s.client.Do(req, &cts)
- if err != nil {
- return nil, resp, err
- }
-
- return cts, resp, err
-}
-
-// GetTemplate get a single GitLab CI YML template.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#single-gitlab-ci-yml-template
-func (s *CIYMLTemplatesService) GetTemplate(key string, options ...OptionFunc) (*CIYMLTemplate, *Response, error) {
- u := fmt.Sprintf("templates/gitlab_ci_ymls/%s", url.QueryEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ct := new(CIYMLTemplate)
- resp, err := s.client.Do(req, ct)
- if err != nil {
- return nil, resp, err
- }
-
- return ct, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/commits.go b/vendor/github.com/xanzy/go-gitlab/commits.go
deleted file mode 100644
index 1bbcc401..00000000
--- a/vendor/github.com/xanzy/go-gitlab/commits.go
+++ /dev/null
@@ -1,518 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// CommitsService handles communication with the commit related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type CommitsService struct {
- client *Client
-}
-
-// Commit represents a GitLab commit.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type Commit struct {
- ID string `json:"id"`
- ShortID string `json:"short_id"`
- Title string `json:"title"`
- AuthorName string `json:"author_name"`
- AuthorEmail string `json:"author_email"`
- AuthoredDate *time.Time `json:"authored_date"`
- CommitterName string `json:"committer_name"`
- CommitterEmail string `json:"committer_email"`
- CommittedDate *time.Time `json:"committed_date"`
- CreatedAt *time.Time `json:"created_at"`
- Message string `json:"message"`
- ParentIDs []string `json:"parent_ids"`
- Stats *CommitStats `json:"stats"`
- Status *BuildStateValue `json:"status"`
-}
-
-// CommitStats represents the number of added and deleted files in a commit.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type CommitStats struct {
- Additions int `json:"additions"`
- Deletions int `json:"deletions"`
- Total int `json:"total"`
-}
-
-func (c Commit) String() string {
- return Stringify(c)
-}
-
-// ListCommitsOptions represents the available ListCommits() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-repository-commits
-type ListCommitsOptions struct {
- ListOptions
- RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
- Since *time.Time `url:"since,omitempty" json:"since,omitempty"`
- Until *time.Time `url:"until,omitempty" json:"until,omitempty"`
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- All *bool `url:"all,omitempty" json:"all,omitempty"`
- WithStats *bool `url:"with_stats,omitempty" json:"with_stats,omitempty"`
-}
-
-// ListCommits gets a list of repository commits in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-commits
-func (s *CommitsService) ListCommits(pid interface{}, opt *ListCommitsOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c []*Commit
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// FileAction represents the available actions that can be performed on a file.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
-type FileAction string
-
-// The available file actions.
-const (
- FileCreate FileAction = "create"
- FileDelete FileAction = "delete"
- FileMove FileAction = "move"
- FileUpdate FileAction = "update"
-)
-
-// CommitAction represents a single file action within a commit.
-type CommitAction struct {
- Action FileAction `url:"action" json:"action"`
- FilePath string `url:"file_path" json:"file_path"`
- PreviousPath string `url:"previous_path,omitempty" json:"previous_path,omitempty"`
- Content string `url:"content,omitempty" json:"content,omitempty"`
- Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
-}
-
-// CommitRef represents the reference of branches/tags in a commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
-type CommitRef struct {
- Type string `json:"type"`
- Name string `json:"name"`
-}
-
-// GetCommitRefsOptions represents the available GetCommitRefs() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
-type GetCommitRefsOptions struct {
- ListOptions
- Type *string `url:"type,omitempty" json:"type,omitempty"`
-}
-
-// GetCommitRefs gets all references (from branches or tags) a commit is pushed to
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
-func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetCommitRefsOptions, options ...OptionFunc) ([]CommitRef, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/refs", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []CommitRef
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// GetCommit gets a specific commit identified by the commit hash or name of a
-// branch or tag.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-a-single-commit
-func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...OptionFunc) (*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(Commit)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// CreateCommitOptions represents the available options for a new commit.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
-type CreateCommitOptions struct {
- Branch *string `url:"branch" json:"branch"`
- CommitMessage *string `url:"commit_message" json:"commit_message"`
- StartBranch *string `url:"start_branch,omitempty" json:"start_branch,omitempty"`
- Actions []*CommitAction `url:"actions" json:"actions"`
- AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
- AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
-}
-
-// CreateCommit creates a commit with multiple files and actions.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
-func (s *CommitsService) CreateCommit(pid interface{}, opt *CreateCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c *Commit
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// Diff represents a GitLab diff.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type Diff struct {
- Diff string `json:"diff"`
- NewPath string `json:"new_path"`
- OldPath string `json:"old_path"`
- AMode string `json:"a_mode"`
- BMode string `json:"b_mode"`
- NewFile bool `json:"new_file"`
- RenamedFile bool `json:"renamed_file"`
- DeletedFile bool `json:"deleted_file"`
-}
-
-func (d Diff) String() string {
- return Stringify(d)
-}
-
-// GetCommitDiffOptions represents the available GetCommitDiff() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-the-diff-of-a-commit
-type GetCommitDiffOptions ListOptions
-
-// GetCommitDiff gets the diff of a commit in a project..
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-the-diff-of-a-commit
-func (s *CommitsService) GetCommitDiff(pid interface{}, sha string, opt *GetCommitDiffOptions, options ...OptionFunc) ([]*Diff, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/diff", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var d []*Diff
- resp, err := s.client.Do(req, &d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CommitComment represents a GitLab commit comment.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type CommitComment struct {
- Note string `json:"note"`
- Path string `json:"path"`
- Line int `json:"line"`
- LineType string `json:"line_type"`
- Author Author `json:"author"`
-}
-
-// Author represents a GitLab commit author
-type Author struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- Blocked bool `json:"blocked"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (c CommitComment) String() string {
- return Stringify(c)
-}
-
-// GetCommitCommentsOptions represents the available GetCommitComments() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-the-comments-of-a-commit
-type GetCommitCommentsOptions ListOptions
-
-// GetCommitComments gets the comments of a commit in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-the-comments-of-a-commit
-func (s *CommitsService) GetCommitComments(pid interface{}, sha string, opt *GetCommitCommentsOptions, options ...OptionFunc) ([]*CommitComment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c []*CommitComment
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// PostCommitCommentOptions represents the available PostCommitComment()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#post-comment-to-commit
-type PostCommitCommentOptions struct {
- Note *string `url:"note,omitempty" json:"note,omitempty"`
- Path *string `url:"path" json:"path"`
- Line *int `url:"line" json:"line"`
- LineType *string `url:"line_type" json:"line_type"`
-}
-
-// PostCommitComment adds a comment to a commit. Optionally you can post
-// comments on a specific line of a commit. Therefor both path, line_new and
-// line_old are required.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#post-comment-to-commit
-func (s *CommitsService) PostCommitComment(pid interface{}, sha string, opt *PostCommitCommentOptions, options ...OptionFunc) (*CommitComment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(CommitComment)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// GetCommitStatusesOptions represents the available GetCommitStatuses() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
-type GetCommitStatusesOptions struct {
- ListOptions
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Stage *string `url:"stage,omitempty" json:"stage,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- All *bool `url:"all,omitempty" json:"all,omitempty"`
-}
-
-// CommitStatus represents a GitLab commit status.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
-type CommitStatus struct {
- ID int `json:"id"`
- SHA string `json:"sha"`
- Ref string `json:"ref"`
- Status string `json:"status"`
- Name string `json:"name"`
- TargetURL string `json:"target_url"`
- Description string `json:"description"`
- CreatedAt *time.Time `json:"created_at"`
- StartedAt *time.Time `json:"started_at"`
- FinishedAt *time.Time `json:"finished_at"`
- Author Author `json:"author"`
-}
-
-// GetCommitStatuses gets the statuses of a commit in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
-func (s *CommitsService) GetCommitStatuses(pid interface{}, sha string, opt *GetCommitStatusesOptions, options ...OptionFunc) ([]*CommitStatus, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/statuses", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*CommitStatus
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// SetCommitStatusOptions represents the available SetCommitStatus() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#post-the-status-to-commit
-type SetCommitStatusOptions struct {
- State BuildStateValue `url:"state" json:"state"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Context *string `url:"context,omitempty" json:"context,omitempty"`
- TargetURL *string `url:"target_url,omitempty" json:"target_url,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// SetCommitStatus sets the status of a commit in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#post-the-status-to-commit
-func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCommitStatusOptions, options ...OptionFunc) (*CommitStatus, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/statuses/%s", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs *CommitStatus
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// GetMergeRequestsByCommit gets merge request associated with a commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit
-func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/merge_requests",
- url.QueryEscape(project), url.QueryEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var mrs []*MergeRequest
- resp, err := s.client.Do(req, &mrs)
- if err != nil {
- return nil, resp, err
- }
-
- return mrs, resp, err
-}
-
-// CherryPickCommitOptions represents the available options for cherry-picking a commit.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit
-type CherryPickCommitOptions struct {
- TargetBranch *string `url:"branch" json:"branch,omitempty"`
-}
-
-// CherryPickCommit sherry picks a commit to a given branch.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit
-func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *CherryPickCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/cherry_pick",
- url.QueryEscape(project), url.QueryEscape(sha))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c *Commit
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/custom_attributes.go b/vendor/github.com/xanzy/go-gitlab/custom_attributes.go
deleted file mode 100644
index ce165c80..00000000
--- a/vendor/github.com/xanzy/go-gitlab/custom_attributes.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// CustomAttributesService handles communication with the group, project and
-// user custom attributes related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/custom_attributes.html
-type CustomAttributesService struct {
- client *Client
-}
-
-// CustomAttribute struct is used to unmarshal response to api calls.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/custom_attributes.html
-type CustomAttribute struct {
- Key string `json:"key"`
- Value string `json:"value"`
-}
-
-// ListCustomUserAttributes lists the custom attributes of the specified user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes
-func (s *CustomAttributesService) ListCustomUserAttributes(user int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) {
- return s.listCustomAttributes("users", user, options...)
-}
-
-// ListCustomGroupAttributes lists the custom attributes of the specified group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes
-func (s *CustomAttributesService) ListCustomGroupAttributes(group int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) {
- return s.listCustomAttributes("groups", group, options...)
-}
-
-// ListCustomProjectAttributes lists the custom attributes of the specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes
-func (s *CustomAttributesService) ListCustomProjectAttributes(project int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) {
- return s.listCustomAttributes("projects", project, options...)
-}
-
-func (s *CustomAttributesService) listCustomAttributes(resource string, id int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) {
- u := fmt.Sprintf("%s/%d/custom_attributes", resource, id)
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cas []*CustomAttribute
- resp, err := s.client.Do(req, &cas)
- if err != nil {
- return nil, resp, err
- }
- return cas, resp, err
-}
-
-// GetCustomUserAttribute returns the user attribute with a speciifc key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute
-func (s *CustomAttributesService) GetCustomUserAttribute(user int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.getCustomAttribute("users", user, key, options...)
-}
-
-// GetCustomGroupAttribute returns the group attribute with a speciifc key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute
-func (s *CustomAttributesService) GetCustomGroupAttribute(group int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.getCustomAttribute("groups", group, key, options...)
-}
-
-// GetCustomProjectAttribute returns the project attribute with a speciifc key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute
-func (s *CustomAttributesService) GetCustomProjectAttribute(project int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.getCustomAttribute("projects", project, key, options...)
-}
-
-func (s *CustomAttributesService) getCustomAttribute(resource string, id int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, key)
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ca *CustomAttribute
- resp, err := s.client.Do(req, &ca)
- if err != nil {
- return nil, resp, err
- }
- return ca, resp, err
-}
-
-// SetCustomUserAttribute sets the custom attributes of the specified user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute
-func (s *CustomAttributesService) SetCustomUserAttribute(user int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.setCustomAttribute("users", user, c, options...)
-}
-
-// SetCustomGroupAttribute sets the custom attributes of the specified group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute
-func (s *CustomAttributesService) SetCustomGroupAttribute(group int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.setCustomAttribute("groups", group, c, options...)
-}
-
-// SetCustomProjectAttribute sets the custom attributes of the specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute
-func (s *CustomAttributesService) SetCustomProjectAttribute(project int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.setCustomAttribute("projects", project, c, options...)
-}
-
-func (s *CustomAttributesService) setCustomAttribute(resource string, id int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, c.Key)
- req, err := s.client.NewRequest("PUT", u, c, options)
- if err != nil {
- return nil, nil, err
- }
-
- ca := new(CustomAttribute)
- resp, err := s.client.Do(req, ca)
- if err != nil {
- return nil, resp, err
- }
- return ca, resp, err
-}
-
-// DeleteCustomUserAttribute removes the custom attribute of the specified user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute
-func (s *CustomAttributesService) DeleteCustomUserAttribute(user int, key string, options ...OptionFunc) (*Response, error) {
- return s.deleteCustomAttribute("users", user, key, options...)
-}
-
-// DeleteCustomGroupAttribute removes the custom attribute of the specified group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute
-func (s *CustomAttributesService) DeleteCustomGroupAttribute(group int, key string, options ...OptionFunc) (*Response, error) {
- return s.deleteCustomAttribute("groups", group, key, options...)
-}
-
-// DeleteCustomProjectAttribute removes the custom attribute of the specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute
-func (s *CustomAttributesService) DeleteCustomProjectAttribute(project int, key string, options ...OptionFunc) (*Response, error) {
- return s.deleteCustomAttribute("projects", project, key, options...)
-}
-
-func (s *CustomAttributesService) deleteCustomAttribute(resource string, id int, key string, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, key)
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/deploy_keys.go b/vendor/github.com/xanzy/go-gitlab/deploy_keys.go
deleted file mode 100644
index 76444592..00000000
--- a/vendor/github.com/xanzy/go-gitlab/deploy_keys.go
+++ /dev/null
@@ -1,201 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// DeployKeysService handles communication with the keys related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/deploy_keys.html
-type DeployKeysService struct {
- client *Client
-}
-
-// DeployKey represents a GitLab deploy key.
-type DeployKey struct {
- ID int `json:"id"`
- Title string `json:"title"`
- Key string `json:"key"`
- CanPush *bool `json:"can_push"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (k DeployKey) String() string {
- return Stringify(k)
-}
-
-// ListAllDeployKeys gets a list of all deploy keys
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#list-all-deploy-keys
-func (s *DeployKeysService) ListAllDeployKeys(options ...OptionFunc) ([]*DeployKey, *Response, error) {
- req, err := s.client.NewRequest("GET", "deploy_keys", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ks []*DeployKey
- resp, err := s.client.Do(req, &ks)
- if err != nil {
- return nil, resp, err
- }
-
- return ks, resp, err
-}
-
-// ListProjectDeployKeysOptions represents the available ListProjectDeployKeys()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#list-project-deploy-keys
-type ListProjectDeployKeysOptions ListOptions
-
-// ListProjectDeployKeys gets a list of a project's deploy keys
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#list-project-deploy-keys
-func (s *DeployKeysService) ListProjectDeployKeys(pid interface{}, opt *ListProjectDeployKeysOptions, options ...OptionFunc) ([]*DeployKey, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ks []*DeployKey
- resp, err := s.client.Do(req, &ks)
- if err != nil {
- return nil, resp, err
- }
-
- return ks, resp, err
-}
-
-// GetDeployKey gets a single deploy key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#single-deploy-key
-func (s *DeployKeysService) GetDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*DeployKey, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys/%d", url.QueryEscape(project), deployKey)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(DeployKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// AddDeployKeyOptions represents the available ADDDeployKey() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
-type AddDeployKeyOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Key *string `url:"key,omitempty" json:"key,omitempty"`
- CanPush *bool `url:"can_push,omitempty" json:"can_push,omitempty"`
-}
-
-// AddDeployKey creates a new deploy key for a project. If deploy key already
-// exists in another project - it will be joined to project but only if
-// original one was is accessible by same user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
-func (s *DeployKeysService) AddDeployKey(pid interface{}, opt *AddDeployKeyOptions, options ...OptionFunc) (*DeployKey, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(DeployKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// DeleteDeployKey deletes a deploy key from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#delete-deploy-key
-func (s *DeployKeysService) DeleteDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys/%d", url.QueryEscape(project), deployKey)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// EnableDeployKey enables a deploy key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#enable-deploy-key
-func (s *DeployKeysService) EnableDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*DeployKey, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys/%d/enable", url.QueryEscape(project), deployKey)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(DeployKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/deployments.go b/vendor/github.com/xanzy/go-gitlab/deployments.go
deleted file mode 100644
index e43d1c4a..00000000
--- a/vendor/github.com/xanzy/go-gitlab/deployments.go
+++ /dev/null
@@ -1,121 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// 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.
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// DeploymentsService handles communication with the deployment related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html
-type DeploymentsService struct {
- client *Client
-}
-
-// Deployment represents the Gitlab deployment
-type Deployment struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- Ref string `json:"ref"`
- Sha string `json:"sha"`
- CreatedAt *time.Time `json:"created_at"`
- User *ProjectUser `json:"user"`
- Environment *Environment `json:"environment"`
- Deployable struct {
- ID int `json:"id"`
- Status string `json:"status"`
- Stage string `json:"stage"`
- Name string `json:"name"`
- Ref string `json:"ref"`
- Tag bool `json:"tag"`
- Coverage float64 `json:"coverage"`
- CreatedAt *time.Time `json:"created_at"`
- StartedAt *time.Time `json:"started_at"`
- FinishedAt *time.Time `json:"finished_at"`
- Duration float64 `json:"duration"`
- User *User `json:"user"`
- Commit *Commit `json:"commit"`
- Pipeline struct {
- ID int `json:"id"`
- Sha string `json:"sha"`
- Ref string `json:"ref"`
- Status string `json:"status"`
- } `json:"pipeline"`
- Runner *Runner `json:"runner"`
- } `json:"deployable"`
-}
-
-// ListProjectDeploymentsOptions represents the available ListProjectDeployments() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments
-type ListProjectDeploymentsOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListProjectDeployments gets a list of deployments in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments
-func (s *DeploymentsService) ListProjectDeployments(pid interface{}, opts *ListProjectDeploymentsOptions, options ...OptionFunc) ([]*Deployment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deployments", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Deployment
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetProjectDeployment get a deployment for a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html#get-a-specific-deployment
-func (s *DeploymentsService) GetProjectDeployment(pid interface{}, deployment int, options ...OptionFunc) (*Deployment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deployments/%d", url.QueryEscape(project), deployment)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Deployment)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/discussions.go b/vendor/github.com/xanzy/go-gitlab/discussions.go
deleted file mode 100644
index fd3e5dfb..00000000
--- a/vendor/github.com/xanzy/go-gitlab/discussions.go
+++ /dev/null
@@ -1,1112 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// DiscussionsService handles communication with the discussions related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/discussions.html
-type DiscussionsService struct {
- client *Client
-}
-
-// Discussion represents a GitLab discussion.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/discussions.html
-type Discussion struct {
- ID string `json:"id"`
- IndividualNote bool `json:"individual_note"`
- Notes []*Note `json:"notes"`
-}
-
-func (d Discussion) String() string {
- return Stringify(d)
-}
-
-// ListIssueDiscussionsOptions represents the available ListIssueDiscussions()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-issue-discussions
-type ListIssueDiscussionsOptions ListOptions
-
-// ListIssueDiscussions gets a list of all discussions for a single
-// issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-issue-discussions
-func (s *DiscussionsService) ListIssueDiscussions(pid interface{}, issue int, opt *ListIssueDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetIssueDiscussion returns a single discussion for a specific project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-issue-discussion
-func (s *DiscussionsService) GetIssueDiscussion(pid interface{}, issue int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions/%s",
- url.QueryEscape(project),
- issue,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateIssueDiscussionOptions represents the available CreateIssueDiscussion()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-issue-discussion
-type CreateIssueDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// CreateIssueDiscussion creates a new discussion to a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-issue-discussion
-func (s *DiscussionsService) CreateIssueDiscussion(pid interface{}, issue int, opt *CreateIssueDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddIssueDiscussionNoteOptions represents the available AddIssueDiscussionNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-issue-discussion
-type AddIssueDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddIssueDiscussionNote creates a new discussion to a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-issue-discussion
-func (s *DiscussionsService) AddIssueDiscussionNote(pid interface{}, issue int, discussion string, opt *AddIssueDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions/%s/notes",
- url.QueryEscape(project),
- issue,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// UpdateIssueDiscussionNoteOptions represents the available
-// UpdateIssueDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-issue-discussion-note
-type UpdateIssueDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateIssueDiscussionNote modifies existing discussion of an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-issue-discussion-note
-func (s *DiscussionsService) UpdateIssueDiscussionNote(pid interface{}, issue int, discussion string, note int, opt *UpdateIssueDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions/%s/notes/%d",
- url.QueryEscape(project),
- issue,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// DeleteIssueDiscussionNote deletes an existing discussion of an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-an-issue-discussion-note
-func (s *DiscussionsService) DeleteIssueDiscussionNote(pid interface{}, issue int, discussion string, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions/%s/notes/%d",
- url.QueryEscape(project),
- issue,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListSnippetDiscussionsOptions represents the available ListSnippetDiscussions()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-all-snippet-discussions
-type ListSnippetDiscussionsOptions ListOptions
-
-// ListSnippetDiscussions gets a list of all discussions for a single
-// snippet. Snippet discussions are comments users can post to a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-all-snippet-discussions
-func (s *DiscussionsService) ListSnippetDiscussions(pid interface{}, snippet int, opt *ListSnippetDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions", url.QueryEscape(project), snippet)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetSnippetDiscussion returns a single discussion for a given snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-snippet-discussion
-func (s *DiscussionsService) GetSnippetDiscussion(pid interface{}, snippet int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions/%s",
- url.QueryEscape(project),
- snippet,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateSnippetDiscussionOptions represents the available
-// CreateSnippetDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-snippet-discussion
-type CreateSnippetDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// CreateSnippetDiscussion creates a new discussion for a single snippet.
-// Snippet discussions are comments users can post to a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-snippet-discussion
-func (s *DiscussionsService) CreateSnippetDiscussion(pid interface{}, snippet int, opt *CreateSnippetDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions", url.QueryEscape(project), snippet)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddSnippetDiscussionNoteOptions represents the available
-// AddSnippetDiscussionNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-snippet-discussion
-type AddSnippetDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddSnippetDiscussionNote creates a new discussion to a single project
-// snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-snippet-discussion
-func (s *DiscussionsService) AddSnippetDiscussionNote(pid interface{}, snippet int, discussion string, opt *AddSnippetDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions/%s/notes",
- url.QueryEscape(project),
- snippet,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// UpdateSnippetDiscussionNoteOptions represents the available
-// UpdateSnippetDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-snippet-discussion-note
-type UpdateSnippetDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateSnippetDiscussionNote modifies existing discussion of a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-snippet-discussion-note
-func (s *DiscussionsService) UpdateSnippetDiscussionNote(pid interface{}, snippet int, discussion string, note int, opt *UpdateSnippetDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions/%s/notes/%d",
- url.QueryEscape(project),
- snippet,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// DeleteSnippetDiscussionNote deletes an existing discussion of a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-a-snippet-discussion-note
-func (s *DiscussionsService) DeleteSnippetDiscussionNote(pid interface{}, snippet int, discussion string, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions/%s/notes/%d",
- url.QueryEscape(project),
- snippet,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListGroupEpicDiscussionsOptions represents the available
-// ListEpicDiscussions() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#list-all-epic-discussions
-type ListGroupEpicDiscussionsOptions ListOptions
-
-// ListGroupEpicDiscussions gets a list of all discussions for a single
-// epic. Epic discussions are comments users can post to a epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#list-all-epic-discussions
-func (s *DiscussionsService) ListGroupEpicDiscussions(gid interface{}, epic int, opt *ListGroupEpicDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions",
- url.QueryEscape(group),
- epic,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetEpicDiscussion returns a single discussion for a given epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#get-single-epic-discussion
-func (s *DiscussionsService) GetEpicDiscussion(gid interface{}, epic int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions/%s",
- url.QueryEscape(group),
- epic,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateEpicDiscussionOptions represents the available CreateEpicDiscussion()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#create-new-epic-discussion
-type CreateEpicDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// CreateEpicDiscussion creates a new discussion for a single epic. Epic
-// discussions are comments users can post to a epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#create-new-epic-discussion
-func (s *DiscussionsService) CreateEpicDiscussion(gid interface{}, epic int, opt *CreateEpicDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions",
- url.QueryEscape(group),
- epic,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddEpicDiscussionNoteOptions represents the available
-// AddEpicDiscussionNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-epic-discussion
-type AddEpicDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddEpicDiscussionNote creates a new discussion to a single project epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-epic-discussion
-func (s *DiscussionsService) AddEpicDiscussionNote(gid interface{}, epic int, discussion string, opt *AddEpicDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions/%s/notes",
- url.QueryEscape(group),
- epic,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// UpdateEpicDiscussionNoteOptions represents the available UpdateEpicDiscussion()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#modify-existing-epic-discussion-note
-type UpdateEpicDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateEpicDiscussionNote modifies existing discussion of a epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#modify-existing-epic-discussion-note
-func (s *DiscussionsService) UpdateEpicDiscussionNote(gid interface{}, epic int, discussion string, note int, opt *UpdateEpicDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions/%s/notes/%d",
- url.QueryEscape(group),
- epic,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// DeleteEpicDiscussionNote deletes an existing discussion of a epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#delete-an-epic-discussion-note
-func (s *DiscussionsService) DeleteEpicDiscussionNote(gid interface{}, epic int, discussion string, note int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions/%s/notes/%d",
- url.QueryEscape(group),
- epic,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListMergeRequestDiscussionsOptions represents the available
-// ListMergeRequestDiscussions() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-all-merge-request-discussions
-type ListMergeRequestDiscussionsOptions ListOptions
-
-// ListMergeRequestDiscussions gets a list of all discussions for a single
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-all-merge-request-discussions
-func (s *DiscussionsService) ListMergeRequestDiscussions(pid interface{}, mergeRequest int, opt *ListMergeRequestDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions",
- url.QueryEscape(project),
- mergeRequest,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetMergeRequestDiscussion returns a single discussion for a given merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-merge-request-discussion
-func (s *DiscussionsService) GetMergeRequestDiscussion(pid interface{}, mergeRequest int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s",
- url.QueryEscape(project),
- mergeRequest,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateMergeRequestDiscussionOptions represents the available
-// CreateMergeRequestDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-merge-request-discussion
-type CreateMergeRequestDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
- Position *NotePosition `url:"position,omitempty" json:"position,omitempty"`
-}
-
-// CreateMergeRequestDiscussion creates a new discussion for a single merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-merge-request-discussion
-func (s *DiscussionsService) CreateMergeRequestDiscussion(pid interface{}, mergeRequest int, opt *CreateMergeRequestDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions",
- url.QueryEscape(project),
- mergeRequest,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// ResolveMergeRequestDiscussionOptions represents the available
-// ResolveMergeRequestDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#resolve-a-merge-request-discussion
-type ResolveMergeRequestDiscussionOptions struct {
- Resolved *bool `url:"resolved,omitempty" json:"resolved,omitempty"`
-}
-
-// ResolveMergeRequestDiscussion resolves/unresolves whole discussion of a merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/discussions.html#resolve-a-merge-request-discussion
-func (s *DiscussionsService) ResolveMergeRequestDiscussion(pid interface{}, mergeRequest int, discussion string, opt *ResolveMergeRequestDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s",
- url.QueryEscape(project),
- mergeRequest,
- discussion,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddMergeRequestDiscussionNoteOptions represents the available
-// AddMergeRequestDiscussionNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-merge-request-discussion
-type AddMergeRequestDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddMergeRequestDiscussionNote creates a new discussion to a single project
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-merge-request-discussion
-func (s *DiscussionsService) AddMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, opt *AddMergeRequestDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s/notes",
- url.QueryEscape(project),
- mergeRequest,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// UpdateMergeRequestDiscussionNoteOptions represents the available
-// UpdateMergeRequestDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-merge-request-discussion-note
-type UpdateMergeRequestDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateMergeRequestDiscussionNote modifies existing discussion of a merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-merge-request-discussion-note
-func (s *DiscussionsService) UpdateMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, note int, opt *UpdateMergeRequestDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s/notes/%d",
- url.QueryEscape(project),
- mergeRequest,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// DeleteMergeRequestDiscussionNote deletes an existing discussion of a merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-a-merge-request-discussion-note
-func (s *DiscussionsService) DeleteMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s/notes/%d",
- url.QueryEscape(project),
- mergeRequest,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListCommitDiscussionsOptions represents the available
-// ListCommitDiscussions() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-commit-discussions
-type ListCommitDiscussionsOptions ListOptions
-
-// ListCommitDiscussions gets a list of all discussions for a single
-// commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-commit-discussions
-func (s *DiscussionsService) ListCommitDiscussions(pid interface{}, commit string, opt *ListCommitDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions",
- url.QueryEscape(project),
- commit,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetCommitDiscussion returns a single discussion for a specific project
-// commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-commit-discussion
-func (s *DiscussionsService) GetCommitDiscussion(pid interface{}, commit string, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions/%s",
- url.QueryEscape(project),
- commit,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateCommitDiscussionOptions represents the available
-// CreateCommitDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-commit-discussion
-type CreateCommitDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
- Position *NotePosition `url:"position,omitempty" json:"position,omitempty"`
-}
-
-// CreateCommitDiscussion creates a new discussion to a single project commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-commit-discussion
-func (s *DiscussionsService) CreateCommitDiscussion(pid interface{}, commit string, opt *CreateCommitDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions",
- url.QueryEscape(project),
- commit,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddCommitDiscussionNoteOptions represents the available
-// AddCommitDiscussionNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-commit-discussion
-type AddCommitDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddCommitDiscussionNote creates a new discussion to a single project commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-commit-discussion
-func (s *DiscussionsService) AddCommitDiscussionNote(pid interface{}, commit string, discussion string, opt *AddCommitDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions/%s/notes",
- url.QueryEscape(project),
- commit,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// UpdateCommitDiscussionNoteOptions represents the available
-// UpdateCommitDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-commit-discussion-note
-type UpdateCommitDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateCommitDiscussionNote modifies existing discussion of an commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-commit-discussion-note
-func (s *DiscussionsService) UpdateCommitDiscussionNote(pid interface{}, commit string, discussion string, note int, opt *UpdateCommitDiscussionNoteOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions/%s/notes/%d",
- url.QueryEscape(project),
- commit,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// DeleteCommitDiscussionNote deletes an existing discussion of an commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-an-commit-discussion-note
-func (s *DiscussionsService) DeleteCommitDiscussionNote(pid interface{}, commit string, discussion string, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions/%s/notes/%d",
- url.QueryEscape(project),
- commit,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/environments.go b/vendor/github.com/xanzy/go-gitlab/environments.go
deleted file mode 100644
index c2305ee9..00000000
--- a/vendor/github.com/xanzy/go-gitlab/environments.go
+++ /dev/null
@@ -1,166 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// EnvironmentsService handles communication with the environment related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/environments.html
-type EnvironmentsService struct {
- client *Client
-}
-
-// Environment represents a GitLab environment.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/environments.html
-type Environment struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Slug string `json:"slug"`
- ExternalURL string `json:"external_url"`
-}
-
-func (env Environment) String() string {
- return Stringify(env)
-}
-
-// ListEnvironmentsOptions represents the available ListEnvironments() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#list-environments
-type ListEnvironmentsOptions ListOptions
-
-// ListEnvironments gets a list of environments from a project, sorted by name
-// alphabetically.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#list-environments
-func (s *EnvironmentsService) ListEnvironments(pid interface{}, opts *ListEnvironmentsOptions, options ...OptionFunc) ([]*Environment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/environments", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var envs []*Environment
- resp, err := s.client.Do(req, &envs)
- if err != nil {
- return nil, resp, err
- }
-
- return envs, resp, err
-}
-
-// CreateEnvironmentOptions represents the available CreateEnvironment() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#create-a-new-environment
-type CreateEnvironmentOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- ExternalURL *string `url:"external_url,omitempty" json:"external_url,omitempty"`
-}
-
-// CreateEnvironment adds a environment to a project. This is an idempotent
-// method and can be called multiple times with the same parameters. Createing
-// an environment that is already a environment does not affect the
-// existing environmentship.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#create-a-new-environment
-func (s *EnvironmentsService) CreateEnvironment(pid interface{}, opt *CreateEnvironmentOptions, options ...OptionFunc) (*Environment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/environments", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- env := new(Environment)
- resp, err := s.client.Do(req, env)
- if err != nil {
- return nil, resp, err
- }
-
- return env, resp, err
-}
-
-// EditEnvironmentOptions represents the available EditEnvironment() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#edit-an-existing-environment
-type EditEnvironmentOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- ExternalURL *string `url:"external_url,omitempty" json:"external_url,omitempty"`
-}
-
-// EditEnvironment updates a project team environment to a specified access level..
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#edit-an-existing-environment
-func (s *EnvironmentsService) EditEnvironment(pid interface{}, environment int, opt *EditEnvironmentOptions, options ...OptionFunc) (*Environment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/environments/%d", url.QueryEscape(project), environment)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- env := new(Environment)
- resp, err := s.client.Do(req, env)
- if err != nil {
- return nil, resp, err
- }
-
- return env, resp, err
-}
-
-// DeleteEnvironment removes a environment from a project team.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/environments.html#remove-a-environment-from-a-group-or-project
-func (s *EnvironmentsService) DeleteEnvironment(pid interface{}, environment int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/environments/%d", url.QueryEscape(project), environment)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/event_types.go b/vendor/github.com/xanzy/go-gitlab/event_types.go
deleted file mode 100644
index 2d632b01..00000000
--- a/vendor/github.com/xanzy/go-gitlab/event_types.go
+++ /dev/null
@@ -1,668 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "time"
-)
-
-// PushEvent represents a push event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#push-events
-type PushEvent struct {
- ObjectKind string `json:"object_kind"`
- Before string `json:"before"`
- After string `json:"after"`
- Ref string `json:"ref"`
- CheckoutSha string `json:"checkout_sha"`
- UserID int `json:"user_id"`
- UserName string `json:"user_name"`
- UserEmail string `json:"user_email"`
- UserAvatar string `json:"user_avatar"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- Commits []*struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- Added []string `json:"added"`
- Modified []string `json:"modified"`
- Removed []string `json:"removed"`
- } `json:"commits"`
- TotalCommitsCount int `json:"total_commits_count"`
-}
-
-// TagEvent represents a tag event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#tag-events
-type TagEvent struct {
- ObjectKind string `json:"object_kind"`
- Before string `json:"before"`
- After string `json:"after"`
- Ref string `json:"ref"`
- CheckoutSha string `json:"checkout_sha"`
- UserID int `json:"user_id"`
- UserName string `json:"user_name"`
- UserAvatar string `json:"user_avatar"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- Commits []*struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- Added []string `json:"added"`
- Modified []string `json:"modified"`
- Removed []string `json:"removed"`
- } `json:"commits"`
- TotalCommitsCount int `json:"total_commits_count"`
-}
-
-// IssueEvent represents a issue event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#issues-events
-type IssueEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Title string `json:"title"`
- AssigneeID int `json:"assignee_id"`
- AuthorID int `json:"author_id"`
- ProjectID int `json:"project_id"`
- CreatedAt string `json:"created_at"` // Should be *time.Time (see Gitlab issue #21468)
- UpdatedAt string `json:"updated_at"` // Should be *time.Time (see Gitlab issue #21468)
- Position int `json:"position"`
- BranchName string `json:"branch_name"`
- Description string `json:"description"`
- MilestoneID int `json:"milestone_id"`
- State string `json:"state"`
- IID int `json:"iid"`
- URL string `json:"url"`
- Action string `json:"action"`
- } `json:"object_attributes"`
- Assignee struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"assignee"`
-}
-
-// CommitCommentEvent represents a comment on a commit event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#comment-on-commit
-type CommitCommentEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Note string `json:"note"`
- NoteableType string `json:"noteable_type"`
- AuthorID int `json:"author_id"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- ProjectID int `json:"project_id"`
- Attachment string `json:"attachment"`
- LineCode string `json:"line_code"`
- CommitID string `json:"commit_id"`
- NoteableID int `json:"noteable_id"`
- System bool `json:"system"`
- StDiff struct {
- Diff string `json:"diff"`
- NewPath string `json:"new_path"`
- OldPath string `json:"old_path"`
- AMode string `json:"a_mode"`
- BMode string `json:"b_mode"`
- NewFile bool `json:"new_file"`
- RenamedFile bool `json:"renamed_file"`
- DeletedFile bool `json:"deleted_file"`
- } `json:"st_diff"`
- } `json:"object_attributes"`
- Commit *struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- } `json:"commit"`
-}
-
-// MergeCommentEvent represents a comment on a merge event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#comment-on-merge-request
-type MergeCommentEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Note string `json:"note"`
- NoteableType string `json:"noteable_type"`
- AuthorID int `json:"author_id"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- ProjectID int `json:"project_id"`
- Attachment string `json:"attachment"`
- LineCode string `json:"line_code"`
- CommitID string `json:"commit_id"`
- NoteableID int `json:"noteable_id"`
- System bool `json:"system"`
- StDiff *Diff `json:"st_diff"`
- URL string `json:"url"`
- } `json:"object_attributes"`
- Repository *Repository `json:"repository"`
- MergeRequest struct {
- ID int `json:"id"`
- TargetBranch string `json:"target_branch"`
- SourceBranch string `json:"source_branch"`
- SourceProjectID int `json:"source_project_id"`
- AuthorID int `json:"author_id"`
- AssigneeID int `json:"assignee_id"`
- Title string `json:"title"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- MilestoneID int `json:"milestone_id"`
- State string `json:"state"`
- MergeStatus string `json:"merge_status"`
- TargetProjectID int `json:"target_project_id"`
- IID int `json:"iid"`
- Description string `json:"description"`
- Position int `json:"position"`
- LockedAt string `json:"locked_at"`
- UpdatedByID int `json:"updated_by_id"`
- MergeError string `json:"merge_error"`
- MergeParams struct {
- ForceRemoveSourceBranch string `json:"force_remove_source_branch"`
- } `json:"merge_params"`
- MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
- MergeUserID int `json:"merge_user_id"`
- MergeCommitSha string `json:"merge_commit_sha"`
- DeletedAt string `json:"deleted_at"`
- InProgressMergeCommitSha string `json:"in_progress_merge_commit_sha"`
- LockVersion int `json:"lock_version"`
- ApprovalsBeforeMerge string `json:"approvals_before_merge"`
- RebaseCommitSha string `json:"rebase_commit_sha"`
- TimeEstimate int `json:"time_estimate"`
- Squash bool `json:"squash"`
- LastEditedAt string `json:"last_edited_at"`
- LastEditedByID int `json:"last_edited_by_id"`
- Source *Repository `json:"source"`
- Target *Repository `json:"target"`
- LastCommit struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- } `json:"last_commit"`
- WorkInProgress bool `json:"work_in_progress"`
- TotalTimeSpent int `json:"total_time_spent"`
- } `json:"merge_request"`
-}
-
-// IssueCommentEvent represents a comment on an issue event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#comment-on-issue
-type IssueCommentEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Note string `json:"note"`
- NoteableType string `json:"noteable_type"`
- AuthorID int `json:"author_id"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- ProjectID int `json:"project_id"`
- Attachment string `json:"attachment"`
- LineCode string `json:"line_code"`
- CommitID string `json:"commit_id"`
- NoteableID int `json:"noteable_id"`
- System bool `json:"system"`
- StDiff []*Diff `json:"st_diff"`
- URL string `json:"url"`
- } `json:"object_attributes"`
- Issue *Issue `json:"issue"`
-}
-
-// SnippetCommentEvent represents a comment on a snippet event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#comment-on-code-snippet
-type SnippetCommentEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Note string `json:"note"`
- NoteableType string `json:"noteable_type"`
- AuthorID int `json:"author_id"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- ProjectID int `json:"project_id"`
- Attachment string `json:"attachment"`
- LineCode string `json:"line_code"`
- CommitID string `json:"commit_id"`
- NoteableID int `json:"noteable_id"`
- System bool `json:"system"`
- StDiff *Diff `json:"st_diff"`
- URL string `json:"url"`
- } `json:"object_attributes"`
- Snippet *Snippet `json:"snippet"`
-}
-
-// MergeEvent represents a merge event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#merge-request-events
-type MergeEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- ObjectAttributes struct {
- ID int `json:"id"`
- TargetBranch string `json:"target_branch"`
- SourceBranch string `json:"source_branch"`
- SourceProjectID int `json:"source_project_id"`
- AuthorID int `json:"author_id"`
- AssigneeID int `json:"assignee_id"`
- Title string `json:"title"`
- CreatedAt string `json:"created_at"` // Should be *time.Time (see Gitlab issue #21468)
- UpdatedAt string `json:"updated_at"` // Should be *time.Time (see Gitlab issue #21468)
- StCommits []*Commit `json:"st_commits"`
- StDiffs []*Diff `json:"st_diffs"`
- MilestoneID int `json:"milestone_id"`
- State string `json:"state"`
- MergeStatus string `json:"merge_status"`
- TargetProjectID int `json:"target_project_id"`
- IID int `json:"iid"`
- Description string `json:"description"`
- Position int `json:"position"`
- LockedAt string `json:"locked_at"`
- UpdatedByID int `json:"updated_by_id"`
- MergeError string `json:"merge_error"`
- MergeParams struct {
- ForceRemoveSourceBranch string `json:"force_remove_source_branch"`
- } `json:"merge_params"`
- MergeWhenBuildSucceeds bool `json:"merge_when_build_succeeds"`
- MergeUserID int `json:"merge_user_id"`
- MergeCommitSha string `json:"merge_commit_sha"`
- DeletedAt string `json:"deleted_at"`
- ApprovalsBeforeMerge string `json:"approvals_before_merge"`
- RebaseCommitSha string `json:"rebase_commit_sha"`
- InProgressMergeCommitSha string `json:"in_progress_merge_commit_sha"`
- LockVersion int `json:"lock_version"`
- TimeEstimate int `json:"time_estimate"`
- Source *Repository `json:"source"`
- Target *Repository `json:"target"`
- LastCommit struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- } `json:"last_commit"`
- WorkInProgress bool `json:"work_in_progress"`
- URL string `json:"url"`
- Action string `json:"action"`
- OldRev string `json:"oldrev"`
- Assignee struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"assignee"`
- } `json:"object_attributes"`
- Repository *Repository `json:"repository"`
- Assignee struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"assignee"`
- Changes struct {
- AssigneeID struct {
- Previous int `json:"previous"`
- Current int `json:"current"`
- } `json:"assignee_id"`
- Description struct {
- Previous string `json:"previous"`
- Current string `json:"current"`
- } `json:"description"`
- Labels struct {
- Previous []Label `json:"previous"`
- Current []Label `json:"current"`
- } `json:"labels"`
- UpdatedByID struct {
- Previous int `json:"previous"`
- Current int `json:"current"`
- } `json:"updated_by_id"`
- } `json:"changes"`
-}
-
-// WikiPageEvent represents a wiki page event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#wiki-page-events
-type WikiPageEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Wiki struct {
- WebURL string `json:"web_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- } `json:"wiki"`
- ObjectAttributes struct {
- Title string `json:"title"`
- Content string `json:"content"`
- Format string `json:"format"`
- Message string `json:"message"`
- Slug string `json:"slug"`
- URL string `json:"url"`
- Action string `json:"action"`
- } `json:"object_attributes"`
-}
-
-// PipelineEvent represents a pipeline event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#pipeline-events
-type PipelineEvent struct {
- ObjectKind string `json:"object_kind"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Ref string `json:"ref"`
- Tag bool `json:"tag"`
- Sha string `json:"sha"`
- BeforeSha string `json:"before_sha"`
- Status string `json:"status"`
- Stages []string `json:"stages"`
- CreatedAt string `json:"created_at"`
- FinishedAt string `json:"finished_at"`
- Duration int `json:"duration"`
- } `json:"object_attributes"`
- User struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"user"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Commit struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- } `json:"commit"`
- Builds []struct {
- ID int `json:"id"`
- Stage string `json:"stage"`
- Name string `json:"name"`
- Status string `json:"status"`
- CreatedAt string `json:"created_at"`
- StartedAt string `json:"started_at"`
- FinishedAt string `json:"finished_at"`
- When string `json:"when"`
- Manual bool `json:"manual"`
- User struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"user"`
- Runner struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Active bool `json:"active"`
- IsShared bool `json:"is_shared"`
- } `json:"runner"`
- ArtifactsFile struct {
- Filename string `json:"filename"`
- Size int `json:"size"`
- } `json:"artifacts_file"`
- } `json:"builds"`
-}
-
-//BuildEvent represents a build event
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/web_hooks/web_hooks.html#build-events
-type BuildEvent struct {
- ObjectKind string `json:"object_kind"`
- Ref string `json:"ref"`
- Tag bool `json:"tag"`
- BeforeSha string `json:"before_sha"`
- Sha string `json:"sha"`
- BuildID int `json:"build_id"`
- BuildName string `json:"build_name"`
- BuildStage string `json:"build_stage"`
- BuildStatus string `json:"build_status"`
- BuildStartedAt string `json:"build_started_at"`
- BuildFinishedAt string `json:"build_finished_at"`
- BuildDuration float64 `json:"build_duration"`
- BuildAllowFailure bool `json:"build_allow_failure"`
- ProjectID int `json:"project_id"`
- ProjectName string `json:"project_name"`
- User struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"user"`
- Commit struct {
- ID int `json:"id"`
- Sha string `json:"sha"`
- Message string `json:"message"`
- AuthorName string `json:"author_name"`
- AuthorEmail string `json:"author_email"`
- Status string `json:"status"`
- Duration int `json:"duration"`
- StartedAt string `json:"started_at"`
- FinishedAt string `json:"finished_at"`
- } `json:"commit"`
- Repository *Repository `json:"repository"`
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/events.go b/vendor/github.com/xanzy/go-gitlab/events.go
deleted file mode 100644
index ee6fbad3..00000000
--- a/vendor/github.com/xanzy/go-gitlab/events.go
+++ /dev/null
@@ -1,147 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// EventsService handles communication with the event related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/events.html
-type EventsService struct {
- client *Client
-}
-
-// ContributionEvent represents a user's contribution
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
-type ContributionEvent struct {
- Title string `json:"title"`
- ProjectID int `json:"project_id"`
- ActionName string `json:"action_name"`
- TargetID int `json:"target_id"`
- TargetIID int `json:"target_iid"`
- TargetType string `json:"target_type"`
- AuthorID int `json:"author_id"`
- TargetTitle string `json:"target_title"`
- CreatedAt *time.Time `json:"created_at"`
- PushData struct {
- CommitCount int `json:"commit_count"`
- Action string `json:"action"`
- RefType string `json:"ref_type"`
- CommitFrom string `json:"commit_from"`
- CommitTo string `json:"commit_to"`
- Ref string `json:"ref"`
- CommitTitle string `json:"commit_title"`
- } `json:"push_data"`
- Note *Note `json:"note"`
- Author struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- AuthorUsername string `json:"author_username"`
-}
-
-// ListContributionEventsOptions represents the options for GetUserContributionEvents
-//
-// GitLap API docs:
-// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
-type ListContributionEventsOptions struct {
- ListOptions
- Action *EventTypeValue `json:"action,omitempty"`
- TargetType *EventTargetTypeValue `json:"target_type,omitempty"`
- Before *ISOTime `json:"before,omitempty"`
- After *ISOTime `json:"after,omitempty"`
- Sort *string `json:"sort,omitempty"`
-}
-
-// ListUserContributionEvents retrieves user contribution events
-// for the specified user, sorted from newest to oldest.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
-func (s *UsersService) ListUserContributionEvents(uid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
- user, err := parseID(uid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("users/%s/events", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*ContributionEvent
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// ListCurrentUserContributionEvents gets a list currently authenticated user's events
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#list-currently-authenticated-user-39-s-events
-func (s *EventsService) ListCurrentUserContributionEvents(opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
- req, err := s.client.NewRequest("GET", "events", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*ContributionEvent
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// ListProjectVisibleEvents gets a list of visible events for a particular project
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/events.html#list-a-project-s-visible-events
-func (s *EventsService) ListProjectVisibleEvents(pid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/events", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*ContributionEvent
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/feature_flags.go b/vendor/github.com/xanzy/go-gitlab/feature_flags.go
deleted file mode 100644
index b6380ab0..00000000
--- a/vendor/github.com/xanzy/go-gitlab/feature_flags.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// FeaturesService handles the communication with the application FeaturesService
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
-type FeaturesService struct {
- client *Client
-}
-
-// Feature represents a GitLab feature flag.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
-type Feature struct {
- Name string `json:"name"`
- State string `json:"state"`
- Gates []Gate
-}
-
-// Gate represents a gate of a GitLab feature flag.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
-type Gate struct {
- Key string `json:"key"`
- Value interface{} `json:"value"`
-}
-
-func (f Feature) String() string {
- return Stringify(f)
-}
-
-// ListFeatures gets a list of feature flags
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/features.html#list-all-features
-func (s *FeaturesService) ListFeatures(options ...OptionFunc) ([]*Feature, *Response, error) {
- req, err := s.client.NewRequest("GET", "features", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var f []*Feature
- resp, err := s.client.Do(req, &f)
- if err != nil {
- return nil, resp, err
- }
- return f, resp, err
-}
-
-// SetFeatureFlag sets or creates a feature flag gate
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/features.html#set-or-create-a-feature
-func (s *FeaturesService) SetFeatureFlag(name string, value interface{}, options ...OptionFunc) (*Feature, *Response, error) {
- u := fmt.Sprintf("features/%s", url.QueryEscape(name))
-
- opt := struct {
- Value interface{} `url:"value" json:"value"`
- }{
- value,
- }
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- f := &Feature{}
- resp, err := s.client.Do(req, f)
- if err != nil {
- return nil, resp, err
- }
- return f, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go b/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go
deleted file mode 100644
index 5c911f45..00000000
--- a/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// GitIgnoreTemplatesService handles communication with the gitignore
-// templates related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/templates/gitignores.html
-type GitIgnoreTemplatesService struct {
- client *Client
-}
-
-// GitIgnoreTemplate represents a GitLab gitignore template.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/templates/gitignores.html
-type GitIgnoreTemplate struct {
- Name string `json:"name"`
- Content string `json:"content"`
-}
-
-// ListTemplatesOptions represents the available ListAllTemplates() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
-type ListTemplatesOptions ListOptions
-
-// ListTemplates get a list of available git ignore templates
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
-func (s *GitIgnoreTemplatesService) ListTemplates(opt *ListTemplatesOptions, options ...OptionFunc) ([]*GitIgnoreTemplate, *Response, error) {
- req, err := s.client.NewRequest("GET", "templates/gitignores", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gs []*GitIgnoreTemplate
- resp, err := s.client.Do(req, &gs)
- if err != nil {
- return nil, resp, err
- }
-
- return gs, resp, err
-}
-
-// GetTemplate get a git ignore template
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitignores.html#single-gitignore-template
-func (s *GitIgnoreTemplatesService) GetTemplate(key string, options ...OptionFunc) (*GitIgnoreTemplate, *Response, error) {
- u := fmt.Sprintf("templates/gitignores/%s", url.QueryEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(GitIgnoreTemplate)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go
deleted file mode 100644
index a18e2176..00000000
--- a/vendor/github.com/xanzy/go-gitlab/gitlab.go
+++ /dev/null
@@ -1,887 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "sort"
- "strconv"
- "strings"
- "time"
-
- "github.com/google/go-querystring/query"
- "golang.org/x/oauth2"
-)
-
-const (
- defaultBaseURL = "https://gitlab.com/"
- apiVersionPath = "api/v4/"
- userAgent = "go-gitlab"
-)
-
-// authType represents an authentication type within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-type authType int
-
-// List of available authentication types.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-const (
- basicAuth authType = iota
- oAuthToken
- privateToken
-)
-
-// AccessLevelValue represents a permission level within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html
-type AccessLevelValue int
-
-// List of available access levels
-//
-// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html
-const (
- NoPermissions AccessLevelValue = 0
- GuestPermissions AccessLevelValue = 10
- ReporterPermissions AccessLevelValue = 20
- DeveloperPermissions AccessLevelValue = 30
- MaintainerPermissions AccessLevelValue = 40
- OwnerPermissions AccessLevelValue = 50
-
- // These are deprecated and should be removed in a future version
- MasterPermissions AccessLevelValue = 40
- OwnerPermission AccessLevelValue = 50
-)
-
-// BuildStateValue represents a GitLab build state.
-type BuildStateValue string
-
-// These constants represent all valid build states.
-const (
- Pending BuildStateValue = "pending"
- Running BuildStateValue = "running"
- Success BuildStateValue = "success"
- Failed BuildStateValue = "failed"
- Canceled BuildStateValue = "canceled"
- Skipped BuildStateValue = "skipped"
-)
-
-// ISOTime represents an ISO 8601 formatted date
-type ISOTime time.Time
-
-// ISO 8601 date format
-const iso8601 = "2006-01-02"
-
-// MarshalJSON implements the json.Marshaler interface
-func (t ISOTime) MarshalJSON() ([]byte, error) {
- if y := time.Time(t).Year(); y < 0 || y >= 10000 {
- // ISO 8901 uses 4 digits for the years
- return nil, errors.New("ISOTime.MarshalJSON: year outside of range [0,9999]")
- }
-
- b := make([]byte, 0, len(iso8601)+2)
- b = append(b, '"')
- b = time.Time(t).AppendFormat(b, iso8601)
- b = append(b, '"')
-
- return b, nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface
-func (t *ISOTime) UnmarshalJSON(data []byte) error {
- // Ignore null, like in the main JSON package
- if string(data) == "null" {
- return nil
- }
-
- isotime, err := time.Parse(`"`+iso8601+`"`, string(data))
- *t = ISOTime(isotime)
-
- return err
-}
-
-// String implements the Stringer interface
-func (t ISOTime) String() string {
- return time.Time(t).Format(iso8601)
-}
-
-// NotificationLevelValue represents a notification level.
-type NotificationLevelValue int
-
-// String implements the fmt.Stringer interface.
-func (l NotificationLevelValue) String() string {
- return notificationLevelNames[l]
-}
-
-// MarshalJSON implements the json.Marshaler interface.
-func (l NotificationLevelValue) MarshalJSON() ([]byte, error) {
- return json.Marshal(l.String())
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (l *NotificationLevelValue) UnmarshalJSON(data []byte) error {
- var raw interface{}
- if err := json.Unmarshal(data, &raw); err != nil {
- return err
- }
-
- switch raw := raw.(type) {
- case float64:
- *l = NotificationLevelValue(raw)
- case string:
- *l = notificationLevelTypes[raw]
- case nil:
- // No action needed.
- default:
- return fmt.Errorf("json: cannot unmarshal %T into Go value of type %T", raw, *l)
- }
-
- return nil
-}
-
-// List of valid notification levels.
-const (
- DisabledNotificationLevel NotificationLevelValue = iota
- ParticipatingNotificationLevel
- WatchNotificationLevel
- GlobalNotificationLevel
- MentionNotificationLevel
- CustomNotificationLevel
-)
-
-var notificationLevelNames = [...]string{
- "disabled",
- "participating",
- "watch",
- "global",
- "mention",
- "custom",
-}
-
-var notificationLevelTypes = map[string]NotificationLevelValue{
- "disabled": DisabledNotificationLevel,
- "participating": ParticipatingNotificationLevel,
- "watch": WatchNotificationLevel,
- "global": GlobalNotificationLevel,
- "mention": MentionNotificationLevel,
- "custom": CustomNotificationLevel,
-}
-
-// VisibilityValue represents a visibility level within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-type VisibilityValue string
-
-// List of available visibility levels
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-const (
- PrivateVisibility VisibilityValue = "private"
- InternalVisibility VisibilityValue = "internal"
- PublicVisibility VisibilityValue = "public"
-)
-
-// MergeMethodValue represents a project merge type within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
-type MergeMethodValue string
-
-// List of available merge type
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
-const (
- NoFastForwardMerge MergeMethodValue = "merge"
- FastForwardMerge MergeMethodValue = "ff"
- RebaseMerge MergeMethodValue = "rebase_merge"
-)
-
-// EventTypeValue represents actions type for contribution events
-type EventTypeValue string
-
-// List of available action type
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#action-types
-const (
- CreatedEventType EventTypeValue = "created"
- UpdatedEventType EventTypeValue = "updated"
- ClosedEventType EventTypeValue = "closed"
- ReopenedEventType EventTypeValue = "reopened"
- PushedEventType EventTypeValue = "pushed"
- CommentedEventType EventTypeValue = "commented"
- MergedEventType EventTypeValue = "merged"
- JoinedEventType EventTypeValue = "joined"
- LeftEventType EventTypeValue = "left"
- DestroyedEventType EventTypeValue = "destroyed"
- ExpiredEventType EventTypeValue = "expired"
-)
-
-// EventTargetTypeValue represents actions type value for contribution events
-type EventTargetTypeValue string
-
-// List of available action type
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#target-types
-const (
- IssueEventTargetType EventTargetTypeValue = "issue"
- MilestoneEventTargetType EventTargetTypeValue = "milestone"
- MergeRequestEventTargetType EventTargetTypeValue = "merge_request"
- NoteEventTargetType EventTargetTypeValue = "note"
- ProjectEventTargetType EventTargetTypeValue = "project"
- SnippetEventTargetType EventTargetTypeValue = "snippet"
- UserEventTargetType EventTargetTypeValue = "user"
-)
-
-// A Client manages communication with the GitLab API.
-type Client struct {
- // HTTP client used to communicate with the API.
- client *http.Client
-
- // Base URL for API requests. Defaults to the public GitLab API, but can be
- // set to a domain endpoint to use with a self hosted GitLab server. baseURL
- // should always be specified with a trailing slash.
- baseURL *url.URL
-
- // Token type used to make authenticated API calls.
- authType authType
-
- // Username and password used for basix authentication.
- username, password string
-
- // Token used to make authenticated API calls.
- token string
-
- // User agent used when communicating with the GitLab API.
- UserAgent string
-
- // Services used for talking to different parts of the GitLab API.
- AccessRequests *AccessRequestsService
- AwardEmoji *AwardEmojiService
- Branches *BranchesService
- BuildVariables *BuildVariablesService
- BroadcastMessage *BroadcastMessagesService
- CIYMLTemplate *CIYMLTemplatesService
- Commits *CommitsService
- CustomAttribute *CustomAttributesService
- DeployKeys *DeployKeysService
- Deployments *DeploymentsService
- Discussions *DiscussionsService
- Environments *EnvironmentsService
- Events *EventsService
- Features *FeaturesService
- GitIgnoreTemplates *GitIgnoreTemplatesService
- Groups *GroupsService
- GroupIssueBoards *GroupIssueBoardsService
- GroupMembers *GroupMembersService
- GroupMilestones *GroupMilestonesService
- GroupVariables *GroupVariablesService
- Issues *IssuesService
- IssueLinks *IssueLinksService
- Jobs *JobsService
- Keys *KeysService
- Boards *IssueBoardsService
- Labels *LabelsService
- LicenseTemplates *LicenseTemplatesService
- MergeRequests *MergeRequestsService
- MergeRequestApprovals *MergeRequestApprovalsService
- Milestones *MilestonesService
- Namespaces *NamespacesService
- Notes *NotesService
- NotificationSettings *NotificationSettingsService
- PagesDomains *PagesDomainsService
- Pipelines *PipelinesService
- PipelineSchedules *PipelineSchedulesService
- PipelineTriggers *PipelineTriggersService
- Projects *ProjectsService
- ProjectMembers *ProjectMembersService
- ProjectBadges *ProjectBadgesService
- ProjectSnippets *ProjectSnippetsService
- ProjectVariables *ProjectVariablesService
- ProtectedBranches *ProtectedBranchesService
- Repositories *RepositoriesService
- RepositoryFiles *RepositoryFilesService
- Runners *RunnersService
- Search *SearchService
- Services *ServicesService
- Session *SessionService
- Settings *SettingsService
- Sidekiq *SidekiqService
- Snippets *SnippetsService
- SystemHooks *SystemHooksService
- Tags *TagsService
- Todos *TodosService
- Users *UsersService
- Validate *ValidateService
- Version *VersionService
- Wikis *WikisService
-}
-
-// ListOptions specifies the optional parameters to various List methods that
-// support pagination.
-type ListOptions struct {
- // For paginated result sets, page of results to retrieve.
- Page int `url:"page,omitempty" json:"page,omitempty"`
-
- // For paginated result sets, the number of results to include per page.
- PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"`
-}
-
-// NewClient returns a new GitLab API client. If a nil httpClient is
-// provided, http.DefaultClient will be used. To use API methods which require
-// authentication, provide a valid private or personal token.
-func NewClient(httpClient *http.Client, token string) *Client {
- client := newClient(httpClient)
- client.authType = privateToken
- client.token = token
- return client
-}
-
-// NewBasicAuthClient returns a new GitLab API client. If a nil httpClient is
-// provided, http.DefaultClient will be used. To use API methods which require
-// authentication, provide a valid username and password.
-func NewBasicAuthClient(httpClient *http.Client, endpoint, username, password string) (*Client, error) {
- client := newClient(httpClient)
- client.authType = basicAuth
- client.username = username
- client.password = password
- client.SetBaseURL(endpoint)
-
- err := client.requestOAuthToken(context.TODO())
- if err != nil {
- return nil, err
- }
-
- return client, nil
-}
-
-func (c *Client) requestOAuthToken(ctx context.Context) error {
- config := &oauth2.Config{
- Endpoint: oauth2.Endpoint{
- AuthURL: fmt.Sprintf("%s://%s/oauth/authorize", c.BaseURL().Scheme, c.BaseURL().Host),
- TokenURL: fmt.Sprintf("%s://%s/oauth/token", c.BaseURL().Scheme, c.BaseURL().Host),
- },
- }
- ctx = context.WithValue(ctx, oauth2.HTTPClient, c.client)
- t, err := config.PasswordCredentialsToken(ctx, c.username, c.password)
- if err != nil {
- return err
- }
- c.token = t.AccessToken
- return nil
-}
-
-// NewOAuthClient returns a new GitLab API client. If a nil httpClient is
-// provided, http.DefaultClient will be used. To use API methods which require
-// authentication, provide a valid oauth token.
-func NewOAuthClient(httpClient *http.Client, token string) *Client {
- client := newClient(httpClient)
- client.authType = oAuthToken
- client.token = token
- return client
-}
-
-func newClient(httpClient *http.Client) *Client {
- if httpClient == nil {
- httpClient = http.DefaultClient
- }
-
- c := &Client{client: httpClient, UserAgent: userAgent}
- if err := c.SetBaseURL(defaultBaseURL); err != nil {
- // Should never happen since defaultBaseURL is our constant.
- panic(err)
- }
-
- // Create the internal timeStats service.
- timeStats := &timeStatsService{client: c}
-
- // Create all the public services.
- c.AccessRequests = &AccessRequestsService{client: c}
- c.AwardEmoji = &AwardEmojiService{client: c}
- c.Branches = &BranchesService{client: c}
- c.BuildVariables = &BuildVariablesService{client: c}
- c.BroadcastMessage = &BroadcastMessagesService{client: c}
- c.CIYMLTemplate = &CIYMLTemplatesService{client: c}
- c.Commits = &CommitsService{client: c}
- c.CustomAttribute = &CustomAttributesService{client: c}
- c.DeployKeys = &DeployKeysService{client: c}
- c.Deployments = &DeploymentsService{client: c}
- c.Discussions = &DiscussionsService{client: c}
- c.Environments = &EnvironmentsService{client: c}
- c.Events = &EventsService{client: c}
- c.Features = &FeaturesService{client: c}
- c.GitIgnoreTemplates = &GitIgnoreTemplatesService{client: c}
- c.Groups = &GroupsService{client: c}
- c.GroupIssueBoards = &GroupIssueBoardsService{client: c}
- c.GroupMembers = &GroupMembersService{client: c}
- c.GroupMilestones = &GroupMilestonesService{client: c}
- c.GroupVariables = &GroupVariablesService{client: c}
- c.Issues = &IssuesService{client: c, timeStats: timeStats}
- c.IssueLinks = &IssueLinksService{client: c}
- c.Jobs = &JobsService{client: c}
- c.Keys = &KeysService{client: c}
- c.Boards = &IssueBoardsService{client: c}
- c.Labels = &LabelsService{client: c}
- c.LicenseTemplates = &LicenseTemplatesService{client: c}
- c.MergeRequests = &MergeRequestsService{client: c, timeStats: timeStats}
- c.MergeRequestApprovals = &MergeRequestApprovalsService{client: c}
- c.Milestones = &MilestonesService{client: c}
- c.Namespaces = &NamespacesService{client: c}
- c.Notes = &NotesService{client: c}
- c.NotificationSettings = &NotificationSettingsService{client: c}
- c.PagesDomains = &PagesDomainsService{client: c}
- c.Pipelines = &PipelinesService{client: c}
- c.PipelineSchedules = &PipelineSchedulesService{client: c}
- c.PipelineTriggers = &PipelineTriggersService{client: c}
- c.Projects = &ProjectsService{client: c}
- c.ProjectMembers = &ProjectMembersService{client: c}
- c.ProjectBadges = &ProjectBadgesService{client: c}
- c.ProjectSnippets = &ProjectSnippetsService{client: c}
- c.ProjectVariables = &ProjectVariablesService{client: c}
- c.ProtectedBranches = &ProtectedBranchesService{client: c}
- c.Repositories = &RepositoriesService{client: c}
- c.RepositoryFiles = &RepositoryFilesService{client: c}
- c.Runners = &RunnersService{client: c}
- c.Services = &ServicesService{client: c}
- c.Search = &SearchService{client: c}
- c.Session = &SessionService{client: c}
- c.Settings = &SettingsService{client: c}
- c.Sidekiq = &SidekiqService{client: c}
- c.Snippets = &SnippetsService{client: c}
- c.SystemHooks = &SystemHooksService{client: c}
- c.Tags = &TagsService{client: c}
- c.Todos = &TodosService{client: c}
- c.Users = &UsersService{client: c}
- c.Validate = &ValidateService{client: c}
- c.Version = &VersionService{client: c}
- c.Wikis = &WikisService{client: c}
-
- return c
-}
-
-// BaseURL return a copy of the baseURL.
-func (c *Client) BaseURL() *url.URL {
- u := *c.baseURL
- return &u
-}
-
-// SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr
-// should always be specified with a trailing slash.
-func (c *Client) SetBaseURL(urlStr string) error {
- // Make sure the given URL end with a slash
- if !strings.HasSuffix(urlStr, "/") {
- urlStr += "/"
- }
-
- baseURL, err := url.Parse(urlStr)
- if err != nil {
- return err
- }
-
- if !strings.HasSuffix(baseURL.Path, apiVersionPath) {
- baseURL.Path += apiVersionPath
- }
-
- // Update the base URL of the client.
- c.baseURL = baseURL
-
- return nil
-}
-
-// NewRequest creates an API request. A relative URL path can be provided in
-// urlStr, in which case it is resolved relative to the base URL of the Client.
-// Relative URL paths should always be specified without a preceding slash. If
-// specified, the value pointed to by body is JSON encoded and included as the
-// request body.
-func (c *Client) NewRequest(method, path string, opt interface{}, options []OptionFunc) (*http.Request, error) {
- u := *c.baseURL
- unescaped, err := url.PathUnescape(path)
- if err != nil {
- return nil, err
- }
-
- // Set the encoded path data
- u.RawPath = c.baseURL.Path + path
- u.Path = c.baseURL.Path + unescaped
-
- if opt != nil {
- q, err := query.Values(opt)
- if err != nil {
- return nil, err
- }
- u.RawQuery = q.Encode()
- }
-
- req := &http.Request{
- Method: method,
- URL: &u,
- Proto: "HTTP/1.1",
- ProtoMajor: 1,
- ProtoMinor: 1,
- Header: make(http.Header),
- Host: u.Host,
- }
-
- for _, fn := range options {
- if fn == nil {
- continue
- }
-
- if err := fn(req); err != nil {
- return nil, err
- }
- }
-
- if method == "POST" || method == "PUT" {
- bodyBytes, err := json.Marshal(opt)
- if err != nil {
- return nil, err
- }
- bodyReader := bytes.NewReader(bodyBytes)
-
- u.RawQuery = ""
- req.Body = ioutil.NopCloser(bodyReader)
- req.ContentLength = int64(bodyReader.Len())
- req.Header.Set("Content-Type", "application/json")
- }
-
- req.Header.Set("Accept", "application/json")
-
- switch c.authType {
- case basicAuth, oAuthToken:
- req.Header.Set("Authorization", "Bearer "+c.token)
- case privateToken:
- req.Header.Set("PRIVATE-TOKEN", c.token)
- }
-
- if c.UserAgent != "" {
- req.Header.Set("User-Agent", c.UserAgent)
- }
-
- return req, nil
-}
-
-// Response is a GitLab API response. This wraps the standard http.Response
-// returned from GitLab and provides convenient access to things like
-// pagination links.
-type Response struct {
- *http.Response
-
- // These fields provide the page values for paginating through a set of
- // results. Any or all of these may be set to the zero value for
- // responses that are not part of a paginated set, or for which there
- // are no additional pages.
- TotalItems int
- TotalPages int
- ItemsPerPage int
- CurrentPage int
- NextPage int
- PreviousPage int
-}
-
-// newResponse creates a new Response for the provided http.Response.
-func newResponse(r *http.Response) *Response {
- response := &Response{Response: r}
- response.populatePageValues()
- return response
-}
-
-const (
- xTotal = "X-Total"
- xTotalPages = "X-Total-Pages"
- xPerPage = "X-Per-Page"
- xPage = "X-Page"
- xNextPage = "X-Next-Page"
- xPrevPage = "X-Prev-Page"
-)
-
-// populatePageValues parses the HTTP Link response headers and populates the
-// various pagination link values in the Response.
-func (r *Response) populatePageValues() {
- if totalItems := r.Response.Header.Get(xTotal); totalItems != "" {
- r.TotalItems, _ = strconv.Atoi(totalItems)
- }
- if totalPages := r.Response.Header.Get(xTotalPages); totalPages != "" {
- r.TotalPages, _ = strconv.Atoi(totalPages)
- }
- if itemsPerPage := r.Response.Header.Get(xPerPage); itemsPerPage != "" {
- r.ItemsPerPage, _ = strconv.Atoi(itemsPerPage)
- }
- if currentPage := r.Response.Header.Get(xPage); currentPage != "" {
- r.CurrentPage, _ = strconv.Atoi(currentPage)
- }
- if nextPage := r.Response.Header.Get(xNextPage); nextPage != "" {
- r.NextPage, _ = strconv.Atoi(nextPage)
- }
- if previousPage := r.Response.Header.Get(xPrevPage); previousPage != "" {
- r.PreviousPage, _ = strconv.Atoi(previousPage)
- }
-}
-
-// Do sends an API request and returns the API response. The API response is
-// JSON decoded and stored in the value pointed to by v, or returned as an
-// error if an API error has occurred. If v implements the io.Writer
-// interface, the raw response body will be written to v, without attempting to
-// first decode it.
-func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) {
- resp, err := c.client.Do(req)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- if resp.StatusCode == http.StatusUnauthorized && c.authType == basicAuth {
- err = c.requestOAuthToken(req.Context())
- if err != nil {
- return nil, err
- }
- return c.Do(req, v)
- }
-
- response := newResponse(resp)
-
- err = CheckResponse(resp)
- if err != nil {
- // even though there was an error, we still return the response
- // in case the caller wants to inspect it further
- return response, err
- }
-
- if v != nil {
- if w, ok := v.(io.Writer); ok {
- _, err = io.Copy(w, resp.Body)
- } else {
- err = json.NewDecoder(resp.Body).Decode(v)
- }
- }
-
- return response, err
-}
-
-// Helper function to accept and format both the project ID or name as project
-// identifier for all API calls.
-func parseID(id interface{}) (string, error) {
- switch v := id.(type) {
- case int:
- return strconv.Itoa(v), nil
- case string:
- return v, nil
- default:
- return "", fmt.Errorf("invalid ID type %#v, the ID must be an int or a string", id)
- }
-}
-
-// An ErrorResponse reports one or more errors caused by an API request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/README.html#data-validation-and-error-reporting
-type ErrorResponse struct {
- Body []byte
- Response *http.Response
- Message string
-}
-
-func (e *ErrorResponse) Error() string {
- path, _ := url.QueryUnescape(e.Response.Request.URL.Path)
- u := fmt.Sprintf("%s://%s%s", e.Response.Request.URL.Scheme, e.Response.Request.URL.Host, path)
- return fmt.Sprintf("%s %s: %d %s", e.Response.Request.Method, u, e.Response.StatusCode, e.Message)
-}
-
-// CheckResponse checks the API response for errors, and returns them if present.
-func CheckResponse(r *http.Response) error {
- switch r.StatusCode {
- case 200, 201, 202, 204, 304:
- return nil
- }
-
- errorResponse := &ErrorResponse{Response: r}
- data, err := ioutil.ReadAll(r.Body)
- if err == nil && data != nil {
- errorResponse.Body = data
-
- var raw interface{}
- if err := json.Unmarshal(data, &raw); err != nil {
- errorResponse.Message = "failed to parse unknown error format"
- } else {
- errorResponse.Message = parseError(raw)
- }
- }
-
- return errorResponse
-}
-
-// Format:
-// {
-// "message": {
-// "": [
-// "",
-// "",
-// ...
-// ],
-// "": {
-// "": [
-// "",
-// "",
-// ...
-// ],
-// }
-// },
-// "error": ""
-// }
-func parseError(raw interface{}) string {
- switch raw := raw.(type) {
- case string:
- return raw
-
- case []interface{}:
- var errs []string
- for _, v := range raw {
- errs = append(errs, parseError(v))
- }
- return fmt.Sprintf("[%s]", strings.Join(errs, ", "))
-
- case map[string]interface{}:
- var errs []string
- for k, v := range raw {
- errs = append(errs, fmt.Sprintf("{%s: %s}", k, parseError(v)))
- }
- sort.Strings(errs)
- return strings.Join(errs, ", ")
-
- default:
- return fmt.Sprintf("failed to parse unexpected error type: %T", raw)
- }
-}
-
-// OptionFunc can be passed to all API requests to make the API call as if you were
-// another user, provided your private token is from an administrator account.
-//
-// GitLab docs: https://docs.gitlab.com/ce/api/README.html#sudo
-type OptionFunc func(*http.Request) error
-
-// WithSudo takes either a username or user ID and sets the SUDO request header
-func WithSudo(uid interface{}) OptionFunc {
- return func(req *http.Request) error {
- user, err := parseID(uid)
- if err != nil {
- return err
- }
- req.Header.Set("SUDO", user)
- return nil
- }
-}
-
-// WithContext runs the request with the provided context
-func WithContext(ctx context.Context) OptionFunc {
- return func(req *http.Request) error {
- *req = *req.WithContext(ctx)
- return nil
- }
-}
-
-// Bool is a helper routine that allocates a new bool value
-// to store v and returns a pointer to it.
-func Bool(v bool) *bool {
- p := new(bool)
- *p = v
- return p
-}
-
-// Int is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it, but unlike Int32
-// its argument value is an int.
-func Int(v int) *int {
- p := new(int)
- *p = v
- return p
-}
-
-// String is a helper routine that allocates a new string value
-// to store v and returns a pointer to it.
-func String(v string) *string {
- p := new(string)
- *p = v
- return p
-}
-
-// AccessLevel is a helper routine that allocates a new AccessLevelValue
-// to store v and returns a pointer to it.
-func AccessLevel(v AccessLevelValue) *AccessLevelValue {
- p := new(AccessLevelValue)
- *p = v
- return p
-}
-
-// BuildState is a helper routine that allocates a new BuildStateValue
-// to store v and returns a pointer to it.
-func BuildState(v BuildStateValue) *BuildStateValue {
- p := new(BuildStateValue)
- *p = v
- return p
-}
-
-// NotificationLevel is a helper routine that allocates a new NotificationLevelValue
-// to store v and returns a pointer to it.
-func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue {
- p := new(NotificationLevelValue)
- *p = v
- return p
-}
-
-// Visibility is a helper routine that allocates a new VisibilityValue
-// to store v and returns a pointer to it.
-func Visibility(v VisibilityValue) *VisibilityValue {
- p := new(VisibilityValue)
- *p = v
- return p
-}
-
-// MergeMethod is a helper routine that allocates a new MergeMethod
-// to sotre v and returns a pointer to it.
-func MergeMethod(v MergeMethodValue) *MergeMethodValue {
- p := new(MergeMethodValue)
- *p = v
- return p
-}
-
-// BoolValue is a boolean value with advanced json unmarshaling features.
-type BoolValue bool
-
-// UnmarshalJSON allows 1 and 0 to be considered as boolean values
-// Needed for https://gitlab.com/gitlab-org/gitlab-ce/issues/50122
-func (t *BoolValue) UnmarshalJSON(b []byte) error {
- switch string(b) {
- case `"1"`:
- *t = true
- return nil
- case `"0"`:
- *t = false
- return nil
- default:
- var v bool
- err := json.Unmarshal(b, &v)
- *t = BoolValue(v)
- return err
- }
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_boards.go b/vendor/github.com/xanzy/go-gitlab/group_boards.go
deleted file mode 100644
index 764df14e..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_boards.go
+++ /dev/null
@@ -1,262 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// GroupIssueBoardsService handles communication with the group issue board
-// related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html
-type GroupIssueBoardsService struct {
- client *Client
-}
-
-// GroupIssueBoard represents a GitLab group issue board.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html
-type GroupIssueBoard struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Group *Group `json:"group"`
- Milestone *Milestone `json:"milestone"`
- Lists []*BoardList `json:"lists"`
-}
-
-func (b GroupIssueBoard) String() string {
- return Stringify(b)
-}
-
-// ListGroupIssueBoardsOptions represents the available
-// ListGroupIssueBoards() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#group-board
-type ListGroupIssueBoardsOptions ListOptions
-
-// ListGroupIssueBoards gets a list of all issue boards in a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#group-board
-func (s *GroupIssueBoardsService) ListGroupIssueBoards(gid interface{}, opt *ListGroupIssueBoardsOptions, options ...OptionFunc) ([]*GroupIssueBoard, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gs []*GroupIssueBoard
- resp, err := s.client.Do(req, &gs)
- if err != nil {
- return nil, resp, err
- }
-
- return gs, resp, err
-}
-
-// GetGroupIssueBoard gets a single issue board of a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#single-board
-func (s *GroupIssueBoardsService) GetGroupIssueBoard(gid interface{}, board int, options ...OptionFunc) (*GroupIssueBoard, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d", url.QueryEscape(group), board)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- gib := new(GroupIssueBoard)
- resp, err := s.client.Do(req, gib)
- if err != nil {
- return nil, resp, err
- }
-
- return gib, resp, err
-}
-
-// ListGroupIssueBoardListsOptions represents the available
-// ListGroupIssueBoardLists() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#list-board-lists
-type ListGroupIssueBoardListsOptions ListOptions
-
-// ListGroupIssueBoardLists gets a list of the issue board's lists. Does not include
-// backlog and closed lists.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/group_boards.html#list-board-lists
-func (s *GroupIssueBoardsService) ListGroupIssueBoardLists(gid interface{}, board int, opt *ListGroupIssueBoardListsOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists", url.QueryEscape(group), board)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gbl []*BoardList
- resp, err := s.client.Do(req, &gbl)
- if err != nil {
- return nil, resp, err
- }
-
- return gbl, resp, err
-}
-
-// GetGroupIssueBoardList gets a single issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#single-board-list
-func (s *GroupIssueBoardsService) GetGroupIssueBoardList(gid interface{}, board, list int, options ...OptionFunc) (*BoardList, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
- url.QueryEscape(group),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- gbl := new(BoardList)
- resp, err := s.client.Do(req, gbl)
- if err != nil {
- return nil, resp, err
- }
-
- return gbl, resp, err
-}
-
-// CreateGroupIssueBoardListOptions represents the available
-// CreateGroupIssueBoardList() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#new-board-list
-type CreateGroupIssueBoardListOptions struct {
- LabelID *int `url:"label_id" json:"label_id"`
-}
-
-// CreateGroupIssueBoardList creates a new issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#new-board-list
-func (s *GroupIssueBoardsService) CreateGroupIssueBoardList(gid interface{}, board int, opt *CreateGroupIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists", url.QueryEscape(group), board)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gbl := new(BoardList)
- resp, err := s.client.Do(req, gbl)
- if err != nil {
- return nil, resp, err
- }
-
- return gbl, resp, err
-}
-
-// UpdateGroupIssueBoardListOptions represents the available
-// UpdateGroupIssueBoardList() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#edit-board-list
-type UpdateGroupIssueBoardListOptions struct {
- Position *int `url:"position" json:"position"`
-}
-
-// UpdateIssueBoardList updates the position of an existing
-// group issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#edit-board-list
-func (s *GroupIssueBoardsService) UpdateIssueBoardList(gid interface{}, board, list int, opt *UpdateGroupIssueBoardListOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
- url.QueryEscape(group),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gbl []*BoardList
- resp, err := s.client.Do(req, gbl)
- if err != nil {
- return nil, resp, err
- }
-
- return gbl, resp, err
-}
-
-// DeleteGroupIssueBoardList soft deletes a group issue board list.
-// Only for admins and group owners.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#delete-a-board-list
-func (s *GroupIssueBoardsService) DeleteGroupIssueBoardList(gid interface{}, board, list int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
- url.QueryEscape(group),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_members.go b/vendor/github.com/xanzy/go-gitlab/group_members.go
deleted file mode 100644
index 27e7064c..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_members.go
+++ /dev/null
@@ -1,221 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// GroupMembersService handles communication with the group members
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
-type GroupMembersService struct {
- client *Client
-}
-
-// GroupMember represents a GitLab group member.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
-type GroupMember struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- AccessLevel AccessLevelValue `json:"access_level"`
- ExpiresAt *ISOTime `json:"expires_at"`
-}
-
-// ListGroupMembersOptions represents the available ListGroupMembers() and
-// ListAllGroupMembers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
-type ListGroupMembersOptions struct {
- ListOptions
- Query *string `url:"query,omitempty" json:"query,omitempty"`
-}
-
-// ListGroupMembers get a list of group members viewable by the authenticated
-// user. Returns a list including inherited members through ancestor groups.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
-func (s *GroupsService) ListGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...OptionFunc) ([]*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gm []*GroupMember
- resp, err := s.client.Do(req, &gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// ListAllGroupMembers get a list of group members viewable by the authenticated
-// user. Returns a list including inherited members through ancestor groups.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project-including-inherited-members
-func (s *GroupsService) ListAllGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...OptionFunc) ([]*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members/all", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gm []*GroupMember
- resp, err := s.client.Do(req, &gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// AddGroupMemberOptions represents the available AddGroupMember() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
-type AddGroupMemberOptions struct {
- UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"`
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
- ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at"`
-}
-
-// GetGroupMember gets a member of a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project
-func (s *GroupMembersService) GetGroupMember(gid interface{}, user int, options ...OptionFunc) (*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members/%d", url.QueryEscape(group), user)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- gm := new(GroupMember)
- resp, err := s.client.Do(req, gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// AddGroupMember adds a user to the list of group members.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
-func (s *GroupMembersService) AddGroupMember(gid interface{}, opt *AddGroupMemberOptions, options ...OptionFunc) (*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gm := new(GroupMember)
- resp, err := s.client.Do(req, gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// EditGroupMemberOptions represents the available EditGroupMember()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
-type EditGroupMemberOptions struct {
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
- ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at"`
-}
-
-// EditGroupMember updates a member of a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
-func (s *GroupMembersService) EditGroupMember(gid interface{}, user int, opt *EditGroupMemberOptions, options ...OptionFunc) (*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members/%d", url.QueryEscape(group), user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gm := new(GroupMember)
- resp, err := s.client.Do(req, gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// RemoveGroupMember removes user from user team.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project
-func (s *GroupMembersService) RemoveGroupMember(gid interface{}, user int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/members/%d", url.QueryEscape(group), user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_milestones.go b/vendor/github.com/xanzy/go-gitlab/group_milestones.go
deleted file mode 100644
index 8335a47b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_milestones.go
+++ /dev/null
@@ -1,250 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// GroupMilestonesService handles communication with the milestone related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/group_milestones.html
-type GroupMilestonesService struct {
- client *Client
-}
-
-// GroupMilestone represents a GitLab milestone.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/group_milestones.html
-type GroupMilestone struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- GroupID int `json:"group_id"`
- Title string `json:"title"`
- Description string `json:"description"`
- StartDate *ISOTime `json:"start_date"`
- DueDate *ISOTime `json:"due_date"`
- State string `json:"state"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (m GroupMilestone) String() string {
- return Stringify(m)
-}
-
-// ListGroupMilestonesOptions represents the available
-// ListGroupMilestones() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#list-group-milestones
-type ListGroupMilestonesOptions struct {
- ListOptions
- IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
- State string `url:"state,omitempty" json:"state,omitempty"`
- Search string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListGroupMilestones returns a list of group milestones.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#list-group-milestones
-func (s *GroupMilestonesService) ListGroupMilestones(gid interface{}, opt *ListGroupMilestonesOptions, options ...OptionFunc) ([]*GroupMilestone, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*GroupMilestone
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetGroupMilestone gets a single group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-single-milestone
-func (s *GroupMilestonesService) GetGroupMilestone(gid interface{}, milestone int, options ...OptionFunc) (*GroupMilestone, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones/%d", url.QueryEscape(group), milestone)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(GroupMilestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// CreateGroupMilestoneOptions represents the available CreateGroupMilestone() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#create-new-milestone
-type CreateGroupMilestoneOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
-}
-
-// CreateGroupMilestone creates a new group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#create-new-milestone
-func (s *GroupMilestonesService) CreateGroupMilestone(gid interface{}, opt *CreateGroupMilestoneOptions, options ...OptionFunc) (*GroupMilestone, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(GroupMilestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UpdateGroupMilestoneOptions represents the available UpdateGroupMilestone() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#edit-milestone
-type UpdateGroupMilestoneOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
-}
-
-// UpdateGroupMilestone updates an existing group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#edit-milestone
-func (s *GroupMilestonesService) UpdateGroupMilestone(gid interface{}, milestone int, opt *UpdateGroupMilestoneOptions, options ...OptionFunc) (*GroupMilestone, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones/%d", url.QueryEscape(group), milestone)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(GroupMilestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetGroupMilestoneIssuesOptions represents the available GetGroupMilestoneIssues() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-issues-assigned-to-a-single-milestone
-type GetGroupMilestoneIssuesOptions ListOptions
-
-// GetGroupMilestoneIssues gets all issues assigned to a single group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-issues-assigned-to-a-single-milestone
-func (s *GroupMilestonesService) GetGroupMilestoneIssues(gid interface{}, milestone int, opt *GetGroupMilestoneIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones/%d/issues", url.QueryEscape(group), milestone)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// GetGroupMilestoneMergeRequestsOptions represents the available
-// GetGroupMilestoneMergeRequests() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
-type GetGroupMilestoneMergeRequestsOptions ListOptions
-
-// GetGroupMilestoneMergeRequests gets all merge requests assigned to a
-// single group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
-func (s *GroupMilestonesService) GetGroupMilestoneMergeRequests(gid interface{}, milestone int, opt *GetGroupMilestoneMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones/%d/merge_requests", url.QueryEscape(group), milestone)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var mr []*MergeRequest
- resp, err := s.client.Do(req, &mr)
- if err != nil {
- return nil, resp, err
- }
-
- return mr, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_variables.go b/vendor/github.com/xanzy/go-gitlab/group_variables.go
deleted file mode 100644
index cc28e4fd..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_variables.go
+++ /dev/null
@@ -1,171 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// GroupVariablesService handles communication with the
-// group variables related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html
-type GroupVariablesService struct {
- client *Client
-}
-
-// GroupVariable represents a GitLab group Variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html
-type GroupVariable struct {
- Key string `json:"key"`
- Value string `json:"value"`
- Protected bool `json:"protected"`
-}
-
-func (v GroupVariable) String() string {
- return Stringify(v)
-}
-
-// ListVariables gets a list of all variables for a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#list-group-variables
-func (s *GroupVariablesService) ListVariables(gid interface{}, options ...OptionFunc) ([]*GroupVariable, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/variables", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var vs []*GroupVariable
- resp, err := s.client.Do(req, &vs)
- if err != nil {
- return nil, resp, err
- }
-
- return vs, resp, err
-}
-
-// GetVariable gets a variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#show-variable-details
-func (s *GroupVariablesService) GetVariable(gid interface{}, key string, options ...OptionFunc) (*GroupVariable, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/variables/%s", url.QueryEscape(group), url.QueryEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(GroupVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// CreateVariable creates a new group variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#create-variable
-func (s *GroupVariablesService) CreateVariable(gid interface{}, opt *CreateVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/variables", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(GroupVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// UpdateVariable updates the position of an existing
-// group issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#update-variable
-func (s *GroupVariablesService) UpdateVariable(gid interface{}, key string, opt *UpdateVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/variables/%s",
- url.QueryEscape(group),
- url.QueryEscape(key),
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(GroupVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// RemoveVariable removes a group's variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#remove-variable
-func (s *GroupVariablesService) RemoveVariable(gid interface{}, key string, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/variables/%s",
- url.QueryEscape(group),
- url.QueryEscape(key),
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/groups.go b/vendor/github.com/xanzy/go-gitlab/groups.go
deleted file mode 100644
index d379915c..00000000
--- a/vendor/github.com/xanzy/go-gitlab/groups.go
+++ /dev/null
@@ -1,307 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// GroupsService handles communication with the group related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html
-type GroupsService struct {
- client *Client
-}
-
-// Group represents a GitLab group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html
-type Group struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Description string `json:"description"`
- Visibility *VisibilityValue `json:"visibility"`
- LFSEnabled bool `json:"lfs_enabled"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- RequestAccessEnabled bool `json:"request_access_enabled"`
- FullName string `json:"full_name"`
- FullPath string `json:"full_path"`
- ParentID int `json:"parent_id"`
- Projects []*Project `json:"projects"`
- Statistics *StorageStatistics `json:"statistics"`
-}
-
-// ListGroupsOptions represents the available ListGroups() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#list-project-groups
-type ListGroupsOptions struct {
- ListOptions
- AllAvailable *bool `url:"all_available,omitempty" json:"all_available,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Owned *bool `url:"owned,omitempty" json:"owned,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Statistics *bool `url:"statistics,omitempty" json:"statistics,omitempty"`
-}
-
-// ListGroups gets a list of groups (as user: my groups, as admin: all groups).
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-project-groups
-func (s *GroupsService) ListGroups(opt *ListGroupsOptions, options ...OptionFunc) ([]*Group, *Response, error) {
- req, err := s.client.NewRequest("GET", "groups", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var g []*Group
- resp, err := s.client.Do(req, &g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// GetGroup gets all details of a group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#details-of-a-group
-func (s *GroupsService) GetGroup(gid interface{}, options ...OptionFunc) (*Group, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(Group)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// CreateGroupOptions represents the available CreateGroup() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group
-type CreateGroupOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
- LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
- RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
- ParentID *int `url:"parent_id,omitempty" json:"parent_id,omitempty"`
-}
-
-// CreateGroup creates a new project group. Available only for users who can
-// create groups.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group
-func (s *GroupsService) CreateGroup(opt *CreateGroupOptions, options ...OptionFunc) (*Group, *Response, error) {
- req, err := s.client.NewRequest("POST", "groups", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(Group)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// TransferGroup transfers a project to the Group namespace. Available only
-// for admin.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#transfer-project-to-group
-func (s *GroupsService) TransferGroup(gid interface{}, pid interface{}, options ...OptionFunc) (*Group, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
-
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
-
- u := fmt.Sprintf("groups/%s/projects/%s", url.QueryEscape(group),
- url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(Group)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// UpdateGroupOptions represents the set of available options to update a Group;
-// as of today these are exactly the same available when creating a new Group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#update-group
-type UpdateGroupOptions CreateGroupOptions
-
-// UpdateGroup updates an existing group; only available to group owners and
-// administrators.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#update-group
-func (s *GroupsService) UpdateGroup(gid interface{}, opt *UpdateGroupOptions, options ...OptionFunc) (*Group, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(Group)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// DeleteGroup removes group with all projects inside.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#remove-group
-func (s *GroupsService) DeleteGroup(gid interface{}, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SearchGroup get all groups that match your string in their name or path.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#search-for-group
-func (s *GroupsService) SearchGroup(query string, options ...OptionFunc) ([]*Group, *Response, error) {
- var q struct {
- Search string `url:"search,omitempty" json:"search,omitempty"`
- }
- q.Search = query
-
- req, err := s.client.NewRequest("GET", "groups", &q, options)
- if err != nil {
- return nil, nil, err
- }
-
- var g []*Group
- resp, err := s.client.Do(req, &g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// ListGroupProjectsOptions represents the available ListGroupProjects()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects
-type ListGroupProjectsOptions ListProjectsOptions
-
-// ListGroupProjects get a list of group projects
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects
-func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/projects", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*Project
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ListSubgroupsOptions represents the available ListSubgroupsOptions()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-s-subgroups
-type ListSubgroupsOptions ListGroupsOptions
-
-// ListSubgroups gets a list of subgroups for a given project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-s-subgroups
-func (s *GroupsService) ListSubgroups(gid interface{}, opt *ListSubgroupsOptions, options ...OptionFunc) ([]*Group, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/subgroups", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var g []*Group
- resp, err := s.client.Do(req, &g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/issue_links.go b/vendor/github.com/xanzy/go-gitlab/issue_links.go
deleted file mode 100644
index 5dfd76aa..00000000
--- a/vendor/github.com/xanzy/go-gitlab/issue_links.go
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-// Copyright 2017, Arkbriar
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// IssueLinksService handles communication with the issue relations related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
-type IssueLinksService struct {
- client *Client
-}
-
-// IssueLink represents a two-way relation between two issues.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
-type IssueLink struct {
- SourceIssue *Issue `json:"source_issue"`
- TargetIssue *Issue `json:"target_issue"`
-}
-
-// ListIssueRelations gets a list of related issues of a given issue,
-// sorted by the relationship creation datetime (ascending).
-//
-// Issues will be filtered according to the user authorizations.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/issue_links.html#list-issue-relations
-func (s *IssueLinksService) ListIssueRelations(pid interface{}, issueIID int, options ...OptionFunc) ([]*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/links", url.QueryEscape(project), issueIID)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var is []*Issue
- resp, err := s.client.Do(req, &is)
- if err != nil {
- return nil, resp, err
- }
-
- return is, resp, err
-}
-
-// CreateIssueLinkOptions represents the available CreateIssueLink() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
-type CreateIssueLinkOptions struct {
- TargetProjectID *string `json:"target_project_id"`
- TargetIssueIID *string `json:"target_issue_iid"`
-}
-
-// CreateIssueLink creates a two-way relation between two issues.
-// User must be allowed to update both issues in order to succeed.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/issue_links.html#create-an-issue-link
-func (s *IssueLinksService) CreateIssueLink(pid interface{}, issueIID int, opt *CreateIssueLinkOptions, options ...OptionFunc) (*IssueLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/links", url.QueryEscape(project), issueIID)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(IssueLink)
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// DeleteIssueLink deletes an issue link, thus removes the two-way relationship.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/issue_links.html#delete-an-issue-link
-func (s *IssueLinksService) DeleteIssueLink(pid interface{}, issueIID, issueLinkID int, options ...OptionFunc) (*IssueLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/links/%d",
- url.QueryEscape(project),
- issueIID,
- issueLinkID)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(IssueLink)
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/issues.go b/vendor/github.com/xanzy/go-gitlab/issues.go
deleted file mode 100644
index 04852942..00000000
--- a/vendor/github.com/xanzy/go-gitlab/issues.go
+++ /dev/null
@@ -1,491 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "encoding/json"
- "fmt"
- "net/url"
- "strings"
- "time"
-)
-
-// IssuesService handles communication with the issue related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html
-type IssuesService struct {
- client *Client
- timeStats *timeStatsService
-}
-
-// Issue represents a GitLab issue.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html
-type Issue struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- ProjectID int `json:"project_id"`
- Milestone *Milestone `json:"milestone"`
- Author struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- } `json:"author"`
- Description string `json:"description"`
- State string `json:"state"`
- Assignees []struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- } `json:"assignees"`
- Assignee struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"assignee"`
- Upvotes int `json:"upvotes"`
- Downvotes int `json:"downvotes"`
- Labels []string `json:"labels"`
- Title string `json:"title"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- ClosedAt *time.Time `json:"closed_at"`
- Subscribed bool `json:"subscribed"`
- UserNotesCount int `json:"user_notes_count"`
- DueDate *ISOTime `json:"due_date"`
- WebURL string `json:"web_url"`
- TimeStats *TimeStats `json:"time_stats"`
- Confidential bool `json:"confidential"`
- Weight int `json:"weight"`
- DiscussionLocked bool `json:"discussion_locked"`
- Links struct {
- Self string `json:"self"`
- Notes string `json:"notes"`
- AwardEmoji string `json:"award_emoji"`
- Project string `json:"project"`
- } `json:"_links"`
- IssueLinkID int `json:"issue_link_id"`
-}
-
-func (i Issue) String() string {
- return Stringify(i)
-}
-
-// Labels is a custom type with specific marshaling characteristics.
-type Labels []string
-
-// MarshalJSON implements the json.Marshaler interface.
-func (l *Labels) MarshalJSON() ([]byte, error) {
- return json.Marshal(strings.Join(*l, ","))
-}
-
-// ListIssuesOptions represents the available ListIssues() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
-type ListIssuesOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
-}
-
-// ListIssues gets all issues created by authenticated user. This function
-// takes pagination parameters page and per_page to restrict the list of issues.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
-func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- req, err := s.client.NewRequest("GET", "issues", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// ListGroupIssuesOptions represents the available ListGroupIssues() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-group-issues
-type ListGroupIssuesOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
-}
-
-// ListGroupIssues gets a list of group issues. This function accepts
-// pagination parameters page and per_page to return the list of group issues.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-group-issues
-func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- group, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/issues", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// ListProjectIssuesOptions represents the available ListProjectIssues() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues
-type ListProjectIssuesOptions struct {
- ListOptions
- IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
-}
-
-// ListProjectIssues gets a list of project issues. This function accepts
-// pagination parameters page and per_page to return the list of project issues.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues
-func (s *IssuesService) ListProjectIssues(pid interface{}, opt *ListProjectIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// GetIssue gets a single project issue.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#single-issues
-func (s *IssuesService) GetIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// CreateIssueOptions represents the available CreateIssue() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#new-issues
-type CreateIssueOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
- AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
- MergeRequestToResolveDiscussionsOf *int `url:"merge_request_to_resolve_discussions_of,omitempty" json:"merge_request_to_resolve_discussions_of,omitempty"`
- DiscussionToResolve *string `url:"discussion_to_resolve,omitempty" json:"discussion_to_resolve,omitempty"`
- Weight *int `url:"weight,omitempty" json:"weight,omitempty"`
-}
-
-// CreateIssue creates a new project issue.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#new-issues
-func (s *IssuesService) CreateIssue(pid interface{}, opt *CreateIssueOptions, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// UpdateIssueOptions represents the available UpdateIssue() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#edit-issue
-type UpdateIssueOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
- AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
- UpdatedAt *time.Time `url:"updated_at,omitempty" json:"updated_at,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
- Weight *int `url:"weight,omitempty" json:"weight,omitempty"`
- DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"`
-}
-
-// UpdateIssue updates an existing project issue. This function is also used
-// to mark an issue as closed.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#edit-issues
-func (s *IssuesService) UpdateIssue(pid interface{}, issue int, opt *UpdateIssueOptions, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// DeleteIssue deletes a single project issue.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#delete-an-issue
-func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SubscribeToIssue subscribes the authenticated user to the given issue to
-// receive notifications. If the user is already subscribed to the issue, the
-// status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#subscribe-to-a-merge-request
-func (s *IssuesService) SubscribeToIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/subscribe", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// UnsubscribeFromIssue unsubscribes the authenticated user from the given
-// issue to not receive notifications from that merge request. If the user
-// is not subscribed to the issue, status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request
-func (s *IssuesService) UnsubscribeFromIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/unsubscribe", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// ListMergeRequestsClosingIssueOptions represents the available
-// ListMergeRequestsClosingIssue() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-that-will-close-issue-on-merge
-type ListMergeRequestsClosingIssueOptions ListOptions
-
-// ListMergeRequestsClosingIssue gets all the merge requests that will close
-// issue when merged.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-that-will-close-issue-on-merge
-func (s *IssuesService) ListMergeRequestsClosingIssue(pid interface{}, issue int, opt *ListMergeRequestsClosingIssueOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("/projects/%s/issues/%d/closed_by", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// SetTimeEstimate sets the time estimate for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#set-a-time-estimate-for-an-issue
-func (s *IssuesService) SetTimeEstimate(pid interface{}, issue int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.setTimeEstimate(pid, "issues", issue, opt, options...)
-}
-
-// ResetTimeEstimate resets the time estimate for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#reset-the-time-estimate-for-an-issue
-func (s *IssuesService) ResetTimeEstimate(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.resetTimeEstimate(pid, "issues", issue, options...)
-}
-
-// AddSpentTime adds spent time for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#add-spent-time-for-an-issue
-func (s *IssuesService) AddSpentTime(pid interface{}, issue int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.addSpentTime(pid, "issues", issue, opt, options...)
-}
-
-// ResetSpentTime resets the spent time for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#reset-spent-time-for-an-issue
-func (s *IssuesService) ResetSpentTime(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.resetSpentTime(pid, "issues", issue, options...)
-}
-
-// GetTimeSpent gets the spent time for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#get-time-tracking-stats
-func (s *IssuesService) GetTimeSpent(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.getTimeSpent(pid, "issues", issue, options...)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/jobs.go b/vendor/github.com/xanzy/go-gitlab/jobs.go
deleted file mode 100644
index 746042c2..00000000
--- a/vendor/github.com/xanzy/go-gitlab/jobs.go
+++ /dev/null
@@ -1,384 +0,0 @@
-//
-// Copyright 2017, Arkbriar
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "io"
- "net/url"
- "time"
-)
-
-// JobsService handles communication with the ci builds related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html
-type JobsService struct {
- client *Client
-}
-
-// Job represents a ci build.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html
-type Job struct {
- Commit *Commit `json:"commit"`
- CreatedAt *time.Time `json:"created_at"`
- Coverage float64 `json:"coverage"`
- ArtifactsFile struct {
- Filename string `json:"filename"`
- Size int `json:"size"`
- } `json:"artifacts_file"`
- FinishedAt *time.Time `json:"finished_at"`
- ID int `json:"id"`
- Name string `json:"name"`
- Ref string `json:"ref"`
- Runner struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Active bool `json:"active"`
- IsShared bool `json:"is_shared"`
- Name string `json:"name"`
- } `json:"runner"`
- Stage string `json:"stage"`
- StartedAt *time.Time `json:"started_at"`
- Status string `json:"status"`
- Tag bool `json:"tag"`
- User *User `json:"user"`
-}
-
-// ListJobsOptions are options for two list apis
-type ListJobsOptions struct {
- ListOptions
- Scope []BuildStateValue `url:"scope,omitempty" json:"scope,omitempty"`
-}
-
-// ListProjectJobs gets a list of jobs in a project.
-//
-// The scope of jobs to show, one or array of: created, pending, running,
-// failed, success, canceled, skipped; showing all jobs if none provided
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#list-project-jobs
-func (s *JobsService) ListProjectJobs(pid interface{}, opts *ListJobsOptions, options ...OptionFunc) ([]Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var jobs []Job
- resp, err := s.client.Do(req, &jobs)
- if err != nil {
- return nil, resp, err
- }
-
- return jobs, resp, err
-}
-
-// ListPipelineJobs gets a list of jobs for specific pipeline in a
-// project. If the pipeline ID is not found, it will respond with 404.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#list-pipeline-jobs
-func (s *JobsService) ListPipelineJobs(pid interface{}, pipelineID int, opts *ListJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d/jobs", url.QueryEscape(project), pipelineID)
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var jobs []*Job
- resp, err := s.client.Do(req, &jobs)
- if err != nil {
- return nil, resp, err
- }
-
- return jobs, resp, err
-}
-
-// GetJob gets a single job of a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#get-a-single-job
-func (s *JobsService) GetJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d", url.QueryEscape(project), jobID)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// GetJobArtifacts get jobs artifacts of a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#get-job-artifacts
-func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...OptionFunc) (io.Reader, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/artifacts", url.QueryEscape(project), jobID)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- artifactsBuf := new(bytes.Buffer)
- resp, err := s.client.Do(req, artifactsBuf)
- if err != nil {
- return nil, resp, err
- }
-
- return artifactsBuf, resp, err
-}
-
-// DownloadArtifactsFile download the artifacts file from the given
-// reference name and job provided the job finished successfully.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
-func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, job string, options ...OptionFunc) (io.Reader, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/artifacts/%s/download?job=%s", url.QueryEscape(project), refName, job)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- artifactsBuf := new(bytes.Buffer)
- resp, err := s.client.Do(req, artifactsBuf)
- if err != nil {
- return nil, resp, err
- }
-
- return artifactsBuf, resp, err
-}
-
-// DownloadSingleArtifactsFile download a file from the artifacts from the
-// given reference name and job provided the job finished successfully.
-// Only a single file is going to be extracted from the archive and streamed
-// to a client.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#download-a-single-artifact-file
-func (s *JobsService) DownloadSingleArtifactsFile(pid interface{}, jobID int, artifactPath string, options ...OptionFunc) (io.Reader, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
-
- u := fmt.Sprintf(
- "projects/%s/jobs/%d/artifacts/%s",
- url.QueryEscape(project),
- jobID,
- artifactPath,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- artifactBuf := new(bytes.Buffer)
- resp, err := s.client.Do(req, artifactBuf)
- if err != nil {
- return nil, resp, err
- }
-
- return artifactBuf, resp, err
-}
-
-// GetTraceFile gets a trace of a specific job of a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#get-a-trace-file
-func (s *JobsService) GetTraceFile(pid interface{}, jobID int, options ...OptionFunc) (io.Reader, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/trace", url.QueryEscape(project), jobID)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- traceBuf := new(bytes.Buffer)
- resp, err := s.client.Do(req, traceBuf)
- if err != nil {
- return nil, resp, err
- }
-
- return traceBuf, resp, err
-}
-
-// CancelJob cancels a single job of a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#cancel-a-job
-func (s *JobsService) CancelJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/cancel", url.QueryEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// RetryJob retries a single job of a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#retry-a-job
-func (s *JobsService) RetryJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/retry", url.QueryEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// EraseJob erases a single job of a project, removes a job
-// artifacts and a job trace.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#erase-a-job
-func (s *JobsService) EraseJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/erase", url.QueryEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// KeepArtifacts prevents artifacts from being deleted when
-// expiration is set.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#keep-artifacts
-func (s *JobsService) KeepArtifacts(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/artifacts/keep", url.QueryEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// PlayJob triggers a manual action to start a job.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#play-a-job
-func (s *JobsService) PlayJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/play", url.QueryEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/keys.go b/vendor/github.com/xanzy/go-gitlab/keys.go
deleted file mode 100644
index dab9b25a..00000000
--- a/vendor/github.com/xanzy/go-gitlab/keys.go
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// KeysService handles communication with the
-// keys related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/keys.html
-type KeysService struct {
- client *Client
-}
-
-// Key represents a GitLab user's SSH key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/keys.html
-type Key struct {
- ID int `json:"id"`
- Title string `json:"title"`
- Key string `json:"key"`
- CreatedAt *time.Time `json:"created_at"`
- User User `json:"user"`
-}
-
-// GetKeyWithUser gets a single key by id along with the associated
-// user information.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/keys.html#get-ssh-key-with-user-by-id-of-an-ssh-key
-func (s *KeysService) GetKeyWithUser(kid interface{}, options ...OptionFunc) (*Key, *Response, error) {
- key, err := parseID(kid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("keys/%s", url.QueryEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(Key)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/labels.go b/vendor/github.com/xanzy/go-gitlab/labels.go
deleted file mode 100644
index 5134846d..00000000
--- a/vendor/github.com/xanzy/go-gitlab/labels.go
+++ /dev/null
@@ -1,249 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "encoding/json"
- "fmt"
- "net/url"
-)
-
-// LabelsService handles communication with the label related methods of the
-// GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html
-type LabelsService struct {
- client *Client
-}
-
-// Label represents a GitLab label.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html
-type Label struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Color string `json:"color"`
- Description string `json:"description"`
- OpenIssuesCount int `json:"open_issues_count"`
- ClosedIssuesCount int `json:"closed_issues_count"`
- OpenMergeRequestsCount int `json:"open_merge_requests_count"`
- Subscribed bool `json:"subscribed"`
- Priority int `json:"priority"`
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (l *Label) UnmarshalJSON(data []byte) error {
- type alias Label
- if err := json.Unmarshal(data, (*alias)(l)); err != nil {
- return err
- }
-
- if l.Name == "" {
- var raw map[string]interface{}
- if err := json.Unmarshal(data, &raw); err != nil {
- return err
- }
- if title, ok := raw["title"].(string); ok {
- l.Name = title
- }
- }
-
- return nil
-}
-
-func (l Label) String() string {
- return Stringify(l)
-}
-
-// ListLabelsOptions represents the available ListLabels() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
-type ListLabelsOptions ListOptions
-
-// ListLabels gets all labels for given project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
-func (s *LabelsService) ListLabels(pid interface{}, opt *ListLabelsOptions, options ...OptionFunc) ([]*Label, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/labels", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var l []*Label
- resp, err := s.client.Do(req, &l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// CreateLabelOptions represents the available CreateLabel() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label
-type CreateLabelOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Color *string `url:"color,omitempty" json:"color,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// CreateLabel creates a new label for given repository with given name and
-// color.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label
-func (s *LabelsService) CreateLabel(pid interface{}, opt *CreateLabelOptions, options ...OptionFunc) (*Label, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/labels", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(Label)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// DeleteLabelOptions represents the available DeleteLabel() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
-type DeleteLabelOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
-}
-
-// DeleteLabel deletes a label given by its name.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
-func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/labels", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// UpdateLabelOptions represents the available UpdateLabel() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
-type UpdateLabelOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- NewName *string `url:"new_name,omitempty" json:"new_name,omitempty"`
- Color *string `url:"color,omitempty" json:"color,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// UpdateLabel updates an existing label with new name or now color. At least
-// one parameter is required, to update the label.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#edit-an-existing-label
-func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, options ...OptionFunc) (*Label, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/labels", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(Label)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// SubscribeToLabel subscribes the authenticated user to a label to receive
-// notifications. If the user is already subscribed to the label, the status
-// code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/labels.html#subscribe-to-a-label
-func (s *LabelsService) SubscribeToLabel(pid interface{}, labelID interface{}, options ...OptionFunc) (*Label, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- label, err := parseID(labelID)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/labels/%s/subscribe", url.QueryEscape(project), label)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(Label)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// UnsubscribeFromLabel unsubscribes the authenticated user from a label to not
-// receive notifications from it. If the user is not subscribed to the label, the
-// status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/labels.html#unsubscribe-from-a-label
-func (s *LabelsService) UnsubscribeFromLabel(pid interface{}, labelID interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- label, err := parseID(labelID)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/labels/%s/unsubscribe", url.QueryEscape(project), label)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/license_templates.go b/vendor/github.com/xanzy/go-gitlab/license_templates.go
deleted file mode 100644
index 83f8259b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/license_templates.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// LicenseTemplate represents a license template.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html
-type LicenseTemplate struct {
- Key string `json:"key"`
- Name string `json:"name"`
- Nickname string `json:"nickname"`
- Featured bool `json:"featured"`
- HTMLURL string `json:"html_url"`
- SourceURL string `json:"source_url"`
- Description string `json:"description"`
- Conditions []string `json:"conditions"`
- Permissions []string `json:"permissions"`
- Limitations []string `json:"limitations"`
- Content string `json:"content"`
-}
-
-// LicenseTemplatesService handles communication with the license templates
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/templates/licenses.html
-type LicenseTemplatesService struct {
- client *Client
-}
-
-// ListLicenseTemplatesOptions represents the available
-// ListLicenseTemplates() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html#list-license-templates
-type ListLicenseTemplatesOptions struct {
- ListOptions
- Popular *bool `url:"popular,omitempty" json:"popular,omitempty"`
-}
-
-// ListLicenseTemplates get all license templates.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html#list-license-templates
-func (s *LicenseTemplatesService) ListLicenseTemplates(opt *ListLicenseTemplatesOptions, options ...OptionFunc) ([]*LicenseTemplate, *Response, error) {
- req, err := s.client.NewRequest("GET", "templates/licenses", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var lts []*LicenseTemplate
- resp, err := s.client.Do(req, <s)
- if err != nil {
- return nil, resp, err
- }
-
- return lts, resp, err
-}
-
-// GetLicenseTemplateOptions represents the available
-// GetLicenseTemplate() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html#single-license-template
-type GetLicenseTemplateOptions struct {
- Project *string `url:"project,omitempty" json:"project,omitempty"`
- Fullname *string `url:"fullname,omitempty" json:"fullname,omitempty"`
-}
-
-// GetLicenseTemplate get a single license template. You can pass parameters
-// to replace the license placeholder.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html#single-license-template
-func (s *LicenseTemplatesService) GetLicenseTemplate(template string, opt *GetLicenseTemplateOptions, options ...OptionFunc) (*LicenseTemplate, *Response, error) {
- u := fmt.Sprintf("templates/licenses/%s", template)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- lt := new(LicenseTemplate)
- resp, err := s.client.Do(req, lt)
- if err != nil {
- return nil, resp, err
- }
-
- return lt, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go b/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
deleted file mode 100644
index 81aa4fb4..00000000
--- a/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// MergeRequestApprovalsService handles communication with the merge request
-// approvals related methods of the GitLab API. This includes reading/updating
-// approval settings and approve/unapproving merge requests
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/merge_request_approvals.html
-type MergeRequestApprovalsService struct {
- client *Client
-}
-
-// MergeRequestApprovals represents GitLab merge request approvals.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals
-type MergeRequestApprovals struct {
- ID int `json:"id"`
- ProjectID int `json:"project_id"`
- Title string `json:"title"`
- Description string `json:"description"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- MergeStatus string `json:"merge_status"`
- ApprovalsBeforeMerge int `json:"approvals_before_merge"`
- ApprovalsRequired int `json:"approvals_required"`
- ApprovalsLeft int `json:"approvals_left"`
- ApprovedBy []struct {
- User struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"user"`
- } `json:"approved_by"`
- Approvers []struct {
- User struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"user"`
- } `json:"approvers"`
- ApproverGroups []struct {
- Group struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Description string `json:"description"`
- Visibility string `json:"visibility"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- FullName string `json:"full_name"`
- FullPath string `json:"full_path"`
- LFSEnabled bool `json:"lfs_enabled"`
- RequestAccessEnabled bool `json:"request_access_enabled"`
- } `json:"group"`
- } `json:"approver_group"`
-}
-
-func (m MergeRequestApprovals) String() string {
- return Stringify(m)
-}
-
-// ApproveMergeRequestOptions represents the available ApproveMergeRequest() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#approve-merge-request
-type ApproveMergeRequestOptions struct {
- Sha *string `url:"sha,omitempty" json:"sha,omitempty"`
-}
-
-// ApproveMergeRequest approves a merge request on GitLab. If a non-empty sha
-// is provided then it must match the sha at the HEAD of the MR.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#approve-merge-request
-func (s *MergeRequestApprovalsService) ApproveMergeRequest(pid interface{}, mr int, opt *ApproveMergeRequestOptions, options ...OptionFunc) (*MergeRequestApprovals, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/approve", url.QueryEscape(project), mr)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequestApprovals)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UnapproveMergeRequest unapproves a previously approved merge request on GitLab.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#unapprove-merge-request
-func (s *MergeRequestApprovalsService) UnapproveMergeRequest(pid interface{}, mr int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/unapprove", url.QueryEscape(project), mr)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/merge_requests.go b/vendor/github.com/xanzy/go-gitlab/merge_requests.go
deleted file mode 100644
index 4ff6347d..00000000
--- a/vendor/github.com/xanzy/go-gitlab/merge_requests.go
+++ /dev/null
@@ -1,807 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// MergeRequestsService handles communication with the merge requests related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html
-type MergeRequestsService struct {
- client *Client
- timeStats *timeStatsService
-}
-
-// MergeRequest represents a GitLab merge request.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html
-type MergeRequest struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- TargetBranch string `json:"target_branch"`
- SourceBranch string `json:"source_branch"`
- ProjectID int `json:"project_id"`
- Title string `json:"title"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- Upvotes int `json:"upvotes"`
- Downvotes int `json:"downvotes"`
- Author struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- } `json:"author"`
- Assignee struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- } `json:"assignee"`
- SourceProjectID int `json:"source_project_id"`
- TargetProjectID int `json:"target_project_id"`
- Labels []string `json:"labels"`
- Description string `json:"description"`
- WorkInProgress bool `json:"work_in_progress"`
- Milestone *Milestone `json:"milestone"`
- MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
- MergeStatus string `json:"merge_status"`
- MergedBy struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- } `json:"merged_by"`
- MergedAt *time.Time `json:"merged_at"`
- ClosedBy struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- } `json:"closed_by"`
- ClosedAt *time.Time `json:"closed_at"`
- Subscribed bool `json:"subscribed"`
- SHA string `json:"sha"`
- MergeCommitSHA string `json:"merge_commit_sha"`
- UserNotesCount int `json:"user_notes_count"`
- ChangesCount string `json:"changes_count"`
- ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
- ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
- WebURL string `json:"web_url"`
- DiscussionLocked bool `json:"discussion_locked"`
- Changes []struct {
- OldPath string `json:"old_path"`
- NewPath string `json:"new_path"`
- AMode string `json:"a_mode"`
- BMode string `json:"b_mode"`
- Diff string `json:"diff"`
- NewFile bool `json:"new_file"`
- RenamedFile bool `json:"renamed_file"`
- DeletedFile bool `json:"deleted_file"`
- } `json:"changes"`
- TimeStats *TimeStats `json:"time_stats"`
- Squash bool `json:"squash"`
- Pipeline struct {
- ID int `json:"id"`
- Ref string `json:"ref"`
- SHA string `json:"sha"`
- Status string `json:"status"`
- } `json:"pipeline"`
-}
-
-func (m MergeRequest) String() string {
- return Stringify(m)
-}
-
-// MergeRequestDiffVersion represents Gitlab merge request version.
-//
-// Gitlab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-a-single-mr-diff-version
-type MergeRequestDiffVersion struct {
- ID int `json:"id"`
- HeadCommitSHA string `json:"head_commit_sha,omitempty"`
- BaseCommitSHA string `json:"base_commit_sha,omitempty"`
- StartCommitSHA string `json:"start_commit_sha,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- MergeRequestID int `json:"merge_request_id,omitempty"`
- State string `json:"state,omitempty"`
- RealSize string `json:"real_size,omitempty"`
- Commits []*Commit `json:"commits,omitempty"`
- Diffs []*Diff `json:"diffs,omitempty"`
-}
-
-func (m MergeRequestDiffVersion) String() string {
- return Stringify(m)
-}
-
-// ListMergeRequestsOptions represents the available ListMergeRequests()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
-type ListMergeRequestsOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- View *string `url:"view,omitempty" json:"view,omitempty"`
- Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListMergeRequests gets all merge requests. The state parameter can be used
-// to get only merge requests with a given state (opened, closed, or merged)
-// or all of them (all). The pagination parameters page and per_page can be
-// used to restrict the list of merge requests.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
-func (s *MergeRequestsService) ListMergeRequests(opt *ListMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- req, err := s.client.NewRequest("GET", "merge_requests", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// ListGroupMergeRequestsOptions represents the available ListGroupMergeRequests()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-group-merge-requests
-type ListGroupMergeRequestsOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- View *string `url:"view,omitempty" json:"view,omitempty"`
- Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListGroupMergeRequests gets all merge requests for this group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-group-merge-requests
-func (s *MergeRequestsService) ListGroupMergeRequests(gid interface{}, opt *ListGroupMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/merge_requests", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// ListProjectMergeRequestsOptions represents the available ListMergeRequests()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-project-merge-requests
-type ListProjectMergeRequestsOptions struct {
- ListOptions
- IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
- State *string `url:"state,omitempty" json:"state,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- View *string `url:"view,omitempty" json:"view,omitempty"`
- Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListProjectMergeRequests gets all merge requests for this project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-project-merge-requests
-func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *ListProjectMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetMergeRequest shows information about a single merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr
-func (s *MergeRequestsService) GetMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetMergeRequestApprovals gets information about a merge requests approvals
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals
-func (s *MergeRequestsService) GetMergeRequestApprovals(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequestApprovals, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(MergeRequestApprovals)
- resp, err := s.client.Do(req, a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// GetMergeRequestCommitsOptions represents the available GetMergeRequestCommits()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-commits
-type GetMergeRequestCommitsOptions ListOptions
-
-// GetMergeRequestCommits gets a list of merge request commits.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-commits
-func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequest int, opt *GetMergeRequestCommitsOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/commits", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c []*Commit
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// GetMergeRequestChanges shows information about the merge request including
-// its files and changes.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-changes
-func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/changes", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// ListMergeRequestPipelines gets all pipelines for the provided merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-mr-pipelines
-func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeRequest int, options ...OptionFunc) (PipelineList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/pipelines", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p PipelineList
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// GetIssuesClosedOnMergeOptions represents the available GetIssuesClosedOnMerge()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-issues-that-will-close-on-merge
-type GetIssuesClosedOnMergeOptions ListOptions
-
-// GetIssuesClosedOnMerge gets all the issues that would be closed by merging the
-// provided merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-issues-that-will-close-on-merge
-func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequest int, opt *GetIssuesClosedOnMergeOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("/projects/%s/merge_requests/%d/closes_issues", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// CreateMergeRequestOptions represents the available CreateMergeRequest()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#create-mr
-type CreateMergeRequestOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- TargetProjectID *int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"`
- Squash *bool `url:"squash,omitempty" json:"squash,omitempty"`
- AllowCollaboration *bool `url:"allow_collaboration,omitempty" json:"allow_collaboration,omitempty"`
-}
-
-// CreateMergeRequest creates a new merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#create-mr
-func (s *MergeRequestsService) CreateMergeRequest(pid interface{}, opt *CreateMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UpdateMergeRequestOptions represents the available UpdateMergeRequest()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#update-mr
-type UpdateMergeRequestOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
-}
-
-// UpdateMergeRequest updates an existing project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#update-mr
-func (s *MergeRequestsService) UpdateMergeRequest(pid interface{}, mergeRequest int, opt *UpdateMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// DeleteMergeRequest deletes a merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#delete-a-merge-request
-func (s *MergeRequestsService) DeleteMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// AcceptMergeRequestOptions represents the available AcceptMergeRequest()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#accept-mr
-type AcceptMergeRequestOptions struct {
- MergeCommitMessage *string `url:"merge_commit_message,omitempty" json:"merge_commit_message,omitempty"`
- ShouldRemoveSourceBranch *bool `url:"should_remove_source_branch,omitempty" json:"should_remove_source_branch,omitempty"`
- MergeWhenPipelineSucceeds *bool `url:"merge_when_pipeline_succeeds,omitempty" json:"merge_when_pipeline_succeeds,omitempty"`
- Sha *string `url:"sha,omitempty" json:"sha,omitempty"`
-}
-
-// AcceptMergeRequest merges changes submitted with MR using this API. If merge
-// success you get 200 OK. If it has some conflicts and can not be merged - you
-// get 405 and error message 'Branch cannot be merged'. If merge request is
-// already merged or closed - you get 405 and error message 'Method Not Allowed'
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#accept-mr
-func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest int, opt *AcceptMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/merge", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// CancelMergeWhenPipelineSucceeds cancels a merge when pipeline succeeds. If
-// you don't have permissions to accept this merge request - you'll get a 401.
-// If the merge request is already merged or closed - you get 405 and error
-// message 'Method Not Allowed'. In case the merge request is not set to be
-// merged when the pipeline succeeds, you'll also get a 406 error.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#cancel-merge-when-pipeline-succeeds
-func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/cancel_merge_when_pipeline_succeeds", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("PUT", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetMergeRequestDiffVersionsOptions represents the available
-// GetMergeRequestDiffVersions() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-mr-diff-versions
-type GetMergeRequestDiffVersionsOptions ListOptions
-
-// GetMergeRequestDiffVersions get a list of merge request diff versions.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-mr-diff-versions
-func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, mergeRequest int, opt *GetMergeRequestDiffVersionsOptions, options ...OptionFunc) ([]*MergeRequestDiffVersion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/versions", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var v []*MergeRequestDiffVersion
- resp, err := s.client.Do(req, &v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// GetSingleMergeRequestDiffVersion get a single MR diff version
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-a-single-mr-diff-version
-func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{}, mergeRequest, version int, options ...OptionFunc) (*MergeRequestDiffVersion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/versions/%d", url.QueryEscape(project), mergeRequest, version)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var v = new(MergeRequestDiffVersion)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// SubscribeToMergeRequest subscribes the authenticated user to the given merge
-// request to receive notifications. If the user is already subscribed to the
-// merge request, the status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#subscribe-to-a-merge-request
-func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/subscribe", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UnsubscribeFromMergeRequest unsubscribes the authenticated user from the
-// given merge request to not receive notifications from that merge request.
-// If the user is not subscribed to the merge request, status code 304 is
-// returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request
-func (s *MergeRequestsService) UnsubscribeFromMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/unsubscribe", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// CreateTodo manually creates a todo for the current user on a merge request.
-// If there already exists a todo for the user on that merge request,
-// status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#create-a-todo
-func (s *MergeRequestsService) CreateTodo(pid interface{}, mergeRequest int, options ...OptionFunc) (*Todo, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/todo", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(Todo)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// SetTimeEstimate sets the time estimate for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#set-a-time-estimate-for-a-merge-request
-func (s *MergeRequestsService) SetTimeEstimate(pid interface{}, mergeRequest int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.setTimeEstimate(pid, "merge_requests", mergeRequest, opt, options...)
-}
-
-// ResetTimeEstimate resets the time estimate for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#reset-the-time-estimate-for-a-merge-request
-func (s *MergeRequestsService) ResetTimeEstimate(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.resetTimeEstimate(pid, "merge_requests", mergeRequest, options...)
-}
-
-// AddSpentTime adds spent time for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#add-spent-time-for-a-merge-request
-func (s *MergeRequestsService) AddSpentTime(pid interface{}, mergeRequest int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.addSpentTime(pid, "merge_requests", mergeRequest, opt, options...)
-}
-
-// ResetSpentTime resets the spent time for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#reset-spent-time-for-a-merge-request
-func (s *MergeRequestsService) ResetSpentTime(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.resetSpentTime(pid, "merge_requests", mergeRequest, options...)
-}
-
-// GetTimeSpent gets the spent time for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-time-tracking-stats
-func (s *MergeRequestsService) GetTimeSpent(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.getTimeSpent(pid, "merge_requests", mergeRequest, options...)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/milestones.go b/vendor/github.com/xanzy/go-gitlab/milestones.go
deleted file mode 100644
index c1a69f93..00000000
--- a/vendor/github.com/xanzy/go-gitlab/milestones.go
+++ /dev/null
@@ -1,267 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// MilestonesService handles communication with the milestone related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/milestones.html
-type MilestonesService struct {
- client *Client
-}
-
-// Milestone represents a GitLab milestone.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/milestones.html
-type Milestone struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- ProjectID int `json:"project_id"`
- Title string `json:"title"`
- Description string `json:"description"`
- StartDate *ISOTime `json:"start_date"`
- DueDate *ISOTime `json:"due_date"`
- State string `json:"state"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (m Milestone) String() string {
- return Stringify(m)
-}
-
-// ListMilestonesOptions represents the available ListMilestones() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones
-type ListMilestonesOptions struct {
- ListOptions
- IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
- State string `url:"state,omitempty" json:"state,omitempty"`
- Search string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListMilestones returns a list of project milestones.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones
-func (s *MilestonesService) ListMilestones(pid interface{}, opt *ListMilestonesOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*Milestone
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetMilestone gets a single project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-single-milestone
-func (s *MilestonesService) GetMilestone(pid interface{}, milestone int, options ...OptionFunc) (*Milestone, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d", url.QueryEscape(project), milestone)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(Milestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// CreateMilestoneOptions represents the available CreateMilestone() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#create-new-milestone
-type CreateMilestoneOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
-}
-
-// CreateMilestone creates a new project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#create-new-milestone
-func (s *MilestonesService) CreateMilestone(pid interface{}, opt *CreateMilestoneOptions, options ...OptionFunc) (*Milestone, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(Milestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UpdateMilestoneOptions represents the available UpdateMilestone() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#edit-milestone
-type UpdateMilestoneOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
-}
-
-// UpdateMilestone updates an existing project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#edit-milestone
-func (s *MilestonesService) UpdateMilestone(pid interface{}, milestone int, opt *UpdateMilestoneOptions, options ...OptionFunc) (*Milestone, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d", url.QueryEscape(project), milestone)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(Milestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// DeleteMilestone deletes a specified project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#delete-project-milestone
-func (s *MilestonesService) DeleteMilestone(pid interface{}, milestone int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d", url.QueryEscape(project), milestone)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
- return s.client.Do(req, nil)
-}
-
-// GetMilestoneIssuesOptions represents the available GetMilestoneIssues() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone
-type GetMilestoneIssuesOptions ListOptions
-
-// GetMilestoneIssues gets all issues assigned to a single project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone
-func (s *MilestonesService) GetMilestoneIssues(pid interface{}, milestone int, opt *GetMilestoneIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d/issues", url.QueryEscape(project), milestone)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// GetMilestoneMergeRequestsOptions represents the available
-// GetMilestoneMergeRequests() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
-type GetMilestoneMergeRequestsOptions ListOptions
-
-// GetMilestoneMergeRequests gets all merge requests assigned to a single
-// project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
-func (s *MilestonesService) GetMilestoneMergeRequests(pid interface{}, milestone int, opt *GetMilestoneMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d/merge_requests", url.QueryEscape(project), milestone)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var mr []*MergeRequest
- resp, err := s.client.Do(req, &mr)
- if err != nil {
- return nil, resp, err
- }
-
- return mr, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/namespaces.go b/vendor/github.com/xanzy/go-gitlab/namespaces.go
deleted file mode 100644
index 9add6449..00000000
--- a/vendor/github.com/xanzy/go-gitlab/namespaces.go
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// NamespacesService handles communication with the namespace related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html
-type NamespacesService struct {
- client *Client
-}
-
-// Namespace represents a GitLab namespace.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html
-type Namespace struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Kind string `json:"kind"`
- FullPath string `json:"full_path"`
- ParentID int `json:"parent_id"`
- MembersCountWithDescendants int `json:"members_count_with_descendants"`
-}
-
-func (n Namespace) String() string {
- return Stringify(n)
-}
-
-// ListNamespacesOptions represents the available ListNamespaces() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
-type ListNamespacesOptions struct {
- ListOptions
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListNamespaces gets a list of projects accessible by the authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
-func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions, options ...OptionFunc) ([]*Namespace, *Response, error) {
- req, err := s.client.NewRequest("GET", "namespaces", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Namespace
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// SearchNamespace gets all namespaces that match your string in their name
-// or path.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/namespaces.html#search-for-namespace
-func (s *NamespacesService) SearchNamespace(query string, options ...OptionFunc) ([]*Namespace, *Response, error) {
- var q struct {
- Search string `url:"search,omitempty" json:"search,omitempty"`
- }
- q.Search = query
-
- req, err := s.client.NewRequest("GET", "namespaces", &q, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Namespace
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetNamespace gets a namespace by id.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/namespaces.html#get-namespace-by-id
-func (s *NamespacesService) GetNamespace(id interface{}, options ...OptionFunc) (*Namespace, *Response, error) {
- namespace, err := parseID(id)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("namespaces/%s", namespace)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Namespace)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/notes.go b/vendor/github.com/xanzy/go-gitlab/notes.go
deleted file mode 100644
index 0543174b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/notes.go
+++ /dev/null
@@ -1,521 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// NotesService handles communication with the notes related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
-type NotesService struct {
- client *Client
-}
-
-// Note represents a GitLab note.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
-type Note struct {
- ID int `json:"id"`
- Body string `json:"body"`
- Attachment string `json:"attachment"`
- Title string `json:"title"`
- FileName string `json:"file_name"`
- Author struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- System bool `json:"system"`
- ExpiresAt *time.Time `json:"expires_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- NoteableID int `json:"noteable_id"`
- NoteableType string `json:"noteable_type"`
- Position *NotePosition `json:"position"`
- Resolvable bool `json:"resolvable"`
- Resolved bool `json:"resolved"`
- ResolvedBy struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"resolved_by"`
- NoteableIID int `json:"noteable_iid"`
-}
-
-// NotePosition represents the position attributes of a note.
-type NotePosition struct {
- BaseSHA string `json:"base_sha"`
- StartSHA string `json:"start_sha"`
- HeadSHA string `json:"head_sha"`
- PositionType string `json:"position_type"`
- NewPath string `json:"new_path,omitempty"`
- NewLine int `json:"new_line,omitempty"`
- OldPath string `json:"old_path,omitempty"`
- OldLine int `json:"old_line,omitempty"`
- Width int `json:"width,omitempty"`
- Height int `json:"height,omitempty"`
- X int `json:"x,omitempty"`
- Y int `json:"y,omitempty"`
-}
-
-func (n Note) String() string {
- return Stringify(n)
-}
-
-// ListIssueNotesOptions represents the available ListIssueNotes() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes
-type ListIssueNotesOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListIssueNotes gets a list of all notes for a single issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes
-func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssueNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Note
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetIssueNote returns a single note for a specific project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#get-single-issue-note
-func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", url.QueryEscape(project), issue, note)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// CreateIssueNoteOptions represents the available CreateIssueNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note
-type CreateIssueNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// CreateIssueNote creates a new note to a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note
-func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes", url.QueryEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateIssueNoteOptions represents the available UpdateIssueNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note
-type UpdateIssueNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// UpdateIssueNote modifies existing note of an issue.
-//
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note
-func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *UpdateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", url.QueryEscape(project), issue, note)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteIssueNote deletes an existing note of an issue.
-//
-// https://docs.gitlab.com/ce/api/notes.html#delete-an-issue-note
-func (s *NotesService) DeleteIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", url.QueryEscape(project), issue, note)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListSnippetNotesOptions represents the available ListSnippetNotes() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-all-snippet-notes
-type ListSnippetNotesOptions ListOptions
-
-// ListSnippetNotes gets a list of all notes for a single snippet. Snippet
-// notes are comments users can post to a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-all-snippet-notes
-func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, opt *ListSnippetNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes", url.QueryEscape(project), snippet)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Note
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetSnippetNote returns a single note for a given snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#get-single-snippet-note
-func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", url.QueryEscape(project), snippet, note)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// CreateSnippetNoteOptions represents the available CreateSnippetNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note
-type CreateSnippetNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// CreateSnippetNote creates a new note for a single snippet. Snippet notes are
-// comments users can post to a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note
-func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *CreateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes", url.QueryEscape(project), snippet)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateSnippetNoteOptions represents the available UpdateSnippetNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
-type UpdateSnippetNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// UpdateSnippetNote modifies existing note of a snippet.
-//
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
-func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt *UpdateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", url.QueryEscape(project), snippet, note)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteSnippetNote deletes an existing note of a snippet.
-//
-// https://docs.gitlab.com/ce/api/notes.html#delete-a-snippet-note
-func (s *NotesService) DeleteSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", url.QueryEscape(project), snippet, note)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListMergeRequestNotesOptions represents the available ListMergeRequestNotes()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-all-merge-request-notes
-type ListMergeRequestNotesOptions ListOptions
-
-// ListMergeRequestNotes gets a list of all notes for a single merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-all-merge-request-notes
-func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, opt *ListMergeRequestNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/notes", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Note
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetMergeRequestNote returns a single note for a given merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#get-single-merge-request-note
-func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/notes/%d", url.QueryEscape(project), mergeRequest, note)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// CreateMergeRequestNoteOptions represents the available
-// CreateMergeRequestNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note
-type CreateMergeRequestNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// CreateMergeRequestNote creates a new note for a single merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note
-func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, opt *CreateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/notes", url.QueryEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateMergeRequestNoteOptions represents the available
-// UpdateMergeRequestNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
-type UpdateMergeRequestNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// UpdateMergeRequestNote modifies existing note of a merge request.
-//
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
-func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, note int, opt *UpdateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/merge_requests/%d/notes/%d", url.QueryEscape(project), mergeRequest, note)
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteMergeRequestNote deletes an existing note of a merge request.
-//
-// https://docs.gitlab.com/ce/api/notes.html#delete-a-merge-request-note
-func (s *NotesService) DeleteMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/merge_requests/%d/notes/%d", url.QueryEscape(project), mergeRequest, note)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/notifications.go b/vendor/github.com/xanzy/go-gitlab/notifications.go
deleted file mode 100644
index a5501dd7..00000000
--- a/vendor/github.com/xanzy/go-gitlab/notifications.go
+++ /dev/null
@@ -1,214 +0,0 @@
-package gitlab
-
-import (
- "errors"
- "fmt"
- "net/url"
-)
-
-// NotificationSettingsService handles communication with the notification settings
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/notification_settings.html
-type NotificationSettingsService struct {
- client *Client
-}
-
-// NotificationSettings represents the Gitlab notification setting.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#notification-settings
-type NotificationSettings struct {
- Level NotificationLevelValue `json:"level"`
- NotificationEmail string `json:"notification_email"`
- Events *NotificationEvents `json:"events"`
-}
-
-// NotificationEvents represents the available notification setting events.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#notification-settings
-type NotificationEvents struct {
- CloseIssue bool `json:"close_issue"`
- CloseMergeRequest bool `json:"close_merge_request"`
- FailedPipeline bool `json:"failed_pipeline"`
- MergeMergeRequest bool `json:"merge_merge_request"`
- NewIssue bool `json:"new_issue"`
- NewMergeRequest bool `json:"new_merge_request"`
- NewNote bool `json:"new_note"`
- ReassignIssue bool `json:"reassign_issue"`
- ReassignMergeRequest bool `json:"reassign_merge_request"`
- ReopenIssue bool `json:"reopen_issue"`
- ReopenMergeRequest bool `json:"reopen_merge_request"`
- SuccessPipeline bool `json:"success_pipeline"`
-}
-
-func (ns NotificationSettings) String() string {
- return Stringify(ns)
-}
-
-// GetGlobalSettings returns current notification settings and email address.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#global-notification-settings
-func (s *NotificationSettingsService) GetGlobalSettings(options ...OptionFunc) (*NotificationSettings, *Response, error) {
- u := "notification_settings"
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// NotificationSettingsOptions represents the available options that can be passed
-// to the API when updating the notification settings.
-type NotificationSettingsOptions struct {
- Level *NotificationLevelValue `url:"level,omitempty" json:"level,omitempty"`
- NotificationEmail *string `url:"notification_email,omitempty" json:"notification_email,omitempty"`
- CloseIssue *bool `url:"close_issue,omitempty" json:"close_issue,omitempty"`
- CloseMergeRequest *bool `url:"close_merge_request,omitempty" json:"close_merge_request,omitempty"`
- FailedPipeline *bool `url:"failed_pipeline,omitempty" json:"failed_pipeline,omitempty"`
- MergeMergeRequest *bool `url:"merge_merge_request,omitempty" json:"merge_merge_request,omitempty"`
- NewIssue *bool `url:"new_issue,omitempty" json:"new_issue,omitempty"`
- NewMergeRequest *bool `url:"new_merge_request,omitempty" json:"new_merge_request,omitempty"`
- NewNote *bool `url:"new_note,omitempty" json:"new_note,omitempty"`
- ReassignIssue *bool `url:"reassign_issue,omitempty" json:"reassign_issue,omitempty"`
- ReassignMergeRequest *bool `url:"reassign_merge_request,omitempty" json:"reassign_merge_request,omitempty"`
- ReopenIssue *bool `url:"reopen_issue,omitempty" json:"reopen_issue,omitempty"`
- ReopenMergeRequest *bool `url:"reopen_merge_request,omitempty" json:"reopen_merge_request,omitempty"`
- SuccessPipeline *bool `url:"success_pipeline,omitempty" json:"success_pipeline,omitempty"`
-}
-
-// UpdateGlobalSettings updates current notification settings and email address.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#update-global-notification-settings
-func (s *NotificationSettingsService) UpdateGlobalSettings(opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- if opt.Level != nil && *opt.Level == GlobalNotificationLevel {
- return nil, nil, errors.New(
- "notification level 'global' is not valid for global notification settings")
- }
-
- u := "notification_settings"
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// GetSettingsForGroup returns current group notification settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#group-project-level-notification-settings
-func (s *NotificationSettingsService) GetSettingsForGroup(gid interface{}, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/notification_settings", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// GetSettingsForProject returns current project notification settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#group-project-level-notification-settings
-func (s *NotificationSettingsService) GetSettingsForProject(pid interface{}, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/notification_settings", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// UpdateSettingsForGroup updates current group notification settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#update-group-project-level-notification-settings
-func (s *NotificationSettingsService) UpdateSettingsForGroup(gid interface{}, opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/notification_settings", url.QueryEscape(group))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// UpdateSettingsForProject updates current project notification settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#update-group-project-level-notification-settings
-func (s *NotificationSettingsService) UpdateSettingsForProject(pid interface{}, opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/notification_settings", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/pages_domains.go b/vendor/github.com/xanzy/go-gitlab/pages_domains.go
deleted file mode 100644
index c1db4eaa..00000000
--- a/vendor/github.com/xanzy/go-gitlab/pages_domains.go
+++ /dev/null
@@ -1,194 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// PagesDomainsService handles communication with the pages domains
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pages_domains.html
-type PagesDomainsService struct {
- client *Client
-}
-
-// PagesDomain represents a pages domain.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pages_domains.html
-type PagesDomain struct {
- Domain string `json:"domain"`
- URL string `json:"url"`
- ProjectID int `json:"project_id"`
- Verified bool `json:"verified"`
- VerificationCode string `json:"verification_code"`
- EnabledUntil *time.Time `json:"enabled_until"`
- Certificate struct {
- Expired bool `json:"expired"`
- Expiration *time.Time `json:"expiration"`
- } `json:"certificate"`
-}
-
-// ListPagesDomainsOptions represents the available ListPagesDomains() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#list-pages-domains
-type ListPagesDomainsOptions ListOptions
-
-// ListPagesDomains gets a list of project pages domains.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#list-pages-domains
-func (s *PagesDomainsService) ListPagesDomains(pid interface{}, opt *ListPagesDomainsOptions, options ...OptionFunc) ([]*PagesDomain, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pd []*PagesDomain
- resp, err := s.client.Do(req, &pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// ListAllPagesDomains gets a list of all pages domains.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#list-all-pages-domains
-func (s *PagesDomainsService) ListAllPagesDomains(options ...OptionFunc) ([]*PagesDomain, *Response, error) {
- req, err := s.client.NewRequest("GET", "pages/domains", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pd []*PagesDomain
- resp, err := s.client.Do(req, &pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// GetPagesDomain get a specific pages domain for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#single-pages-domain
-func (s *PagesDomainsService) GetPagesDomain(pid interface{}, domain string, options ...OptionFunc) (*PagesDomain, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains/%s", url.QueryEscape(project), domain)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pd := new(PagesDomain)
- resp, err := s.client.Do(req, pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// CreatePagesDomainOptions represents the available CreatePagesDomain() options.
-//
-// GitLab API docs:
-// // https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain
-type CreatePagesDomainOptions struct {
- Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
- Certificate *string `url:"certifiate,omitempty" json:"certifiate,omitempty"`
- Key *string `url:"key,omitempty" json:"key,omitempty"`
-}
-
-// CreatePagesDomain creates a new project pages domain.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain
-func (s *PagesDomainsService) CreatePagesDomain(pid interface{}, opt *CreatePagesDomainOptions, options ...OptionFunc) (*PagesDomain, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pd := new(PagesDomain)
- resp, err := s.client.Do(req, pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// UpdatePagesDomainOptions represents the available UpdatePagesDomain() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#update-pages-domain
-type UpdatePagesDomainOptions struct {
- Cerificate *string `url:"certifiate" json:"certifiate"`
- Key *string `url:"key" json:"key"`
-}
-
-// UpdatePagesDomain updates an existing project pages domain.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#update-pages-domain
-func (s *PagesDomainsService) UpdatePagesDomain(pid interface{}, domain string, opt *UpdatePagesDomainOptions, options ...OptionFunc) (*PagesDomain, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains/%s", url.QueryEscape(project), domain)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pd := new(PagesDomain)
- resp, err := s.client.Do(req, pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// DeletePagesDomain deletes an existing prject pages domain.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#delete-pages-domain
-func (s *PagesDomainsService) DeletePagesDomain(pid interface{}, domain string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains/%s", url.QueryEscape(project), domain)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go b/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go
deleted file mode 100644
index 9ed568e0..00000000
--- a/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go
+++ /dev/null
@@ -1,332 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// PipelineSchedulesService handles communication with the pipeline
-// schedules related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipeline_schedules.html
-type PipelineSchedulesService struct {
- client *Client
-}
-
-// PipelineSchedule represents a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html
-type PipelineSchedule struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Ref string `json:"ref"`
- Cron string `json:"cron"`
- CronTimezone string `json:"cron_timezone"`
- NextRunAt *time.Time `json:"next_run_at"`
- Active bool `json:"active"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- Owner *User `json:"owner"`
- LastPipeline struct {
- ID int `json:"id"`
- Sha string `json:"sha"`
- Ref string `json:"ref"`
- Status string `json:"status"`
- } `json:"last_pipeline"`
- Variables []*PipelineVariable `json:"variables"`
-}
-
-// ListPipelineSchedulesOptions represents the available ListPipelineTriggers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
-type ListPipelineSchedulesOptions ListOptions
-
-// ListPipelineSchedules gets a list of project triggers.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html
-func (s *PipelineSchedulesService) ListPipelineSchedules(pid interface{}, opt *ListPipelineSchedulesOptions, options ...OptionFunc) ([]*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ps []*PipelineSchedule
- resp, err := s.client.Do(req, &ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// GetPipelineSchedule gets a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html
-func (s *PipelineSchedulesService) GetPipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", url.QueryEscape(project), schedule)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreatePipelineScheduleOptions represents the available
-// CreatePipelineSchedule() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-type CreatePipelineScheduleOptions struct {
- Description *string `url:"description" json:"description"`
- Ref *string `url:"ref" json:"ref"`
- Cron *string `url:"cron" json:"cron"`
- CronTimezone *string `url:"cron_timezone,omitempty" json:"cron_timezone,omitempty"`
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
-}
-
-// CreatePipelineSchedule creates a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-func (s *PipelineSchedulesService) CreatePipelineSchedule(pid interface{}, opt *CreatePipelineScheduleOptions, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// EditPipelineScheduleOptions represents the available
-// EditPipelineSchedule() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-type EditPipelineScheduleOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Cron *string `url:"cron,omitempty" json:"cron,omitempty"`
- CronTimezone *string `url:"cron_timezone,omitempty" json:"cron_timezone,omitempty"`
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
-}
-
-// EditPipelineSchedule edits a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule
-func (s *PipelineSchedulesService) EditPipelineSchedule(pid interface{}, schedule int, opt *EditPipelineScheduleOptions, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", url.QueryEscape(project), schedule)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// TakeOwnershipOfPipelineSchedule sets the owner of the specified
-// pipeline schedule to the user issuing the request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#take-ownership-of-a-pipeline-schedule
-func (s *PipelineSchedulesService) TakeOwnershipOfPipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/take_ownership", url.QueryEscape(project), schedule)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// DeletePipelineSchedule deletes a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#delete-a-pipeline-schedule
-func (s *PipelineSchedulesService) DeletePipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", url.QueryEscape(project), schedule)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreatePipelineScheduleVariableOptions represents the available
-// CreatePipelineScheduleVariable() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-type CreatePipelineScheduleVariableOptions struct {
- Key *string `url:"key" json:"key"`
- Value *string `url:"value" json:"value"`
-}
-
-// CreatePipelineScheduleVariable creates a pipeline schedule variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-func (s *PipelineSchedulesService) CreatePipelineScheduleVariable(pid interface{}, schedule int, opt *CreatePipelineScheduleVariableOptions, options ...OptionFunc) (*PipelineVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables", url.QueryEscape(project), schedule)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineVariable)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// EditPipelineScheduleVariableOptions represents the available
-// EditPipelineScheduleVariable() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule-variable
-type EditPipelineScheduleVariableOptions struct {
- Value *string `url:"value" json:"value"`
-}
-
-// EditPipelineScheduleVariable creates a pipeline schedule variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule-variable
-func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid interface{}, schedule int, key string, opt *EditPipelineScheduleVariableOptions, options ...OptionFunc) (*PipelineVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables/%s", url.QueryEscape(project), schedule, key)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineVariable)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// DeletePipelineScheduleVariable creates a pipeline schedule variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#delete-a-pipeline-schedule-variable
-func (s *PipelineSchedulesService) DeletePipelineScheduleVariable(pid interface{}, schedule int, key string, options ...OptionFunc) (*PipelineVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables/%s", url.QueryEscape(project), schedule, key)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineVariable)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go b/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go
deleted file mode 100644
index 6e8dfb8a..00000000
--- a/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go
+++ /dev/null
@@ -1,232 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// PipelineTriggersService handles Project pipeline triggers.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html
-type PipelineTriggersService struct {
- client *Client
-}
-
-// PipelineTrigger represents a project pipeline trigger.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#pipeline-triggers
-type PipelineTrigger struct {
- ID int `json:"id"`
- Description string `json:"description"`
- CreatedAt *time.Time `json:"created_at"`
- DeletedAt *time.Time `json:"deleted_at"`
- LastUsed *time.Time `json:"last_used"`
- Token string `json:"token"`
- UpdatedAt *time.Time `json:"updated_at"`
- Owner *User `json:"owner"`
-}
-
-// ListPipelineTriggersOptions represents the available ListPipelineTriggers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
-type ListPipelineTriggersOptions ListOptions
-
-// ListPipelineTriggers gets a list of project triggers.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
-func (s *PipelineTriggersService) ListPipelineTriggers(pid interface{}, opt *ListPipelineTriggersOptions, options ...OptionFunc) ([]*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pt []*PipelineTrigger
- resp, err := s.client.Do(req, &pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// GetPipelineTrigger gets a specific pipeline trigger for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#get-trigger-details
-func (s *PipelineTriggersService) GetPipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers/%d", url.QueryEscape(project), trigger)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(PipelineTrigger)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// AddPipelineTriggerOptions represents the available AddPipelineTrigger() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger
-type AddPipelineTriggerOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// AddPipelineTrigger adds a pipeline trigger to a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger
-func (s *PipelineTriggersService) AddPipelineTrigger(pid interface{}, opt *AddPipelineTriggerOptions, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(PipelineTrigger)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// EditPipelineTriggerOptions represents the available EditPipelineTrigger() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger
-type EditPipelineTriggerOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// EditPipelineTrigger edits a trigger for a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger
-func (s *PipelineTriggersService) EditPipelineTrigger(pid interface{}, trigger int, opt *EditPipelineTriggerOptions, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers/%d", url.QueryEscape(project), trigger)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(PipelineTrigger)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// TakeOwnershipOfPipelineTrigger sets the owner of the specified
-// pipeline trigger to the user issuing the request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#take-ownership-of-a-project-trigger
-func (s *PipelineTriggersService) TakeOwnershipOfPipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers/%d/take_ownership", url.QueryEscape(project), trigger)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(PipelineTrigger)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// DeletePipelineTrigger removes a trigger from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#remove-a-project-trigger
-func (s *PipelineTriggersService) DeletePipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers/%d", url.QueryEscape(project), trigger)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// RunPipelineTriggerOptions represents the available RunPipelineTrigger() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/ci/triggers/README.html#triggering-a-pipeline
-type RunPipelineTriggerOptions struct {
- Ref *string `url:"ref" json:"ref"`
- Token *string `url:"token" json:"token"`
- Variables map[string]string `url:"variables,omitempty" json:"variables,omitempty"`
-}
-
-// RunPipelineTrigger starts a trigger from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/ci/triggers/README.html#triggering-a-pipeline
-func (s *PipelineTriggersService) RunPipelineTrigger(pid interface{}, opt *RunPipelineTriggerOptions, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/trigger/pipeline", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(Pipeline)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/pipelines.go b/vendor/github.com/xanzy/go-gitlab/pipelines.go
deleted file mode 100644
index d34ce2f3..00000000
--- a/vendor/github.com/xanzy/go-gitlab/pipelines.go
+++ /dev/null
@@ -1,229 +0,0 @@
-//
-// Copyright 2017, Igor Varavko
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// PipelinesService handles communication with the repositories related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html
-type PipelinesService struct {
- client *Client
-}
-
-// PipelineVariable represents a pipeline variable.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html
-type PipelineVariable struct {
- Key string `json:"key"`
- Value string `json:"value"`
-}
-
-// Pipeline represents a GitLab pipeline.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html
-type Pipeline struct {
- ID int `json:"id"`
- Status string `json:"status"`
- Ref string `json:"ref"`
- Sha string `json:"sha"`
- BeforeSha string `json:"before_sha"`
- Tag bool `json:"tag"`
- YamlErrors string `json:"yaml_errors"`
- User struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- }
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- StartedAt *time.Time `json:"started_at"`
- FinishedAt *time.Time `json:"finished_at"`
- CommittedAt *time.Time `json:"committed_at"`
- Duration int `json:"duration"`
- Coverage string `json:"coverage"`
-}
-
-func (i Pipeline) String() string {
- return Stringify(i)
-}
-
-// PipelineList represents a GitLab list project pipelines
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines
-type PipelineList []struct {
- ID int `json:"id"`
- Status string `json:"status"`
- Ref string `json:"ref"`
- Sha string `json:"sha"`
-}
-
-func (i PipelineList) String() string {
- return Stringify(i)
-}
-
-// ListProjectPipelinesOptions represents the available ListProjectPipelines() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines
-type ListProjectPipelinesOptions struct {
- ListOptions
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- Status *BuildStateValue `url:"status,omitempty" json:"status,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- YamlErrors *bool `url:"yaml_errors,omitempty" json:"yaml_errors,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListProjectPipelines gets a list of project piplines.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines
-func (s *PipelinesService) ListProjectPipelines(pid interface{}, opt *ListProjectPipelinesOptions, options ...OptionFunc) (PipelineList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p PipelineList
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
- return p, resp, err
-}
-
-// GetPipeline gets a single project pipeline.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#get-a-single-pipeline
-func (s *PipelinesService) GetPipeline(pid interface{}, pipeline int, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d", url.QueryEscape(project), pipeline)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Pipeline)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreatePipelineOptions represents the available CreatePipeline() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#create-a-new-pipeline
-type CreatePipelineOptions struct {
- Ref *string `url:"ref" json:"ref"`
- Variables []*PipelineVariable `url:"variables,omitempty" json:"variables,omitempty"`
-}
-
-// CreatePipeline creates a new project pipeline.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#create-a-new-pipeline
-func (s *PipelinesService) CreatePipeline(pid interface{}, opt *CreatePipelineOptions, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Pipeline)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// RetryPipelineBuild retries failed builds in a pipeline
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipelines.html#retry-failed-builds-in-a-pipeline
-func (s *PipelinesService) RetryPipelineBuild(pid interface{}, pipelineID int, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d/retry", project, pipelineID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Pipeline)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CancelPipelineBuild cancels a pipeline builds
-//
-// GitLab API docs:
-//https://docs.gitlab.com/ce/api/pipelines.html#cancel-a-pipelines-builds
-func (s *PipelinesService) CancelPipelineBuild(pid interface{}, pipelineID int, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d/cancel", project, pipelineID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Pipeline)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_badges.go b/vendor/github.com/xanzy/go-gitlab/project_badges.go
deleted file mode 100644
index 0c398387..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_badges.go
+++ /dev/null
@@ -1,208 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// ProjectBadge represents a project badge.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#list-all-badges-of-a-project
-type ProjectBadge struct {
- ID int `json:"id"`
- LinkURL string `json:"link_url"`
- ImageURL string `json:"image_url"`
- RenderedLinkURL string `json:"rendered_link_url"`
- RenderedImageURL string `json:"rendered_image_url"`
- // Kind represents a project badge kind. Can be empty, when used PreviewProjectBadge().
- Kind string `json:"kind"`
-}
-
-// ProjectBadgesService handles communication with the project badges
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/project_badges.html
-type ProjectBadgesService struct {
- client *Client
-}
-
-// ListProjectBadgesOptions represents the available ListProjectBadges()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#list-all-badges-of-a-project
-type ListProjectBadgesOptions ListOptions
-
-// ListProjectBadges gets a list of a project's badges and its group badges.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#list-all-badges-of-a-project
-func (s *ProjectBadgesService) ListProjectBadges(pid interface{}, opt *ListProjectBadgesOptions, options ...OptionFunc) ([]*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pb []*ProjectBadge
- resp, err := s.client.Do(req, &pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
-
-// GetProjectBadge gets a project badge.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#get-a-badge-of-a-project
-func (s *ProjectBadgesService) GetProjectBadge(pid interface{}, badge int, options ...OptionFunc) (*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges/%d", url.QueryEscape(project), badge)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pb := new(ProjectBadge)
- resp, err := s.client.Do(req, pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
-
-// AddProjectBadgeOptions represents the available AddProjectBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#add-a-badge-to-a-project
-type AddProjectBadgeOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// AddProjectBadge adds a badge to a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#add-a-badge-to-a-project
-func (s *ProjectBadgesService) AddProjectBadge(pid interface{}, opt *AddProjectBadgeOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pb := new(ProjectBadge)
- resp, err := s.client.Do(req, pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
-
-// EditProjectBadgeOptions represents the available EditProjectBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#edit-a-badge-of-a-project
-type EditProjectBadgeOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// EditProjectBadge updates a badge of a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#edit-a-badge-of-a-project
-func (s *ProjectBadgesService) EditProjectBadge(pid interface{}, badge int, opt *EditProjectBadgeOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges/%d", url.QueryEscape(project), badge)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pb := new(ProjectBadge)
- resp, err := s.client.Do(req, pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
-
-// DeleteProjectBadge removes a badge from a project. Only project's
-// badges will be removed by using this endpoint.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#remove-a-badge-from-a-project
-func (s *ProjectBadgesService) DeleteProjectBadge(pid interface{}, badge int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/badges/%d", url.QueryEscape(project), badge)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectBadgePreviewOptions represents the available PreviewProjectBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#preview-a-badge-from-a-project
-type ProjectBadgePreviewOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// PreviewProjectBadge returns how the link_url and image_url final URLs would be after
-// resolving the placeholder interpolation.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#preview-a-badge-from-a-project
-func (s *ProjectBadgesService) PreviewProjectBadge(pid interface{}, opt *ProjectBadgePreviewOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges/render", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pb := new(ProjectBadge)
- resp, err := s.client.Do(req, &pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_members.go b/vendor/github.com/xanzy/go-gitlab/project_members.go
deleted file mode 100644
index 94b618cf..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_members.go
+++ /dev/null
@@ -1,208 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// ProjectMembersService handles communication with the project members
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
-type ProjectMembersService struct {
- client *Client
-}
-
-// ListProjectMembersOptions represents the available ListProjectMembers() and
-// ListAllProjectMembers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
-type ListProjectMembersOptions struct {
- ListOptions
- Query *string `url:"query,omitempty" json:"query,omitempty"`
-}
-
-// ListProjectMembers gets a list of a project's team members viewable by the
-// authenticated user. Returns only direct members and not inherited members
-// through ancestors groups.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
-func (s *ProjectMembersService) ListProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...OptionFunc) ([]*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pm []*ProjectMember
- resp, err := s.client.Do(req, &pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// ListAllProjectMembers gets a list of a project's team members viewable by the
-// authenticated user. Returns a list including inherited members through
-// ancestor groups.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project-including-inherited-members
-func (s *ProjectMembersService) ListAllProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...OptionFunc) ([]*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members/all", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pm []*ProjectMember
- resp, err := s.client.Do(req, &pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// GetProjectMember gets a project team member.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project
-func (s *ProjectMembersService) GetProjectMember(pid interface{}, user int, options ...OptionFunc) (*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members/%d", url.QueryEscape(project), user)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pm := new(ProjectMember)
- resp, err := s.client.Do(req, pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// AddProjectMemberOptions represents the available AddProjectMember() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
-type AddProjectMemberOptions struct {
- UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"`
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
-}
-
-// AddProjectMember adds a user to a project team. This is an idempotent
-// method and can be called multiple times with the same parameters. Adding
-// team membership to a user that is already a member does not affect the
-// existing membership.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
-func (s *ProjectMembersService) AddProjectMember(pid interface{}, opt *AddProjectMemberOptions, options ...OptionFunc) (*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pm := new(ProjectMember)
- resp, err := s.client.Do(req, pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// EditProjectMemberOptions represents the available EditProjectMember() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
-type EditProjectMemberOptions struct {
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
-}
-
-// EditProjectMember updates a project team member to a specified access level..
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
-func (s *ProjectMembersService) EditProjectMember(pid interface{}, user int, opt *EditProjectMemberOptions, options ...OptionFunc) (*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members/%d", url.QueryEscape(project), user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pm := new(ProjectMember)
- resp, err := s.client.Do(req, pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// DeleteProjectMember removes a user from a project team.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project
-func (s *ProjectMembersService) DeleteProjectMember(pid interface{}, user int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/members/%d", url.QueryEscape(project), user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_snippets.go b/vendor/github.com/xanzy/go-gitlab/project_snippets.go
deleted file mode 100644
index 00428196..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_snippets.go
+++ /dev/null
@@ -1,207 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "net/url"
-)
-
-// ProjectSnippetsService handles communication with the project snippets
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html
-type ProjectSnippetsService struct {
- client *Client
-}
-
-// ListProjectSnippetsOptions represents the available ListSnippets() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html#list-snippets
-type ListProjectSnippetsOptions ListOptions
-
-// ListSnippets gets a list of project snippets.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html#list-snippets
-func (s *ProjectSnippetsService) ListSnippets(pid interface{}, opt *ListProjectSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ps []*Snippet
- resp, err := s.client.Do(req, &ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// GetSnippet gets a single project snippet
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#single-snippet
-func (s *ProjectSnippetsService) GetSnippet(pid interface{}, snippet int, options ...OptionFunc) (*Snippet, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d", url.QueryEscape(project), snippet)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// CreateProjectSnippetOptions represents the available CreateSnippet() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#create-new-snippet
-type CreateProjectSnippetOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Code *string `url:"code,omitempty" json:"code,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
-}
-
-// CreateSnippet creates a new project snippet. The user must have permission
-// to create new snippets.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#create-new-snippet
-func (s *ProjectSnippetsService) CreateSnippet(pid interface{}, opt *CreateProjectSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// UpdateProjectSnippetOptions represents the available UpdateSnippet() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#update-snippet
-type UpdateProjectSnippetOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Code *string `url:"code,omitempty" json:"code,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
-}
-
-// UpdateSnippet updates an existing project snippet. The user must have
-// permission to change an existing snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#update-snippet
-func (s *ProjectSnippetsService) UpdateSnippet(pid interface{}, snippet int, opt *UpdateProjectSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d", url.QueryEscape(project), snippet)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// DeleteSnippet deletes an existing project snippet. This is an idempotent
-// function and deleting a non-existent snippet still returns a 200 OK status
-// code.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#delete-snippet
-func (s *ProjectSnippetsService) DeleteSnippet(pid interface{}, snippet int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d", url.QueryEscape(project), snippet)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SnippetContent returns the raw project snippet as plain text.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#snippet-content
-func (s *ProjectSnippetsService) SnippetContent(pid interface{}, snippet int, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/raw", url.QueryEscape(project), snippet)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_variables.go b/vendor/github.com/xanzy/go-gitlab/project_variables.go
deleted file mode 100644
index 5b9f7630..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_variables.go
+++ /dev/null
@@ -1,196 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// ProjectVariablesService handles communication with the
-// project variables related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html
-type ProjectVariablesService struct {
- client *Client
-}
-
-// ProjectVariable represents a GitLab Project Variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html
-type ProjectVariable struct {
- Key string `json:"key"`
- Value string `json:"value"`
- Protected bool `json:"protected"`
- EnvironmentScope string `json:"environment_scope"`
-}
-
-func (v ProjectVariable) String() string {
- return Stringify(v)
-}
-
-// ListVariables gets a list of all variables in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#list-project-variables
-func (s *ProjectVariablesService) ListVariables(pid interface{}, options ...OptionFunc) ([]*ProjectVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var vs []*ProjectVariable
- resp, err := s.client.Do(req, &vs)
- if err != nil {
- return nil, resp, err
- }
-
- return vs, resp, err
-}
-
-// GetVariable gets a variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#show-variable-details
-func (s *ProjectVariablesService) GetVariable(pid interface{}, key string, options ...OptionFunc) (*ProjectVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s", url.QueryEscape(project), url.QueryEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(ProjectVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// CreateVariableOptions represents the available
-// CreateVariable() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable
-type CreateVariableOptions struct {
- Key *string `url:"key,omitempty" json:"key,omitempty"`
- Value *string `url:"value,omitempty" json:"value,omitempty"`
- Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
- EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
-}
-
-// CreateVariable creates a new project variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable
-func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreateVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(ProjectVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// UpdateVariableOptions represents the available
-// UpdateVariable() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable
-type UpdateVariableOptions struct {
- Key *string `url:"key,omitempty" json:"key,omitempty"`
- Value *string `url:"value,omitempty" json:"value,omitempty"`
- Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
- EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
-}
-
-// UpdateVariable updates the position of an existing
-// group issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable
-func (s *ProjectVariablesService) UpdateVariable(pid interface{}, key string, opt *UpdateVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s",
- url.QueryEscape(project),
- url.QueryEscape(key),
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(ProjectVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// RemoveVariable removes a project's variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#remove-variable
-func (s *ProjectVariablesService) RemoveVariable(pid interface{}, key string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s",
- url.QueryEscape(project),
- url.QueryEscape(key),
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/projects.go b/vendor/github.com/xanzy/go-gitlab/projects.go
deleted file mode 100644
index 7afbd42b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/projects.go
+++ /dev/null
@@ -1,1028 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "mime/multipart"
- "net/url"
- "os"
- "time"
-)
-
-// ProjectsService handles communication with the repositories related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html
-type ProjectsService struct {
- client *Client
-}
-
-// Project represents a GitLab project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html
-type Project struct {
- ID int `json:"id"`
- Description string `json:"description"`
- DefaultBranch string `json:"default_branch"`
- Public bool `json:"public"`
- Visibility VisibilityValue `json:"visibility"`
- SSHURLToRepo string `json:"ssh_url_to_repo"`
- HTTPURLToRepo string `json:"http_url_to_repo"`
- WebURL string `json:"web_url"`
- TagList []string `json:"tag_list"`
- Owner *User `json:"owner"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- IssuesEnabled bool `json:"issues_enabled"`
- OpenIssuesCount int `json:"open_issues_count"`
- MergeRequestsEnabled bool `json:"merge_requests_enabled"`
- ApprovalsBeforeMerge int `json:"approvals_before_merge"`
- JobsEnabled bool `json:"jobs_enabled"`
- WikiEnabled bool `json:"wiki_enabled"`
- SnippetsEnabled bool `json:"snippets_enabled"`
- ContainerRegistryEnabled bool `json:"container_registry_enabled"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- LastActivityAt *time.Time `json:"last_activity_at,omitempty"`
- CreatorID int `json:"creator_id"`
- Namespace *ProjectNamespace `json:"namespace"`
- ImportStatus string `json:"import_status"`
- ImportError string `json:"import_error"`
- Permissions *Permissions `json:"permissions"`
- Archived bool `json:"archived"`
- AvatarURL string `json:"avatar_url"`
- SharedRunnersEnabled bool `json:"shared_runners_enabled"`
- ForksCount int `json:"forks_count"`
- StarCount int `json:"star_count"`
- RunnersToken string `json:"runners_token"`
- PublicJobs bool `json:"public_jobs"`
- OnlyAllowMergeIfPipelineSucceeds bool `json:"only_allow_merge_if_pipeline_succeeds"`
- OnlyAllowMergeIfAllDiscussionsAreResolved bool `json:"only_allow_merge_if_all_discussions_are_resolved"`
- LFSEnabled bool `json:"lfs_enabled"`
- RequestAccessEnabled bool `json:"request_access_enabled"`
- MergeMethod string `json:"merge_method"`
- ForkedFromProject *ForkParent `json:"forked_from_project"`
- SharedWithGroups []struct {
- GroupID int `json:"group_id"`
- GroupName string `json:"group_name"`
- GroupAccessLevel int `json:"group_access_level"`
- } `json:"shared_with_groups"`
- Statistics *ProjectStatistics `json:"statistics"`
- Links *Links `json:"_links,omitempty"`
- CIConfigPath *string `json:"ci_config_path"`
-}
-
-// Repository represents a repository.
-type Repository struct {
- Name string `json:"name"`
- Description string `json:"description"`
- WebURL string `json:"web_url"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- Visibility VisibilityValue `json:"visibility"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
-}
-
-// ProjectNamespace represents a project namespace.
-type ProjectNamespace struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Kind string `json:"kind"`
- FullPath string `json:"full_path"`
-}
-
-// StorageStatistics represents a statistics record for a group or project.
-type StorageStatistics struct {
- StorageSize int64 `json:"storage_size"`
- RepositorySize int64 `json:"repository_size"`
- LfsObjectsSize int64 `json:"lfs_objects_size"`
- JobArtifactsSize int64 `json:"job_artifacts_size"`
-}
-
-// ProjectStatistics represents a statistics record for a project.
-type ProjectStatistics struct {
- StorageStatistics
- CommitCount int `json:"commit_count"`
-}
-
-// Permissions represents permissions.
-type Permissions struct {
- ProjectAccess *ProjectAccess `json:"project_access"`
- GroupAccess *GroupAccess `json:"group_access"`
-}
-
-// ProjectAccess represents project access.
-type ProjectAccess struct {
- AccessLevel AccessLevelValue `json:"access_level"`
- NotificationLevel NotificationLevelValue `json:"notification_level"`
-}
-
-// GroupAccess represents group access.
-type GroupAccess struct {
- AccessLevel AccessLevelValue `json:"access_level"`
- NotificationLevel NotificationLevelValue `json:"notification_level"`
-}
-
-// ForkParent represents the parent project when this is a fork.
-type ForkParent struct {
- HTTPURLToRepo string `json:"http_url_to_repo"`
- ID int `json:"id"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- WebURL string `json:"web_url"`
-}
-
-// Links represents a project web links for self, issues, merge_requests,
-// repo_branches, labels, events, members.
-type Links struct {
- Self string `json:"self"`
- Issues string `json:"issues"`
- MergeRequests string `json:"merge_requests"`
- RepoBranches string `json:"repo_branches"`
- Labels string `json:"labels"`
- Events string `json:"events"`
- Members string `json:"members"`
-}
-
-func (s Project) String() string {
- return Stringify(s)
-}
-
-// ListProjectsOptions represents the available ListProjects() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-projects
-type ListProjectsOptions struct {
- ListOptions
- Archived *bool `url:"archived,omitempty" json:"archived,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- Simple *bool `url:"simple,omitempty" json:"simple,omitempty"`
- Owned *bool `url:"owned,omitempty" json:"owned,omitempty"`
- Membership *bool `url:"membership,omitempty" json:"membership,omitempty"`
- Starred *bool `url:"starred,omitempty" json:"starred,omitempty"`
- Statistics *bool `url:"statistics,omitempty" json:"statistics,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
- WithIssuesEnabled *bool `url:"with_issues_enabled,omitempty" json:"with_issues_enabled,omitempty"`
- WithMergeRequestsEnabled *bool `url:"with_merge_requests_enabled,omitempty" json:"with_merge_requests_enabled,omitempty"`
- MinAccessLevel *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"`
-}
-
-// ListProjects gets a list of projects accessible by the authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-projects
-func (s *ProjectsService) ListProjects(opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- req, err := s.client.NewRequest("GET", "projects", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*Project
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ListUserProjects gets a list of projects for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-user-projects
-func (s *ProjectsService) ListUserProjects(uid interface{}, opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- user, err := parseID(uid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("users/%s/projects", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*Project
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ProjectUser represents a GitLab project user.
-type ProjectUser struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
-}
-
-// ListProjectUserOptions represents the available ListProjectsUsers() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#get-project-users
-type ListProjectUserOptions struct {
- ListOptions
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListProjectsUsers gets a list of users for the given project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-users
-func (s *ProjectsService) ListProjectsUsers(pid interface{}, opt *ListProjectUserOptions, options ...OptionFunc) ([]*ProjectUser, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/users", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*ProjectUser
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ProjectLanguages is a map of strings because the response is arbitrary
-//
-// Gitlab API docs: https://docs.gitlab.com/ce/api/projects.html#languages
-type ProjectLanguages map[string]float32
-
-// GetProjectLanguages gets a list of languages used by the project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#languages
-func (s *ProjectsService) GetProjectLanguages(pid interface{}, options ...OptionFunc) (*ProjectLanguages, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/languages", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(ProjectLanguages)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// GetProject gets a specific project, identified by project ID or
-// NAMESPACE/PROJECT_NAME, which is owned by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-single-project
-func (s *ProjectsService) GetProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ProjectEvent represents a GitLab project event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-events
-type ProjectEvent struct {
- Title interface{} `json:"title"`
- ProjectID int `json:"project_id"`
- ActionName string `json:"action_name"`
- TargetID interface{} `json:"target_id"`
- TargetType interface{} `json:"target_type"`
- AuthorID int `json:"author_id"`
- AuthorUsername string `json:"author_username"`
- Data struct {
- Before string `json:"before"`
- After string `json:"after"`
- Ref string `json:"ref"`
- UserID int `json:"user_id"`
- UserName string `json:"user_name"`
- Repository *Repository `json:"repository"`
- Commits []*Commit `json:"commits"`
- TotalCommitsCount int `json:"total_commits_count"`
- } `json:"data"`
- TargetTitle interface{} `json:"target_title"`
-}
-
-func (s ProjectEvent) String() string {
- return Stringify(s)
-}
-
-// GetProjectEventsOptions represents the available GetProjectEvents() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-events
-type GetProjectEventsOptions ListOptions
-
-// GetProjectEvents gets the events for the specified project. Sorted from
-// newest to latest.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-events
-func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEventsOptions, options ...OptionFunc) ([]*ProjectEvent, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/events", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*ProjectEvent
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreateProjectOptions represents the available CreateProjects() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#create-project
-type CreateProjectOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- DefaultBranch *string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
- NamespaceID *int `url:"namespace_id,omitempty" json:"namespace_id,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- IssuesEnabled *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
- MergeRequestsEnabled *bool `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"`
- JobsEnabled *bool `url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"`
- WikiEnabled *bool `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"`
- SnippetsEnabled *bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
- ResolveOutdatedDiffDiscussions *bool `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
- ContainerRegistryEnabled *bool `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
- SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
- ImportURL *string `url:"import_url,omitempty" json:"import_url,omitempty"`
- PublicJobs *bool `url:"public_jobs,omitempty" json:"public_jobs,omitempty"`
- OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
- OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
- MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"`
- LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
- RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
- TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
- PrintingMergeRequestLinkEnabled *bool `url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"`
- CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
- ApprovalsBeforeMerge *int `url:"approvals_before_merge" json:"approvals_before_merge"`
-}
-
-// CreateProject creates a new project owned by the authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#create-project
-func (s *ProjectsService) CreateProject(opt *CreateProjectOptions, options ...OptionFunc) (*Project, *Response, error) {
- req, err := s.client.NewRequest("POST", "projects", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreateProjectForUserOptions represents the available CreateProjectForUser()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#create-project-for-user
-type CreateProjectForUserOptions CreateProjectOptions
-
-// CreateProjectForUser creates a new project owned by the specified user.
-// Available only for admins.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#create-project-for-user
-func (s *ProjectsService) CreateProjectForUser(user int, opt *CreateProjectForUserOptions, options ...OptionFunc) (*Project, *Response, error) {
- u := fmt.Sprintf("projects/user/%d", user)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// EditProjectOptions represents the available EditProject() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project
-type EditProjectOptions CreateProjectOptions
-
-// EditProject updates an existing project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project
-func (s *ProjectsService) EditProject(pid interface{}, opt *EditProjectOptions, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ForkProject forks a project into the user namespace of the authenticated
-// user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#fork-project
-func (s *ProjectsService) ForkProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/fork", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// StarProject stars a given the project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#star-a-project
-func (s *ProjectsService) StarProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/star", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// UnstarProject unstars a given project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#unstar-a-project
-func (s *ProjectsService) UnstarProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/unstar", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ArchiveProject archives the project if the user is either admin or the
-// project owner of this project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#archive-a-project
-func (s *ProjectsService) ArchiveProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/archive", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// UnarchiveProject unarchives the project if the user is either admin or
-// the project owner of this project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#unarchive-a-project
-func (s *ProjectsService) UnarchiveProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/unarchive", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// DeleteProject removes a project including all associated resources
-// (issues, merge requests etc.)
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#remove-project
-func (s *ProjectsService) DeleteProject(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ShareWithGroupOptions represents options to share project with groups
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#share-project-with-group
-type ShareWithGroupOptions struct {
- GroupID *int `url:"group_id" json:"group_id"`
- GroupAccess *AccessLevelValue `url:"group_access" json:"group_access"`
- ExpiresAt *string `url:"expires_at" json:"expires_at"`
-}
-
-// ShareProjectWithGroup allows to share a project with a group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#share-project-with-group
-func (s *ProjectsService) ShareProjectWithGroup(pid interface{}, opt *ShareWithGroupOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/share", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteSharedProjectFromGroup allows to unshare a project from a group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#delete-a-shared-project-link-within-a-group
-func (s *ProjectsService) DeleteSharedProjectFromGroup(pid interface{}, groupID int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/share/%d", url.QueryEscape(project), groupID)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectMember represents a project member.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-project-team-members
-type ProjectMember struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- AccessLevel AccessLevelValue `json:"access_level"`
-}
-
-// ProjectHook represents a project hook.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-project-hooks
-type ProjectHook struct {
- ID int `json:"id"`
- URL string `json:"url"`
- ProjectID int `json:"project_id"`
- PushEvents bool `json:"push_events"`
- IssuesEvents bool `json:"issues_events"`
- ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
- MergeRequestsEvents bool `json:"merge_requests_events"`
- TagPushEvents bool `json:"tag_push_events"`
- NoteEvents bool `json:"note_events"`
- JobEvents bool `json:"job_events"`
- PipelineEvents bool `json:"pipeline_events"`
- WikiPageEvents bool `json:"wiki_page_events"`
- EnableSSLVerification bool `json:"enable_ssl_verification"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-// ListProjectHooksOptions represents the available ListProjectHooks() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-project-hooks
-type ListProjectHooksOptions ListOptions
-
-// ListProjectHooks gets a list of project hooks.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-project-hooks
-func (s *ProjectsService) ListProjectHooks(pid interface{}, opt *ListProjectHooksOptions, options ...OptionFunc) ([]*ProjectHook, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ph []*ProjectHook
- resp, err := s.client.Do(req, &ph)
- if err != nil {
- return nil, resp, err
- }
-
- return ph, resp, err
-}
-
-// GetProjectHook gets a specific hook for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-hook
-func (s *ProjectsService) GetProjectHook(pid interface{}, hook int, options ...OptionFunc) (*ProjectHook, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks/%d", url.QueryEscape(project), hook)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ph := new(ProjectHook)
- resp, err := s.client.Do(req, ph)
- if err != nil {
- return nil, resp, err
- }
-
- return ph, resp, err
-}
-
-// AddProjectHookOptions represents the available AddProjectHook() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#add-project-hook
-type AddProjectHookOptions struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
- PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
- IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
- ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
- MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
- TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
- NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
- JobEvents *bool `url:"job_events,omitempty" json:"job_events,omitempty"`
- PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
- WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
- EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
- Token *string `url:"token,omitempty" json:"token,omitempty"`
-}
-
-// AddProjectHook adds a hook to a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#add-project-hook
-func (s *ProjectsService) AddProjectHook(pid interface{}, opt *AddProjectHookOptions, options ...OptionFunc) (*ProjectHook, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ph := new(ProjectHook)
- resp, err := s.client.Do(req, ph)
- if err != nil {
- return nil, resp, err
- }
-
- return ph, resp, err
-}
-
-// EditProjectHookOptions represents the available EditProjectHook() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#edit-project-hook
-type EditProjectHookOptions struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
- PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
- IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
- ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
- MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
- TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
- NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
- JobEvents *bool `url:"job_events,omitempty" json:"job_events,omitempty"`
- PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
- WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
- EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
- Token *string `url:"token,omitempty" json:"token,omitempty"`
-}
-
-// EditProjectHook edits a hook for a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#edit-project-hook
-func (s *ProjectsService) EditProjectHook(pid interface{}, hook int, opt *EditProjectHookOptions, options ...OptionFunc) (*ProjectHook, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks/%d", url.QueryEscape(project), hook)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ph := new(ProjectHook)
- resp, err := s.client.Do(req, ph)
- if err != nil {
- return nil, resp, err
- }
-
- return ph, resp, err
-}
-
-// DeleteProjectHook removes a hook from a project. This is an idempotent
-// method and can be called multiple times. Either the hook is available or not.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#delete-project-hook
-func (s *ProjectsService) DeleteProjectHook(pid interface{}, hook int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks/%d", url.QueryEscape(project), hook)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectForkRelation represents a project fork relationship.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#admin-fork-relation
-type ProjectForkRelation struct {
- ID int `json:"id"`
- ForkedToProjectID int `json:"forked_to_project_id"`
- ForkedFromProjectID int `json:"forked_from_project_id"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
-}
-
-// CreateProjectForkRelation creates a forked from/to relation between
-// existing projects.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#create-a-forked-fromto-relation-between-existing-projects.
-func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options ...OptionFunc) (*ProjectForkRelation, *Response, error) {
- u := fmt.Sprintf("projects/%d/fork/%d", pid, fork)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pfr := new(ProjectForkRelation)
- resp, err := s.client.Do(req, pfr)
- if err != nil {
- return nil, resp, err
- }
-
- return pfr, resp, err
-}
-
-// DeleteProjectForkRelation deletes an existing forked from relationship.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#delete-an-existing-forked-from-relationship
-func (s *ProjectsService) DeleteProjectForkRelation(pid int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("projects/%d/fork", pid)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectFile represents an uploaded project file
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#upload-a-file
-type ProjectFile struct {
- Alt string `json:"alt"`
- URL string `json:"url"`
- Markdown string `json:"markdown"`
-}
-
-// UploadFile upload a file from disk
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#upload-a-file
-func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...OptionFunc) (*ProjectFile, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/uploads", url.QueryEscape(project))
-
- f, err := os.Open(file)
- if err != nil {
- return nil, nil, err
- }
- defer f.Close()
-
- b := &bytes.Buffer{}
- w := multipart.NewWriter(b)
-
- fw, err := w.CreateFormFile("file", file)
- if err != nil {
- return nil, nil, err
- }
-
- _, err = io.Copy(fw, f)
- if err != nil {
- return nil, nil, err
- }
- w.Close()
-
- req, err := s.client.NewRequest("", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- req.Body = ioutil.NopCloser(b)
- req.ContentLength = int64(b.Len())
- req.Header.Set("Content-Type", w.FormDataContentType())
- req.Method = "POST"
-
- uf := &ProjectFile{}
- resp, err := s.client.Do(req, uf)
- if err != nil {
- return nil, resp, err
- }
-
- return uf, resp, nil
-}
-
-// ListProjectForks gets a list of project forks.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-forks-of-a-project
-func (s *ProjectsService) ListProjectForks(pid interface{}, opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/forks", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var forks []*Project
- resp, err := s.client.Do(req, &forks)
- if err != nil {
- return nil, resp, err
- }
-
- return forks, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/protected_branches.go b/vendor/github.com/xanzy/go-gitlab/protected_branches.go
deleted file mode 100644
index 0a56241e..00000000
--- a/vendor/github.com/xanzy/go-gitlab/protected_branches.go
+++ /dev/null
@@ -1,165 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen, Michael Lihs
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// ProtectedBranchesService handles communication with the protected branch
-// related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#protected-branches-api
-type ProtectedBranchesService struct {
- client *Client
-}
-
-// BranchAccessDescription represents the access description for a protected
-// branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#protected-branches-api
-type BranchAccessDescription struct {
- AccessLevel AccessLevelValue `json:"access_level"`
- AccessLevelDescription string `json:"access_level_description"`
-}
-
-// ProtectedBranch represents a protected branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#list-protected-branches
-type ProtectedBranch struct {
- Name string `json:"name"`
- PushAccessLevels []*BranchAccessDescription `json:"push_access_levels"`
- MergeAccessLevels []*BranchAccessDescription `json:"merge_access_levels"`
-}
-
-// ListProtectedBranchesOptions represents the available ListProtectedBranches()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#list-protected-branches
-type ListProtectedBranchesOptions ListOptions
-
-// ListProtectedBranches gets a list of protected branches from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#list-protected-branches
-func (s *ProtectedBranchesService) ListProtectedBranches(pid interface{}, opt *ListProtectedBranchesOptions, options ...OptionFunc) ([]*ProtectedBranch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_branches", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*ProtectedBranch
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// GetProtectedBranch gets a single protected branch or wildcard protected branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#get-a-single-protected-branch-or-wildcard-protected-branch
-func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch string, options ...OptionFunc) (*ProtectedBranch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_branches/%s", url.QueryEscape(project), branch)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(ProtectedBranch)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ProtectRepositoryBranchesOptions represents the available
-// ProtectRepositoryBranches() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches
-type ProtectRepositoryBranchesOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- PushAccessLevel *AccessLevelValue `url:"push_access_level,omitempty" json:"push_access_level,omitempty"`
- MergeAccessLevel *AccessLevelValue `url:"merge_access_level,omitempty" json:"merge_access_level,omitempty"`
-}
-
-// ProtectRepositoryBranches protects a single repository branch or several
-// project repository branches using a wildcard protected branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches
-func (s *ProtectedBranchesService) ProtectRepositoryBranches(pid interface{}, opt *ProtectRepositoryBranchesOptions, options ...OptionFunc) (*ProtectedBranch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_branches", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(ProtectedBranch)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// UnprotectRepositoryBranches unprotects the given protected branch or wildcard
-// protected branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#unprotect-repository-branches
-func (s *ProtectedBranchesService) UnprotectRepositoryBranches(pid interface{}, branch string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_branches/%s", url.QueryEscape(project), branch)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/repositories.go b/vendor/github.com/xanzy/go-gitlab/repositories.go
deleted file mode 100644
index 01d767a8..00000000
--- a/vendor/github.com/xanzy/go-gitlab/repositories.go
+++ /dev/null
@@ -1,261 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "net/url"
-)
-
-// RepositoriesService handles communication with the repositories related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html
-type RepositoriesService struct {
- client *Client
-}
-
-// TreeNode represents a GitLab repository file or directory.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html
-type TreeNode struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Type string `json:"type"`
- Path string `json:"path"`
- Mode string `json:"mode"`
-}
-
-func (t TreeNode) String() string {
- return Stringify(t)
-}
-
-// ListTreeOptions represents the available ListTree() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#list-repository-tree
-type ListTreeOptions struct {
- ListOptions
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Recursive *bool `url:"recursive,omitempty" json:"recursive,omitempty"`
-}
-
-// ListTree gets a list of repository files and directories in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#list-repository-tree
-func (s *RepositoriesService) ListTree(pid interface{}, opt *ListTreeOptions, options ...OptionFunc) ([]*TreeNode, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tree", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t []*TreeNode
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// RawFileContent gets the raw file contents for a file by commit SHA and path
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#raw-file-content
-func (s *RepositoriesService) RawFileContent(pid interface{}, sha string, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/blobs/%s", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// RawBlobContent gets the raw file contents for a blob by blob SHA.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#raw-blob-content
-func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/blobs/%s/raw", url.QueryEscape(project), sha)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// ArchiveOptions represents the available Archive() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#get-file-archive
-type ArchiveOptions struct {
- SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
-}
-
-// Archive gets an archive of the repository.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#get-file-archive
-func (s *RepositoriesService) Archive(pid interface{}, opt *ArchiveOptions, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/archive", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// Compare represents the result of a comparison of branches, tags or commits.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
-type Compare struct {
- Commit *Commit `json:"commit"`
- Commits []*Commit `json:"commits"`
- Diffs []*Diff `json:"diffs"`
- CompareTimeout bool `json:"compare_timeout"`
- CompareSameRef bool `json:"compare_same_ref"`
-}
-
-func (c Compare) String() string {
- return Stringify(c)
-}
-
-// CompareOptions represents the available Compare() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
-type CompareOptions struct {
- From *string `url:"from,omitempty" json:"from,omitempty"`
- To *string `url:"to,omitempty" json:"to,omitempty"`
- Straight *bool `url:"straight,omitempty" json:"straight,omitempty"`
-}
-
-// Compare compares branches, tags or commits.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
-func (s *RepositoriesService) Compare(pid interface{}, opt *CompareOptions, options ...OptionFunc) (*Compare, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/compare", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(Compare)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// Contributor represents a GitLap contributor.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors
-type Contributor struct {
- Name string `json:"name,omitempty"`
- Email string `json:"email,omitempty"`
- Commits int `json:"commits,omitempty"`
- Additions int `json:"additions,omitempty"`
- Deletions int `json:"deletions,omitempty"`
-}
-
-func (c Contributor) String() string {
- return Stringify(c)
-}
-
-// ListContributorsOptions represents the available ListContributorsOptions()
-// options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors
-type ListContributorsOptions ListOptions
-
-// Contributors gets the repository contributors list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors
-func (s *RepositoriesService) Contributors(pid interface{}, opt *ListContributorsOptions, options ...OptionFunc) ([]*Contributor, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/contributors", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c []*Contributor
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/repository_files.go b/vendor/github.com/xanzy/go-gitlab/repository_files.go
deleted file mode 100644
index cbfd4249..00000000
--- a/vendor/github.com/xanzy/go-gitlab/repository_files.go
+++ /dev/null
@@ -1,235 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "net/url"
-)
-
-// RepositoryFilesService handles communication with the repository files
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repository_files.html
-type RepositoryFilesService struct {
- client *Client
-}
-
-// File represents a GitLab repository file.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repository_files.html
-type File struct {
- FileName string `json:"file_name"`
- FilePath string `json:"file_path"`
- Size int `json:"size"`
- Encoding string `json:"encoding"`
- Content string `json:"content"`
- Ref string `json:"ref"`
- BlobID string `json:"blob_id"`
- CommitID string `json:"commit_id"`
-}
-
-func (r File) String() string {
- return Stringify(r)
-}
-
-// GetFileOptions represents the available GetFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository
-type GetFileOptions struct {
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
-}
-
-// GetFile allows you to receive information about a file in repository like
-// name, size, content. Note that file content is Base64 encoded.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository
-func (s *RepositoryFilesService) GetFile(pid interface{}, fileName string, opt *GetFileOptions, options ...OptionFunc) (*File, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/files/%s", url.QueryEscape(project), url.PathEscape(fileName))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- f := new(File)
- resp, err := s.client.Do(req, f)
- if err != nil {
- return nil, resp, err
- }
-
- return f, resp, err
-}
-
-// GetRawFileOptions represents the available GetRawFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-raw-file-from-repository
-type GetRawFileOptions struct {
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
-}
-
-// GetRawFile allows you to receive the raw file in repository.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-raw-file-from-repository
-func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, opt *GetRawFileOptions, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/files/%s/raw", url.QueryEscape(project), url.PathEscape(fileName))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var f bytes.Buffer
- resp, err := s.client.Do(req, &f)
- if err != nil {
- return nil, resp, err
- }
-
- return f.Bytes(), resp, err
-}
-
-// FileInfo represents file details of a GitLab repository file.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repository_files.html
-type FileInfo struct {
- FilePath string `json:"file_path"`
- Branch string `json:"branch"`
-}
-
-func (r FileInfo) String() string {
- return Stringify(r)
-}
-
-// CreateFileOptions represents the available CreateFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository
-type CreateFileOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
- Encoding *string `url:"encoding,omitempty" json:"encoding,omitempty"`
- AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
- AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
- Content *string `url:"content,omitempty" json:"content,omitempty"`
- CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
-}
-
-// CreateFile creates a new file in a repository.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository
-func (s *RepositoryFilesService) CreateFile(pid interface{}, fileName string, opt *CreateFileOptions, options ...OptionFunc) (*FileInfo, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/files/%s", url.QueryEscape(project), url.PathEscape(fileName))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- f := new(FileInfo)
- resp, err := s.client.Do(req, f)
- if err != nil {
- return nil, resp, err
- }
-
- return f, resp, err
-}
-
-// UpdateFileOptions represents the available UpdateFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#update-existing-file-in-repository
-type UpdateFileOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
- Encoding *string `url:"encoding,omitempty" json:"encoding,omitempty"`
- AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
- AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
- Content *string `url:"content,omitempty" json:"content,omitempty"`
- CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
- LastCommitID *string `url:"last_commit_id,omitempty" json:"last_commit_id,omitempty"`
-}
-
-// UpdateFile updates an existing file in a repository
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#update-existing-file-in-repository
-func (s *RepositoryFilesService) UpdateFile(pid interface{}, fileName string, opt *UpdateFileOptions, options ...OptionFunc) (*FileInfo, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/files/%s", url.QueryEscape(project), url.PathEscape(fileName))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- f := new(FileInfo)
- resp, err := s.client.Do(req, f)
- if err != nil {
- return nil, resp, err
- }
-
- return f, resp, err
-}
-
-// DeleteFileOptions represents the available DeleteFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository
-type DeleteFileOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
- AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
- AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
- CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
-}
-
-// DeleteFile deletes an existing file in a repository
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository
-func (s *RepositoryFilesService) DeleteFile(pid interface{}, fileName string, opt *DeleteFileOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/files/%s", url.QueryEscape(project), url.PathEscape(fileName))
-
- req, err := s.client.NewRequest("DELETE", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/runners.go b/vendor/github.com/xanzy/go-gitlab/runners.go
deleted file mode 100644
index 11ffc238..00000000
--- a/vendor/github.com/xanzy/go-gitlab/runners.go
+++ /dev/null
@@ -1,408 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// RunnersService handles communication with the runner related methods of the
-// GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
-type RunnersService struct {
- client *Client
-}
-
-// Runner represents a GitLab CI Runner.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
-type Runner struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Active bool `json:"active"`
- IsShared bool `json:"is_shared"`
- Name string `json:"name"`
- Online bool `json:"online"`
- Status string `json:"status"`
- Token string `json:"token"`
-}
-
-// RunnerDetails represents the GitLab CI runner details.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
-type RunnerDetails struct {
- Active bool `json:"active"`
- Architecture string `json:"architecture"`
- Description string `json:"description"`
- ID int `json:"id"`
- IsShared bool `json:"is_shared"`
- ContactedAt *time.Time `json:"contacted_at"`
- Name string `json:"name"`
- Online bool `json:"online"`
- Status string `json:"status"`
- Platform string `json:"platform"`
- Projects []struct {
- ID int `json:"id"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- } `json:"projects"`
- Token string `json:"token"`
- Revision string `json:"revision"`
- TagList []string `json:"tag_list"`
- Version string `json:"version"`
- AccessLevel string `json:"access_level"`
- MaximumTimeout int `json:"maximum_timeout"`
-}
-
-// ListRunnersOptions represents the available ListRunners() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
-type ListRunnersOptions struct {
- ListOptions
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
-}
-
-// ListRunners gets a list of runners accessible by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
-func (s *RunnersService) ListRunners(opt *ListRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) {
- req, err := s.client.NewRequest("GET", "runners", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Runner
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// ListAllRunners gets a list of all runners in the GitLab instance. Access is
-// restricted to users with admin privileges.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-all-runners
-func (s *RunnersService) ListAllRunners(opt *ListRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) {
- req, err := s.client.NewRequest("GET", "runners/all", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Runner
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// GetRunnerDetails returns details for given runner.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#get-runner-39-s-details
-func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc) (*RunnerDetails, *Response, error) {
- runner, err := parseID(rid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("runners/%s", runner)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs *RunnerDetails
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// UpdateRunnerDetailsOptions represents the available UpdateRunnerDetails() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details
-type UpdateRunnerDetailsOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
- TagList []string `url:"tag_list[],omitempty" json:"tag_list,omitempty"`
- RunUntagged *bool `url:"run_untagged,omitempty" json:"run_untagged,omitempty"`
- Locked *bool `url:"locked,omitempty" json:"locked,omitempty"`
- AccessLevel *string `url:"access_level,omitempty" json:"access_level,omitempty"`
- MaximumTimeout *int `url:"maximum_timeout,omitempty" json:"maximum_timeout,omitempty"`
-}
-
-// UpdateRunnerDetails updates details for a given runner.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details
-func (s *RunnersService) UpdateRunnerDetails(rid interface{}, opt *UpdateRunnerDetailsOptions, options ...OptionFunc) (*RunnerDetails, *Response, error) {
- runner, err := parseID(rid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("runners/%s", runner)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs *RunnerDetails
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// RemoveRunner removes a runner.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#remove-a-runner
-func (s *RunnersService) RemoveRunner(rid interface{}, options ...OptionFunc) (*Response, error) {
- runner, err := parseID(rid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("runners/%s", runner)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListRunnerJobsOptions represents the available ListRunnerJobs()
-// options. Status can be one of: running, success, failed, canceled.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs
-type ListRunnerJobsOptions struct {
- ListOptions
- Status *string `url:"status,omitempty" json:"status,omitempty"`
-}
-
-// ListRunnerJobs gets a list of jobs that are being processed or were processed by specified Runner.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs
-func (s *RunnersService) ListRunnerJobs(rid interface{}, opt *ListRunnerJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) {
- runner, err := parseID(rid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("runners/%s/jobs", runner)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Job
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// ListProjectRunnersOptions represents the available ListProjectRunners()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-project-s-runners
-type ListProjectRunnersOptions ListRunnersOptions
-
-// ListProjectRunners gets a list of runners accessible by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-project-s-runners
-func (s *RunnersService) ListProjectRunners(pid interface{}, opt *ListProjectRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/runners", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Runner
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// EnableProjectRunnerOptions represents the available EnableProjectRunner()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project
-type EnableProjectRunnerOptions struct {
- RunnerID int `json:"runner_id"`
-}
-
-// EnableProjectRunner enables an available specific runner in the project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project
-func (s *RunnersService) EnableProjectRunner(pid interface{}, opt *EnableProjectRunnerOptions, options ...OptionFunc) (*Runner, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/runners", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var r *Runner
- resp, err := s.client.Do(req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// DisableProjectRunner disables a specific runner from project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#disable-a-runner-from-project
-func (s *RunnersService) DisableProjectRunner(pid interface{}, rid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- runner, err := parseID(rid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/runners/%s", url.QueryEscape(project), url.QueryEscape(runner))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// RegisterNewRunnerOptions represents the available RegisterNewRunner()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#register-a-new-runner
-type RegisterNewRunnerOptions struct {
- Token *string `url:"token" json:"token"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Info *string `url:"info,omitempty" json:"info,omitempty"`
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
- Locked *bool `url:"locked,omitempty" json:"locked,omitempty"`
- RunUntagged *bool `url:"run_untagged,omitempty" json:"run_untagged,omitempty"`
- TagList []string `url:"tag_list[],omitempty" json:"tag_list,omitempty"`
- MaximumTimeout *int `url:"maximum_timeout,omitempty" json:"maximum_timeout,omitempty"`
-}
-
-// RegisterNewRunner registers a new Runner for the instance.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#register-a-new-runner
-func (s *RunnersService) RegisterNewRunner(opt *RegisterNewRunnerOptions, options ...OptionFunc) (*Runner, *Response, error) {
- req, err := s.client.NewRequest("POST", "runners", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var r *Runner
- resp, err := s.client.Do(req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// DeleteRegisteredRunnerOptions represents the available
-// DeleteRegisteredRunner() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#delete-a-registered-runner
-type DeleteRegisteredRunnerOptions struct {
- Token *string `url:"token" json:"token"`
-}
-
-// DeleteRegisteredRunner registers a new Runner for the instance.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#delete-a-registered-runner
-func (s *RunnersService) DeleteRegisteredRunner(opt *DeleteRegisteredRunnerOptions, options ...OptionFunc) (*Response, error) {
- req, err := s.client.NewRequest("DELETE", "runners", opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// VerifyRegisteredRunnerOptions represents the available
-// VerifyRegisteredRunner() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#verify-authentication-for-a-registered-runner
-type VerifyRegisteredRunnerOptions struct {
- Token *string `url:"token" json:"token"`
-}
-
-// VerifyRegisteredRunner registers a new Runner for the instance.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#verify-authentication-for-a-registered-runner
-func (s *RunnersService) VerifyRegisteredRunner(opt *VerifyRegisteredRunnerOptions, options ...OptionFunc) (*Response, error) {
- req, err := s.client.NewRequest("POST", "runners/verify", opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/search.go b/vendor/github.com/xanzy/go-gitlab/search.go
deleted file mode 100644
index 99c2f020..00000000
--- a/vendor/github.com/xanzy/go-gitlab/search.go
+++ /dev/null
@@ -1,326 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// SearchService handles communication with the search related methods of the
-// GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html
-type SearchService struct {
- client *Client
-}
-
-// SearchOptions represents the available options for all search methods.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html
-type SearchOptions ListOptions
-
-type searchOptions struct {
- SearchOptions
- Scope string `url:"scope" json:"scope"`
- Search string `url:"search" json:"search"`
-}
-
-// Projects searches the expression within projects
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-projects
-func (s *SearchService) Projects(query string, opt *SearchOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- var ps []*Project
- resp, err := s.search("projects", query, &ps, opt, options...)
- return ps, resp, err
-}
-
-// ProjectsByGroup searches the expression within projects for
-// the specified group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#group-search-api
-func (s *SearchService) ProjectsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- var ps []*Project
- resp, err := s.searchByGroup(gid, "projects", query, &ps, opt, options...)
- return ps, resp, err
-}
-
-// Issues searches the expression within issues
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues
-func (s *SearchService) Issues(query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- var is []*Issue
- resp, err := s.search("issues", query, &is, opt, options...)
- return is, resp, err
-}
-
-// IssuesByGroup searches the expression within issues for
-// the specified group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues
-func (s *SearchService) IssuesByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- var is []*Issue
- resp, err := s.searchByGroup(gid, "issues", query, &is, opt, options...)
- return is, resp, err
-}
-
-// IssuesByProject searches the expression within issues for
-// the specified project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues
-func (s *SearchService) IssuesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- var is []*Issue
- resp, err := s.searchByProject(pid, "issues", query, &is, opt, options...)
- return is, resp, err
-}
-
-// MergeRequests searches the expression within merge requests
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-merge_requests
-func (s *SearchService) MergeRequests(query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- var ms []*MergeRequest
- resp, err := s.search("merge_requests", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// MergeRequestsByGroup searches the expression within merge requests for
-// the specified group
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-merge_requests
-func (s *SearchService) MergeRequestsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- var ms []*MergeRequest
- resp, err := s.searchByGroup(gid, "merge_requests", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// MergeRequestsByProject searches the expression within merge requests for
-// the specified project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-merge_requests
-func (s *SearchService) MergeRequestsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- var ms []*MergeRequest
- resp, err := s.searchByProject(pid, "merge_requests", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// Milestones searches the expression within milestones
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones
-func (s *SearchService) Milestones(query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
- var ms []*Milestone
- resp, err := s.search("milestones", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// MilestonesByGroup searches the expression within milestones for
-// the specified group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones
-func (s *SearchService) MilestonesByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
- var ms []*Milestone
- resp, err := s.searchByGroup(gid, "milestones", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// MilestonesByProject searches the expression within milestones for
-// the specified project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones
-func (s *SearchService) MilestonesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
- var ms []*Milestone
- resp, err := s.searchByProject(pid, "milestones", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// SnippetTitles searches the expression within snippet titles
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-snippet_titles
-func (s *SearchService) SnippetTitles(query string, opt *SearchOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- var ss []*Snippet
- resp, err := s.search("snippet_titles", query, &ss, opt, options...)
- return ss, resp, err
-}
-
-// SnippetBlobs searches the expression within snippet blobs
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-snippet_blobs
-func (s *SearchService) SnippetBlobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- var ss []*Snippet
- resp, err := s.search("snippet_blobs", query, &ss, opt, options...)
- return ss, resp, err
-}
-
-// NotesByProject searches the expression within notes for the specified
-// project
-//
-// GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-notes
-func (s *SearchService) NotesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- var ns []*Note
- resp, err := s.searchByProject(pid, "notes", query, &ns, opt, options...)
- return ns, resp, err
-}
-
-// WikiBlobs searches the expression within all wiki blobs
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs
-func (s *SearchService) WikiBlobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) {
- var ws []*Wiki
- resp, err := s.search("wiki_blobs", query, &ws, opt, options...)
- return ws, resp, err
-}
-
-// WikiBlobsByGroup searches the expression within wiki blobs for
-// specified group
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs
-func (s *SearchService) WikiBlobsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) {
- var ws []*Wiki
- resp, err := s.searchByGroup(gid, "wiki_blobs", query, &ws, opt, options...)
- return ws, resp, err
-}
-
-// WikiBlobsByProject searches the expression within wiki blobs for
-// the specified project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs
-func (s *SearchService) WikiBlobsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) {
- var ws []*Wiki
- resp, err := s.searchByProject(pid, "wiki_blobs", query, &ws, opt, options...)
- return ws, resp, err
-}
-
-// Commits searches the expression within all commits
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits
-func (s *SearchService) Commits(query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- var cs []*Commit
- resp, err := s.search("commits", query, &cs, opt, options...)
- return cs, resp, err
-}
-
-// CommitsByGroup searches the expression within commits for the specified
-// group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits
-func (s *SearchService) CommitsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- var cs []*Commit
- resp, err := s.searchByGroup(gid, "commits", query, &cs, opt, options...)
- return cs, resp, err
-}
-
-// CommitsByProject searches the expression within commits for the
-// specified project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits
-func (s *SearchService) CommitsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- var cs []*Commit
- resp, err := s.searchByProject(pid, "commits", query, &cs, opt, options...)
- return cs, resp, err
-}
-
-// Blob represents a single blob.
-type Blob struct {
- Basename string `json:"basename"`
- Data string `json:"data"`
- Filename string `json:"filename"`
- ID int `json:"id"`
- Ref string `json:"ref"`
- Startline int `json:"startline"`
- ProjectID int `json:"project_id"`
-}
-
-// Blobs searches the expression within all blobs
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs
-func (s *SearchService) Blobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) {
- var bs []*Blob
- resp, err := s.search("blobs", query, &bs, opt, options...)
- return bs, resp, err
-}
-
-// BlobsByGroup searches the expression within blobs for the specified
-// group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs
-func (s *SearchService) BlobsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) {
- var bs []*Blob
- resp, err := s.searchByGroup(gid, "blobs", query, &bs, opt, options...)
- return bs, resp, err
-}
-
-// BlobsByProject searches the expression within blobs for the specified
-// project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs
-func (s *SearchService) BlobsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) {
- var bs []*Blob
- resp, err := s.searchByProject(pid, "blobs", query, &bs, opt, options...)
- return bs, resp, err
-}
-
-func (s *SearchService) search(scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) {
- opts := &searchOptions{SearchOptions: *opt, Scope: scope, Search: query}
-
- req, err := s.client.NewRequest("GET", "search", opts, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, result)
-}
-
-func (s *SearchService) searchByGroup(gid interface{}, scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/-/search", url.QueryEscape(group))
-
- opts := &searchOptions{SearchOptions: *opt, Scope: scope, Search: query}
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, result)
-}
-
-func (s *SearchService) searchByProject(pid interface{}, scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/-/search", url.QueryEscape(project))
-
- opts := &searchOptions{SearchOptions: *opt, Scope: scope, Search: query}
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, result)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/services.go b/vendor/github.com/xanzy/go-gitlab/services.go
deleted file mode 100644
index 890e5a3f..00000000
--- a/vendor/github.com/xanzy/go-gitlab/services.go
+++ /dev/null
@@ -1,649 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// ServicesService handles communication with the services related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/services.html
-type ServicesService struct {
- client *Client
-}
-
-// Service represents a GitLab service.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/services.html
-type Service struct {
- ID int `json:"id"`
- Title string `json:"title"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- Active bool `json:"active"`
- PushEvents bool `json:"push_events"`
- IssuesEvents bool `json:"issues_events"`
- ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
- MergeRequestsEvents bool `json:"merge_requests_events"`
- TagPushEvents bool `json:"tag_push_events"`
- NoteEvents bool `json:"note_events"`
- ConfidentialNoteEvents bool `json:"confidential_note_events"`
- PipelineEvents bool `json:"pipeline_events"`
- JobEvents bool `json:"job_events"`
- WikiPageEvents bool `json:"wiki_page_events"`
-}
-
-// SetGitLabCIServiceOptions represents the available SetGitLabCIService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-gitlab-ci-service
-type SetGitLabCIServiceOptions struct {
- Token *string `url:"token,omitempty" json:"token,omitempty"`
- ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"`
-}
-
-// SetGitLabCIService sets GitLab CI service for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-gitlab-ci-service
-func (s *ServicesService) SetGitLabCIService(pid interface{}, opt *SetGitLabCIServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/gitlab-ci", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteGitLabCIService deletes GitLab CI service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-gitlab-ci-service
-func (s *ServicesService) DeleteGitLabCIService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/gitlab-ci", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SetHipChatServiceOptions represents the available SetHipChatService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-hipchat-service
-type SetHipChatServiceOptions struct {
- Token *string `url:"token,omitempty" json:"token,omitempty" `
- Room *string `url:"room,omitempty" json:"room,omitempty"`
-}
-
-// SetHipChatService sets HipChat service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-hipchat-service
-func (s *ServicesService) SetHipChatService(pid interface{}, opt *SetHipChatServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/hipchat", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteHipChatService deletes HipChat service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-hipchat-service
-func (s *ServicesService) DeleteHipChatService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/hipchat", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DroneCIService represents Drone CI service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#drone-ci
-type DroneCIService struct {
- Service
- Properties *DroneCIServiceProperties `json:"properties"`
-}
-
-// DroneCIServiceProperties represents Drone CI specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#drone-ci
-type DroneCIServiceProperties struct {
- Token string `json:"token"`
- DroneURL string `json:"drone_url"`
- EnableSSLVerification bool `json:"enable_ssl_verification"`
-}
-
-// GetDroneCIService gets Drone CI service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-drone-ci-service-settings
-func (s *ServicesService) GetDroneCIService(pid interface{}, options ...OptionFunc) (*DroneCIService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/drone-ci", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(DroneCIService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetDroneCIServiceOptions represents the available SetDroneCIService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service
-type SetDroneCIServiceOptions struct {
- Token *string `url:"token" json:"token" `
- DroneURL *string `url:"drone_url" json:"drone_url"`
- EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
-}
-
-// SetDroneCIService sets Drone CI service for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service
-func (s *ServicesService) SetDroneCIService(pid interface{}, opt *SetDroneCIServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/drone-ci", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteDroneCIService deletes Drone CI service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-drone-ci-service
-func (s *ServicesService) DeleteDroneCIService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/drone-ci", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SlackService represents Slack service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#slack
-type SlackService struct {
- Service
- Properties *SlackServiceProperties `json:"properties"`
-}
-
-// SlackServiceProperties represents Slack specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#slack
-type SlackServiceProperties struct {
- // Note: NotifyOnlyBrokenPipelines and NotifyOnlyDefaultBranch are not
- // just "bool" because in some cases gitlab returns
- // "notify_only_broken_pipelines": true, and in other cases
- // "notify_only_broken_pipelines": "1". The same is for
- // "notify_only_default_branch" field.
- // We need to handle this, until the bug will be fixed.
- // Ref: https://gitlab.com/gitlab-org/gitlab-ce/issues/50122
-
- NotifyOnlyBrokenPipelines BoolValue `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
- NotifyOnlyDefaultBranch BoolValue `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"`
- WebHook string `url:"webhook,omitempty" json:"webhook,omitempty"`
- Username string `url:"username,omitempty" json:"username,omitempty"`
- Channel string `url:"channel,omitempty" json:"channel,omitempty"`
- PushChannel string `url:"push_channel,omitempty" json:"push_channel,omitempty"`
- IssueChannel string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"`
- ConfidentialIssueChannel string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"`
- MergeRequestChannel string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"`
- NoteChannel string `url:"note_channel,omitempty" json:"note_channel,omitempty"`
- ConfidentialNoteChannel string `url:"confidential_note_channel,omitempty" json:"confidential_note_channel,omitempty"`
- TagPushChannel string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"`
- PipelineChannel string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"`
- WikiPageChannel string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"`
-}
-
-// GetSlackService gets Slack service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings
-func (s *ServicesService) GetSlackService(pid interface{}, options ...OptionFunc) (*SlackService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/slack", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(SlackService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetSlackServiceOptions represents the available SetSlackService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-slack-service
-type SetSlackServiceOptions struct {
- WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- Channel *string `url:"channel,omitempty" json:"channel,omitempty"`
- NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
- NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"`
- PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
- PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"`
- IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
- IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"`
- ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
- ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"`
- MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
- MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"`
- TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
- TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"`
- NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
- NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"`
- ConfidentialNoteEvents *bool `url:"confidential_note_events" json:"confidential_note_events"`
- // TODO: Currently, GitLab ignores this option (not implemented yet?), so
- // there is no way to set it. Uncomment when this is fixed.
- // See: https://gitlab.com/gitlab-org/gitlab-ce/issues/49730
- //ConfidentialNoteChannel *string `json:"confidential_note_channel,omitempty"`
- PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
- PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"`
- WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"`
- WikiPageEvents *bool `url:"wiki_page_events" json:"wiki_page_events"`
-}
-
-// SetSlackService sets Slack service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-slack-service
-func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/slack", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteSlackService deletes Slack service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-slack-service
-func (s *ServicesService) DeleteSlackService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/slack", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// JiraService represents Jira service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#jira
-type JiraService struct {
- Service
- Properties *JiraServiceProperties `json:"properties"`
-}
-
-// JiraServiceProperties represents Jira specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#jira
-type JiraServiceProperties struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
- ProjectKey *string `url:"project_key,omitempty" json:"project_key,omitempty" `
- Username *string `url:"username,omitempty" json:"username,omitempty" `
- Password *string `url:"password,omitempty" json:"password,omitempty" `
- JiraIssueTransitionID *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"`
-}
-
-// GetJiraService gets Jira service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-jira-service-settings
-func (s *ServicesService) GetJiraService(pid interface{}, options ...OptionFunc) (*JiraService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jira", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(JiraService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetJiraServiceOptions represents the available SetJiraService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-jira-service
-type SetJiraServiceOptions JiraServiceProperties
-
-// SetJiraService sets Jira service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-jira-service
-func (s *ServicesService) SetJiraService(pid interface{}, opt *SetJiraServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jira", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteJiraService deletes Jira service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-jira-service
-func (s *ServicesService) DeleteJiraService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jira", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// JenkinsCIService represents Jenkins CI service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
-type JenkinsCIService struct {
- Service
- Properties *JenkinsCIServiceProperties `json:"properties"`
-}
-
-// JenkinsCIServiceProperties represents Jenkins CI specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
-type JenkinsCIServiceProperties struct {
- URL *string `url:"jenkins_url,omitempty" json:"jenkins_url,omitempty"`
- ProjectName *string `url:"project_name,omitempty" json:"project_name,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
-}
-
-// GetJenkinsCIService gets Jenkins CI service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#get-jenkins-ci-service-settings
-func (s *ServicesService) GetJenkinsCIService(pid interface{}, options ...OptionFunc) (*JenkinsCIService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jenkins", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(JenkinsCIService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetJenkinsCIServiceOptions represents the available SetJenkinsCIService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
-type SetJenkinsCIServiceOptions struct {
- URL *string `url:"jenkins_url,omitempty" json:"jenkins_url,omitempty"`
- ProjectName *string `url:"project_name,omitempty" json:"project_name,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- Password *string `url:"password,omitempty" json:"password,omitempty"`
-}
-
-// SetJenkinsCIService sets Jenkins service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#create-edit-jenkins-ci-service
-func (s *ServicesService) SetJenkinsCIService(pid interface{}, opt *SetJenkinsCIServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jenkins", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteJenkinsCIService deletes Jenkins CI service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-jira-service
-func (s *ServicesService) DeleteJenkinsCIService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jenkins", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// MicrosoftTeamsService represents Microsoft Teams service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#microsoft-teams
-type MicrosoftTeamsService struct {
- Service
- Properties *MicrosoftTeamsServiceProperties `json:"properties"`
-}
-
-// MicrosoftTeamsServiceProperties represents Microsoft Teams specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#microsoft-teams
-type MicrosoftTeamsServiceProperties struct {
- WebHook string `json:"webhook"`
-}
-
-// GetMicrosoftTeamsService gets MicrosoftTeams service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-microsoft-teams-service-settings
-func (s *ServicesService) GetMicrosoftTeamsService(pid interface{}, options ...OptionFunc) (*MicrosoftTeamsService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/microsoft-teams", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(MicrosoftTeamsService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetMicrosoftTeamsServiceOptions represents the available SetMicrosoftTeamsService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service
-type SetMicrosoftTeamsServiceOptions struct {
- WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"`
-}
-
-// SetMicrosoftTeamsService sets Microsoft Teams service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service
-func (s *ServicesService) SetMicrosoftTeamsService(pid interface{}, opt *SetMicrosoftTeamsServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/microsoft-teams", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
- return s.client.Do(req, nil)
-}
-
-// DeleteMicrosoftTeamsService deletes Microsoft Teams service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-microsoft-teams-service
-func (s *ServicesService) DeleteMicrosoftTeamsService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/microsoft-teams", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/session.go b/vendor/github.com/xanzy/go-gitlab/session.go
deleted file mode 100644
index f89fdbe5..00000000
--- a/vendor/github.com/xanzy/go-gitlab/session.go
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import "time"
-
-// SessionService handles communication with the session related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/session.html
-type SessionService struct {
- client *Client
-}
-
-// Session represents a GitLab session.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/session.html#session
-type Session struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- PrivateToken string `json:"private_token"`
- Blocked bool `json:"blocked"`
- CreatedAt *time.Time `json:"created_at"`
- Bio interface{} `json:"bio"`
- Skype string `json:"skype"`
- Linkedin string `json:"linkedin"`
- Twitter string `json:"twitter"`
- WebsiteURL string `json:"website_url"`
- DarkScheme bool `json:"dark_scheme"`
- ThemeID int `json:"theme_id"`
- IsAdmin bool `json:"is_admin"`
- CanCreateGroup bool `json:"can_create_group"`
- CanCreateTeam bool `json:"can_create_team"`
- CanCreateProject bool `json:"can_create_project"`
-}
-
-// GetSessionOptions represents the available Session() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/session.html#session
-type GetSessionOptions struct {
- Login *string `url:"login,omitempty" json:"login,omitempty"`
- Email *string `url:"email,omitempty" json:"email,omitempty"`
- Password *string `url:"password,omitempty" json:"password,omitempty"`
-}
-
-// GetSession logs in to get private token.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/session.html#session
-func (s *SessionService) GetSession(opt *GetSessionOptions, options ...OptionFunc) (*Session, *Response, error) {
- req, err := s.client.NewRequest("POST", "session", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- session := new(Session)
- resp, err := s.client.Do(req, session)
- if err != nil {
- return nil, resp, err
- }
-
- return session, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/settings.go b/vendor/github.com/xanzy/go-gitlab/settings.go
deleted file mode 100644
index fde9910f..00000000
--- a/vendor/github.com/xanzy/go-gitlab/settings.go
+++ /dev/null
@@ -1,265 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import "time"
-
-// SettingsService handles communication with the application SettingsService
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/settings.html
-type SettingsService struct {
- client *Client
-}
-
-// Settings represents the GitLab application settings.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/settings.html
-type Settings struct {
- ID int `json:"id"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- AdminNotificationEmail string `json:"admin_notification_email"`
- AfterSignOutPath string `json:"after_sign_out_path"`
- AfterSignUpText string `json:"after_sign_up_text"`
- AkismetAPIKey string `json:"akismet_api_key"`
- AkismetEnabled bool `json:"akismet_enabled"`
- CircuitbreakerAccessRetries int `json:"circuitbreaker_access_retries"`
- CircuitbreakerBackoffThreshold int `json:"circuitbreaker_backoff_threshold"`
- CircuitbreakerFailureCountThreshold int `json:"circuitbreaker_failure_count_threshold"`
- CircuitbreakerFailureResetTime int `json:"circuitbreaker_failure_reset_time"`
- CircuitbreakerFailureWaitTime int `json:"circuitbreaker_failure_wait_time"`
- CircuitbreakerStorageTimeout int `json:"circuitbreaker_storage_timeout"`
- ClientsideSentryDSN string `json:"clientside_sentry_dsn"`
- ClientsideSentryEnabled bool `json:"clientside_sentry_enabled"`
- ContainerRegistryTokenExpireDelay int `json:"container_registry_token_expire_delay"`
- DefaultArtifactsExpireIn string `json:"default_artifacts_expire_in"`
- DefaultBranchProtection int `json:"default_branch_protection"`
- DefaultGroupVisibility string `json:"default_group_visibility"`
- DefaultProjectVisibility string `json:"default_project_visibility"`
- DefaultProjectsLimit int `json:"default_projects_limit"`
- DefaultSnippetVisibility string `json:"default_snippet_visibility"`
- DisabledOauthSignInSources []string `json:"disabled_oauth_sign_in_sources"`
- DomainBlacklistEnabled bool `json:"domain_blacklist_enabled"`
- DomainBlacklist []string `json:"domain_blacklist"`
- DomainWhitelist []string `json:"domain_whitelist"`
- DSAKeyRestriction int `json:"dsa_key_restriction"`
- ECDSAKeyRestriction int `json:"ecdsa_key_restriction"`
- Ed25519KeyRestriction int `json:"ed25519_key_restriction"`
- EmailAuthorInBody bool `json:"email_author_in_body"`
- EnabledGitAccessProtocol string `json:"enabled_git_access_protocol"`
- GravatarEnabled bool `json:"gravatar_enabled"`
- HelpPageHideCommercialContent bool `json:"help_page_hide_commercial_content"`
- HelpPageSupportURL string `json:"help_page_support_url"`
- HomePageURL string `json:"home_page_url"`
- HousekeepingBitmapsEnabled bool `json:"housekeeping_bitmaps_enabled"`
- HousekeepingEnabled bool `json:"housekeeping_enabled"`
- HousekeepingFullRepackPeriod int `json:"housekeeping_full_repack_period"`
- HousekeepingGcPeriod int `json:"housekeeping_gc_period"`
- HousekeepingIncrementalRepackPeriod int `json:"housekeeping_incremental_repack_period"`
- HTMLEmailsEnabled bool `json:"html_emails_enabled"`
- ImportSources []string `json:"import_sources"`
- KodingEnabled bool `json:"koding_enabled"`
- KodingURL string `json:"koding_url"`
- MaxArtifactsSize int `json:"max_artifacts_size"`
- MaxAttachmentSize int `json:"max_attachment_size"`
- MaxPagesSize int `json:"max_pages_size"`
- MetricsEnabled bool `json:"metrics_enabled"`
- MetricsHost string `json:"metrics_host"`
- MetricsMethodCallThreshold int `json:"metrics_method_call_threshold"`
- MetricsPacketSize int `json:"metrics_packet_size"`
- MetricsPoolSize int `json:"metrics_pool_size"`
- MetricsPort int `json:"metrics_port"`
- MetricsSampleInterval int `json:"metrics_sample_interval"`
- MetricsTimeout int `json:"metrics_timeout"`
- PasswordAuthenticationEnabledForWeb bool `json:"password_authentication_enabled_for_web"`
- PasswordAuthenticationEnabledForGit bool `json:"password_authentication_enabled_for_git"`
- PerformanceBarAllowedGroupID string `json:"performance_bar_allowed_group_id"`
- PerformanceBarEnabled bool `json:"performance_bar_enabled"`
- PlantumlEnabled bool `json:"plantuml_enabled"`
- PlantumlURL string `json:"plantuml_url"`
- PollingIntervalMultiplier float64 `json:"polling_interval_multiplier"`
- ProjectExportEnabled bool `json:"project_export_enabled"`
- PrometheusMetricsEnabled bool `json:"prometheus_metrics_enabled"`
- RecaptchaEnabled bool `json:"recaptcha_enabled"`
- RecaptchaPrivateKey string `json:"recaptcha_private_key"`
- RecaptchaSiteKey string `json:"recaptcha_site_key"`
- RepositoryChecksEnabled bool `json:"repository_checks_enabled"`
- RepositoryStorages []string `json:"repository_storages"`
- RequireTwoFactorAuthentication bool `json:"require_two_factor_authentication"`
- RestrictedVisibilityLevels []VisibilityValue `json:"restricted_visibility_levels"`
- RsaKeyRestriction int `json:"rsa_key_restriction"`
- SendUserConfirmationEmail bool `json:"send_user_confirmation_email"`
- SentryDSN string `json:"sentry_dsn"`
- SentryEnabled bool `json:"sentry_enabled"`
- SessionExpireDelay int `json:"session_expire_delay"`
- SharedRunnersEnabled bool `json:"shared_runners_enabled"`
- SharedRunnersText string `json:"shared_runners_text"`
- SidekiqThrottlingEnabled bool `json:"sidekiq_throttling_enabled"`
- SidekiqThrottlingFactor float64 `json:"sidekiq_throttling_factor"`
- SidekiqThrottlingQueues []string `json:"sidekiq_throttling_queues"`
- SignInText string `json:"sign_in_text"`
- SignupEnabled bool `json:"signup_enabled"`
- TerminalMaxSessionTime int `json:"terminal_max_session_time"`
- TwoFactorGracePeriod int `json:"two_factor_grace_period"`
- UniqueIPsLimitEnabled bool `json:"unique_ips_limit_enabled"`
- UniqueIPsLimitPerUser int `json:"unique_ips_limit_per_user"`
- UniqueIPsLimitTimeWindow int `json:"unique_ips_limit_time_window"`
- UsagePingEnabled bool `json:"usage_ping_enabled"`
- UserDefaultExternal bool `json:"user_default_external"`
- UserOauthApplications bool `json:"user_oauth_applications"`
- VersionCheckEnabled bool `json:"version_check_enabled"`
-}
-
-func (s Settings) String() string {
- return Stringify(s)
-}
-
-// GetSettings gets the current application settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/settings.html#get-current-application.settings
-func (s *SettingsService) GetSettings(options ...OptionFunc) (*Settings, *Response, error) {
- req, err := s.client.NewRequest("GET", "application/settings", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- as := new(Settings)
- resp, err := s.client.Do(req, as)
- if err != nil {
- return nil, resp, err
- }
-
- return as, resp, err
-}
-
-// UpdateSettingsOptions represents the available UpdateSettings() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/settings.html#change-application.settings
-type UpdateSettingsOptions struct {
- AdminNotificationEmail *string `url:"admin_notification_email,omitempty" json:"admin_notification_email,omitempty"`
- AfterSignOutPath *string `url:"after_sign_out_path,omitempty" json:"after_sign_out_path,omitempty"`
- AfterSignUpText *string `url:"after_sign_up_text,omitempty" json:"after_sign_up_text,omitempty"`
- AkismetAPIKey *string `url:"akismet_api_key,omitempty" json:"akismet_api_key,omitempty"`
- AkismetEnabled *bool `url:"akismet_enabled,omitempty" json:"akismet_enabled,omitempty"`
- CircuitbreakerAccessRetries *int `url:"circuitbreaker_access_retries,omitempty" json:"circuitbreaker_access_retries,omitempty"`
- CircuitbreakerBackoffThreshold *int `url:"circuitbreaker_backoff_threshold,omitempty" json:"circuitbreaker_backoff_threshold,omitempty"`
- CircuitbreakerFailureCountThreshold *int `url:"circuitbreaker_failure_count_threshold,omitempty" json:"circuitbreaker_failure_count_threshold,omitempty"`
- CircuitbreakerFailureResetTime *int `url:"circuitbreaker_failure_reset_time,omitempty" json:"circuitbreaker_failure_reset_time,omitempty"`
- CircuitbreakerFailureWaitTime *int `url:"circuitbreaker_failure_wait_time,omitempty" json:"circuitbreaker_failure_wait_time,omitempty"`
- CircuitbreakerStorageTimeout *int `url:"circuitbreaker_storage_timeout,omitempty" json:"circuitbreaker_storage_timeout,omitempty"`
- ClientsideSentryDSN *string `url:"clientside_sentry_dsn,omitempty" json:"clientside_sentry_dsn,omitempty"`
- ClientsideSentryEnabled *bool `url:"clientside_sentry_enabled,omitempty" json:"clientside_sentry_enabled,omitempty"`
- ContainerRegistryTokenExpireDelay *int `url:"container_registry_token_expire_delay,omitempty" json:"container_registry_token_expire_delay,omitempty"`
- DefaultArtifactsExpireIn *string `url:"default_artifacts_expire_in,omitempty" json:"default_artifacts_expire_in,omitempty"`
- DefaultBranchProtection *int `url:"default_branch_protection,omitempty" json:"default_branch_protection,omitempty"`
- DefaultGroupVisibility *string `url:"default_group_visibility,omitempty" json:"default_group_visibility,omitempty"`
- DefaultProjectVisibility *string `url:"default_project_visibility,omitempty" json:"default_project_visibility,omitempty"`
- DefaultProjectsLimit *int `url:"default_projects_limit,omitempty" json:"default_projects_limit,omitempty"`
- DefaultSnippetVisibility *string `url:"default_snippet_visibility,omitempty" json:"default_snippet_visibility,omitempty"`
- DisabledOauthSignInSources []string `url:"disabled_oauth_sign_in_sources,omitempty" json:"disabled_oauth_sign_in_sources,omitempty"`
- DomainBlacklistEnabled *bool `url:"domain_blacklist_enabled,omitempty" json:"domain_blacklist_enabled,omitempty"`
- DomainBlacklist []string `url:"domain_blacklist,omitempty" json:"domain_blacklist,omitempty"`
- DomainWhitelist []string `url:"domain_whitelist,omitempty" json:"domain_whitelist,omitempty"`
- DSAKeyRestriction *int `url:"dsa_key_restriction,omitempty" json:"dsa_key_restriction,omitempty"`
- ECDSAKeyRestriction *int `url:"ecdsa_key_restriction,omitempty" json:"ecdsa_key_restriction,omitempty"`
- Ed25519KeyRestriction *int `url:"ed25519_key_restriction,omitempty" json:"ed25519_key_restriction,omitempty"`
- EmailAuthorInBody *bool `url:"email_author_in_body,omitempty" json:"email_author_in_body,omitempty"`
- EnabledGitAccessProtocol *string `url:"enabled_git_access_protocol,omitempty" json:"enabled_git_access_protocol,omitempty"`
- GravatarEnabled *bool `url:"gravatar_enabled,omitempty" json:"gravatar_enabled,omitempty"`
- HelpPageHideCommercialContent *bool `url:"help_page_hide_commercial_content,omitempty" json:"help_page_hide_commercial_content,omitempty"`
- HelpPageSupportURL *string `url:"help_page_support_url,omitempty" json:"help_page_support_url,omitempty"`
- HomePageURL *string `url:"home_page_url,omitempty" json:"home_page_url,omitempty"`
- HousekeepingBitmapsEnabled *bool `url:"housekeeping_bitmaps_enabled,omitempty" json:"housekeeping_bitmaps_enabled,omitempty"`
- HousekeepingEnabled *bool `url:"housekeeping_enabled,omitempty" json:"housekeeping_enabled,omitempty"`
- HousekeepingFullRepackPeriod *int `url:"housekeeping_full_repack_period,omitempty" json:"housekeeping_full_repack_period,omitempty"`
- HousekeepingGcPeriod *int `url:"housekeeping_gc_period,omitempty" json:"housekeeping_gc_period,omitempty"`
- HousekeepingIncrementalRepackPeriod *int `url:"housekeeping_incremental_repack_period,omitempty" json:"housekeeping_incremental_repack_period,omitempty"`
- HTMLEmailsEnabled *bool `url:"html_emails_enabled,omitempty" json:"html_emails_enabled,omitempty"`
- ImportSources []string `url:"import_sources,omitempty" json:"import_sources,omitempty"`
- KodingEnabled *bool `url:"koding_enabled,omitempty" json:"koding_enabled,omitempty"`
- KodingURL *string `url:"koding_url,omitempty" json:"koding_url,omitempty"`
- MaxArtifactsSize *int `url:"max_artifacts_size,omitempty" json:"max_artifacts_size,omitempty"`
- MaxAttachmentSize *int `url:"max_attachment_size,omitempty" json:"max_attachment_size,omitempty"`
- MaxPagesSize *int `url:"max_pages_size,omitempty" json:"max_pages_size,omitempty"`
- MetricsEnabled *bool `url:"metrics_enabled,omitempty" json:"metrics_enabled,omitempty"`
- MetricsHost *string `url:"metrics_host,omitempty" json:"metrics_host,omitempty"`
- MetricsMethodCallThreshold *int `url:"metrics_method_call_threshold,omitempty" json:"metrics_method_call_threshold,omitempty"`
- MetricsPacketSize *int `url:"metrics_packet_size,omitempty" json:"metrics_packet_size,omitempty"`
- MetricsPoolSize *int `url:"metrics_pool_size,omitempty" json:"metrics_pool_size,omitempty"`
- MetricsPort *int `url:"metrics_port,omitempty" json:"metrics_port,omitempty"`
- MetricsSampleInterval *int `url:"metrics_sample_interval,omitempty" json:"metrics_sample_interval,omitempty"`
- MetricsTimeout *int `url:"metrics_timeout,omitempty" json:"metrics_timeout,omitempty"`
- PasswordAuthenticationEnabledForWeb *bool `url:"password_authentication_enabled_for_web,omitempty" json:"password_authentication_enabled_for_web,omitempty"`
- PasswordAuthenticationEnabledForGit *bool `url:"password_authentication_enabled_for_git,omitempty" json:"password_authentication_enabled_for_git,omitempty"`
- PerformanceBarAllowedGroupID *string `url:"performance_bar_allowed_group_id,omitempty" json:"performance_bar_allowed_group_id,omitempty"`
- PerformanceBarEnabled *bool `url:"performance_bar_enabled,omitempty" json:"performance_bar_enabled,omitempty"`
- PlantumlEnabled *bool `url:"plantuml_enabled,omitempty" json:"plantuml_enabled,omitempty"`
- PlantumlURL *string `url:"plantuml_url,omitempty" json:"plantuml_url,omitempty"`
- PollingIntervalMultiplier *float64 `url:"polling_interval_multiplier,omitempty" json:"polling_interval_multiplier,omitempty"`
- ProjectExportEnabled *bool `url:"project_export_enabled,omitempty" json:"project_export_enabled,omitempty"`
- PrometheusMetricsEnabled *bool `url:"prometheus_metrics_enabled,omitempty" json:"prometheus_metrics_enabled,omitempty"`
- RecaptchaEnabled *bool `url:"recaptcha_enabled,omitempty" json:"recaptcha_enabled,omitempty"`
- RecaptchaPrivateKey *string `url:"recaptcha_private_key,omitempty" json:"recaptcha_private_key,omitempty"`
- RecaptchaSiteKey *string `url:"recaptcha_site_key,omitempty" json:"recaptcha_site_key,omitempty"`
- RepositoryChecksEnabled *bool `url:"repository_checks_enabled,omitempty" json:"repository_checks_enabled,omitempty"`
- RepositoryStorages []string `url:"repository_storages,omitempty" json:"repository_storages,omitempty"`
- RequireTwoFactorAuthentication *bool `url:"require_two_factor_authentication,omitempty" json:"require_two_factor_authentication,omitempty"`
- RestrictedVisibilityLevels []VisibilityValue `url:"restricted_visibility_levels,omitempty" json:"restricted_visibility_levels,omitempty"`
- RsaKeyRestriction *int `url:"rsa_key_restriction,omitempty" json:"rsa_key_restriction,omitempty"`
- SendUserConfirmationEmail *bool `url:"send_user_confirmation_email,omitempty" json:"send_user_confirmation_email,omitempty"`
- SentryDSN *string `url:"sentry_dsn,omitempty" json:"sentry_dsn,omitempty"`
- SentryEnabled *bool `url:"sentry_enabled,omitempty" json:"sentry_enabled,omitempty"`
- SessionExpireDelay *int `url:"session_expire_delay,omitempty" json:"session_expire_delay,omitempty"`
- SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
- SharedRunnersText *string `url:"shared_runners_text,omitempty" json:"shared_runners_text,omitempty"`
- SidekiqThrottlingEnabled *bool `url:"sidekiq_throttling_enabled,omitempty" json:"sidekiq_throttling_enabled,omitempty"`
- SidekiqThrottlingFactor *float64 `url:"sidekiq_throttling_factor,omitempty" json:"sidekiq_throttling_factor,omitempty"`
- SidekiqThrottlingQueues []string `url:"sidekiq_throttling_queues,omitempty" json:"sidekiq_throttling_queues,omitempty"`
- SignInText *string `url:"sign_in_text,omitempty" json:"sign_in_text,omitempty"`
- SignupEnabled *bool `url:"signup_enabled,omitempty" json:"signup_enabled,omitempty"`
- TerminalMaxSessionTime *int `url:"terminal_max_session_time,omitempty" json:"terminal_max_session_time,omitempty"`
- TwoFactorGracePeriod *int `url:"two_factor_grace_period,omitempty" json:"two_factor_grace_period,omitempty"`
- UniqueIPsLimitEnabled *bool `url:"unique_ips_limit_enabled,omitempty" json:"unique_ips_limit_enabled,omitempty"`
- UniqueIPsLimitPerUser *int `url:"unique_ips_limit_per_user,omitempty" json:"unique_ips_limit_per_user,omitempty"`
- UniqueIPsLimitTimeWindow *int `url:"unique_ips_limit_time_window,omitempty" json:"unique_ips_limit_time_window,omitempty"`
- UsagePingEnabled *bool `url:"usage_ping_enabled,omitempty" json:"usage_ping_enabled,omitempty"`
- UserDefaultExternal *bool `url:"user_default_external,omitempty" json:"user_default_external,omitempty"`
- UserOauthApplications *bool `url:"user_oauth_applications,omitempty" json:"user_oauth_applications,omitempty"`
- VersionCheckEnabled *bool `url:"version_check_enabled,omitempty" json:"version_check_enabled,omitempty"`
-}
-
-// UpdateSettings updates the application settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/settings.html#change-application.settings
-func (s *SettingsService) UpdateSettings(opt *UpdateSettingsOptions, options ...OptionFunc) (*Settings, *Response, error) {
- req, err := s.client.NewRequest("PUT", "application/settings", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- as := new(Settings)
- resp, err := s.client.Do(req, as)
- if err != nil {
- return nil, resp, err
- }
-
- return as, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go b/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go
deleted file mode 100644
index 83e77024..00000000
--- a/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go
+++ /dev/null
@@ -1,154 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import "time"
-
-// SidekiqService handles communication with the sidekiq service
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/sidekiq_metrics.html
-type SidekiqService struct {
- client *Client
-}
-
-// QueueMetrics represents the GitLab sidekiq queue metrics.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-queue-metrics
-type QueueMetrics struct {
- Queues map[string]struct {
- Backlog int `json:"backlog"`
- Latency int `json:"latency"`
- } `json:"queues"`
-}
-
-// GetQueueMetrics lists information about all the registered queues,
-// their backlog and their latency.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-queue-metrics
-func (s *SidekiqService) GetQueueMetrics(options ...OptionFunc) (*QueueMetrics, *Response, error) {
- req, err := s.client.NewRequest("GET", "/sidekiq/queue_metrics", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- q := new(QueueMetrics)
- resp, err := s.client.Do(req, q)
- if err != nil {
- return nil, resp, err
- }
-
- return q, resp, err
-}
-
-// ProcessMetrics represents the GitLab sidekiq process metrics.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-process-metrics
-type ProcessMetrics struct {
- Processes []struct {
- Hostname string `json:"hostname"`
- Pid int `json:"pid"`
- Tag string `json:"tag"`
- StartedAt *time.Time `json:"started_at"`
- Queues []string `json:"queues"`
- Labels []string `json:"labels"`
- Concurrency int `json:"concurrency"`
- Busy int `json:"busy"`
- } `json:"processes"`
-}
-
-// GetProcessMetrics lists information about all the Sidekiq workers registered
-// to process your queues.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-process-metrics
-func (s *SidekiqService) GetProcessMetrics(options ...OptionFunc) (*ProcessMetrics, *Response, error) {
- req, err := s.client.NewRequest("GET", "/sidekiq/process_metrics", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(ProcessMetrics)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// JobStats represents the GitLab sidekiq job stats.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-job-statistics
-type JobStats struct {
- Jobs struct {
- Processed int `json:"processed"`
- Failed int `json:"failed"`
- Enqueued int `json:"enqueued"`
- } `json:"jobs"`
-}
-
-// GetJobStats list information about the jobs that Sidekiq has performed.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-job-statistics
-func (s *SidekiqService) GetJobStats(options ...OptionFunc) (*JobStats, *Response, error) {
- req, err := s.client.NewRequest("GET", "/sidekiq/job_stats", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- j := new(JobStats)
- resp, err := s.client.Do(req, j)
- if err != nil {
- return nil, resp, err
- }
-
- return j, resp, err
-}
-
-// CompoundMetrics represents the GitLab sidekiq compounded stats.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-a-compound-response-of-all-the-previously-mentioned-metrics
-type CompoundMetrics struct {
- QueueMetrics
- ProcessMetrics
- JobStats
-}
-
-// GetCompoundMetrics lists all the currently available information about Sidekiq.
-// Get a compound response of all the previously mentioned metrics
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-job-statistics
-func (s *SidekiqService) GetCompoundMetrics(options ...OptionFunc) (*CompoundMetrics, *Response, error) {
- req, err := s.client.NewRequest("GET", "/sidekiq/compound_metrics", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(CompoundMetrics)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/snippets.go b/vendor/github.com/xanzy/go-gitlab/snippets.go
deleted file mode 100644
index be232c8c..00000000
--- a/vendor/github.com/xanzy/go-gitlab/snippets.go
+++ /dev/null
@@ -1,230 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "time"
-)
-
-// SnippetsService handles communication with the snippets
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html
-type SnippetsService struct {
- client *Client
-}
-
-// Snippet represents a GitLab snippet.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html
-type Snippet struct {
- ID int `json:"id"`
- Title string `json:"title"`
- FileName string `json:"file_name"`
- Description string `json:"description"`
- Author struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- } `json:"author"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- WebURL string `json:"web_url"`
- RawURL string `json:"raw_url"`
-}
-
-func (s Snippet) String() string {
- return Stringify(s)
-}
-
-// ListSnippetsOptions represents the available ListSnippets() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html#list-snippets
-type ListSnippetsOptions ListOptions
-
-// ListSnippets gets a list of snippets.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html#list-snippets
-func (s *SnippetsService) ListSnippets(opt *ListSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- req, err := s.client.NewRequest("GET", "snippets", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ps []*Snippet
- resp, err := s.client.Do(req, &ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// GetSnippet gets a single snippet
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#single-snippet
-func (s *SnippetsService) GetSnippet(snippet int, options ...OptionFunc) (*Snippet, *Response, error) {
- u := fmt.Sprintf("snippets/%d", snippet)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// CreateSnippetOptions represents the available CreateSnippet() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#create-new-snippet
-type CreateSnippetOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Content *string `url:"content,omitempty" json:"content,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
-}
-
-// CreateSnippet creates a new snippet. The user must have permission
-// to create new snippets.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#create-new-snippet
-func (s *SnippetsService) CreateSnippet(opt *CreateSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) {
- req, err := s.client.NewRequest("POST", "snippets", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// UpdateSnippetOptions represents the available UpdateSnippet() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#update-snippet
-type UpdateSnippetOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Content *string `url:"content,omitempty" json:"content,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
-}
-
-// UpdateSnippet updates an existing snippet. The user must have
-// permission to change an existing snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#update-snippet
-func (s *SnippetsService) UpdateSnippet(snippet int, opt *UpdateSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) {
- u := fmt.Sprintf("snippets/%d", snippet)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// DeleteSnippet deletes an existing snippet. This is an idempotent
-// function and deleting a non-existent snippet still returns a 200 OK status
-// code.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#delete-snippet
-func (s *SnippetsService) DeleteSnippet(snippet int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("snippets/%d", snippet)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SnippetContent returns the raw snippet as plain text.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#snippet-content
-func (s *SnippetsService) SnippetContent(snippet int, options ...OptionFunc) ([]byte, *Response, error) {
- u := fmt.Sprintf("snippets/%d/raw", snippet)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// ExploreSnippetsOptions represents the available ExploreSnippets() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#explore-all-public-snippets
-type ExploreSnippetsOptions ListOptions
-
-// ExploreSnippets gets the list of public snippets.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#explore-all-public-snippets
-func (s *SnippetsService) ExploreSnippets(opt *ExploreSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- req, err := s.client.NewRequest("GET", "snippets/public", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ps []*Snippet
- resp, err := s.client.Do(req, &ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/strings.go b/vendor/github.com/xanzy/go-gitlab/strings.go
deleted file mode 100644
index aeefb6b8..00000000
--- a/vendor/github.com/xanzy/go-gitlab/strings.go
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
-
- "reflect"
-)
-
-// Stringify attempts to create a reasonable string representation of types in
-// the GitHub library. It does things like resolve pointers to their values
-// and omits struct fields with nil values.
-func Stringify(message interface{}) string {
- var buf bytes.Buffer
- v := reflect.ValueOf(message)
- stringifyValue(&buf, v)
- return buf.String()
-}
-
-// stringifyValue was heavily inspired by the goprotobuf library.
-func stringifyValue(buf *bytes.Buffer, val reflect.Value) {
- if val.Kind() == reflect.Ptr && val.IsNil() {
- buf.WriteString("")
- return
- }
-
- v := reflect.Indirect(val)
-
- switch v.Kind() {
- case reflect.String:
- fmt.Fprintf(buf, `"%s"`, v)
- case reflect.Slice:
- buf.WriteByte('[')
- for i := 0; i < v.Len(); i++ {
- if i > 0 {
- buf.WriteByte(' ')
- }
-
- stringifyValue(buf, v.Index(i))
- }
-
- buf.WriteByte(']')
- return
- case reflect.Struct:
- if v.Type().Name() != "" {
- buf.WriteString(v.Type().String())
- }
-
- buf.WriteByte('{')
-
- var sep bool
- for i := 0; i < v.NumField(); i++ {
- fv := v.Field(i)
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- continue
- }
- if fv.Kind() == reflect.Slice && fv.IsNil() {
- continue
- }
-
- if sep {
- buf.WriteString(", ")
- } else {
- sep = true
- }
-
- buf.WriteString(v.Type().Field(i).Name)
- buf.WriteByte(':')
- stringifyValue(buf, fv)
- }
-
- buf.WriteByte('}')
- default:
- if v.CanInterface() {
- fmt.Fprint(buf, v.Interface())
- }
- }
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/system_hooks.go b/vendor/github.com/xanzy/go-gitlab/system_hooks.go
deleted file mode 100644
index d5209d4f..00000000
--- a/vendor/github.com/xanzy/go-gitlab/system_hooks.go
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// SystemHooksService handles communication with the system hooks related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/system_hooks.html
-type SystemHooksService struct {
- client *Client
-}
-
-// Hook represents a GitLap system hook.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/system_hooks.html
-type Hook struct {
- ID int `json:"id"`
- URL string `json:"url"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (h Hook) String() string {
- return Stringify(h)
-}
-
-// ListHooks gets a list of system hooks.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#list-system-hooks
-func (s *SystemHooksService) ListHooks(options ...OptionFunc) ([]*Hook, *Response, error) {
- req, err := s.client.NewRequest("GET", "hooks", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var h []*Hook
- resp, err := s.client.Do(req, &h)
- if err != nil {
- return nil, resp, err
- }
-
- return h, resp, err
-}
-
-// AddHookOptions represents the available AddHook() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook
-type AddHookOptions struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
-}
-
-// AddHook adds a new system hook hook.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook
-func (s *SystemHooksService) AddHook(opt *AddHookOptions, options ...OptionFunc) (*Hook, *Response, error) {
- req, err := s.client.NewRequest("POST", "hooks", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- h := new(Hook)
- resp, err := s.client.Do(req, h)
- if err != nil {
- return nil, resp, err
- }
-
- return h, resp, err
-}
-
-// HookEvent represents an event trigger by a GitLab system hook.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/system_hooks.html
-type HookEvent struct {
- EventName string `json:"event_name"`
- Name string `json:"name"`
- Path string `json:"path"`
- ProjectID int `json:"project_id"`
- OwnerName string `json:"owner_name"`
- OwnerEmail string `json:"owner_email"`
-}
-
-func (h HookEvent) String() string {
- return Stringify(h)
-}
-
-// TestHook tests a system hook.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#test-system-hook
-func (s *SystemHooksService) TestHook(hook int, options ...OptionFunc) (*HookEvent, *Response, error) {
- u := fmt.Sprintf("hooks/%d", hook)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- h := new(HookEvent)
- resp, err := s.client.Do(req, h)
- if err != nil {
- return nil, resp, err
- }
-
- return h, resp, err
-}
-
-// DeleteHook deletes a system hook. This is an idempotent API function and
-// returns 200 OK even if the hook is not available. If the hook is deleted it
-// is also returned as JSON.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#delete-system-hook
-func (s *SystemHooksService) DeleteHook(hook int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("hooks/%d", hook)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/tags.go b/vendor/github.com/xanzy/go-gitlab/tags.go
deleted file mode 100644
index 4e8a7139..00000000
--- a/vendor/github.com/xanzy/go-gitlab/tags.go
+++ /dev/null
@@ -1,236 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// TagsService handles communication with the tags related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/tags.html
-type TagsService struct {
- client *Client
-}
-
-// Tag represents a GitLab tag.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/tags.html
-type Tag struct {
- Commit *Commit `json:"commit"`
- Release *Release `json:"release"`
- Name string `json:"name"`
- Message string `json:"message"`
-}
-
-// Release represents a GitLab version release.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/tags.html
-type Release struct {
- TagName string `json:"tag_name"`
- Description string `json:"description"`
-}
-
-func (t Tag) String() string {
- return Stringify(t)
-}
-
-// ListTagsOptions represents the available ListTags() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#list-project-repository-tags
-type ListTagsOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListTags gets a list of tags from a project, sorted by name in reverse
-// alphabetical order.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#list-project-repository-tags
-func (s *TagsService) ListTags(pid interface{}, opt *ListTagsOptions, options ...OptionFunc) ([]*Tag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t []*Tag
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// GetTag a specific repository tag determined by its name. It returns 200 together
-// with the tag information if the tag exists. It returns 404 if the tag does not exist.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#get-a-single-repository-tag
-func (s *TagsService) GetTag(pid interface{}, tag string, options ...OptionFunc) (*Tag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags/%s", url.QueryEscape(project), url.QueryEscape(tag))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t *Tag
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// CreateTagOptions represents the available CreateTag() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#create-a-new-tag
-type CreateTagOptions struct {
- TagName *string `url:"tag_name,omitempty" json:"tag_name,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Message *string `url:"message,omitempty" json:"message,omitempty"`
- ReleaseDescription *string `url:"release_description:omitempty" json:"release_description,omitempty"`
-}
-
-// CreateTag creates a new tag in the repository that points to the supplied ref.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#create-a-new-tag
-func (s *TagsService) CreateTag(pid interface{}, opt *CreateTagOptions, options ...OptionFunc) (*Tag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(Tag)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// DeleteTag deletes a tag of a repository with given name.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#delete-a-tag
-func (s *TagsService) DeleteTag(pid interface{}, tag string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags/%s", url.QueryEscape(project), url.QueryEscape(tag))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// CreateReleaseOptions represents the available CreateRelease() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#create-a-new-release
-type CreateReleaseOptions struct {
- Description *string `url:"description:omitempty" json:"description,omitempty"`
-}
-
-// CreateRelease Add release notes to the existing git tag.
-// If there already exists a release for the given tag, status code 409 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#create-a-new-release
-func (s *TagsService) CreateRelease(pid interface{}, tag string, opt *CreateReleaseOptions, options ...OptionFunc) (*Release, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags/%s/release", url.QueryEscape(project), url.QueryEscape(tag))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Release)
- resp, err := s.client.Do(req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// UpdateReleaseOptions represents the available UpdateRelease() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#update-a-release
-type UpdateReleaseOptions struct {
- Description *string `url:"description:omitempty" json:"description,omitempty"`
-}
-
-// UpdateRelease Updates the release notes of a given release.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#update-a-release
-func (s *TagsService) UpdateRelease(pid interface{}, tag string, opt *UpdateReleaseOptions, options ...OptionFunc) (*Release, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags/%s/release", url.QueryEscape(project), url.QueryEscape(tag))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Release)
- resp, err := s.client.Do(req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/time_stats.go b/vendor/github.com/xanzy/go-gitlab/time_stats.go
deleted file mode 100644
index 5e3bff90..00000000
--- a/vendor/github.com/xanzy/go-gitlab/time_stats.go
+++ /dev/null
@@ -1,163 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// timeStatsService handles communication with the time tracking related
-// methods of the GitLab API.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-type timeStatsService struct {
- client *Client
-}
-
-// TimeStats represents the time estimates and time spent for an issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-type TimeStats struct {
- HumanTimeEstimate string `json:"human_time_estimate"`
- HumanTotalTimeSpent string `json:"human_total_time_spent"`
- TimeEstimate int `json:"time_estimate"`
- TotalTimeSpent int `json:"total_time_spent"`
-}
-
-func (t TimeStats) String() string {
- return Stringify(t)
-}
-
-// SetTimeEstimateOptions represents the available SetTimeEstimate()
-// options.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-type SetTimeEstimateOptions struct {
- Duration *string `url:"duration,omitempty" json:"duration,omitempty"`
-}
-
-// setTimeEstimate sets the time estimate for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) setTimeEstimate(pid interface{}, entity string, issue int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/time_estimate", url.QueryEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// resetTimeEstimate resets the time estimate for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) resetTimeEstimate(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/reset_time_estimate", url.QueryEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// AddSpentTimeOptions represents the available AddSpentTime() options.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-type AddSpentTimeOptions struct {
- Duration *string `url:"duration,omitempty" json:"duration,omitempty"`
-}
-
-// addSpentTime adds spent time for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) addSpentTime(pid interface{}, entity string, issue int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/add_spent_time", url.QueryEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// resetSpentTime resets the spent time for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) resetSpentTime(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/reset_spent_time", url.QueryEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// getTimeSpent gets the spent time for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) getTimeSpent(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/time_stats", url.QueryEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/todos.go b/vendor/github.com/xanzy/go-gitlab/todos.go
deleted file mode 100644
index db58eddb..00000000
--- a/vendor/github.com/xanzy/go-gitlab/todos.go
+++ /dev/null
@@ -1,175 +0,0 @@
-package gitlab
-
-import "time"
-import "fmt"
-
-// TodosService handles communication with the todos related methods of
-// the Gitlab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
-type TodosService struct {
- client *Client
-}
-
-// TodoAction represents the available actions that can be performed on a todo.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
-type TodoAction string
-
-// The available todo actions.
-const (
- TodoAssigned TodoAction = "assigned"
- TodoMentioned TodoAction = "mentioned"
- TodoBuildFailed TodoAction = "build_failed"
- TodoMarked TodoAction = "marked"
- TodoApprovalRequired TodoAction = "approval_required"
- TodoDirectlyAddressed TodoAction = "directly_addressed"
-)
-
-// TodoTarget represents a todo target of type Issue or MergeRequest
-type TodoTarget struct {
- // TODO: replace both Assignee and Author structs with v4 User struct
- Assignee struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"assignee"`
- Author struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- CreatedAt *time.Time `json:"created_at"`
- Description string `json:"description"`
- Downvotes int `json:"downvotes"`
- ID int `json:"id"`
- IID int `json:"iid"`
- Labels []string `json:"labels"`
- Milestone Milestone `json:"milestone"`
- ProjectID int `json:"project_id"`
- State string `json:"state"`
- Subscribed bool `json:"subscribed"`
- Title string `json:"title"`
- UpdatedAt *time.Time `json:"updated_at"`
- Upvotes int `json:"upvotes"`
- UserNotesCount int `json:"user_notes_count"`
- WebURL string `json:"web_url"`
-
- // Only available for type Issue
- Confidential bool `json:"confidential"`
- DueDate string `json:"due_date"`
- Weight int `json:"weight"`
-
- // Only available for type MergeRequest
- ApprovalsBeforeMerge bool `json:"approvals_before_merge"`
- ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
- MergeCommitSha string `json:"merge_commit_sha"`
- MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
- MergeStatus string `json:"merge_status"`
- Sha string `json:"sha"`
- ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
- SourceBranch string `json:"source_branch"`
- SourceProjectID int `json:"source_project_id"`
- Squash bool `json:"squash"`
- TargetBranch string `json:"target_branch"`
- TargetProjectID int `json:"target_project_id"`
- WorkInProgress bool `json:"work_in_progress"`
-}
-
-// Todo represents a GitLab todo.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
-type Todo struct {
- ID int `json:"id"`
- Project struct {
- ID int `json:"id"`
- HTTPURLToRepo string `json:"http_url_to_repo"`
- WebURL string `json:"web_url"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- } `json:"project"`
- Author struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- ActionName TodoAction `json:"action_name"`
- TargetType string `json:"target_type"`
- Target TodoTarget `json:"target"`
- TargetURL string `json:"target_url"`
- Body string `json:"body"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (t Todo) String() string {
- return Stringify(t)
-}
-
-// ListTodosOptions represents the available ListTodos() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#get-a-list-of-todos
-type ListTodosOptions struct {
- Action *TodoAction `url:"action,omitempty" json:"action,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- ProjectID *int `url:"project_id,omitempty" json:"project_id,omitempty"`
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Type *string `url:"type,omitempty" json:"type,omitempty"`
-}
-
-// ListTodos lists all todos created by authenticated user.
-// When no filter is applied, it returns all pending todos for the current user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/todos.html#get-a-list-of-todos
-func (s *TodosService) ListTodos(opt *ListTodosOptions, options ...OptionFunc) ([]*Todo, *Response, error) {
- req, err := s.client.NewRequest("GET", "todos", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t []*Todo
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// MarkTodoAsDone marks a single pending todo given by its ID for the current user as done.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#mark-a-todo-as-done
-func (s *TodosService) MarkTodoAsDone(id int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("todos/%d/mark_as_done", id)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// MarkAllTodosAsDone marks all pending todos for the current user as done.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#mark-all-todos-as-done
-func (s *TodosService) MarkAllTodosAsDone(options ...OptionFunc) (*Response, error) {
- req, err := s.client.NewRequest("POST", "todos/mark_as_done", nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/users.go b/vendor/github.com/xanzy/go-gitlab/users.go
deleted file mode 100644
index a619ab03..00000000
--- a/vendor/github.com/xanzy/go-gitlab/users.go
+++ /dev/null
@@ -1,767 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// 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.
-//
-
-package gitlab
-
-import (
- "errors"
- "fmt"
- "time"
-)
-
-// UsersService handles communication with the user related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html
-type UsersService struct {
- client *Client
-}
-
-// User represents a GitLab user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html
-type User struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- Bio string `json:"bio"`
- Location string `json:"location"`
- Skype string `json:"skype"`
- Linkedin string `json:"linkedin"`
- Twitter string `json:"twitter"`
- WebsiteURL string `json:"website_url"`
- Organization string `json:"organization"`
- ExternUID string `json:"extern_uid"`
- Provider string `json:"provider"`
- ThemeID int `json:"theme_id"`
- LastActivityOn *ISOTime `json:"last_activity_on"`
- ColorSchemeID int `json:"color_scheme_id"`
- IsAdmin bool `json:"is_admin"`
- AvatarURL string `json:"avatar_url"`
- CanCreateGroup bool `json:"can_create_group"`
- CanCreateProject bool `json:"can_create_project"`
- ProjectsLimit int `json:"projects_limit"`
- CurrentSignInAt *time.Time `json:"current_sign_in_at"`
- LastSignInAt *time.Time `json:"last_sign_in_at"`
- TwoFactorEnabled bool `json:"two_factor_enabled"`
- Identities []*UserIdentity `json:"identities"`
- External bool `json:"external"`
-}
-
-// UserIdentity represents a user identity.
-type UserIdentity struct {
- Provider string `json:"provider"`
- ExternUID string `json:"extern_uid"`
-}
-
-// ListUsersOptions represents the available ListUsers() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-users
-type ListUsersOptions struct {
- ListOptions
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
- Blocked *bool `url:"blocked,omitempty" json:"blocked,omitempty"`
-
- // The options below are only available for admins.
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- ExternalUID *string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
- Provider *string `url:"provider,omitempty" json:"provider,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListUsers gets a list of users.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-users
-func (s *UsersService) ListUsers(opt *ListUsersOptions, options ...OptionFunc) ([]*User, *Response, error) {
- req, err := s.client.NewRequest("GET", "users", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var usr []*User
- resp, err := s.client.Do(req, &usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// GetUser gets a single user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-user
-func (s *UsersService) GetUser(user int, options ...OptionFunc) (*User, *Response, error) {
- u := fmt.Sprintf("users/%d", user)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- usr := new(User)
- resp, err := s.client.Do(req, usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// CreateUserOptions represents the available CreateUser() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-creation
-type CreateUserOptions struct {
- Email *string `url:"email,omitempty" json:"email,omitempty"`
- Password *string `url:"password,omitempty" json:"password,omitempty"`
- ResetPassword *bool `url:"reset_password,omitempty" json:"reset_password,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Skype *string `url:"skype,omitempty" json:"skype,omitempty"`
- Linkedin *string `url:"linkedin,omitempty" json:"linkedin,omitempty"`
- Twitter *string `url:"twitter,omitempty" json:"twitter,omitempty"`
- WebsiteURL *string `url:"website_url,omitempty" json:"website_url,omitempty"`
- Organization *string `url:"organization,omitempty" json:"organization,omitempty"`
- ProjectsLimit *int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"`
- ExternUID *string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
- Provider *string `url:"provider,omitempty" json:"provider,omitempty"`
- Bio *string `url:"bio,omitempty" json:"bio,omitempty"`
- Location *string `url:"location,omitempty" json:"location,omitempty"`
- Admin *bool `url:"admin,omitempty" json:"admin,omitempty"`
- CanCreateGroup *bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"`
- SkipConfirmation *bool `url:"skip_confirmation,omitempty" json:"skip_confirmation,omitempty"`
- External *bool `url:"external,omitempty" json:"external,omitempty"`
-}
-
-// CreateUser creates a new user. Note only administrators can create new users.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-creation
-func (s *UsersService) CreateUser(opt *CreateUserOptions, options ...OptionFunc) (*User, *Response, error) {
- req, err := s.client.NewRequest("POST", "users", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- usr := new(User)
- resp, err := s.client.Do(req, usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// ModifyUserOptions represents the available ModifyUser() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-modification
-type ModifyUserOptions struct {
- Email *string `url:"email,omitempty" json:"email,omitempty"`
- Password *string `url:"password,omitempty" json:"password,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Skype *string `url:"skype,omitempty" json:"skype,omitempty"`
- Linkedin *string `url:"linkedin,omitempty" json:"linkedin,omitempty"`
- Twitter *string `url:"twitter,omitempty" json:"twitter,omitempty"`
- WebsiteURL *string `url:"website_url,omitempty" json:"website_url,omitempty"`
- Organization *string `url:"organization,omitempty" json:"organization,omitempty"`
- ProjectsLimit *int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"`
- ExternUID *string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
- Provider *string `url:"provider,omitempty" json:"provider,omitempty"`
- Bio *string `url:"bio,omitempty" json:"bio,omitempty"`
- Location *string `url:"location,omitempty" json:"location,omitempty"`
- Admin *bool `url:"admin,omitempty" json:"admin,omitempty"`
- CanCreateGroup *bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"`
- SkipReconfirmation *bool `url:"skip_reconfirmation,omitempty" json:"skip_reconfirmation,omitempty"`
- External *bool `url:"external,omitempty" json:"external,omitempty"`
-}
-
-// ModifyUser modifies an existing user. Only administrators can change attributes
-// of a user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-modification
-func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions, options ...OptionFunc) (*User, *Response, error) {
- u := fmt.Sprintf("users/%d", user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- usr := new(User)
- resp, err := s.client.Do(req, usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// DeleteUser deletes a user. Available only for administrators. This is an
-// idempotent function, calling this function for a non-existent user id still
-// returns a status code 200 OK. The JSON response differs if the user was
-// actually deleted or not. In the former the user is returned and in the
-// latter not.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-deletion
-func (s *UsersService) DeleteUser(user int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("users/%d", user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// CurrentUser gets currently authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#current-user
-func (s *UsersService) CurrentUser(options ...OptionFunc) (*User, *Response, error) {
- req, err := s.client.NewRequest("GET", "user", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- usr := new(User)
- resp, err := s.client.Do(req, usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// SSHKey represents a SSH key.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-ssh-keys
-type SSHKey struct {
- ID int `json:"id"`
- Title string `json:"title"`
- Key string `json:"key"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-// ListSSHKeys gets a list of currently authenticated user's SSH keys.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-ssh-keys
-func (s *UsersService) ListSSHKeys(options ...OptionFunc) ([]*SSHKey, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/keys", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var k []*SSHKey
- resp, err := s.client.Do(req, &k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// ListSSHKeysForUserOptions represents the available ListSSHKeysForUser() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#list-ssh-keys-for-user
-type ListSSHKeysForUserOptions ListOptions
-
-// ListSSHKeysForUser gets a list of a specified user's SSH keys. Available
-// only for admin
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#list-ssh-keys-for-user
-func (s *UsersService) ListSSHKeysForUser(user int, opt *ListSSHKeysForUserOptions, options ...OptionFunc) ([]*SSHKey, *Response, error) {
- u := fmt.Sprintf("users/%d/keys", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var k []*SSHKey
- resp, err := s.client.Do(req, &k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// GetSSHKey gets a single key.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-ssh-key
-func (s *UsersService) GetSSHKey(key int, options ...OptionFunc) (*SSHKey, *Response, error) {
- u := fmt.Sprintf("user/keys/%d", key)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(SSHKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// AddSSHKeyOptions represents the available AddSSHKey() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#add-ssh-key
-type AddSSHKeyOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Key *string `url:"key,omitempty" json:"key,omitempty"`
-}
-
-// AddSSHKey creates a new key owned by the currently authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key
-func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions, options ...OptionFunc) (*SSHKey, *Response, error) {
- req, err := s.client.NewRequest("POST", "user/keys", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(SSHKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// AddSSHKeyForUser creates new key owned by specified user. Available only for
-// admin.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key-for-user
-func (s *UsersService) AddSSHKeyForUser(user int, opt *AddSSHKeyOptions, options ...OptionFunc) (*SSHKey, *Response, error) {
- u := fmt.Sprintf("users/%d/keys", user)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(SSHKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// DeleteSSHKey deletes key owned by currently authenticated user. This is an
-// idempotent function and calling it on a key that is already deleted or not
-// available results in 200 OK.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-current-owner
-func (s *UsersService) DeleteSSHKey(key int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("user/keys/%d", key)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteSSHKeyForUser deletes key owned by a specified user. Available only
-// for admin.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-given-user
-func (s *UsersService) DeleteSSHKeyForUser(user, key int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("users/%d/keys/%d", user, key)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// BlockUser blocks the specified user. Available only for admin.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#block-user
-func (s *UsersService) BlockUser(user int, options ...OptionFunc) error {
- u := fmt.Sprintf("users/%d/block", user)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return err
- }
-
- resp, err := s.client.Do(req, nil)
- if err != nil {
- return err
- }
-
- switch resp.StatusCode {
- case 201:
- return nil
- case 403:
- return errors.New("Cannot block a user that is already blocked by LDAP synchronization")
- case 404:
- return errors.New("User does not exist")
- default:
- return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode)
- }
-}
-
-// UnblockUser unblocks the specified user. Available only for admin.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#unblock-user
-func (s *UsersService) UnblockUser(user int, options ...OptionFunc) error {
- u := fmt.Sprintf("users/%d/unblock", user)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return err
- }
-
- resp, err := s.client.Do(req, nil)
- if err != nil {
- return err
- }
-
- switch resp.StatusCode {
- case 201:
- return nil
- case 403:
- return errors.New("Cannot unblock a user that is blocked by LDAP synchronization")
- case 404:
- return errors.New("User does not exist")
- default:
- return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode)
- }
-}
-
-// Email represents an Email.
-//
-// GitLab API docs: https://doc.gitlab.com/ce/api/users.html#list-emails
-type Email struct {
- ID int `json:"id"`
- Email string `json:"email"`
-}
-
-// ListEmails gets a list of currently authenticated user's Emails.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-emails
-func (s *UsersService) ListEmails(options ...OptionFunc) ([]*Email, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/emails", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var e []*Email
- resp, err := s.client.Do(req, &e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// ListEmailsForUserOptions represents the available ListEmailsForUser() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#list-emails-for-user
-type ListEmailsForUserOptions ListOptions
-
-// ListEmailsForUser gets a list of a specified user's Emails. Available
-// only for admin
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#list-emails-for-user
-func (s *UsersService) ListEmailsForUser(user int, opt *ListEmailsForUserOptions, options ...OptionFunc) ([]*Email, *Response, error) {
- u := fmt.Sprintf("users/%d/emails", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var e []*Email
- resp, err := s.client.Do(req, &e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// GetEmail gets a single email.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-email
-func (s *UsersService) GetEmail(email int, options ...OptionFunc) (*Email, *Response, error) {
- u := fmt.Sprintf("user/emails/%d", email)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Email)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// AddEmailOptions represents the available AddEmail() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#add-email
-type AddEmailOptions struct {
- Email *string `url:"email,omitempty" json:"email,omitempty"`
-}
-
-// AddEmail creates a new email owned by the currently authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email
-func (s *UsersService) AddEmail(opt *AddEmailOptions, options ...OptionFunc) (*Email, *Response, error) {
- req, err := s.client.NewRequest("POST", "user/emails", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Email)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// AddEmailForUser creates new email owned by specified user. Available only for
-// admin.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email-for-user
-func (s *UsersService) AddEmailForUser(user int, opt *AddEmailOptions, options ...OptionFunc) (*Email, *Response, error) {
- u := fmt.Sprintf("users/%d/emails", user)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Email)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// DeleteEmail deletes email owned by currently authenticated user. This is an
-// idempotent function and calling it on a key that is already deleted or not
-// available results in 200 OK.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#delete-email-for-current-owner
-func (s *UsersService) DeleteEmail(email int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("user/emails/%d", email)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteEmailForUser deletes email owned by a specified user. Available only
-// for admin.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#delete-email-for-given-user
-func (s *UsersService) DeleteEmailForUser(user, email int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("users/%d/emails/%d", user, email)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ImpersonationToken represents an impersonation token.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-all-impersonation-tokens-of-a-user
-type ImpersonationToken struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Active bool `json:"active"`
- Token string `json:"token"`
- Scopes []string `json:"scopes"`
- Revoked bool `json:"revoked"`
- CreatedAt *time.Time `json:"created_at"`
- ExpiresAt *ISOTime `json:"expires_at"`
-}
-
-// GetAllImpersonationTokensOptions represents the available
-// GetAllImpersonationTokens() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-all-impersonation-tokens-of-a-user
-type GetAllImpersonationTokensOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
-}
-
-// GetAllImpersonationTokens retrieves all impersonation tokens of a user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-all-impersonation-tokens-of-a-user
-func (s *UsersService) GetAllImpersonationTokens(user int, opt *GetAllImpersonationTokensOptions, options ...OptionFunc) ([]*ImpersonationToken, *Response, error) {
- u := fmt.Sprintf("users/%d/impersonation_tokens", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ts []*ImpersonationToken
- resp, err := s.client.Do(req, &ts)
- if err != nil {
- return nil, resp, err
- }
-
- return ts, resp, err
-}
-
-// GetImpersonationToken retrieves an impersonation token of a user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-an-impersonation-token-of-a-user
-func (s *UsersService) GetImpersonationToken(user, token int, options ...OptionFunc) (*ImpersonationToken, *Response, error) {
- u := fmt.Sprintf("users/%d/impersonation_tokens/%d", user, token)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(ImpersonationToken)
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// CreateImpersonationTokenOptions represents the available
-// CreateImpersonationToken() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#create-an-impersonation-token
-type CreateImpersonationTokenOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Scopes *[]string `url:"scopes,omitempty" json:"scopes,omitempty"`
- ExpiresAt *time.Time `url:"expires_at,omitempty" json:"expires_at,omitempty"`
-}
-
-// CreateImpersonationToken creates an impersonation token.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#create-an-impersonation-token
-func (s *UsersService) CreateImpersonationToken(user int, opt *CreateImpersonationTokenOptions, options ...OptionFunc) (*ImpersonationToken, *Response, error) {
- u := fmt.Sprintf("users/%d/impersonation_tokens", user)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(ImpersonationToken)
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// RevokeImpersonationToken revokes an impersonation token.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#revoke-an-impersonation-token
-func (s *UsersService) RevokeImpersonationToken(user, token int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("users/%d/impersonation_tokens/%d", user, token)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// UserActivity represents an entry in the user/activities response
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only
-type UserActivity struct {
- Username string `json:"username"`
- LastActivityOn *ISOTime `json:"last_activity_on"`
-}
-
-// GetUserActivitiesOptions represents the options for GetUserActivities
-//
-// GitLap API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only
-type GetUserActivitiesOptions struct {
- From *ISOTime `url:"from,omitempty" json:"from,omitempty"`
-}
-
-// GetUserActivities retrieves user activities (admin only)
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only
-func (s *UsersService) GetUserActivities(opt *GetUserActivitiesOptions, options ...OptionFunc) ([]*UserActivity, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/activities", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t []*UserActivity
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/validate.go b/vendor/github.com/xanzy/go-gitlab/validate.go
deleted file mode 100644
index a88e1884..00000000
--- a/vendor/github.com/xanzy/go-gitlab/validate.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package gitlab
-
-// ValidateService handles communication with the validation related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html
-type ValidateService struct {
- client *Client
-}
-
-// LintResult represents the linting results.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html
-type LintResult struct {
- Status string `json:"status"`
- Errors []string `json:"errors"`
-}
-
-// Lint validates .gitlab-ci.yml content.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html
-func (s *ValidateService) Lint(content string, options ...OptionFunc) (*LintResult, *Response, error) {
- var opts struct {
- Content string `url:"content,omitempty" json:"content,omitempty"`
- }
- opts.Content = content
-
- req, err := s.client.NewRequest("POST", "ci/lint", &opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(LintResult)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, nil
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/version.go b/vendor/github.com/xanzy/go-gitlab/version.go
deleted file mode 100644
index f1a3a7f5..00000000
--- a/vendor/github.com/xanzy/go-gitlab/version.go
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// Copyright 2017, Andrea Funto'
-//
-// 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.
-//
-
-package gitlab
-
-// VersionService handles communication with the GitLab server instance to
-// retrieve its version information via the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/version.md
-type VersionService struct {
- client *Client
-}
-
-// Version represents a GitLab instance version.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/version.md
-type Version struct {
- Version string `json:"version"`
- Revision string `json:"revision"`
-}
-
-func (s Version) String() string {
- return Stringify(s)
-}
-
-// GetVersion gets a GitLab server instance version; it is only available to
-// authenticated users.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/version.md
-func (s *VersionService) GetVersion() (*Version, *Response, error) {
- req, err := s.client.NewRequest("GET", "version", nil, nil)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(Version)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/wikis.go b/vendor/github.com/xanzy/go-gitlab/wikis.go
deleted file mode 100644
index 72889851..00000000
--- a/vendor/github.com/xanzy/go-gitlab/wikis.go
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright 2017, Stany MARCEL
-//
-// 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.
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// WikisService handles communication with the wikis related methods of
-// the Gitlab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/wikis.html
-type WikisService struct {
- client *Client
-}
-
-// WikiFormat represents the available wiki formats.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/wikis.html
-type WikiFormat string
-
-// The available wiki formats.
-const (
- WikiFormatMarkdown WikiFormat = "markdown"
- WikiFormatRFoc WikiFormat = "rdoc"
- WikiFormatASCIIDoc WikiFormat = "asciidoc"
-)
-
-// Wiki represents a GitLab wiki.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/wikis.html
-type Wiki struct {
- Content string `json:"content"`
- Format WikiFormat `json:"format"`
- Slug string `json:"slug"`
- Title string `json:"title"`
-}
-
-func (w Wiki) String() string {
- return Stringify(w)
-}
-
-// ListWikisOptions represents the available ListWikis options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#list-wiki-pages
-type ListWikisOptions struct {
- WithContent *bool `url:"with_content,omitempty" json:"with_content,omitempty"`
-}
-
-// ListWikis lists all pages of the wiki of the given project id.
-// When with_content is set, it also returns the content of the pages.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#list-wiki-pages
-func (s *WikisService) ListWikis(pid interface{}, opt *ListWikisOptions, options ...OptionFunc) ([]*Wiki, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var w []*Wiki
- resp, err := s.client.Do(req, &w)
- if err != nil {
- return nil, resp, err
- }
-
- return w, resp, err
-}
-
-// GetWikiPage gets a wiki page for a given project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#get-a-wiki-page
-func (s *WikisService) GetWikiPage(pid interface{}, slug string, options ...OptionFunc) (*Wiki, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis/%s", url.QueryEscape(project), url.QueryEscape(slug))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var w *Wiki
- resp, err := s.client.Do(req, &w)
- if err != nil {
- return nil, resp, err
- }
-
- return w, resp, err
-}
-
-// CreateWikiPageOptions represents options to CreateWikiPage.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#create-a-new-wiki-page
-type CreateWikiPageOptions struct {
- Content *string `url:"content" json:"content"`
- Title *string `url:"title" json:"title"`
- Format *string `url:"format,omitempty" json:"format,omitempty"`
-}
-
-// CreateWikiPage creates a new wiki page for the given repository with
-// the given title, slug, and content.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#create-a-new-wiki-page
-func (s *WikisService) CreateWikiPage(pid interface{}, opt *CreateWikiPageOptions, options ...OptionFunc) (*Wiki, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis", url.QueryEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- w := new(Wiki)
- resp, err := s.client.Do(req, w)
- if err != nil {
- return nil, resp, err
- }
-
- return w, resp, err
-}
-
-// EditWikiPageOptions represents options to EditWikiPage.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#edit-an-existing-wiki-page
-type EditWikiPageOptions struct {
- Content *string `url:"content" json:"content"`
- Title *string `url:"title" json:"title"`
- Format *string `url:"format,omitempty" json:"format,omitempty"`
-}
-
-// EditWikiPage Updates an existing wiki page. At least one parameter is
-// required to update the wiki page.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#edit-an-existing-wiki-page
-func (s *WikisService) EditWikiPage(pid interface{}, slug string, opt *EditWikiPageOptions, options ...OptionFunc) (*Wiki, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis/%s", url.QueryEscape(project), url.QueryEscape(slug))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- w := new(Wiki)
- resp, err := s.client.Do(req, w)
- if err != nil {
- return nil, resp, err
- }
-
- return w, resp, err
-}
-
-// DeleteWikiPage deletes a wiki page with a given slug.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#delete-a-wiki-page
-func (s *WikisService) DeleteWikiPage(pid interface{}, slug string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis/%s", url.QueryEscape(project), url.QueryEscape(slug))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/ssh-agent/.gitignore b/vendor/github.com/xanzy/ssh-agent/.gitignore
deleted file mode 100644
index daf913b1..00000000
--- a/vendor/github.com/xanzy/ssh-agent/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/xanzy/ssh-agent/LICENSE b/vendor/github.com/xanzy/ssh-agent/LICENSE
deleted file mode 100644
index 8f71f43f..00000000
--- a/vendor/github.com/xanzy/ssh-agent/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- 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.
-
diff --git a/vendor/github.com/xanzy/ssh-agent/README.md b/vendor/github.com/xanzy/ssh-agent/README.md
deleted file mode 100644
index d93af40a..00000000
--- a/vendor/github.com/xanzy/ssh-agent/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# ssh-agent
-
-Create a new [agent.Agent](https://godoc.org/golang.org/x/crypto/ssh/agent#Agent) on any type of OS (so including Windows) from any [Go](https://golang.org) application.
-
-## Limitations
-
-When compiled for Windows, it will only support [Pageant](http://the.earth.li/~sgtatham/putty/0.66/htmldoc/Chapter9.html#pageant) as the SSH authentication agent.
-
-## Credits
-
-Big thanks to [Давид Мзареулян (David Mzareulyan)](https://github.com/davidmz) for creating the [go-pageant](https://github.com/davidmz/go-pageant) package!
-
-## Issues
-
-If you have an issue: report it on the [issue tracker](https://github.com/xanzy/ssh-agent/issues)
-
-## Author
-
-Sander van Harmelen ()
-
-## License
-
-The files `pageant_windows.go` and `sshagent_windows.go` have their own license (see file headers). The rest of this package is 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
diff --git a/vendor/github.com/xanzy/ssh-agent/pageant_windows.go b/vendor/github.com/xanzy/ssh-agent/pageant_windows.go
deleted file mode 100644
index 62956079..00000000
--- a/vendor/github.com/xanzy/ssh-agent/pageant_windows.go
+++ /dev/null
@@ -1,146 +0,0 @@
-//
-// Copyright (c) 2014 David Mzareulyan
-//
-// 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.
-//
-
-// +build windows
-
-package sshagent
-
-// see https://github.com/Yasushi/putty/blob/master/windows/winpgntc.c#L155
-// see https://github.com/paramiko/paramiko/blob/master/paramiko/win_pageant.py
-
-import (
- "encoding/binary"
- "errors"
- "fmt"
- "sync"
- "syscall"
- "unsafe"
-)
-
-// Maximum size of message can be sent to pageant
-const MaxMessageLen = 8192
-
-var (
- ErrPageantNotFound = errors.New("pageant process not found")
- ErrSendMessage = errors.New("error sending message")
-
- ErrMessageTooLong = errors.New("message too long")
- ErrInvalidMessageFormat = errors.New("invalid message format")
- ErrResponseTooLong = errors.New("response too long")
-)
-
-const (
- agentCopydataID = 0x804e50ba
- wmCopydata = 74
-)
-
-type copyData struct {
- dwData uintptr
- cbData uint32
- lpData unsafe.Pointer
-}
-
-var (
- lock sync.Mutex
-
- winFindWindow = winAPI("user32.dll", "FindWindowW")
- winGetCurrentThreadID = winAPI("kernel32.dll", "GetCurrentThreadId")
- winSendMessage = winAPI("user32.dll", "SendMessageW")
-)
-
-func winAPI(dllName, funcName string) func(...uintptr) (uintptr, uintptr, error) {
- proc := syscall.MustLoadDLL(dllName).MustFindProc(funcName)
- return func(a ...uintptr) (uintptr, uintptr, error) { return proc.Call(a...) }
-}
-
-// Available returns true if Pageant is running
-func Available() bool { return pageantWindow() != 0 }
-
-// Query sends message msg to Pageant and returns response or error.
-// 'msg' is raw agent request with length prefix
-// Response is raw agent response with length prefix
-func query(msg []byte) ([]byte, error) {
- if len(msg) > MaxMessageLen {
- return nil, ErrMessageTooLong
- }
-
- msgLen := binary.BigEndian.Uint32(msg[:4])
- if len(msg) != int(msgLen)+4 {
- return nil, ErrInvalidMessageFormat
- }
-
- lock.Lock()
- defer lock.Unlock()
-
- paWin := pageantWindow()
-
- if paWin == 0 {
- return nil, ErrPageantNotFound
- }
-
- thID, _, _ := winGetCurrentThreadID()
- mapName := fmt.Sprintf("PageantRequest%08x", thID)
- pMapName, _ := syscall.UTF16PtrFromString(mapName)
-
- mmap, err := syscall.CreateFileMapping(syscall.InvalidHandle, nil, syscall.PAGE_READWRITE, 0, MaxMessageLen+4, pMapName)
- if err != nil {
- return nil, err
- }
- defer syscall.CloseHandle(mmap)
-
- ptr, err := syscall.MapViewOfFile(mmap, syscall.FILE_MAP_WRITE, 0, 0, 0)
- if err != nil {
- return nil, err
- }
- defer syscall.UnmapViewOfFile(ptr)
-
- mmSlice := (*(*[MaxMessageLen]byte)(unsafe.Pointer(ptr)))[:]
-
- copy(mmSlice, msg)
-
- mapNameBytesZ := append([]byte(mapName), 0)
-
- cds := copyData{
- dwData: agentCopydataID,
- cbData: uint32(len(mapNameBytesZ)),
- lpData: unsafe.Pointer(&(mapNameBytesZ[0])),
- }
-
- resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(unsafe.Pointer(&cds)))
-
- if resp == 0 {
- return nil, ErrSendMessage
- }
-
- respLen := binary.BigEndian.Uint32(mmSlice[:4])
- if respLen > MaxMessageLen-4 {
- return nil, ErrResponseTooLong
- }
-
- respData := make([]byte, respLen+4)
- copy(respData, mmSlice)
-
- return respData, nil
-}
-
-func pageantWindow() uintptr {
- nameP, _ := syscall.UTF16PtrFromString("Pageant")
- h, _, _ := winFindWindow(uintptr(unsafe.Pointer(nameP)), uintptr(unsafe.Pointer(nameP)))
- return h
-}
diff --git a/vendor/github.com/xanzy/ssh-agent/sshagent.go b/vendor/github.com/xanzy/ssh-agent/sshagent.go
deleted file mode 100644
index 259fea2b..00000000
--- a/vendor/github.com/xanzy/ssh-agent/sshagent.go
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright 2015, Sander van Harmelen
-//
-// 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.
-//
-
-// +build !windows
-
-package sshagent
-
-import (
- "errors"
- "fmt"
- "net"
- "os"
-
- "golang.org/x/crypto/ssh/agent"
-)
-
-// New returns a new agent.Agent that uses a unix socket
-func New() (agent.Agent, net.Conn, error) {
- if !Available() {
- return nil, nil, errors.New("SSH agent requested but SSH_AUTH_SOCK not-specified")
- }
-
- sshAuthSock := os.Getenv("SSH_AUTH_SOCK")
-
- conn, err := net.Dial("unix", sshAuthSock)
- if err != nil {
- return nil, nil, fmt.Errorf("Error connecting to SSH_AUTH_SOCK: %v", err)
- }
-
- return agent.NewClient(conn), conn, nil
-}
-
-// Available returns true is a auth socket is defined
-func Available() bool {
- return os.Getenv("SSH_AUTH_SOCK") != ""
-}
diff --git a/vendor/github.com/xanzy/ssh-agent/sshagent_windows.go b/vendor/github.com/xanzy/ssh-agent/sshagent_windows.go
deleted file mode 100644
index c46710e8..00000000
--- a/vendor/github.com/xanzy/ssh-agent/sshagent_windows.go
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// Copyright (c) 2014 David Mzareulyan
-//
-// 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.
-//
-
-// +build windows
-
-package sshagent
-
-import (
- "errors"
- "io"
- "net"
- "sync"
-
- "golang.org/x/crypto/ssh/agent"
-)
-
-// New returns a new agent.Agent and the (custom) connection it uses
-// to communicate with a running pagent.exe instance (see README.md)
-func New() (agent.Agent, net.Conn, error) {
- if !Available() {
- return nil, nil, errors.New("SSH agent requested but Pageant not running")
- }
-
- return agent.NewClient(&conn{}), nil, nil
-}
-
-type conn struct {
- sync.Mutex
- buf []byte
-}
-
-func (c *conn) Close() {
- c.Lock()
- defer c.Unlock()
- c.buf = nil
-}
-
-func (c *conn) Write(p []byte) (int, error) {
- c.Lock()
- defer c.Unlock()
-
- resp, err := query(p)
- if err != nil {
- return 0, err
- }
-
- c.buf = append(c.buf, resp...)
-
- return len(p), nil
-}
-
-func (c *conn) Read(p []byte) (int, error) {
- c.Lock()
- defer c.Unlock()
-
- if len(c.buf) == 0 {
- return 0, io.EOF
- }
-
- n := copy(p, c.buf)
- c.buf = c.buf[n:]
-
- return n, nil
-}
diff --git a/vendor/golang.org/x/crypto/AUTHORS b/vendor/golang.org/x/crypto/AUTHORS
deleted file mode 100644
index 2b00ddba..00000000
--- a/vendor/golang.org/x/crypto/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at https://tip.golang.org/AUTHORS.
diff --git a/vendor/golang.org/x/crypto/CONTRIBUTORS b/vendor/golang.org/x/crypto/CONTRIBUTORS
deleted file mode 100644
index 1fbd3e97..00000000
--- a/vendor/golang.org/x/crypto/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at https://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/golang.org/x/crypto/LICENSE b/vendor/golang.org/x/crypto/LICENSE
deleted file mode 100644
index 6a66aea5..00000000
--- a/vendor/golang.org/x/crypto/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-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.
diff --git a/vendor/golang.org/x/crypto/PATENTS b/vendor/golang.org/x/crypto/PATENTS
deleted file mode 100644
index 73309904..00000000
--- a/vendor/golang.org/x/crypto/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/crypto/cast5/cast5.go b/vendor/golang.org/x/crypto/cast5/cast5.go
deleted file mode 100644
index 0b4af37b..00000000
--- a/vendor/golang.org/x/crypto/cast5/cast5.go
+++ /dev/null
@@ -1,526 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package cast5 implements CAST5, as defined in RFC 2144. CAST5 is a common
-// OpenPGP cipher.
-package cast5 // import "golang.org/x/crypto/cast5"
-
-import "errors"
-
-const BlockSize = 8
-const KeySize = 16
-
-type Cipher struct {
- masking [16]uint32
- rotate [16]uint8
-}
-
-func NewCipher(key []byte) (c *Cipher, err error) {
- if len(key) != KeySize {
- return nil, errors.New("CAST5: keys must be 16 bytes")
- }
-
- c = new(Cipher)
- c.keySchedule(key)
- return
-}
-
-func (c *Cipher) BlockSize() int {
- return BlockSize
-}
-
-func (c *Cipher) Encrypt(dst, src []byte) {
- l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
- r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7])
-
- l, r = r, l^f1(r, c.masking[0], c.rotate[0])
- l, r = r, l^f2(r, c.masking[1], c.rotate[1])
- l, r = r, l^f3(r, c.masking[2], c.rotate[2])
- l, r = r, l^f1(r, c.masking[3], c.rotate[3])
-
- l, r = r, l^f2(r, c.masking[4], c.rotate[4])
- l, r = r, l^f3(r, c.masking[5], c.rotate[5])
- l, r = r, l^f1(r, c.masking[6], c.rotate[6])
- l, r = r, l^f2(r, c.masking[7], c.rotate[7])
-
- l, r = r, l^f3(r, c.masking[8], c.rotate[8])
- l, r = r, l^f1(r, c.masking[9], c.rotate[9])
- l, r = r, l^f2(r, c.masking[10], c.rotate[10])
- l, r = r, l^f3(r, c.masking[11], c.rotate[11])
-
- l, r = r, l^f1(r, c.masking[12], c.rotate[12])
- l, r = r, l^f2(r, c.masking[13], c.rotate[13])
- l, r = r, l^f3(r, c.masking[14], c.rotate[14])
- l, r = r, l^f1(r, c.masking[15], c.rotate[15])
-
- dst[0] = uint8(r >> 24)
- dst[1] = uint8(r >> 16)
- dst[2] = uint8(r >> 8)
- dst[3] = uint8(r)
- dst[4] = uint8(l >> 24)
- dst[5] = uint8(l >> 16)
- dst[6] = uint8(l >> 8)
- dst[7] = uint8(l)
-}
-
-func (c *Cipher) Decrypt(dst, src []byte) {
- l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
- r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7])
-
- l, r = r, l^f1(r, c.masking[15], c.rotate[15])
- l, r = r, l^f3(r, c.masking[14], c.rotate[14])
- l, r = r, l^f2(r, c.masking[13], c.rotate[13])
- l, r = r, l^f1(r, c.masking[12], c.rotate[12])
-
- l, r = r, l^f3(r, c.masking[11], c.rotate[11])
- l, r = r, l^f2(r, c.masking[10], c.rotate[10])
- l, r = r, l^f1(r, c.masking[9], c.rotate[9])
- l, r = r, l^f3(r, c.masking[8], c.rotate[8])
-
- l, r = r, l^f2(r, c.masking[7], c.rotate[7])
- l, r = r, l^f1(r, c.masking[6], c.rotate[6])
- l, r = r, l^f3(r, c.masking[5], c.rotate[5])
- l, r = r, l^f2(r, c.masking[4], c.rotate[4])
-
- l, r = r, l^f1(r, c.masking[3], c.rotate[3])
- l, r = r, l^f3(r, c.masking[2], c.rotate[2])
- l, r = r, l^f2(r, c.masking[1], c.rotate[1])
- l, r = r, l^f1(r, c.masking[0], c.rotate[0])
-
- dst[0] = uint8(r >> 24)
- dst[1] = uint8(r >> 16)
- dst[2] = uint8(r >> 8)
- dst[3] = uint8(r)
- dst[4] = uint8(l >> 24)
- dst[5] = uint8(l >> 16)
- dst[6] = uint8(l >> 8)
- dst[7] = uint8(l)
-}
-
-type keyScheduleA [4][7]uint8
-type keyScheduleB [4][5]uint8
-
-// keyScheduleRound contains the magic values for a round of the key schedule.
-// The keyScheduleA deals with the lines like:
-// z0z1z2z3 = x0x1x2x3 ^ S5[xD] ^ S6[xF] ^ S7[xC] ^ S8[xE] ^ S7[x8]
-// Conceptually, both x and z are in the same array, x first. The first
-// element describes which word of this array gets written to and the
-// second, which word gets read. So, for the line above, it's "4, 0", because
-// it's writing to the first word of z, which, being after x, is word 4, and
-// reading from the first word of x: word 0.
-//
-// Next are the indexes into the S-boxes. Now the array is treated as bytes. So
-// "xD" is 0xd. The first byte of z is written as "16 + 0", just to be clear
-// that it's z that we're indexing.
-//
-// keyScheduleB deals with lines like:
-// K1 = S5[z8] ^ S6[z9] ^ S7[z7] ^ S8[z6] ^ S5[z2]
-// "K1" is ignored because key words are always written in order. So the five
-// elements are the S-box indexes. They use the same form as in keyScheduleA,
-// above.
-
-type keyScheduleRound struct{}
-type keySchedule []keyScheduleRound
-
-var schedule = []struct {
- a keyScheduleA
- b keyScheduleB
-}{
- {
- keyScheduleA{
- {4, 0, 0xd, 0xf, 0xc, 0xe, 0x8},
- {5, 2, 16 + 0, 16 + 2, 16 + 1, 16 + 3, 0xa},
- {6, 3, 16 + 7, 16 + 6, 16 + 5, 16 + 4, 9},
- {7, 1, 16 + 0xa, 16 + 9, 16 + 0xb, 16 + 8, 0xb},
- },
- keyScheduleB{
- {16 + 8, 16 + 9, 16 + 7, 16 + 6, 16 + 2},
- {16 + 0xa, 16 + 0xb, 16 + 5, 16 + 4, 16 + 6},
- {16 + 0xc, 16 + 0xd, 16 + 3, 16 + 2, 16 + 9},
- {16 + 0xe, 16 + 0xf, 16 + 1, 16 + 0, 16 + 0xc},
- },
- },
- {
- keyScheduleA{
- {0, 6, 16 + 5, 16 + 7, 16 + 4, 16 + 6, 16 + 0},
- {1, 4, 0, 2, 1, 3, 16 + 2},
- {2, 5, 7, 6, 5, 4, 16 + 1},
- {3, 7, 0xa, 9, 0xb, 8, 16 + 3},
- },
- keyScheduleB{
- {3, 2, 0xc, 0xd, 8},
- {1, 0, 0xe, 0xf, 0xd},
- {7, 6, 8, 9, 3},
- {5, 4, 0xa, 0xb, 7},
- },
- },
- {
- keyScheduleA{
- {4, 0, 0xd, 0xf, 0xc, 0xe, 8},
- {5, 2, 16 + 0, 16 + 2, 16 + 1, 16 + 3, 0xa},
- {6, 3, 16 + 7, 16 + 6, 16 + 5, 16 + 4, 9},
- {7, 1, 16 + 0xa, 16 + 9, 16 + 0xb, 16 + 8, 0xb},
- },
- keyScheduleB{
- {16 + 3, 16 + 2, 16 + 0xc, 16 + 0xd, 16 + 9},
- {16 + 1, 16 + 0, 16 + 0xe, 16 + 0xf, 16 + 0xc},
- {16 + 7, 16 + 6, 16 + 8, 16 + 9, 16 + 2},
- {16 + 5, 16 + 4, 16 + 0xa, 16 + 0xb, 16 + 6},
- },
- },
- {
- keyScheduleA{
- {0, 6, 16 + 5, 16 + 7, 16 + 4, 16 + 6, 16 + 0},
- {1, 4, 0, 2, 1, 3, 16 + 2},
- {2, 5, 7, 6, 5, 4, 16 + 1},
- {3, 7, 0xa, 9, 0xb, 8, 16 + 3},
- },
- keyScheduleB{
- {8, 9, 7, 6, 3},
- {0xa, 0xb, 5, 4, 7},
- {0xc, 0xd, 3, 2, 8},
- {0xe, 0xf, 1, 0, 0xd},
- },
- },
-}
-
-func (c *Cipher) keySchedule(in []byte) {
- var t [8]uint32
- var k [32]uint32
-
- for i := 0; i < 4; i++ {
- j := i * 4
- t[i] = uint32(in[j])<<24 | uint32(in[j+1])<<16 | uint32(in[j+2])<<8 | uint32(in[j+3])
- }
-
- x := []byte{6, 7, 4, 5}
- ki := 0
-
- for half := 0; half < 2; half++ {
- for _, round := range schedule {
- for j := 0; j < 4; j++ {
- var a [7]uint8
- copy(a[:], round.a[j][:])
- w := t[a[1]]
- w ^= sBox[4][(t[a[2]>>2]>>(24-8*(a[2]&3)))&0xff]
- w ^= sBox[5][(t[a[3]>>2]>>(24-8*(a[3]&3)))&0xff]
- w ^= sBox[6][(t[a[4]>>2]>>(24-8*(a[4]&3)))&0xff]
- w ^= sBox[7][(t[a[5]>>2]>>(24-8*(a[5]&3)))&0xff]
- w ^= sBox[x[j]][(t[a[6]>>2]>>(24-8*(a[6]&3)))&0xff]
- t[a[0]] = w
- }
-
- for j := 0; j < 4; j++ {
- var b [5]uint8
- copy(b[:], round.b[j][:])
- w := sBox[4][(t[b[0]>>2]>>(24-8*(b[0]&3)))&0xff]
- w ^= sBox[5][(t[b[1]>>2]>>(24-8*(b[1]&3)))&0xff]
- w ^= sBox[6][(t[b[2]>>2]>>(24-8*(b[2]&3)))&0xff]
- w ^= sBox[7][(t[b[3]>>2]>>(24-8*(b[3]&3)))&0xff]
- w ^= sBox[4+j][(t[b[4]>>2]>>(24-8*(b[4]&3)))&0xff]
- k[ki] = w
- ki++
- }
- }
- }
-
- for i := 0; i < 16; i++ {
- c.masking[i] = k[i]
- c.rotate[i] = uint8(k[16+i] & 0x1f)
- }
-}
-
-// These are the three 'f' functions. See RFC 2144, section 2.2.
-func f1(d, m uint32, r uint8) uint32 {
- t := m + d
- I := (t << r) | (t >> (32 - r))
- return ((sBox[0][I>>24] ^ sBox[1][(I>>16)&0xff]) - sBox[2][(I>>8)&0xff]) + sBox[3][I&0xff]
-}
-
-func f2(d, m uint32, r uint8) uint32 {
- t := m ^ d
- I := (t << r) | (t >> (32 - r))
- return ((sBox[0][I>>24] - sBox[1][(I>>16)&0xff]) + sBox[2][(I>>8)&0xff]) ^ sBox[3][I&0xff]
-}
-
-func f3(d, m uint32, r uint8) uint32 {
- t := m - d
- I := (t << r) | (t >> (32 - r))
- return ((sBox[0][I>>24] + sBox[1][(I>>16)&0xff]) ^ sBox[2][(I>>8)&0xff]) - sBox[3][I&0xff]
-}
-
-var sBox = [8][256]uint32{
- {
- 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f, 0x9c004dd3, 0x6003e540, 0xcf9fc949,
- 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0, 0x15c361d2, 0xc2e7661d, 0x22d4ff8e,
- 0x28683b6f, 0xc07fd059, 0xff2379c8, 0x775f50e2, 0x43c340d3, 0xdf2f8656, 0x887ca41a, 0xa2d2bd2d,
- 0xa1c9e0d6, 0x346c4819, 0x61b76d87, 0x22540f2f, 0x2abe32e1, 0xaa54166b, 0x22568e3a, 0xa2d341d0,
- 0x66db40c8, 0xa784392f, 0x004dff2f, 0x2db9d2de, 0x97943fac, 0x4a97c1d8, 0x527644b7, 0xb5f437a7,
- 0xb82cbaef, 0xd751d159, 0x6ff7f0ed, 0x5a097a1f, 0x827b68d0, 0x90ecf52e, 0x22b0c054, 0xbc8e5935,
- 0x4b6d2f7f, 0x50bb64a2, 0xd2664910, 0xbee5812d, 0xb7332290, 0xe93b159f, 0xb48ee411, 0x4bff345d,
- 0xfd45c240, 0xad31973f, 0xc4f6d02e, 0x55fc8165, 0xd5b1caad, 0xa1ac2dae, 0xa2d4b76d, 0xc19b0c50,
- 0x882240f2, 0x0c6e4f38, 0xa4e4bfd7, 0x4f5ba272, 0x564c1d2f, 0xc59c5319, 0xb949e354, 0xb04669fe,
- 0xb1b6ab8a, 0xc71358dd, 0x6385c545, 0x110f935d, 0x57538ad5, 0x6a390493, 0xe63d37e0, 0x2a54f6b3,
- 0x3a787d5f, 0x6276a0b5, 0x19a6fcdf, 0x7a42206a, 0x29f9d4d5, 0xf61b1891, 0xbb72275e, 0xaa508167,
- 0x38901091, 0xc6b505eb, 0x84c7cb8c, 0x2ad75a0f, 0x874a1427, 0xa2d1936b, 0x2ad286af, 0xaa56d291,
- 0xd7894360, 0x425c750d, 0x93b39e26, 0x187184c9, 0x6c00b32d, 0x73e2bb14, 0xa0bebc3c, 0x54623779,
- 0x64459eab, 0x3f328b82, 0x7718cf82, 0x59a2cea6, 0x04ee002e, 0x89fe78e6, 0x3fab0950, 0x325ff6c2,
- 0x81383f05, 0x6963c5c8, 0x76cb5ad6, 0xd49974c9, 0xca180dcf, 0x380782d5, 0xc7fa5cf6, 0x8ac31511,
- 0x35e79e13, 0x47da91d0, 0xf40f9086, 0xa7e2419e, 0x31366241, 0x051ef495, 0xaa573b04, 0x4a805d8d,
- 0x548300d0, 0x00322a3c, 0xbf64cddf, 0xba57a68e, 0x75c6372b, 0x50afd341, 0xa7c13275, 0x915a0bf5,
- 0x6b54bfab, 0x2b0b1426, 0xab4cc9d7, 0x449ccd82, 0xf7fbf265, 0xab85c5f3, 0x1b55db94, 0xaad4e324,
- 0xcfa4bd3f, 0x2deaa3e2, 0x9e204d02, 0xc8bd25ac, 0xeadf55b3, 0xd5bd9e98, 0xe31231b2, 0x2ad5ad6c,
- 0x954329de, 0xadbe4528, 0xd8710f69, 0xaa51c90f, 0xaa786bf6, 0x22513f1e, 0xaa51a79b, 0x2ad344cc,
- 0x7b5a41f0, 0xd37cfbad, 0x1b069505, 0x41ece491, 0xb4c332e6, 0x032268d4, 0xc9600acc, 0xce387e6d,
- 0xbf6bb16c, 0x6a70fb78, 0x0d03d9c9, 0xd4df39de, 0xe01063da, 0x4736f464, 0x5ad328d8, 0xb347cc96,
- 0x75bb0fc3, 0x98511bfb, 0x4ffbcc35, 0xb58bcf6a, 0xe11f0abc, 0xbfc5fe4a, 0xa70aec10, 0xac39570a,
- 0x3f04442f, 0x6188b153, 0xe0397a2e, 0x5727cb79, 0x9ceb418f, 0x1cacd68d, 0x2ad37c96, 0x0175cb9d,
- 0xc69dff09, 0xc75b65f0, 0xd9db40d8, 0xec0e7779, 0x4744ead4, 0xb11c3274, 0xdd24cb9e, 0x7e1c54bd,
- 0xf01144f9, 0xd2240eb1, 0x9675b3fd, 0xa3ac3755, 0xd47c27af, 0x51c85f4d, 0x56907596, 0xa5bb15e6,
- 0x580304f0, 0xca042cf1, 0x011a37ea, 0x8dbfaadb, 0x35ba3e4a, 0x3526ffa0, 0xc37b4d09, 0xbc306ed9,
- 0x98a52666, 0x5648f725, 0xff5e569d, 0x0ced63d0, 0x7c63b2cf, 0x700b45e1, 0xd5ea50f1, 0x85a92872,
- 0xaf1fbda7, 0xd4234870, 0xa7870bf3, 0x2d3b4d79, 0x42e04198, 0x0cd0ede7, 0x26470db8, 0xf881814c,
- 0x474d6ad7, 0x7c0c5e5c, 0xd1231959, 0x381b7298, 0xf5d2f4db, 0xab838653, 0x6e2f1e23, 0x83719c9e,
- 0xbd91e046, 0x9a56456e, 0xdc39200c, 0x20c8c571, 0x962bda1c, 0xe1e696ff, 0xb141ab08, 0x7cca89b9,
- 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c, 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf,
- },
- {
- 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a, 0xeec5207a, 0x55889c94, 0x72fc0651,
- 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef, 0x5f0c0794, 0x18dcdb7d, 0xa1d6eff3,
- 0xa0b52f7b, 0x59e83605, 0xee15b094, 0xe9ffd909, 0xdc440086, 0xef944459, 0xba83ccb3, 0xe0c3cdfb,
- 0xd1da4181, 0x3b092ab1, 0xf997f1c1, 0xa5e6cf7b, 0x01420ddb, 0xe4e7ef5b, 0x25a1ff41, 0xe180f806,
- 0x1fc41080, 0x179bee7a, 0xd37ac6a9, 0xfe5830a4, 0x98de8b7f, 0x77e83f4e, 0x79929269, 0x24fa9f7b,
- 0xe113c85b, 0xacc40083, 0xd7503525, 0xf7ea615f, 0x62143154, 0x0d554b63, 0x5d681121, 0xc866c359,
- 0x3d63cf73, 0xcee234c0, 0xd4d87e87, 0x5c672b21, 0x071f6181, 0x39f7627f, 0x361e3084, 0xe4eb573b,
- 0x602f64a4, 0xd63acd9c, 0x1bbc4635, 0x9e81032d, 0x2701f50c, 0x99847ab4, 0xa0e3df79, 0xba6cf38c,
- 0x10843094, 0x2537a95e, 0xf46f6ffe, 0xa1ff3b1f, 0x208cfb6a, 0x8f458c74, 0xd9e0a227, 0x4ec73a34,
- 0xfc884f69, 0x3e4de8df, 0xef0e0088, 0x3559648d, 0x8a45388c, 0x1d804366, 0x721d9bfd, 0xa58684bb,
- 0xe8256333, 0x844e8212, 0x128d8098, 0xfed33fb4, 0xce280ae1, 0x27e19ba5, 0xd5a6c252, 0xe49754bd,
- 0xc5d655dd, 0xeb667064, 0x77840b4d, 0xa1b6a801, 0x84db26a9, 0xe0b56714, 0x21f043b7, 0xe5d05860,
- 0x54f03084, 0x066ff472, 0xa31aa153, 0xdadc4755, 0xb5625dbf, 0x68561be6, 0x83ca6b94, 0x2d6ed23b,
- 0xeccf01db, 0xa6d3d0ba, 0xb6803d5c, 0xaf77a709, 0x33b4a34c, 0x397bc8d6, 0x5ee22b95, 0x5f0e5304,
- 0x81ed6f61, 0x20e74364, 0xb45e1378, 0xde18639b, 0x881ca122, 0xb96726d1, 0x8049a7e8, 0x22b7da7b,
- 0x5e552d25, 0x5272d237, 0x79d2951c, 0xc60d894c, 0x488cb402, 0x1ba4fe5b, 0xa4b09f6b, 0x1ca815cf,
- 0xa20c3005, 0x8871df63, 0xb9de2fcb, 0x0cc6c9e9, 0x0beeff53, 0xe3214517, 0xb4542835, 0x9f63293c,
- 0xee41e729, 0x6e1d2d7c, 0x50045286, 0x1e6685f3, 0xf33401c6, 0x30a22c95, 0x31a70850, 0x60930f13,
- 0x73f98417, 0xa1269859, 0xec645c44, 0x52c877a9, 0xcdff33a6, 0xa02b1741, 0x7cbad9a2, 0x2180036f,
- 0x50d99c08, 0xcb3f4861, 0xc26bd765, 0x64a3f6ab, 0x80342676, 0x25a75e7b, 0xe4e6d1fc, 0x20c710e6,
- 0xcdf0b680, 0x17844d3b, 0x31eef84d, 0x7e0824e4, 0x2ccb49eb, 0x846a3bae, 0x8ff77888, 0xee5d60f6,
- 0x7af75673, 0x2fdd5cdb, 0xa11631c1, 0x30f66f43, 0xb3faec54, 0x157fd7fa, 0xef8579cc, 0xd152de58,
- 0xdb2ffd5e, 0x8f32ce19, 0x306af97a, 0x02f03ef8, 0x99319ad5, 0xc242fa0f, 0xa7e3ebb0, 0xc68e4906,
- 0xb8da230c, 0x80823028, 0xdcdef3c8, 0xd35fb171, 0x088a1bc8, 0xbec0c560, 0x61a3c9e8, 0xbca8f54d,
- 0xc72feffa, 0x22822e99, 0x82c570b4, 0xd8d94e89, 0x8b1c34bc, 0x301e16e6, 0x273be979, 0xb0ffeaa6,
- 0x61d9b8c6, 0x00b24869, 0xb7ffce3f, 0x08dc283b, 0x43daf65a, 0xf7e19798, 0x7619b72f, 0x8f1c9ba4,
- 0xdc8637a0, 0x16a7d3b1, 0x9fc393b7, 0xa7136eeb, 0xc6bcc63e, 0x1a513742, 0xef6828bc, 0x520365d6,
- 0x2d6a77ab, 0x3527ed4b, 0x821fd216, 0x095c6e2e, 0xdb92f2fb, 0x5eea29cb, 0x145892f5, 0x91584f7f,
- 0x5483697b, 0x2667a8cc, 0x85196048, 0x8c4bacea, 0x833860d4, 0x0d23e0f9, 0x6c387e8a, 0x0ae6d249,
- 0xb284600c, 0xd835731d, 0xdcb1c647, 0xac4c56ea, 0x3ebd81b3, 0x230eabb0, 0x6438bc87, 0xf0b5b1fa,
- 0x8f5ea2b3, 0xfc184642, 0x0a036b7a, 0x4fb089bd, 0x649da589, 0xa345415e, 0x5c038323, 0x3e5d3bb9,
- 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539, 0x73bfbe70, 0x83877605, 0x4523ecf1,
- },
- {
- 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff, 0x369fe44b, 0x8c1fc644, 0xaececa90,
- 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806, 0xf0ad0548, 0xe13c8d83, 0x927010d5,
- 0x11107d9f, 0x07647db9, 0xb2e3e4d4, 0x3d4f285e, 0xb9afa820, 0xfade82e0, 0xa067268b, 0x8272792e,
- 0x553fb2c0, 0x489ae22b, 0xd4ef9794, 0x125e3fbc, 0x21fffcee, 0x825b1bfd, 0x9255c5ed, 0x1257a240,
- 0x4e1a8302, 0xbae07fff, 0x528246e7, 0x8e57140e, 0x3373f7bf, 0x8c9f8188, 0xa6fc4ee8, 0xc982b5a5,
- 0xa8c01db7, 0x579fc264, 0x67094f31, 0xf2bd3f5f, 0x40fff7c1, 0x1fb78dfc, 0x8e6bd2c1, 0x437be59b,
- 0x99b03dbf, 0xb5dbc64b, 0x638dc0e6, 0x55819d99, 0xa197c81c, 0x4a012d6e, 0xc5884a28, 0xccc36f71,
- 0xb843c213, 0x6c0743f1, 0x8309893c, 0x0feddd5f, 0x2f7fe850, 0xd7c07f7e, 0x02507fbf, 0x5afb9a04,
- 0xa747d2d0, 0x1651192e, 0xaf70bf3e, 0x58c31380, 0x5f98302e, 0x727cc3c4, 0x0a0fb402, 0x0f7fef82,
- 0x8c96fdad, 0x5d2c2aae, 0x8ee99a49, 0x50da88b8, 0x8427f4a0, 0x1eac5790, 0x796fb449, 0x8252dc15,
- 0xefbd7d9b, 0xa672597d, 0xada840d8, 0x45f54504, 0xfa5d7403, 0xe83ec305, 0x4f91751a, 0x925669c2,
- 0x23efe941, 0xa903f12e, 0x60270df2, 0x0276e4b6, 0x94fd6574, 0x927985b2, 0x8276dbcb, 0x02778176,
- 0xf8af918d, 0x4e48f79e, 0x8f616ddf, 0xe29d840e, 0x842f7d83, 0x340ce5c8, 0x96bbb682, 0x93b4b148,
- 0xef303cab, 0x984faf28, 0x779faf9b, 0x92dc560d, 0x224d1e20, 0x8437aa88, 0x7d29dc96, 0x2756d3dc,
- 0x8b907cee, 0xb51fd240, 0xe7c07ce3, 0xe566b4a1, 0xc3e9615e, 0x3cf8209d, 0x6094d1e3, 0xcd9ca341,
- 0x5c76460e, 0x00ea983b, 0xd4d67881, 0xfd47572c, 0xf76cedd9, 0xbda8229c, 0x127dadaa, 0x438a074e,
- 0x1f97c090, 0x081bdb8a, 0x93a07ebe, 0xb938ca15, 0x97b03cff, 0x3dc2c0f8, 0x8d1ab2ec, 0x64380e51,
- 0x68cc7bfb, 0xd90f2788, 0x12490181, 0x5de5ffd4, 0xdd7ef86a, 0x76a2e214, 0xb9a40368, 0x925d958f,
- 0x4b39fffa, 0xba39aee9, 0xa4ffd30b, 0xfaf7933b, 0x6d498623, 0x193cbcfa, 0x27627545, 0x825cf47a,
- 0x61bd8ba0, 0xd11e42d1, 0xcead04f4, 0x127ea392, 0x10428db7, 0x8272a972, 0x9270c4a8, 0x127de50b,
- 0x285ba1c8, 0x3c62f44f, 0x35c0eaa5, 0xe805d231, 0x428929fb, 0xb4fcdf82, 0x4fb66a53, 0x0e7dc15b,
- 0x1f081fab, 0x108618ae, 0xfcfd086d, 0xf9ff2889, 0x694bcc11, 0x236a5cae, 0x12deca4d, 0x2c3f8cc5,
- 0xd2d02dfe, 0xf8ef5896, 0xe4cf52da, 0x95155b67, 0x494a488c, 0xb9b6a80c, 0x5c8f82bc, 0x89d36b45,
- 0x3a609437, 0xec00c9a9, 0x44715253, 0x0a874b49, 0xd773bc40, 0x7c34671c, 0x02717ef6, 0x4feb5536,
- 0xa2d02fff, 0xd2bf60c4, 0xd43f03c0, 0x50b4ef6d, 0x07478cd1, 0x006e1888, 0xa2e53f55, 0xb9e6d4bc,
- 0xa2048016, 0x97573833, 0xd7207d67, 0xde0f8f3d, 0x72f87b33, 0xabcc4f33, 0x7688c55d, 0x7b00a6b0,
- 0x947b0001, 0x570075d2, 0xf9bb88f8, 0x8942019e, 0x4264a5ff, 0x856302e0, 0x72dbd92b, 0xee971b69,
- 0x6ea22fde, 0x5f08ae2b, 0xaf7a616d, 0xe5c98767, 0xcf1febd2, 0x61efc8c2, 0xf1ac2571, 0xcc8239c2,
- 0x67214cb8, 0xb1e583d1, 0xb7dc3e62, 0x7f10bdce, 0xf90a5c38, 0x0ff0443d, 0x606e6dc6, 0x60543a49,
- 0x5727c148, 0x2be98a1d, 0x8ab41738, 0x20e1be24, 0xaf96da0f, 0x68458425, 0x99833be5, 0x600d457d,
- 0x282f9350, 0x8334b362, 0xd91d1120, 0x2b6d8da0, 0x642b1e31, 0x9c305a00, 0x52bce688, 0x1b03588a,
- 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636, 0xa133c501, 0xe9d3531c, 0xee353783,
- },
- {
- 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb, 0x64ad8c57, 0x85510443, 0xfa020ed1,
- 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43, 0x6497b7b1, 0xf3641f63, 0x241e4adf,
- 0x28147f5f, 0x4fa2b8cd, 0xc9430040, 0x0cc32220, 0xfdd30b30, 0xc0a5374f, 0x1d2d00d9, 0x24147b15,
- 0xee4d111a, 0x0fca5167, 0x71ff904c, 0x2d195ffe, 0x1a05645f, 0x0c13fefe, 0x081b08ca, 0x05170121,
- 0x80530100, 0xe83e5efe, 0xac9af4f8, 0x7fe72701, 0xd2b8ee5f, 0x06df4261, 0xbb9e9b8a, 0x7293ea25,
- 0xce84ffdf, 0xf5718801, 0x3dd64b04, 0xa26f263b, 0x7ed48400, 0x547eebe6, 0x446d4ca0, 0x6cf3d6f5,
- 0x2649abdf, 0xaea0c7f5, 0x36338cc1, 0x503f7e93, 0xd3772061, 0x11b638e1, 0x72500e03, 0xf80eb2bb,
- 0xabe0502e, 0xec8d77de, 0x57971e81, 0xe14f6746, 0xc9335400, 0x6920318f, 0x081dbb99, 0xffc304a5,
- 0x4d351805, 0x7f3d5ce3, 0xa6c866c6, 0x5d5bcca9, 0xdaec6fea, 0x9f926f91, 0x9f46222f, 0x3991467d,
- 0xa5bf6d8e, 0x1143c44f, 0x43958302, 0xd0214eeb, 0x022083b8, 0x3fb6180c, 0x18f8931e, 0x281658e6,
- 0x26486e3e, 0x8bd78a70, 0x7477e4c1, 0xb506e07c, 0xf32d0a25, 0x79098b02, 0xe4eabb81, 0x28123b23,
- 0x69dead38, 0x1574ca16, 0xdf871b62, 0x211c40b7, 0xa51a9ef9, 0x0014377b, 0x041e8ac8, 0x09114003,
- 0xbd59e4d2, 0xe3d156d5, 0x4fe876d5, 0x2f91a340, 0x557be8de, 0x00eae4a7, 0x0ce5c2ec, 0x4db4bba6,
- 0xe756bdff, 0xdd3369ac, 0xec17b035, 0x06572327, 0x99afc8b0, 0x56c8c391, 0x6b65811c, 0x5e146119,
- 0x6e85cb75, 0xbe07c002, 0xc2325577, 0x893ff4ec, 0x5bbfc92d, 0xd0ec3b25, 0xb7801ab7, 0x8d6d3b24,
- 0x20c763ef, 0xc366a5fc, 0x9c382880, 0x0ace3205, 0xaac9548a, 0xeca1d7c7, 0x041afa32, 0x1d16625a,
- 0x6701902c, 0x9b757a54, 0x31d477f7, 0x9126b031, 0x36cc6fdb, 0xc70b8b46, 0xd9e66a48, 0x56e55a79,
- 0x026a4ceb, 0x52437eff, 0x2f8f76b4, 0x0df980a5, 0x8674cde3, 0xedda04eb, 0x17a9be04, 0x2c18f4df,
- 0xb7747f9d, 0xab2af7b4, 0xefc34d20, 0x2e096b7c, 0x1741a254, 0xe5b6a035, 0x213d42f6, 0x2c1c7c26,
- 0x61c2f50f, 0x6552daf9, 0xd2c231f8, 0x25130f69, 0xd8167fa2, 0x0418f2c8, 0x001a96a6, 0x0d1526ab,
- 0x63315c21, 0x5e0a72ec, 0x49bafefd, 0x187908d9, 0x8d0dbd86, 0x311170a7, 0x3e9b640c, 0xcc3e10d7,
- 0xd5cad3b6, 0x0caec388, 0xf73001e1, 0x6c728aff, 0x71eae2a1, 0x1f9af36e, 0xcfcbd12f, 0xc1de8417,
- 0xac07be6b, 0xcb44a1d8, 0x8b9b0f56, 0x013988c3, 0xb1c52fca, 0xb4be31cd, 0xd8782806, 0x12a3a4e2,
- 0x6f7de532, 0x58fd7eb6, 0xd01ee900, 0x24adffc2, 0xf4990fc5, 0x9711aac5, 0x001d7b95, 0x82e5e7d2,
- 0x109873f6, 0x00613096, 0xc32d9521, 0xada121ff, 0x29908415, 0x7fbb977f, 0xaf9eb3db, 0x29c9ed2a,
- 0x5ce2a465, 0xa730f32c, 0xd0aa3fe8, 0x8a5cc091, 0xd49e2ce7, 0x0ce454a9, 0xd60acd86, 0x015f1919,
- 0x77079103, 0xdea03af6, 0x78a8565e, 0xdee356df, 0x21f05cbe, 0x8b75e387, 0xb3c50651, 0xb8a5c3ef,
- 0xd8eeb6d2, 0xe523be77, 0xc2154529, 0x2f69efdf, 0xafe67afb, 0xf470c4b2, 0xf3e0eb5b, 0xd6cc9876,
- 0x39e4460c, 0x1fda8538, 0x1987832f, 0xca007367, 0xa99144f8, 0x296b299e, 0x492fc295, 0x9266beab,
- 0xb5676e69, 0x9bd3ddda, 0xdf7e052f, 0xdb25701c, 0x1b5e51ee, 0xf65324e6, 0x6afce36c, 0x0316cc04,
- 0x8644213e, 0xb7dc59d0, 0x7965291f, 0xccd6fd43, 0x41823979, 0x932bcdf6, 0xb657c34d, 0x4edfd282,
- 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0, 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2,
- },
- {
- 0x7ec90c04, 0x2c6e74b9, 0x9b0e66df, 0xa6337911, 0xb86a7fff, 0x1dd358f5, 0x44dd9d44, 0x1731167f,
- 0x08fbf1fa, 0xe7f511cc, 0xd2051b00, 0x735aba00, 0x2ab722d8, 0x386381cb, 0xacf6243a, 0x69befd7a,
- 0xe6a2e77f, 0xf0c720cd, 0xc4494816, 0xccf5c180, 0x38851640, 0x15b0a848, 0xe68b18cb, 0x4caadeff,
- 0x5f480a01, 0x0412b2aa, 0x259814fc, 0x41d0efe2, 0x4e40b48d, 0x248eb6fb, 0x8dba1cfe, 0x41a99b02,
- 0x1a550a04, 0xba8f65cb, 0x7251f4e7, 0x95a51725, 0xc106ecd7, 0x97a5980a, 0xc539b9aa, 0x4d79fe6a,
- 0xf2f3f763, 0x68af8040, 0xed0c9e56, 0x11b4958b, 0xe1eb5a88, 0x8709e6b0, 0xd7e07156, 0x4e29fea7,
- 0x6366e52d, 0x02d1c000, 0xc4ac8e05, 0x9377f571, 0x0c05372a, 0x578535f2, 0x2261be02, 0xd642a0c9,
- 0xdf13a280, 0x74b55bd2, 0x682199c0, 0xd421e5ec, 0x53fb3ce8, 0xc8adedb3, 0x28a87fc9, 0x3d959981,
- 0x5c1ff900, 0xfe38d399, 0x0c4eff0b, 0x062407ea, 0xaa2f4fb1, 0x4fb96976, 0x90c79505, 0xb0a8a774,
- 0xef55a1ff, 0xe59ca2c2, 0xa6b62d27, 0xe66a4263, 0xdf65001f, 0x0ec50966, 0xdfdd55bc, 0x29de0655,
- 0x911e739a, 0x17af8975, 0x32c7911c, 0x89f89468, 0x0d01e980, 0x524755f4, 0x03b63cc9, 0x0cc844b2,
- 0xbcf3f0aa, 0x87ac36e9, 0xe53a7426, 0x01b3d82b, 0x1a9e7449, 0x64ee2d7e, 0xcddbb1da, 0x01c94910,
- 0xb868bf80, 0x0d26f3fd, 0x9342ede7, 0x04a5c284, 0x636737b6, 0x50f5b616, 0xf24766e3, 0x8eca36c1,
- 0x136e05db, 0xfef18391, 0xfb887a37, 0xd6e7f7d4, 0xc7fb7dc9, 0x3063fcdf, 0xb6f589de, 0xec2941da,
- 0x26e46695, 0xb7566419, 0xf654efc5, 0xd08d58b7, 0x48925401, 0xc1bacb7f, 0xe5ff550f, 0xb6083049,
- 0x5bb5d0e8, 0x87d72e5a, 0xab6a6ee1, 0x223a66ce, 0xc62bf3cd, 0x9e0885f9, 0x68cb3e47, 0x086c010f,
- 0xa21de820, 0xd18b69de, 0xf3f65777, 0xfa02c3f6, 0x407edac3, 0xcbb3d550, 0x1793084d, 0xb0d70eba,
- 0x0ab378d5, 0xd951fb0c, 0xded7da56, 0x4124bbe4, 0x94ca0b56, 0x0f5755d1, 0xe0e1e56e, 0x6184b5be,
- 0x580a249f, 0x94f74bc0, 0xe327888e, 0x9f7b5561, 0xc3dc0280, 0x05687715, 0x646c6bd7, 0x44904db3,
- 0x66b4f0a3, 0xc0f1648a, 0x697ed5af, 0x49e92ff6, 0x309e374f, 0x2cb6356a, 0x85808573, 0x4991f840,
- 0x76f0ae02, 0x083be84d, 0x28421c9a, 0x44489406, 0x736e4cb8, 0xc1092910, 0x8bc95fc6, 0x7d869cf4,
- 0x134f616f, 0x2e77118d, 0xb31b2be1, 0xaa90b472, 0x3ca5d717, 0x7d161bba, 0x9cad9010, 0xaf462ba2,
- 0x9fe459d2, 0x45d34559, 0xd9f2da13, 0xdbc65487, 0xf3e4f94e, 0x176d486f, 0x097c13ea, 0x631da5c7,
- 0x445f7382, 0x175683f4, 0xcdc66a97, 0x70be0288, 0xb3cdcf72, 0x6e5dd2f3, 0x20936079, 0x459b80a5,
- 0xbe60e2db, 0xa9c23101, 0xeba5315c, 0x224e42f2, 0x1c5c1572, 0xf6721b2c, 0x1ad2fff3, 0x8c25404e,
- 0x324ed72f, 0x4067b7fd, 0x0523138e, 0x5ca3bc78, 0xdc0fd66e, 0x75922283, 0x784d6b17, 0x58ebb16e,
- 0x44094f85, 0x3f481d87, 0xfcfeae7b, 0x77b5ff76, 0x8c2302bf, 0xaaf47556, 0x5f46b02a, 0x2b092801,
- 0x3d38f5f7, 0x0ca81f36, 0x52af4a8a, 0x66d5e7c0, 0xdf3b0874, 0x95055110, 0x1b5ad7a8, 0xf61ed5ad,
- 0x6cf6e479, 0x20758184, 0xd0cefa65, 0x88f7be58, 0x4a046826, 0x0ff6f8f3, 0xa09c7f70, 0x5346aba0,
- 0x5ce96c28, 0xe176eda3, 0x6bac307f, 0x376829d2, 0x85360fa9, 0x17e3fe2a, 0x24b79767, 0xf5a96b20,
- 0xd6cd2595, 0x68ff1ebf, 0x7555442c, 0xf19f06be, 0xf9e0659a, 0xeeb9491d, 0x34010718, 0xbb30cab8,
- 0xe822fe15, 0x88570983, 0x750e6249, 0xda627e55, 0x5e76ffa8, 0xb1534546, 0x6d47de08, 0xefe9e7d4,
- },
- {
- 0xf6fa8f9d, 0x2cac6ce1, 0x4ca34867, 0xe2337f7c, 0x95db08e7, 0x016843b4, 0xeced5cbc, 0x325553ac,
- 0xbf9f0960, 0xdfa1e2ed, 0x83f0579d, 0x63ed86b9, 0x1ab6a6b8, 0xde5ebe39, 0xf38ff732, 0x8989b138,
- 0x33f14961, 0xc01937bd, 0xf506c6da, 0xe4625e7e, 0xa308ea99, 0x4e23e33c, 0x79cbd7cc, 0x48a14367,
- 0xa3149619, 0xfec94bd5, 0xa114174a, 0xeaa01866, 0xa084db2d, 0x09a8486f, 0xa888614a, 0x2900af98,
- 0x01665991, 0xe1992863, 0xc8f30c60, 0x2e78ef3c, 0xd0d51932, 0xcf0fec14, 0xf7ca07d2, 0xd0a82072,
- 0xfd41197e, 0x9305a6b0, 0xe86be3da, 0x74bed3cd, 0x372da53c, 0x4c7f4448, 0xdab5d440, 0x6dba0ec3,
- 0x083919a7, 0x9fbaeed9, 0x49dbcfb0, 0x4e670c53, 0x5c3d9c01, 0x64bdb941, 0x2c0e636a, 0xba7dd9cd,
- 0xea6f7388, 0xe70bc762, 0x35f29adb, 0x5c4cdd8d, 0xf0d48d8c, 0xb88153e2, 0x08a19866, 0x1ae2eac8,
- 0x284caf89, 0xaa928223, 0x9334be53, 0x3b3a21bf, 0x16434be3, 0x9aea3906, 0xefe8c36e, 0xf890cdd9,
- 0x80226dae, 0xc340a4a3, 0xdf7e9c09, 0xa694a807, 0x5b7c5ecc, 0x221db3a6, 0x9a69a02f, 0x68818a54,
- 0xceb2296f, 0x53c0843a, 0xfe893655, 0x25bfe68a, 0xb4628abc, 0xcf222ebf, 0x25ac6f48, 0xa9a99387,
- 0x53bddb65, 0xe76ffbe7, 0xe967fd78, 0x0ba93563, 0x8e342bc1, 0xe8a11be9, 0x4980740d, 0xc8087dfc,
- 0x8de4bf99, 0xa11101a0, 0x7fd37975, 0xda5a26c0, 0xe81f994f, 0x9528cd89, 0xfd339fed, 0xb87834bf,
- 0x5f04456d, 0x22258698, 0xc9c4c83b, 0x2dc156be, 0x4f628daa, 0x57f55ec5, 0xe2220abe, 0xd2916ebf,
- 0x4ec75b95, 0x24f2c3c0, 0x42d15d99, 0xcd0d7fa0, 0x7b6e27ff, 0xa8dc8af0, 0x7345c106, 0xf41e232f,
- 0x35162386, 0xe6ea8926, 0x3333b094, 0x157ec6f2, 0x372b74af, 0x692573e4, 0xe9a9d848, 0xf3160289,
- 0x3a62ef1d, 0xa787e238, 0xf3a5f676, 0x74364853, 0x20951063, 0x4576698d, 0xb6fad407, 0x592af950,
- 0x36f73523, 0x4cfb6e87, 0x7da4cec0, 0x6c152daa, 0xcb0396a8, 0xc50dfe5d, 0xfcd707ab, 0x0921c42f,
- 0x89dff0bb, 0x5fe2be78, 0x448f4f33, 0x754613c9, 0x2b05d08d, 0x48b9d585, 0xdc049441, 0xc8098f9b,
- 0x7dede786, 0xc39a3373, 0x42410005, 0x6a091751, 0x0ef3c8a6, 0x890072d6, 0x28207682, 0xa9a9f7be,
- 0xbf32679d, 0xd45b5b75, 0xb353fd00, 0xcbb0e358, 0x830f220a, 0x1f8fb214, 0xd372cf08, 0xcc3c4a13,
- 0x8cf63166, 0x061c87be, 0x88c98f88, 0x6062e397, 0x47cf8e7a, 0xb6c85283, 0x3cc2acfb, 0x3fc06976,
- 0x4e8f0252, 0x64d8314d, 0xda3870e3, 0x1e665459, 0xc10908f0, 0x513021a5, 0x6c5b68b7, 0x822f8aa0,
- 0x3007cd3e, 0x74719eef, 0xdc872681, 0x073340d4, 0x7e432fd9, 0x0c5ec241, 0x8809286c, 0xf592d891,
- 0x08a930f6, 0x957ef305, 0xb7fbffbd, 0xc266e96f, 0x6fe4ac98, 0xb173ecc0, 0xbc60b42a, 0x953498da,
- 0xfba1ae12, 0x2d4bd736, 0x0f25faab, 0xa4f3fceb, 0xe2969123, 0x257f0c3d, 0x9348af49, 0x361400bc,
- 0xe8816f4a, 0x3814f200, 0xa3f94043, 0x9c7a54c2, 0xbc704f57, 0xda41e7f9, 0xc25ad33a, 0x54f4a084,
- 0xb17f5505, 0x59357cbe, 0xedbd15c8, 0x7f97c5ab, 0xba5ac7b5, 0xb6f6deaf, 0x3a479c3a, 0x5302da25,
- 0x653d7e6a, 0x54268d49, 0x51a477ea, 0x5017d55b, 0xd7d25d88, 0x44136c76, 0x0404a8c8, 0xb8e5a121,
- 0xb81a928a, 0x60ed5869, 0x97c55b96, 0xeaec991b, 0x29935913, 0x01fdb7f1, 0x088e8dfa, 0x9ab6f6f5,
- 0x3b4cbf9f, 0x4a5de3ab, 0xe6051d35, 0xa0e1d855, 0xd36b4cf1, 0xf544edeb, 0xb0e93524, 0xbebb8fbd,
- 0xa2d762cf, 0x49c92f54, 0x38b5f331, 0x7128a454, 0x48392905, 0xa65b1db8, 0x851c97bd, 0xd675cf2f,
- },
- {
- 0x85e04019, 0x332bf567, 0x662dbfff, 0xcfc65693, 0x2a8d7f6f, 0xab9bc912, 0xde6008a1, 0x2028da1f,
- 0x0227bce7, 0x4d642916, 0x18fac300, 0x50f18b82, 0x2cb2cb11, 0xb232e75c, 0x4b3695f2, 0xb28707de,
- 0xa05fbcf6, 0xcd4181e9, 0xe150210c, 0xe24ef1bd, 0xb168c381, 0xfde4e789, 0x5c79b0d8, 0x1e8bfd43,
- 0x4d495001, 0x38be4341, 0x913cee1d, 0x92a79c3f, 0x089766be, 0xbaeeadf4, 0x1286becf, 0xb6eacb19,
- 0x2660c200, 0x7565bde4, 0x64241f7a, 0x8248dca9, 0xc3b3ad66, 0x28136086, 0x0bd8dfa8, 0x356d1cf2,
- 0x107789be, 0xb3b2e9ce, 0x0502aa8f, 0x0bc0351e, 0x166bf52a, 0xeb12ff82, 0xe3486911, 0xd34d7516,
- 0x4e7b3aff, 0x5f43671b, 0x9cf6e037, 0x4981ac83, 0x334266ce, 0x8c9341b7, 0xd0d854c0, 0xcb3a6c88,
- 0x47bc2829, 0x4725ba37, 0xa66ad22b, 0x7ad61f1e, 0x0c5cbafa, 0x4437f107, 0xb6e79962, 0x42d2d816,
- 0x0a961288, 0xe1a5c06e, 0x13749e67, 0x72fc081a, 0xb1d139f7, 0xf9583745, 0xcf19df58, 0xbec3f756,
- 0xc06eba30, 0x07211b24, 0x45c28829, 0xc95e317f, 0xbc8ec511, 0x38bc46e9, 0xc6e6fa14, 0xbae8584a,
- 0xad4ebc46, 0x468f508b, 0x7829435f, 0xf124183b, 0x821dba9f, 0xaff60ff4, 0xea2c4e6d, 0x16e39264,
- 0x92544a8b, 0x009b4fc3, 0xaba68ced, 0x9ac96f78, 0x06a5b79a, 0xb2856e6e, 0x1aec3ca9, 0xbe838688,
- 0x0e0804e9, 0x55f1be56, 0xe7e5363b, 0xb3a1f25d, 0xf7debb85, 0x61fe033c, 0x16746233, 0x3c034c28,
- 0xda6d0c74, 0x79aac56c, 0x3ce4e1ad, 0x51f0c802, 0x98f8f35a, 0x1626a49f, 0xeed82b29, 0x1d382fe3,
- 0x0c4fb99a, 0xbb325778, 0x3ec6d97b, 0x6e77a6a9, 0xcb658b5c, 0xd45230c7, 0x2bd1408b, 0x60c03eb7,
- 0xb9068d78, 0xa33754f4, 0xf430c87d, 0xc8a71302, 0xb96d8c32, 0xebd4e7be, 0xbe8b9d2d, 0x7979fb06,
- 0xe7225308, 0x8b75cf77, 0x11ef8da4, 0xe083c858, 0x8d6b786f, 0x5a6317a6, 0xfa5cf7a0, 0x5dda0033,
- 0xf28ebfb0, 0xf5b9c310, 0xa0eac280, 0x08b9767a, 0xa3d9d2b0, 0x79d34217, 0x021a718d, 0x9ac6336a,
- 0x2711fd60, 0x438050e3, 0x069908a8, 0x3d7fedc4, 0x826d2bef, 0x4eeb8476, 0x488dcf25, 0x36c9d566,
- 0x28e74e41, 0xc2610aca, 0x3d49a9cf, 0xbae3b9df, 0xb65f8de6, 0x92aeaf64, 0x3ac7d5e6, 0x9ea80509,
- 0xf22b017d, 0xa4173f70, 0xdd1e16c3, 0x15e0d7f9, 0x50b1b887, 0x2b9f4fd5, 0x625aba82, 0x6a017962,
- 0x2ec01b9c, 0x15488aa9, 0xd716e740, 0x40055a2c, 0x93d29a22, 0xe32dbf9a, 0x058745b9, 0x3453dc1e,
- 0xd699296e, 0x496cff6f, 0x1c9f4986, 0xdfe2ed07, 0xb87242d1, 0x19de7eae, 0x053e561a, 0x15ad6f8c,
- 0x66626c1c, 0x7154c24c, 0xea082b2a, 0x93eb2939, 0x17dcb0f0, 0x58d4f2ae, 0x9ea294fb, 0x52cf564c,
- 0x9883fe66, 0x2ec40581, 0x763953c3, 0x01d6692e, 0xd3a0c108, 0xa1e7160e, 0xe4f2dfa6, 0x693ed285,
- 0x74904698, 0x4c2b0edd, 0x4f757656, 0x5d393378, 0xa132234f, 0x3d321c5d, 0xc3f5e194, 0x4b269301,
- 0xc79f022f, 0x3c997e7e, 0x5e4f9504, 0x3ffafbbd, 0x76f7ad0e, 0x296693f4, 0x3d1fce6f, 0xc61e45be,
- 0xd3b5ab34, 0xf72bf9b7, 0x1b0434c0, 0x4e72b567, 0x5592a33d, 0xb5229301, 0xcfd2a87f, 0x60aeb767,
- 0x1814386b, 0x30bcc33d, 0x38a0c07d, 0xfd1606f2, 0xc363519b, 0x589dd390, 0x5479f8e6, 0x1cb8d647,
- 0x97fd61a9, 0xea7759f4, 0x2d57539d, 0x569a58cf, 0xe84e63ad, 0x462e1b78, 0x6580f87e, 0xf3817914,
- 0x91da55f4, 0x40a230f3, 0xd1988f35, 0xb6e318d2, 0x3ffa50bc, 0x3d40f021, 0xc3c0bdae, 0x4958c24c,
- 0x518f36b2, 0x84b1d370, 0x0fedce83, 0x878ddada, 0xf2a279c7, 0x94e01be8, 0x90716f4b, 0x954b8aa3,
- },
- {
- 0xe216300d, 0xbbddfffc, 0xa7ebdabd, 0x35648095, 0x7789f8b7, 0xe6c1121b, 0x0e241600, 0x052ce8b5,
- 0x11a9cfb0, 0xe5952f11, 0xece7990a, 0x9386d174, 0x2a42931c, 0x76e38111, 0xb12def3a, 0x37ddddfc,
- 0xde9adeb1, 0x0a0cc32c, 0xbe197029, 0x84a00940, 0xbb243a0f, 0xb4d137cf, 0xb44e79f0, 0x049eedfd,
- 0x0b15a15d, 0x480d3168, 0x8bbbde5a, 0x669ded42, 0xc7ece831, 0x3f8f95e7, 0x72df191b, 0x7580330d,
- 0x94074251, 0x5c7dcdfa, 0xabbe6d63, 0xaa402164, 0xb301d40a, 0x02e7d1ca, 0x53571dae, 0x7a3182a2,
- 0x12a8ddec, 0xfdaa335d, 0x176f43e8, 0x71fb46d4, 0x38129022, 0xce949ad4, 0xb84769ad, 0x965bd862,
- 0x82f3d055, 0x66fb9767, 0x15b80b4e, 0x1d5b47a0, 0x4cfde06f, 0xc28ec4b8, 0x57e8726e, 0x647a78fc,
- 0x99865d44, 0x608bd593, 0x6c200e03, 0x39dc5ff6, 0x5d0b00a3, 0xae63aff2, 0x7e8bd632, 0x70108c0c,
- 0xbbd35049, 0x2998df04, 0x980cf42a, 0x9b6df491, 0x9e7edd53, 0x06918548, 0x58cb7e07, 0x3b74ef2e,
- 0x522fffb1, 0xd24708cc, 0x1c7e27cd, 0xa4eb215b, 0x3cf1d2e2, 0x19b47a38, 0x424f7618, 0x35856039,
- 0x9d17dee7, 0x27eb35e6, 0xc9aff67b, 0x36baf5b8, 0x09c467cd, 0xc18910b1, 0xe11dbf7b, 0x06cd1af8,
- 0x7170c608, 0x2d5e3354, 0xd4de495a, 0x64c6d006, 0xbcc0c62c, 0x3dd00db3, 0x708f8f34, 0x77d51b42,
- 0x264f620f, 0x24b8d2bf, 0x15c1b79e, 0x46a52564, 0xf8d7e54e, 0x3e378160, 0x7895cda5, 0x859c15a5,
- 0xe6459788, 0xc37bc75f, 0xdb07ba0c, 0x0676a3ab, 0x7f229b1e, 0x31842e7b, 0x24259fd7, 0xf8bef472,
- 0x835ffcb8, 0x6df4c1f2, 0x96f5b195, 0xfd0af0fc, 0xb0fe134c, 0xe2506d3d, 0x4f9b12ea, 0xf215f225,
- 0xa223736f, 0x9fb4c428, 0x25d04979, 0x34c713f8, 0xc4618187, 0xea7a6e98, 0x7cd16efc, 0x1436876c,
- 0xf1544107, 0xbedeee14, 0x56e9af27, 0xa04aa441, 0x3cf7c899, 0x92ecbae6, 0xdd67016d, 0x151682eb,
- 0xa842eedf, 0xfdba60b4, 0xf1907b75, 0x20e3030f, 0x24d8c29e, 0xe139673b, 0xefa63fb8, 0x71873054,
- 0xb6f2cf3b, 0x9f326442, 0xcb15a4cc, 0xb01a4504, 0xf1e47d8d, 0x844a1be5, 0xbae7dfdc, 0x42cbda70,
- 0xcd7dae0a, 0x57e85b7a, 0xd53f5af6, 0x20cf4d8c, 0xcea4d428, 0x79d130a4, 0x3486ebfb, 0x33d3cddc,
- 0x77853b53, 0x37effcb5, 0xc5068778, 0xe580b3e6, 0x4e68b8f4, 0xc5c8b37e, 0x0d809ea2, 0x398feb7c,
- 0x132a4f94, 0x43b7950e, 0x2fee7d1c, 0x223613bd, 0xdd06caa2, 0x37df932b, 0xc4248289, 0xacf3ebc3,
- 0x5715f6b7, 0xef3478dd, 0xf267616f, 0xc148cbe4, 0x9052815e, 0x5e410fab, 0xb48a2465, 0x2eda7fa4,
- 0xe87b40e4, 0xe98ea084, 0x5889e9e1, 0xefd390fc, 0xdd07d35b, 0xdb485694, 0x38d7e5b2, 0x57720101,
- 0x730edebc, 0x5b643113, 0x94917e4f, 0x503c2fba, 0x646f1282, 0x7523d24a, 0xe0779695, 0xf9c17a8f,
- 0x7a5b2121, 0xd187b896, 0x29263a4d, 0xba510cdf, 0x81f47c9f, 0xad1163ed, 0xea7b5965, 0x1a00726e,
- 0x11403092, 0x00da6d77, 0x4a0cdd61, 0xad1f4603, 0x605bdfb0, 0x9eedc364, 0x22ebe6a8, 0xcee7d28a,
- 0xa0e736a0, 0x5564a6b9, 0x10853209, 0xc7eb8f37, 0x2de705ca, 0x8951570f, 0xdf09822b, 0xbd691a6c,
- 0xaa12e4f2, 0x87451c0f, 0xe0f6a27a, 0x3ada4819, 0x4cf1764f, 0x0d771c2b, 0x67cdb156, 0x350d8384,
- 0x5938fa0f, 0x42399ef3, 0x36997b07, 0x0e84093d, 0x4aa93e61, 0x8360d87b, 0x1fa98b0c, 0x1149382c,
- 0xe97625a5, 0x0614d1b7, 0x0e25244b, 0x0c768347, 0x589e8d82, 0x0d2059d1, 0xa466bb1e, 0xf8da0a82,
- 0x04f19130, 0xba6e4ec0, 0x99265164, 0x1ee7230d, 0x50b2ad80, 0xeaee6801, 0x8db2a283, 0xea8bf59e,
- },
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/const_amd64.h b/vendor/golang.org/x/crypto/curve25519/const_amd64.h
deleted file mode 100644
index b3f74162..00000000
--- a/vendor/golang.org/x/crypto/curve25519/const_amd64.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
-
-#define REDMASK51 0x0007FFFFFFFFFFFF
diff --git a/vendor/golang.org/x/crypto/curve25519/const_amd64.s b/vendor/golang.org/x/crypto/curve25519/const_amd64.s
deleted file mode 100644
index ee7b4bd5..00000000
--- a/vendor/golang.org/x/crypto/curve25519/const_amd64.s
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-// These constants cannot be encoded in non-MOVQ immediates.
-// We access them directly from memory instead.
-
-DATA ·_121666_213(SB)/8, $996687872
-GLOBL ·_121666_213(SB), 8, $8
-
-DATA ·_2P0(SB)/8, $0xFFFFFFFFFFFDA
-GLOBL ·_2P0(SB), 8, $8
-
-DATA ·_2P1234(SB)/8, $0xFFFFFFFFFFFFE
-GLOBL ·_2P1234(SB), 8, $8
diff --git a/vendor/golang.org/x/crypto/curve25519/cswap_amd64.s b/vendor/golang.org/x/crypto/curve25519/cswap_amd64.s
deleted file mode 100644
index cd793a5b..00000000
--- a/vendor/golang.org/x/crypto/curve25519/cswap_amd64.s
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,!gccgo,!appengine
-
-// func cswap(inout *[4][5]uint64, v uint64)
-TEXT ·cswap(SB),7,$0
- MOVQ inout+0(FP),DI
- MOVQ v+8(FP),SI
-
- SUBQ $1, SI
- NOTQ SI
- MOVQ SI, X15
- PSHUFD $0x44, X15, X15
-
- MOVOU 0(DI), X0
- MOVOU 16(DI), X2
- MOVOU 32(DI), X4
- MOVOU 48(DI), X6
- MOVOU 64(DI), X8
- MOVOU 80(DI), X1
- MOVOU 96(DI), X3
- MOVOU 112(DI), X5
- MOVOU 128(DI), X7
- MOVOU 144(DI), X9
-
- MOVO X1, X10
- MOVO X3, X11
- MOVO X5, X12
- MOVO X7, X13
- MOVO X9, X14
-
- PXOR X0, X10
- PXOR X2, X11
- PXOR X4, X12
- PXOR X6, X13
- PXOR X8, X14
- PAND X15, X10
- PAND X15, X11
- PAND X15, X12
- PAND X15, X13
- PAND X15, X14
- PXOR X10, X0
- PXOR X10, X1
- PXOR X11, X2
- PXOR X11, X3
- PXOR X12, X4
- PXOR X12, X5
- PXOR X13, X6
- PXOR X13, X7
- PXOR X14, X8
- PXOR X14, X9
-
- MOVOU X0, 0(DI)
- MOVOU X2, 16(DI)
- MOVOU X4, 32(DI)
- MOVOU X6, 48(DI)
- MOVOU X8, 64(DI)
- MOVOU X1, 80(DI)
- MOVOU X3, 96(DI)
- MOVOU X5, 112(DI)
- MOVOU X7, 128(DI)
- MOVOU X9, 144(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go
deleted file mode 100644
index cb8fbc57..00000000
--- a/vendor/golang.org/x/crypto/curve25519/curve25519.go
+++ /dev/null
@@ -1,834 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// We have an implementation in amd64 assembly so this code is only run on
-// non-amd64 platforms. The amd64 assembly does not support gccgo.
-// +build !amd64 gccgo appengine
-
-package curve25519
-
-import (
- "encoding/binary"
-)
-
-// This code is a port of the public domain, "ref10" implementation of
-// curve25519 from SUPERCOP 20130419 by D. J. Bernstein.
-
-// fieldElement represents an element of the field GF(2^255 - 19). An element
-// t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77
-// t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on
-// context.
-type fieldElement [10]int32
-
-func feZero(fe *fieldElement) {
- for i := range fe {
- fe[i] = 0
- }
-}
-
-func feOne(fe *fieldElement) {
- feZero(fe)
- fe[0] = 1
-}
-
-func feAdd(dst, a, b *fieldElement) {
- for i := range dst {
- dst[i] = a[i] + b[i]
- }
-}
-
-func feSub(dst, a, b *fieldElement) {
- for i := range dst {
- dst[i] = a[i] - b[i]
- }
-}
-
-func feCopy(dst, src *fieldElement) {
- for i := range dst {
- dst[i] = src[i]
- }
-}
-
-// feCSwap replaces (f,g) with (g,f) if b == 1; replaces (f,g) with (f,g) if b == 0.
-//
-// Preconditions: b in {0,1}.
-func feCSwap(f, g *fieldElement, b int32) {
- b = -b
- for i := range f {
- t := b & (f[i] ^ g[i])
- f[i] ^= t
- g[i] ^= t
- }
-}
-
-// load3 reads a 24-bit, little-endian value from in.
-func load3(in []byte) int64 {
- var r int64
- r = int64(in[0])
- r |= int64(in[1]) << 8
- r |= int64(in[2]) << 16
- return r
-}
-
-// load4 reads a 32-bit, little-endian value from in.
-func load4(in []byte) int64 {
- return int64(binary.LittleEndian.Uint32(in))
-}
-
-func feFromBytes(dst *fieldElement, src *[32]byte) {
- h0 := load4(src[:])
- h1 := load3(src[4:]) << 6
- h2 := load3(src[7:]) << 5
- h3 := load3(src[10:]) << 3
- h4 := load3(src[13:]) << 2
- h5 := load4(src[16:])
- h6 := load3(src[20:]) << 7
- h7 := load3(src[23:]) << 5
- h8 := load3(src[26:]) << 4
- h9 := load3(src[29:]) << 2
-
- var carry [10]int64
- carry[9] = (h9 + 1<<24) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- carry[1] = (h1 + 1<<24) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[3] = (h3 + 1<<24) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[5] = (h5 + 1<<24) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- carry[7] = (h7 + 1<<24) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[0] = (h0 + 1<<25) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[2] = (h2 + 1<<25) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[4] = (h4 + 1<<25) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[6] = (h6 + 1<<25) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- carry[8] = (h8 + 1<<25) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- dst[0] = int32(h0)
- dst[1] = int32(h1)
- dst[2] = int32(h2)
- dst[3] = int32(h3)
- dst[4] = int32(h4)
- dst[5] = int32(h5)
- dst[6] = int32(h6)
- dst[7] = int32(h7)
- dst[8] = int32(h8)
- dst[9] = int32(h9)
-}
-
-// feToBytes marshals h to s.
-// Preconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Write p=2^255-19; q=floor(h/p).
-// Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
-//
-// Proof:
-// Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
-// Also have |h-2^230 h9|<2^230 so |19 2^(-255)(h-2^230 h9)|<1/4.
-//
-// Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
-// Then 0> 25
- q = (h[0] + q) >> 26
- q = (h[1] + q) >> 25
- q = (h[2] + q) >> 26
- q = (h[3] + q) >> 25
- q = (h[4] + q) >> 26
- q = (h[5] + q) >> 25
- q = (h[6] + q) >> 26
- q = (h[7] + q) >> 25
- q = (h[8] + q) >> 26
- q = (h[9] + q) >> 25
-
- // Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20.
- h[0] += 19 * q
- // Goal: Output h-2^255 q, which is between 0 and 2^255-20.
-
- carry[0] = h[0] >> 26
- h[1] += carry[0]
- h[0] -= carry[0] << 26
- carry[1] = h[1] >> 25
- h[2] += carry[1]
- h[1] -= carry[1] << 25
- carry[2] = h[2] >> 26
- h[3] += carry[2]
- h[2] -= carry[2] << 26
- carry[3] = h[3] >> 25
- h[4] += carry[3]
- h[3] -= carry[3] << 25
- carry[4] = h[4] >> 26
- h[5] += carry[4]
- h[4] -= carry[4] << 26
- carry[5] = h[5] >> 25
- h[6] += carry[5]
- h[5] -= carry[5] << 25
- carry[6] = h[6] >> 26
- h[7] += carry[6]
- h[6] -= carry[6] << 26
- carry[7] = h[7] >> 25
- h[8] += carry[7]
- h[7] -= carry[7] << 25
- carry[8] = h[8] >> 26
- h[9] += carry[8]
- h[8] -= carry[8] << 26
- carry[9] = h[9] >> 25
- h[9] -= carry[9] << 25
- // h10 = carry9
-
- // Goal: Output h[0]+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
- // Have h[0]+...+2^230 h[9] between 0 and 2^255-1;
- // evidently 2^255 h10-2^255 q = 0.
- // Goal: Output h[0]+...+2^230 h[9].
-
- s[0] = byte(h[0] >> 0)
- s[1] = byte(h[0] >> 8)
- s[2] = byte(h[0] >> 16)
- s[3] = byte((h[0] >> 24) | (h[1] << 2))
- s[4] = byte(h[1] >> 6)
- s[5] = byte(h[1] >> 14)
- s[6] = byte((h[1] >> 22) | (h[2] << 3))
- s[7] = byte(h[2] >> 5)
- s[8] = byte(h[2] >> 13)
- s[9] = byte((h[2] >> 21) | (h[3] << 5))
- s[10] = byte(h[3] >> 3)
- s[11] = byte(h[3] >> 11)
- s[12] = byte((h[3] >> 19) | (h[4] << 6))
- s[13] = byte(h[4] >> 2)
- s[14] = byte(h[4] >> 10)
- s[15] = byte(h[4] >> 18)
- s[16] = byte(h[5] >> 0)
- s[17] = byte(h[5] >> 8)
- s[18] = byte(h[5] >> 16)
- s[19] = byte((h[5] >> 24) | (h[6] << 1))
- s[20] = byte(h[6] >> 7)
- s[21] = byte(h[6] >> 15)
- s[22] = byte((h[6] >> 23) | (h[7] << 3))
- s[23] = byte(h[7] >> 5)
- s[24] = byte(h[7] >> 13)
- s[25] = byte((h[7] >> 21) | (h[8] << 4))
- s[26] = byte(h[8] >> 4)
- s[27] = byte(h[8] >> 12)
- s[28] = byte((h[8] >> 20) | (h[9] << 6))
- s[29] = byte(h[9] >> 2)
- s[30] = byte(h[9] >> 10)
- s[31] = byte(h[9] >> 18)
-}
-
-// feMul calculates h = f * g
-// Can overlap h with f or g.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-// |g| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Notes on implementation strategy:
-//
-// Using schoolbook multiplication.
-// Karatsuba would save a little in some cost models.
-//
-// Most multiplications by 2 and 19 are 32-bit precomputations;
-// cheaper than 64-bit postcomputations.
-//
-// There is one remaining multiplication by 19 in the carry chain;
-// one *19 precomputation can be merged into this,
-// but the resulting data flow is considerably less clean.
-//
-// There are 12 carries below.
-// 10 of them are 2-way parallelizable and vectorizable.
-// Can get away with 11 carries, but then data flow is much deeper.
-//
-// With tighter constraints on inputs can squeeze carries into int32.
-func feMul(h, f, g *fieldElement) {
- f0 := f[0]
- f1 := f[1]
- f2 := f[2]
- f3 := f[3]
- f4 := f[4]
- f5 := f[5]
- f6 := f[6]
- f7 := f[7]
- f8 := f[8]
- f9 := f[9]
- g0 := g[0]
- g1 := g[1]
- g2 := g[2]
- g3 := g[3]
- g4 := g[4]
- g5 := g[5]
- g6 := g[6]
- g7 := g[7]
- g8 := g[8]
- g9 := g[9]
- g1_19 := 19 * g1 // 1.4*2^29
- g2_19 := 19 * g2 // 1.4*2^30; still ok
- g3_19 := 19 * g3
- g4_19 := 19 * g4
- g5_19 := 19 * g5
- g6_19 := 19 * g6
- g7_19 := 19 * g7
- g8_19 := 19 * g8
- g9_19 := 19 * g9
- f1_2 := 2 * f1
- f3_2 := 2 * f3
- f5_2 := 2 * f5
- f7_2 := 2 * f7
- f9_2 := 2 * f9
- f0g0 := int64(f0) * int64(g0)
- f0g1 := int64(f0) * int64(g1)
- f0g2 := int64(f0) * int64(g2)
- f0g3 := int64(f0) * int64(g3)
- f0g4 := int64(f0) * int64(g4)
- f0g5 := int64(f0) * int64(g5)
- f0g6 := int64(f0) * int64(g6)
- f0g7 := int64(f0) * int64(g7)
- f0g8 := int64(f0) * int64(g8)
- f0g9 := int64(f0) * int64(g9)
- f1g0 := int64(f1) * int64(g0)
- f1g1_2 := int64(f1_2) * int64(g1)
- f1g2 := int64(f1) * int64(g2)
- f1g3_2 := int64(f1_2) * int64(g3)
- f1g4 := int64(f1) * int64(g4)
- f1g5_2 := int64(f1_2) * int64(g5)
- f1g6 := int64(f1) * int64(g6)
- f1g7_2 := int64(f1_2) * int64(g7)
- f1g8 := int64(f1) * int64(g8)
- f1g9_38 := int64(f1_2) * int64(g9_19)
- f2g0 := int64(f2) * int64(g0)
- f2g1 := int64(f2) * int64(g1)
- f2g2 := int64(f2) * int64(g2)
- f2g3 := int64(f2) * int64(g3)
- f2g4 := int64(f2) * int64(g4)
- f2g5 := int64(f2) * int64(g5)
- f2g6 := int64(f2) * int64(g6)
- f2g7 := int64(f2) * int64(g7)
- f2g8_19 := int64(f2) * int64(g8_19)
- f2g9_19 := int64(f2) * int64(g9_19)
- f3g0 := int64(f3) * int64(g0)
- f3g1_2 := int64(f3_2) * int64(g1)
- f3g2 := int64(f3) * int64(g2)
- f3g3_2 := int64(f3_2) * int64(g3)
- f3g4 := int64(f3) * int64(g4)
- f3g5_2 := int64(f3_2) * int64(g5)
- f3g6 := int64(f3) * int64(g6)
- f3g7_38 := int64(f3_2) * int64(g7_19)
- f3g8_19 := int64(f3) * int64(g8_19)
- f3g9_38 := int64(f3_2) * int64(g9_19)
- f4g0 := int64(f4) * int64(g0)
- f4g1 := int64(f4) * int64(g1)
- f4g2 := int64(f4) * int64(g2)
- f4g3 := int64(f4) * int64(g3)
- f4g4 := int64(f4) * int64(g4)
- f4g5 := int64(f4) * int64(g5)
- f4g6_19 := int64(f4) * int64(g6_19)
- f4g7_19 := int64(f4) * int64(g7_19)
- f4g8_19 := int64(f4) * int64(g8_19)
- f4g9_19 := int64(f4) * int64(g9_19)
- f5g0 := int64(f5) * int64(g0)
- f5g1_2 := int64(f5_2) * int64(g1)
- f5g2 := int64(f5) * int64(g2)
- f5g3_2 := int64(f5_2) * int64(g3)
- f5g4 := int64(f5) * int64(g4)
- f5g5_38 := int64(f5_2) * int64(g5_19)
- f5g6_19 := int64(f5) * int64(g6_19)
- f5g7_38 := int64(f5_2) * int64(g7_19)
- f5g8_19 := int64(f5) * int64(g8_19)
- f5g9_38 := int64(f5_2) * int64(g9_19)
- f6g0 := int64(f6) * int64(g0)
- f6g1 := int64(f6) * int64(g1)
- f6g2 := int64(f6) * int64(g2)
- f6g3 := int64(f6) * int64(g3)
- f6g4_19 := int64(f6) * int64(g4_19)
- f6g5_19 := int64(f6) * int64(g5_19)
- f6g6_19 := int64(f6) * int64(g6_19)
- f6g7_19 := int64(f6) * int64(g7_19)
- f6g8_19 := int64(f6) * int64(g8_19)
- f6g9_19 := int64(f6) * int64(g9_19)
- f7g0 := int64(f7) * int64(g0)
- f7g1_2 := int64(f7_2) * int64(g1)
- f7g2 := int64(f7) * int64(g2)
- f7g3_38 := int64(f7_2) * int64(g3_19)
- f7g4_19 := int64(f7) * int64(g4_19)
- f7g5_38 := int64(f7_2) * int64(g5_19)
- f7g6_19 := int64(f7) * int64(g6_19)
- f7g7_38 := int64(f7_2) * int64(g7_19)
- f7g8_19 := int64(f7) * int64(g8_19)
- f7g9_38 := int64(f7_2) * int64(g9_19)
- f8g0 := int64(f8) * int64(g0)
- f8g1 := int64(f8) * int64(g1)
- f8g2_19 := int64(f8) * int64(g2_19)
- f8g3_19 := int64(f8) * int64(g3_19)
- f8g4_19 := int64(f8) * int64(g4_19)
- f8g5_19 := int64(f8) * int64(g5_19)
- f8g6_19 := int64(f8) * int64(g6_19)
- f8g7_19 := int64(f8) * int64(g7_19)
- f8g8_19 := int64(f8) * int64(g8_19)
- f8g9_19 := int64(f8) * int64(g9_19)
- f9g0 := int64(f9) * int64(g0)
- f9g1_38 := int64(f9_2) * int64(g1_19)
- f9g2_19 := int64(f9) * int64(g2_19)
- f9g3_38 := int64(f9_2) * int64(g3_19)
- f9g4_19 := int64(f9) * int64(g4_19)
- f9g5_38 := int64(f9_2) * int64(g5_19)
- f9g6_19 := int64(f9) * int64(g6_19)
- f9g7_38 := int64(f9_2) * int64(g7_19)
- f9g8_19 := int64(f9) * int64(g8_19)
- f9g9_38 := int64(f9_2) * int64(g9_19)
- h0 := f0g0 + f1g9_38 + f2g8_19 + f3g7_38 + f4g6_19 + f5g5_38 + f6g4_19 + f7g3_38 + f8g2_19 + f9g1_38
- h1 := f0g1 + f1g0 + f2g9_19 + f3g8_19 + f4g7_19 + f5g6_19 + f6g5_19 + f7g4_19 + f8g3_19 + f9g2_19
- h2 := f0g2 + f1g1_2 + f2g0 + f3g9_38 + f4g8_19 + f5g7_38 + f6g6_19 + f7g5_38 + f8g4_19 + f9g3_38
- h3 := f0g3 + f1g2 + f2g1 + f3g0 + f4g9_19 + f5g8_19 + f6g7_19 + f7g6_19 + f8g5_19 + f9g4_19
- h4 := f0g4 + f1g3_2 + f2g2 + f3g1_2 + f4g0 + f5g9_38 + f6g8_19 + f7g7_38 + f8g6_19 + f9g5_38
- h5 := f0g5 + f1g4 + f2g3 + f3g2 + f4g1 + f5g0 + f6g9_19 + f7g8_19 + f8g7_19 + f9g6_19
- h6 := f0g6 + f1g5_2 + f2g4 + f3g3_2 + f4g2 + f5g1_2 + f6g0 + f7g9_38 + f8g8_19 + f9g7_38
- h7 := f0g7 + f1g6 + f2g5 + f3g4 + f4g3 + f5g2 + f6g1 + f7g0 + f8g9_19 + f9g8_19
- h8 := f0g8 + f1g7_2 + f2g6 + f3g5_2 + f4g4 + f5g3_2 + f6g2 + f7g1_2 + f8g0 + f9g9_38
- h9 := f0g9 + f1g8 + f2g7 + f3g6 + f4g5 + f5g4 + f6g3 + f7g2 + f8g1 + f9g0
- var carry [10]int64
-
- // |h0| <= (1.1*1.1*2^52*(1+19+19+19+19)+1.1*1.1*2^50*(38+38+38+38+38))
- // i.e. |h0| <= 1.2*2^59; narrower ranges for h2, h4, h6, h8
- // |h1| <= (1.1*1.1*2^51*(1+1+19+19+19+19+19+19+19+19))
- // i.e. |h1| <= 1.5*2^58; narrower ranges for h3, h5, h7, h9
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- // |h0| <= 2^25
- // |h4| <= 2^25
- // |h1| <= 1.51*2^58
- // |h5| <= 1.51*2^58
-
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- // |h1| <= 2^24; from now on fits into int32
- // |h5| <= 2^24; from now on fits into int32
- // |h2| <= 1.21*2^59
- // |h6| <= 1.21*2^59
-
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- // |h2| <= 2^25; from now on fits into int32 unchanged
- // |h6| <= 2^25; from now on fits into int32 unchanged
- // |h3| <= 1.51*2^58
- // |h7| <= 1.51*2^58
-
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
- // |h3| <= 2^24; from now on fits into int32 unchanged
- // |h7| <= 2^24; from now on fits into int32 unchanged
- // |h4| <= 1.52*2^33
- // |h8| <= 1.52*2^33
-
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
- // |h4| <= 2^25; from now on fits into int32 unchanged
- // |h8| <= 2^25; from now on fits into int32 unchanged
- // |h5| <= 1.01*2^24
- // |h9| <= 1.51*2^58
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- // |h9| <= 2^24; from now on fits into int32 unchanged
- // |h0| <= 1.8*2^37
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- // |h0| <= 2^25; from now on fits into int32 unchanged
- // |h1| <= 1.01*2^24
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feSquare calculates h = f*f. Can overlap h with f.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-func feSquare(h, f *fieldElement) {
- f0 := f[0]
- f1 := f[1]
- f2 := f[2]
- f3 := f[3]
- f4 := f[4]
- f5 := f[5]
- f6 := f[6]
- f7 := f[7]
- f8 := f[8]
- f9 := f[9]
- f0_2 := 2 * f0
- f1_2 := 2 * f1
- f2_2 := 2 * f2
- f3_2 := 2 * f3
- f4_2 := 2 * f4
- f5_2 := 2 * f5
- f6_2 := 2 * f6
- f7_2 := 2 * f7
- f5_38 := 38 * f5 // 1.31*2^30
- f6_19 := 19 * f6 // 1.31*2^30
- f7_38 := 38 * f7 // 1.31*2^30
- f8_19 := 19 * f8 // 1.31*2^30
- f9_38 := 38 * f9 // 1.31*2^30
- f0f0 := int64(f0) * int64(f0)
- f0f1_2 := int64(f0_2) * int64(f1)
- f0f2_2 := int64(f0_2) * int64(f2)
- f0f3_2 := int64(f0_2) * int64(f3)
- f0f4_2 := int64(f0_2) * int64(f4)
- f0f5_2 := int64(f0_2) * int64(f5)
- f0f6_2 := int64(f0_2) * int64(f6)
- f0f7_2 := int64(f0_2) * int64(f7)
- f0f8_2 := int64(f0_2) * int64(f8)
- f0f9_2 := int64(f0_2) * int64(f9)
- f1f1_2 := int64(f1_2) * int64(f1)
- f1f2_2 := int64(f1_2) * int64(f2)
- f1f3_4 := int64(f1_2) * int64(f3_2)
- f1f4_2 := int64(f1_2) * int64(f4)
- f1f5_4 := int64(f1_2) * int64(f5_2)
- f1f6_2 := int64(f1_2) * int64(f6)
- f1f7_4 := int64(f1_2) * int64(f7_2)
- f1f8_2 := int64(f1_2) * int64(f8)
- f1f9_76 := int64(f1_2) * int64(f9_38)
- f2f2 := int64(f2) * int64(f2)
- f2f3_2 := int64(f2_2) * int64(f3)
- f2f4_2 := int64(f2_2) * int64(f4)
- f2f5_2 := int64(f2_2) * int64(f5)
- f2f6_2 := int64(f2_2) * int64(f6)
- f2f7_2 := int64(f2_2) * int64(f7)
- f2f8_38 := int64(f2_2) * int64(f8_19)
- f2f9_38 := int64(f2) * int64(f9_38)
- f3f3_2 := int64(f3_2) * int64(f3)
- f3f4_2 := int64(f3_2) * int64(f4)
- f3f5_4 := int64(f3_2) * int64(f5_2)
- f3f6_2 := int64(f3_2) * int64(f6)
- f3f7_76 := int64(f3_2) * int64(f7_38)
- f3f8_38 := int64(f3_2) * int64(f8_19)
- f3f9_76 := int64(f3_2) * int64(f9_38)
- f4f4 := int64(f4) * int64(f4)
- f4f5_2 := int64(f4_2) * int64(f5)
- f4f6_38 := int64(f4_2) * int64(f6_19)
- f4f7_38 := int64(f4) * int64(f7_38)
- f4f8_38 := int64(f4_2) * int64(f8_19)
- f4f9_38 := int64(f4) * int64(f9_38)
- f5f5_38 := int64(f5) * int64(f5_38)
- f5f6_38 := int64(f5_2) * int64(f6_19)
- f5f7_76 := int64(f5_2) * int64(f7_38)
- f5f8_38 := int64(f5_2) * int64(f8_19)
- f5f9_76 := int64(f5_2) * int64(f9_38)
- f6f6_19 := int64(f6) * int64(f6_19)
- f6f7_38 := int64(f6) * int64(f7_38)
- f6f8_38 := int64(f6_2) * int64(f8_19)
- f6f9_38 := int64(f6) * int64(f9_38)
- f7f7_38 := int64(f7) * int64(f7_38)
- f7f8_38 := int64(f7_2) * int64(f8_19)
- f7f9_76 := int64(f7_2) * int64(f9_38)
- f8f8_19 := int64(f8) * int64(f8_19)
- f8f9_38 := int64(f8) * int64(f9_38)
- f9f9_38 := int64(f9) * int64(f9_38)
- h0 := f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38
- h1 := f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38
- h2 := f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19
- h3 := f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38
- h4 := f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38
- h5 := f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38
- h6 := f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19
- h7 := f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38
- h8 := f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38
- h9 := f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2
- var carry [10]int64
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
-
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
-
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
-
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feMul121666 calculates h = f * 121666. Can overlap h with f.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-func feMul121666(h, f *fieldElement) {
- h0 := int64(f[0]) * 121666
- h1 := int64(f[1]) * 121666
- h2 := int64(f[2]) * 121666
- h3 := int64(f[3]) * 121666
- h4 := int64(f[4]) * 121666
- h5 := int64(f[5]) * 121666
- h6 := int64(f[6]) * 121666
- h7 := int64(f[7]) * 121666
- h8 := int64(f[8]) * 121666
- h9 := int64(f[9]) * 121666
- var carry [10]int64
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feInvert sets out = z^-1.
-func feInvert(out, z *fieldElement) {
- var t0, t1, t2, t3 fieldElement
- var i int
-
- feSquare(&t0, z)
- for i = 1; i < 1; i++ {
- feSquare(&t0, &t0)
- }
- feSquare(&t1, &t0)
- for i = 1; i < 2; i++ {
- feSquare(&t1, &t1)
- }
- feMul(&t1, z, &t1)
- feMul(&t0, &t0, &t1)
- feSquare(&t2, &t0)
- for i = 1; i < 1; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t1, &t2)
- feSquare(&t2, &t1)
- for i = 1; i < 5; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t2, &t1)
- for i = 1; i < 10; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t2, &t2, &t1)
- feSquare(&t3, &t2)
- for i = 1; i < 20; i++ {
- feSquare(&t3, &t3)
- }
- feMul(&t2, &t3, &t2)
- feSquare(&t2, &t2)
- for i = 1; i < 10; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t2, &t1)
- for i = 1; i < 50; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t2, &t2, &t1)
- feSquare(&t3, &t2)
- for i = 1; i < 100; i++ {
- feSquare(&t3, &t3)
- }
- feMul(&t2, &t3, &t2)
- feSquare(&t2, &t2)
- for i = 1; i < 50; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t1, &t1)
- for i = 1; i < 5; i++ {
- feSquare(&t1, &t1)
- }
- feMul(out, &t1, &t0)
-}
-
-func scalarMult(out, in, base *[32]byte) {
- var e [32]byte
-
- copy(e[:], in[:])
- e[0] &= 248
- e[31] &= 127
- e[31] |= 64
-
- var x1, x2, z2, x3, z3, tmp0, tmp1 fieldElement
- feFromBytes(&x1, base)
- feOne(&x2)
- feCopy(&x3, &x1)
- feOne(&z3)
-
- swap := int32(0)
- for pos := 254; pos >= 0; pos-- {
- b := e[pos/8] >> uint(pos&7)
- b &= 1
- swap ^= int32(b)
- feCSwap(&x2, &x3, swap)
- feCSwap(&z2, &z3, swap)
- swap = int32(b)
-
- feSub(&tmp0, &x3, &z3)
- feSub(&tmp1, &x2, &z2)
- feAdd(&x2, &x2, &z2)
- feAdd(&z2, &x3, &z3)
- feMul(&z3, &tmp0, &x2)
- feMul(&z2, &z2, &tmp1)
- feSquare(&tmp0, &tmp1)
- feSquare(&tmp1, &x2)
- feAdd(&x3, &z3, &z2)
- feSub(&z2, &z3, &z2)
- feMul(&x2, &tmp1, &tmp0)
- feSub(&tmp1, &tmp1, &tmp0)
- feSquare(&z2, &z2)
- feMul121666(&z3, &tmp1)
- feSquare(&x3, &x3)
- feAdd(&tmp0, &tmp0, &z3)
- feMul(&z3, &x1, &z2)
- feMul(&z2, &tmp1, &tmp0)
- }
-
- feCSwap(&x2, &x3, swap)
- feCSwap(&z2, &z3, swap)
-
- feInvert(&z2, &z2)
- feMul(&x2, &x2, &z2)
- feToBytes(out, &x2)
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/doc.go b/vendor/golang.org/x/crypto/curve25519/doc.go
deleted file mode 100644
index da9b10d9..00000000
--- a/vendor/golang.org/x/crypto/curve25519/doc.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package curve25519 provides an implementation of scalar multiplication on
-// the elliptic curve known as curve25519. See https://cr.yp.to/ecdh.html
-package curve25519 // import "golang.org/x/crypto/curve25519"
-
-// basePoint is the x coordinate of the generator of the curve.
-var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-
-// ScalarMult sets dst to the product in*base where dst and base are the x
-// coordinates of group points and all values are in little-endian form.
-func ScalarMult(dst, in, base *[32]byte) {
- scalarMult(dst, in, base)
-}
-
-// ScalarBaseMult sets dst to the product in*base where dst and base are the x
-// coordinates of group points, base is the standard generator and all values
-// are in little-endian form.
-func ScalarBaseMult(dst, in *[32]byte) {
- ScalarMult(dst, in, &basePoint)
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s b/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s
deleted file mode 100644
index 39081610..00000000
--- a/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-#include "const_amd64.h"
-
-// func freeze(inout *[5]uint64)
-TEXT ·freeze(SB),7,$0-8
- MOVQ inout+0(FP), DI
-
- MOVQ 0(DI),SI
- MOVQ 8(DI),DX
- MOVQ 16(DI),CX
- MOVQ 24(DI),R8
- MOVQ 32(DI),R9
- MOVQ $REDMASK51,AX
- MOVQ AX,R10
- SUBQ $18,R10
- MOVQ $3,R11
-REDUCELOOP:
- MOVQ SI,R12
- SHRQ $51,R12
- ANDQ AX,SI
- ADDQ R12,DX
- MOVQ DX,R12
- SHRQ $51,R12
- ANDQ AX,DX
- ADDQ R12,CX
- MOVQ CX,R12
- SHRQ $51,R12
- ANDQ AX,CX
- ADDQ R12,R8
- MOVQ R8,R12
- SHRQ $51,R12
- ANDQ AX,R8
- ADDQ R12,R9
- MOVQ R9,R12
- SHRQ $51,R12
- ANDQ AX,R9
- IMUL3Q $19,R12,R12
- ADDQ R12,SI
- SUBQ $1,R11
- JA REDUCELOOP
- MOVQ $1,R12
- CMPQ R10,SI
- CMOVQLT R11,R12
- CMPQ AX,DX
- CMOVQNE R11,R12
- CMPQ AX,CX
- CMOVQNE R11,R12
- CMPQ AX,R8
- CMOVQNE R11,R12
- CMPQ AX,R9
- CMOVQNE R11,R12
- NEGQ R12
- ANDQ R12,AX
- ANDQ R12,R10
- SUBQ R10,SI
- SUBQ AX,DX
- SUBQ AX,CX
- SUBQ AX,R8
- SUBQ AX,R9
- MOVQ SI,0(DI)
- MOVQ DX,8(DI)
- MOVQ CX,16(DI)
- MOVQ R8,24(DI)
- MOVQ R9,32(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s b/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s
deleted file mode 100644
index 9e9040b2..00000000
--- a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s
+++ /dev/null
@@ -1,1377 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-#include "const_amd64.h"
-
-// func ladderstep(inout *[5][5]uint64)
-TEXT ·ladderstep(SB),0,$296-8
- MOVQ inout+0(FP),DI
-
- MOVQ 40(DI),SI
- MOVQ 48(DI),DX
- MOVQ 56(DI),CX
- MOVQ 64(DI),R8
- MOVQ 72(DI),R9
- MOVQ SI,AX
- MOVQ DX,R10
- MOVQ CX,R11
- MOVQ R8,R12
- MOVQ R9,R13
- ADDQ ·_2P0(SB),AX
- ADDQ ·_2P1234(SB),R10
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 80(DI),SI
- ADDQ 88(DI),DX
- ADDQ 96(DI),CX
- ADDQ 104(DI),R8
- ADDQ 112(DI),R9
- SUBQ 80(DI),AX
- SUBQ 88(DI),R10
- SUBQ 96(DI),R11
- SUBQ 104(DI),R12
- SUBQ 112(DI),R13
- MOVQ SI,0(SP)
- MOVQ DX,8(SP)
- MOVQ CX,16(SP)
- MOVQ R8,24(SP)
- MOVQ R9,32(SP)
- MOVQ AX,40(SP)
- MOVQ R10,48(SP)
- MOVQ R11,56(SP)
- MOVQ R12,64(SP)
- MOVQ R13,72(SP)
- MOVQ 40(SP),AX
- MULQ 40(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 40(SP),AX
- SHLQ $1,AX
- MULQ 48(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 40(SP),AX
- SHLQ $1,AX
- MULQ 56(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 40(SP),AX
- SHLQ $1,AX
- MULQ 64(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 40(SP),AX
- SHLQ $1,AX
- MULQ 72(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 48(SP),AX
- MULQ 48(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 48(SP),AX
- SHLQ $1,AX
- MULQ 56(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 48(SP),AX
- SHLQ $1,AX
- MULQ 64(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 48(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 72(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 56(SP),AX
- MULQ 56(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 56(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 64(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 56(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 72(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 64(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 64(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 64(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 72(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 72(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 72(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,80(SP)
- MOVQ R8,88(SP)
- MOVQ R9,96(SP)
- MOVQ AX,104(SP)
- MOVQ R10,112(SP)
- MOVQ 0(SP),AX
- MULQ 0(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 0(SP),AX
- SHLQ $1,AX
- MULQ 8(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 0(SP),AX
- SHLQ $1,AX
- MULQ 16(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 0(SP),AX
- SHLQ $1,AX
- MULQ 24(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 0(SP),AX
- SHLQ $1,AX
- MULQ 32(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 8(SP),AX
- MULQ 8(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- SHLQ $1,AX
- MULQ 16(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 8(SP),AX
- SHLQ $1,AX
- MULQ 24(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 16(SP),AX
- MULQ 16(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 16(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 24(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 16(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 24(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 24(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 24(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 32(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,120(SP)
- MOVQ R8,128(SP)
- MOVQ R9,136(SP)
- MOVQ AX,144(SP)
- MOVQ R10,152(SP)
- MOVQ SI,SI
- MOVQ R8,DX
- MOVQ R9,CX
- MOVQ AX,R8
- MOVQ R10,R9
- ADDQ ·_2P0(SB),SI
- ADDQ ·_2P1234(SB),DX
- ADDQ ·_2P1234(SB),CX
- ADDQ ·_2P1234(SB),R8
- ADDQ ·_2P1234(SB),R9
- SUBQ 80(SP),SI
- SUBQ 88(SP),DX
- SUBQ 96(SP),CX
- SUBQ 104(SP),R8
- SUBQ 112(SP),R9
- MOVQ SI,160(SP)
- MOVQ DX,168(SP)
- MOVQ CX,176(SP)
- MOVQ R8,184(SP)
- MOVQ R9,192(SP)
- MOVQ 120(DI),SI
- MOVQ 128(DI),DX
- MOVQ 136(DI),CX
- MOVQ 144(DI),R8
- MOVQ 152(DI),R9
- MOVQ SI,AX
- MOVQ DX,R10
- MOVQ CX,R11
- MOVQ R8,R12
- MOVQ R9,R13
- ADDQ ·_2P0(SB),AX
- ADDQ ·_2P1234(SB),R10
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 160(DI),SI
- ADDQ 168(DI),DX
- ADDQ 176(DI),CX
- ADDQ 184(DI),R8
- ADDQ 192(DI),R9
- SUBQ 160(DI),AX
- SUBQ 168(DI),R10
- SUBQ 176(DI),R11
- SUBQ 184(DI),R12
- SUBQ 192(DI),R13
- MOVQ SI,200(SP)
- MOVQ DX,208(SP)
- MOVQ CX,216(SP)
- MOVQ R8,224(SP)
- MOVQ R9,232(SP)
- MOVQ AX,240(SP)
- MOVQ R10,248(SP)
- MOVQ R11,256(SP)
- MOVQ R12,264(SP)
- MOVQ R13,272(SP)
- MOVQ 224(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,280(SP)
- MULQ 56(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 232(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,288(SP)
- MULQ 48(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 200(SP),AX
- MULQ 40(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 200(SP),AX
- MULQ 48(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 200(SP),AX
- MULQ 56(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 200(SP),AX
- MULQ 64(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 200(SP),AX
- MULQ 72(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 208(SP),AX
- MULQ 40(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 208(SP),AX
- MULQ 48(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 208(SP),AX
- MULQ 56(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 208(SP),AX
- MULQ 64(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 208(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 72(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 216(SP),AX
- MULQ 40(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 216(SP),AX
- MULQ 48(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 216(SP),AX
- MULQ 56(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 216(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 64(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 216(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 72(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 224(SP),AX
- MULQ 40(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 224(SP),AX
- MULQ 48(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 280(SP),AX
- MULQ 64(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 280(SP),AX
- MULQ 72(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 232(SP),AX
- MULQ 40(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 288(SP),AX
- MULQ 56(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 288(SP),AX
- MULQ 64(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 288(SP),AX
- MULQ 72(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,40(SP)
- MOVQ R8,48(SP)
- MOVQ R9,56(SP)
- MOVQ AX,64(SP)
- MOVQ R10,72(SP)
- MOVQ 264(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,200(SP)
- MULQ 16(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 272(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,208(SP)
- MULQ 8(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 240(SP),AX
- MULQ 0(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 240(SP),AX
- MULQ 8(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 240(SP),AX
- MULQ 16(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 240(SP),AX
- MULQ 24(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 240(SP),AX
- MULQ 32(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 248(SP),AX
- MULQ 0(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 248(SP),AX
- MULQ 8(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 248(SP),AX
- MULQ 16(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 248(SP),AX
- MULQ 24(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 248(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 256(SP),AX
- MULQ 0(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 256(SP),AX
- MULQ 8(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 256(SP),AX
- MULQ 16(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 256(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 24(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 256(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 264(SP),AX
- MULQ 0(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 264(SP),AX
- MULQ 8(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 200(SP),AX
- MULQ 24(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 200(SP),AX
- MULQ 32(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 272(SP),AX
- MULQ 0(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 208(SP),AX
- MULQ 16(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 208(SP),AX
- MULQ 24(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 208(SP),AX
- MULQ 32(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,DX
- MOVQ R8,CX
- MOVQ R9,R11
- MOVQ AX,R12
- MOVQ R10,R13
- ADDQ ·_2P0(SB),DX
- ADDQ ·_2P1234(SB),CX
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 40(SP),SI
- ADDQ 48(SP),R8
- ADDQ 56(SP),R9
- ADDQ 64(SP),AX
- ADDQ 72(SP),R10
- SUBQ 40(SP),DX
- SUBQ 48(SP),CX
- SUBQ 56(SP),R11
- SUBQ 64(SP),R12
- SUBQ 72(SP),R13
- MOVQ SI,120(DI)
- MOVQ R8,128(DI)
- MOVQ R9,136(DI)
- MOVQ AX,144(DI)
- MOVQ R10,152(DI)
- MOVQ DX,160(DI)
- MOVQ CX,168(DI)
- MOVQ R11,176(DI)
- MOVQ R12,184(DI)
- MOVQ R13,192(DI)
- MOVQ 120(DI),AX
- MULQ 120(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 128(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 136(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 144(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 152(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 128(DI),AX
- MULQ 128(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 128(DI),AX
- SHLQ $1,AX
- MULQ 136(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 128(DI),AX
- SHLQ $1,AX
- MULQ 144(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 128(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(DI),AX
- MULQ 136(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 136(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 144(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 144(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 144(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 144(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 152(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 152(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,120(DI)
- MOVQ R8,128(DI)
- MOVQ R9,136(DI)
- MOVQ AX,144(DI)
- MOVQ R10,152(DI)
- MOVQ 160(DI),AX
- MULQ 160(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 168(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 176(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 184(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 192(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 168(DI),AX
- MULQ 168(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 168(DI),AX
- SHLQ $1,AX
- MULQ 176(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 168(DI),AX
- SHLQ $1,AX
- MULQ 184(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 168(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),AX
- MULQ 176(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 176(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 184(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 184(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 192(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 192(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,160(DI)
- MOVQ R8,168(DI)
- MOVQ R9,176(DI)
- MOVQ AX,184(DI)
- MOVQ R10,192(DI)
- MOVQ 184(DI),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,0(SP)
- MULQ 16(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 192(DI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,8(SP)
- MULQ 8(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 160(DI),AX
- MULQ 0(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 160(DI),AX
- MULQ 8(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 160(DI),AX
- MULQ 16(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 160(DI),AX
- MULQ 24(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 160(DI),AX
- MULQ 32(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 168(DI),AX
- MULQ 0(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 168(DI),AX
- MULQ 8(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 168(DI),AX
- MULQ 16(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 168(DI),AX
- MULQ 24(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 168(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),AX
- MULQ 0(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 176(DI),AX
- MULQ 8(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 176(DI),AX
- MULQ 16(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 176(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),AX
- MULQ 0(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 184(DI),AX
- MULQ 8(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 0(SP),AX
- MULQ 24(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SP),AX
- MULQ 32(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 192(DI),AX
- MULQ 0(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SP),AX
- MULQ 16(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 8(SP),AX
- MULQ 24(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- MULQ 32(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,160(DI)
- MOVQ R8,168(DI)
- MOVQ R9,176(DI)
- MOVQ AX,184(DI)
- MOVQ R10,192(DI)
- MOVQ 144(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,0(SP)
- MULQ 96(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 152(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,8(SP)
- MULQ 88(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 120(SP),AX
- MULQ 80(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 120(SP),AX
- MULQ 88(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 120(SP),AX
- MULQ 96(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 120(SP),AX
- MULQ 104(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 120(SP),AX
- MULQ 112(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 128(SP),AX
- MULQ 80(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 128(SP),AX
- MULQ 88(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 128(SP),AX
- MULQ 96(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 128(SP),AX
- MULQ 104(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 128(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 112(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(SP),AX
- MULQ 80(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 136(SP),AX
- MULQ 88(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 136(SP),AX
- MULQ 96(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 136(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 104(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 112(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 144(SP),AX
- MULQ 80(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 144(SP),AX
- MULQ 88(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 0(SP),AX
- MULQ 104(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SP),AX
- MULQ 112(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 152(SP),AX
- MULQ 80(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SP),AX
- MULQ 96(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 8(SP),AX
- MULQ 104(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- MULQ 112(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,40(DI)
- MOVQ R8,48(DI)
- MOVQ R9,56(DI)
- MOVQ AX,64(DI)
- MOVQ R10,72(DI)
- MOVQ 160(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 168(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,CX
- MOVQ DX,R8
- MOVQ 176(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R8
- MOVQ DX,R9
- MOVQ 184(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R9
- MOVQ DX,R10
- MOVQ 192(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R10
- IMUL3Q $19,DX,DX
- ADDQ DX,SI
- ADDQ 80(SP),SI
- ADDQ 88(SP),CX
- ADDQ 96(SP),R8
- ADDQ 104(SP),R9
- ADDQ 112(SP),R10
- MOVQ SI,80(DI)
- MOVQ CX,88(DI)
- MOVQ R8,96(DI)
- MOVQ R9,104(DI)
- MOVQ R10,112(DI)
- MOVQ 104(DI),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,0(SP)
- MULQ 176(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 112(DI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,8(SP)
- MULQ 168(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 80(DI),AX
- MULQ 160(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 80(DI),AX
- MULQ 168(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 80(DI),AX
- MULQ 176(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 80(DI),AX
- MULQ 184(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 80(DI),AX
- MULQ 192(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 88(DI),AX
- MULQ 160(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 88(DI),AX
- MULQ 168(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 88(DI),AX
- MULQ 176(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 88(DI),AX
- MULQ 184(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 88(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 192(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 96(DI),AX
- MULQ 160(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 96(DI),AX
- MULQ 168(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 96(DI),AX
- MULQ 176(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 96(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 184(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 96(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 192(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 104(DI),AX
- MULQ 160(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 104(DI),AX
- MULQ 168(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 0(SP),AX
- MULQ 184(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SP),AX
- MULQ 192(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 112(DI),AX
- MULQ 160(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SP),AX
- MULQ 176(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 8(SP),AX
- MULQ 184(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- MULQ 192(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,80(DI)
- MOVQ R8,88(DI)
- MOVQ R9,96(DI)
- MOVQ AX,104(DI)
- MOVQ R10,112(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/mont25519_amd64.go b/vendor/golang.org/x/crypto/curve25519/mont25519_amd64.go
deleted file mode 100644
index 5822bd53..00000000
--- a/vendor/golang.org/x/crypto/curve25519/mont25519_amd64.go
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,!gccgo,!appengine
-
-package curve25519
-
-// These functions are implemented in the .s files. The names of the functions
-// in the rest of the file are also taken from the SUPERCOP sources to help
-// people following along.
-
-//go:noescape
-
-func cswap(inout *[5]uint64, v uint64)
-
-//go:noescape
-
-func ladderstep(inout *[5][5]uint64)
-
-//go:noescape
-
-func freeze(inout *[5]uint64)
-
-//go:noescape
-
-func mul(dest, a, b *[5]uint64)
-
-//go:noescape
-
-func square(out, in *[5]uint64)
-
-// mladder uses a Montgomery ladder to calculate (xr/zr) *= s.
-func mladder(xr, zr *[5]uint64, s *[32]byte) {
- var work [5][5]uint64
-
- work[0] = *xr
- setint(&work[1], 1)
- setint(&work[2], 0)
- work[3] = *xr
- setint(&work[4], 1)
-
- j := uint(6)
- var prevbit byte
-
- for i := 31; i >= 0; i-- {
- for j < 8 {
- bit := ((*s)[i] >> j) & 1
- swap := bit ^ prevbit
- prevbit = bit
- cswap(&work[1], uint64(swap))
- ladderstep(&work)
- j--
- }
- j = 7
- }
-
- *xr = work[1]
- *zr = work[2]
-}
-
-func scalarMult(out, in, base *[32]byte) {
- var e [32]byte
- copy(e[:], (*in)[:])
- e[0] &= 248
- e[31] &= 127
- e[31] |= 64
-
- var t, z [5]uint64
- unpack(&t, base)
- mladder(&t, &z, &e)
- invert(&z, &z)
- mul(&t, &t, &z)
- pack(out, &t)
-}
-
-func setint(r *[5]uint64, v uint64) {
- r[0] = v
- r[1] = 0
- r[2] = 0
- r[3] = 0
- r[4] = 0
-}
-
-// unpack sets r = x where r consists of 5, 51-bit limbs in little-endian
-// order.
-func unpack(r *[5]uint64, x *[32]byte) {
- r[0] = uint64(x[0]) |
- uint64(x[1])<<8 |
- uint64(x[2])<<16 |
- uint64(x[3])<<24 |
- uint64(x[4])<<32 |
- uint64(x[5])<<40 |
- uint64(x[6]&7)<<48
-
- r[1] = uint64(x[6])>>3 |
- uint64(x[7])<<5 |
- uint64(x[8])<<13 |
- uint64(x[9])<<21 |
- uint64(x[10])<<29 |
- uint64(x[11])<<37 |
- uint64(x[12]&63)<<45
-
- r[2] = uint64(x[12])>>6 |
- uint64(x[13])<<2 |
- uint64(x[14])<<10 |
- uint64(x[15])<<18 |
- uint64(x[16])<<26 |
- uint64(x[17])<<34 |
- uint64(x[18])<<42 |
- uint64(x[19]&1)<<50
-
- r[3] = uint64(x[19])>>1 |
- uint64(x[20])<<7 |
- uint64(x[21])<<15 |
- uint64(x[22])<<23 |
- uint64(x[23])<<31 |
- uint64(x[24])<<39 |
- uint64(x[25]&15)<<47
-
- r[4] = uint64(x[25])>>4 |
- uint64(x[26])<<4 |
- uint64(x[27])<<12 |
- uint64(x[28])<<20 |
- uint64(x[29])<<28 |
- uint64(x[30])<<36 |
- uint64(x[31]&127)<<44
-}
-
-// pack sets out = x where out is the usual, little-endian form of the 5,
-// 51-bit limbs in x.
-func pack(out *[32]byte, x *[5]uint64) {
- t := *x
- freeze(&t)
-
- out[0] = byte(t[0])
- out[1] = byte(t[0] >> 8)
- out[2] = byte(t[0] >> 16)
- out[3] = byte(t[0] >> 24)
- out[4] = byte(t[0] >> 32)
- out[5] = byte(t[0] >> 40)
- out[6] = byte(t[0] >> 48)
-
- out[6] ^= byte(t[1]<<3) & 0xf8
- out[7] = byte(t[1] >> 5)
- out[8] = byte(t[1] >> 13)
- out[9] = byte(t[1] >> 21)
- out[10] = byte(t[1] >> 29)
- out[11] = byte(t[1] >> 37)
- out[12] = byte(t[1] >> 45)
-
- out[12] ^= byte(t[2]<<6) & 0xc0
- out[13] = byte(t[2] >> 2)
- out[14] = byte(t[2] >> 10)
- out[15] = byte(t[2] >> 18)
- out[16] = byte(t[2] >> 26)
- out[17] = byte(t[2] >> 34)
- out[18] = byte(t[2] >> 42)
- out[19] = byte(t[2] >> 50)
-
- out[19] ^= byte(t[3]<<1) & 0xfe
- out[20] = byte(t[3] >> 7)
- out[21] = byte(t[3] >> 15)
- out[22] = byte(t[3] >> 23)
- out[23] = byte(t[3] >> 31)
- out[24] = byte(t[3] >> 39)
- out[25] = byte(t[3] >> 47)
-
- out[25] ^= byte(t[4]<<4) & 0xf0
- out[26] = byte(t[4] >> 4)
- out[27] = byte(t[4] >> 12)
- out[28] = byte(t[4] >> 20)
- out[29] = byte(t[4] >> 28)
- out[30] = byte(t[4] >> 36)
- out[31] = byte(t[4] >> 44)
-}
-
-// invert calculates r = x^-1 mod p using Fermat's little theorem.
-func invert(r *[5]uint64, x *[5]uint64) {
- var z2, z9, z11, z2_5_0, z2_10_0, z2_20_0, z2_50_0, z2_100_0, t [5]uint64
-
- square(&z2, x) /* 2 */
- square(&t, &z2) /* 4 */
- square(&t, &t) /* 8 */
- mul(&z9, &t, x) /* 9 */
- mul(&z11, &z9, &z2) /* 11 */
- square(&t, &z11) /* 22 */
- mul(&z2_5_0, &t, &z9) /* 2^5 - 2^0 = 31 */
-
- square(&t, &z2_5_0) /* 2^6 - 2^1 */
- for i := 1; i < 5; i++ { /* 2^20 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_10_0, &t, &z2_5_0) /* 2^10 - 2^0 */
-
- square(&t, &z2_10_0) /* 2^11 - 2^1 */
- for i := 1; i < 10; i++ { /* 2^20 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_20_0, &t, &z2_10_0) /* 2^20 - 2^0 */
-
- square(&t, &z2_20_0) /* 2^21 - 2^1 */
- for i := 1; i < 20; i++ { /* 2^40 - 2^20 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_20_0) /* 2^40 - 2^0 */
-
- square(&t, &t) /* 2^41 - 2^1 */
- for i := 1; i < 10; i++ { /* 2^50 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_50_0, &t, &z2_10_0) /* 2^50 - 2^0 */
-
- square(&t, &z2_50_0) /* 2^51 - 2^1 */
- for i := 1; i < 50; i++ { /* 2^100 - 2^50 */
- square(&t, &t)
- }
- mul(&z2_100_0, &t, &z2_50_0) /* 2^100 - 2^0 */
-
- square(&t, &z2_100_0) /* 2^101 - 2^1 */
- for i := 1; i < 100; i++ { /* 2^200 - 2^100 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_100_0) /* 2^200 - 2^0 */
-
- square(&t, &t) /* 2^201 - 2^1 */
- for i := 1; i < 50; i++ { /* 2^250 - 2^50 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_50_0) /* 2^250 - 2^0 */
-
- square(&t, &t) /* 2^251 - 2^1 */
- square(&t, &t) /* 2^252 - 2^2 */
- square(&t, &t) /* 2^253 - 2^3 */
-
- square(&t, &t) /* 2^254 - 2^4 */
-
- square(&t, &t) /* 2^255 - 2^5 */
- mul(r, &t, &z11) /* 2^255 - 21 */
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s b/vendor/golang.org/x/crypto/curve25519/mul_amd64.s
deleted file mode 100644
index 5ce80a2e..00000000
--- a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-#include "const_amd64.h"
-
-// func mul(dest, a, b *[5]uint64)
-TEXT ·mul(SB),0,$16-24
- MOVQ dest+0(FP), DI
- MOVQ a+8(FP), SI
- MOVQ b+16(FP), DX
-
- MOVQ DX,CX
- MOVQ 24(SI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,0(SP)
- MULQ 16(CX)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 32(SI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,8(SP)
- MULQ 8(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SI),AX
- MULQ 0(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SI),AX
- MULQ 8(CX)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 0(SI),AX
- MULQ 16(CX)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 0(SI),AX
- MULQ 24(CX)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 0(SI),AX
- MULQ 32(CX)
- MOVQ AX,BX
- MOVQ DX,BP
- MOVQ 8(SI),AX
- MULQ 0(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SI),AX
- MULQ 8(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 8(SI),AX
- MULQ 16(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SI),AX
- MULQ 24(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 8(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 16(SI),AX
- MULQ 0(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 16(SI),AX
- MULQ 8(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 16(SI),AX
- MULQ 16(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 16(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 16(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 24(SI),AX
- MULQ 0(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 24(SI),AX
- MULQ 8(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 0(SP),AX
- MULQ 24(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 0(SP),AX
- MULQ 32(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 32(SI),AX
- MULQ 0(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 8(SP),AX
- MULQ 16(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- MULQ 24(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 8(SP),AX
- MULQ 32(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ $REDMASK51,SI
- SHLQ $13,R9:R8
- ANDQ SI,R8
- SHLQ $13,R11:R10
- ANDQ SI,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ SI,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ SI,R14
- ADDQ R13,R14
- SHLQ $13,BP:BX
- ANDQ SI,BX
- ADDQ R15,BX
- IMUL3Q $19,BP,DX
- ADDQ DX,R8
- MOVQ R8,DX
- SHRQ $51,DX
- ADDQ R10,DX
- MOVQ DX,CX
- SHRQ $51,DX
- ANDQ SI,R8
- ADDQ R12,DX
- MOVQ DX,R9
- SHRQ $51,DX
- ANDQ SI,CX
- ADDQ R14,DX
- MOVQ DX,AX
- SHRQ $51,DX
- ANDQ SI,R9
- ADDQ BX,DX
- MOVQ DX,R10
- SHRQ $51,DX
- ANDQ SI,AX
- IMUL3Q $19,DX,DX
- ADDQ DX,R8
- ANDQ SI,R10
- MOVQ R8,0(DI)
- MOVQ CX,8(DI)
- MOVQ R9,16(DI)
- MOVQ AX,24(DI)
- MOVQ R10,32(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/square_amd64.s b/vendor/golang.org/x/crypto/curve25519/square_amd64.s
deleted file mode 100644
index 12f73734..00000000
--- a/vendor/golang.org/x/crypto/curve25519/square_amd64.s
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-#include "const_amd64.h"
-
-// func square(out, in *[5]uint64)
-TEXT ·square(SB),7,$0-16
- MOVQ out+0(FP), DI
- MOVQ in+8(FP), SI
-
- MOVQ 0(SI),AX
- MULQ 0(SI)
- MOVQ AX,CX
- MOVQ DX,R8
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 8(SI)
- MOVQ AX,R9
- MOVQ DX,R10
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 16(SI)
- MOVQ AX,R11
- MOVQ DX,R12
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 24(SI)
- MOVQ AX,R13
- MOVQ DX,R14
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 32(SI)
- MOVQ AX,R15
- MOVQ DX,BX
- MOVQ 8(SI),AX
- MULQ 8(SI)
- ADDQ AX,R11
- ADCQ DX,R12
- MOVQ 8(SI),AX
- SHLQ $1,AX
- MULQ 16(SI)
- ADDQ AX,R13
- ADCQ DX,R14
- MOVQ 8(SI),AX
- SHLQ $1,AX
- MULQ 24(SI)
- ADDQ AX,R15
- ADCQ DX,BX
- MOVQ 8(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,CX
- ADCQ DX,R8
- MOVQ 16(SI),AX
- MULQ 16(SI)
- ADDQ AX,R15
- ADCQ DX,BX
- MOVQ 16(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 24(SI)
- ADDQ AX,CX
- ADCQ DX,R8
- MOVQ 16(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,R9
- ADCQ DX,R10
- MOVQ 24(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(SI)
- ADDQ AX,R9
- ADCQ DX,R10
- MOVQ 24(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,R11
- ADCQ DX,R12
- MOVQ 32(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SI)
- ADDQ AX,R13
- ADCQ DX,R14
- MOVQ $REDMASK51,SI
- SHLQ $13,R8:CX
- ANDQ SI,CX
- SHLQ $13,R10:R9
- ANDQ SI,R9
- ADDQ R8,R9
- SHLQ $13,R12:R11
- ANDQ SI,R11
- ADDQ R10,R11
- SHLQ $13,R14:R13
- ANDQ SI,R13
- ADDQ R12,R13
- SHLQ $13,BX:R15
- ANDQ SI,R15
- ADDQ R14,R15
- IMUL3Q $19,BX,DX
- ADDQ DX,CX
- MOVQ CX,DX
- SHRQ $51,DX
- ADDQ R9,DX
- ANDQ SI,CX
- MOVQ DX,R8
- SHRQ $51,DX
- ADDQ R11,DX
- ANDQ SI,R8
- MOVQ DX,R9
- SHRQ $51,DX
- ADDQ R13,DX
- ANDQ SI,R9
- MOVQ DX,AX
- SHRQ $51,DX
- ADDQ R15,DX
- ANDQ SI,AX
- MOVQ DX,R10
- SHRQ $51,DX
- IMUL3Q $19,DX,DX
- ADDQ DX,CX
- ANDQ SI,R10
- MOVQ CX,0(DI)
- MOVQ R8,8(DI)
- MOVQ R9,16(DI)
- MOVQ AX,24(DI)
- MOVQ R10,32(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/ed25519/ed25519.go b/vendor/golang.org/x/crypto/ed25519/ed25519.go
deleted file mode 100644
index d6f683ba..00000000
--- a/vendor/golang.org/x/crypto/ed25519/ed25519.go
+++ /dev/null
@@ -1,217 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package ed25519 implements the Ed25519 signature algorithm. See
-// https://ed25519.cr.yp.to/.
-//
-// These functions are also compatible with the “Ed25519” function defined in
-// RFC 8032. However, unlike RFC 8032's formulation, this package's private key
-// representation includes a public key suffix to make multiple signing
-// operations with the same key more efficient. This package refers to the RFC
-// 8032 private key as the “seed”.
-package ed25519
-
-// This code is a port of the public domain, “ref10” implementation of ed25519
-// from SUPERCOP.
-
-import (
- "bytes"
- "crypto"
- cryptorand "crypto/rand"
- "crypto/sha512"
- "errors"
- "io"
- "strconv"
-
- "golang.org/x/crypto/ed25519/internal/edwards25519"
-)
-
-const (
- // PublicKeySize is the size, in bytes, of public keys as used in this package.
- PublicKeySize = 32
- // PrivateKeySize is the size, in bytes, of private keys as used in this package.
- PrivateKeySize = 64
- // SignatureSize is the size, in bytes, of signatures generated and verified by this package.
- SignatureSize = 64
- // SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032.
- SeedSize = 32
-)
-
-// PublicKey is the type of Ed25519 public keys.
-type PublicKey []byte
-
-// PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer.
-type PrivateKey []byte
-
-// Public returns the PublicKey corresponding to priv.
-func (priv PrivateKey) Public() crypto.PublicKey {
- publicKey := make([]byte, PublicKeySize)
- copy(publicKey, priv[32:])
- return PublicKey(publicKey)
-}
-
-// Seed returns the private key seed corresponding to priv. It is provided for
-// interoperability with RFC 8032. RFC 8032's private keys correspond to seeds
-// in this package.
-func (priv PrivateKey) Seed() []byte {
- seed := make([]byte, SeedSize)
- copy(seed, priv[:32])
- return seed
-}
-
-// Sign signs the given message with priv.
-// Ed25519 performs two passes over messages to be signed and therefore cannot
-// handle pre-hashed messages. Thus opts.HashFunc() must return zero to
-// indicate the message hasn't been hashed. This can be achieved by passing
-// crypto.Hash(0) as the value for opts.
-func (priv PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error) {
- if opts.HashFunc() != crypto.Hash(0) {
- return nil, errors.New("ed25519: cannot sign hashed message")
- }
-
- return Sign(priv, message), nil
-}
-
-// GenerateKey generates a public/private key pair using entropy from rand.
-// If rand is nil, crypto/rand.Reader will be used.
-func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) {
- if rand == nil {
- rand = cryptorand.Reader
- }
-
- seed := make([]byte, SeedSize)
- if _, err := io.ReadFull(rand, seed); err != nil {
- return nil, nil, err
- }
-
- privateKey := NewKeyFromSeed(seed)
- publicKey := make([]byte, PublicKeySize)
- copy(publicKey, privateKey[32:])
-
- return publicKey, privateKey, nil
-}
-
-// NewKeyFromSeed calculates a private key from a seed. It will panic if
-// len(seed) is not SeedSize. This function is provided for interoperability
-// with RFC 8032. RFC 8032's private keys correspond to seeds in this
-// package.
-func NewKeyFromSeed(seed []byte) PrivateKey {
- if l := len(seed); l != SeedSize {
- panic("ed25519: bad seed length: " + strconv.Itoa(l))
- }
-
- digest := sha512.Sum512(seed)
- digest[0] &= 248
- digest[31] &= 127
- digest[31] |= 64
-
- var A edwards25519.ExtendedGroupElement
- var hBytes [32]byte
- copy(hBytes[:], digest[:])
- edwards25519.GeScalarMultBase(&A, &hBytes)
- var publicKeyBytes [32]byte
- A.ToBytes(&publicKeyBytes)
-
- privateKey := make([]byte, PrivateKeySize)
- copy(privateKey, seed)
- copy(privateKey[32:], publicKeyBytes[:])
-
- return privateKey
-}
-
-// Sign signs the message with privateKey and returns a signature. It will
-// panic if len(privateKey) is not PrivateKeySize.
-func Sign(privateKey PrivateKey, message []byte) []byte {
- if l := len(privateKey); l != PrivateKeySize {
- panic("ed25519: bad private key length: " + strconv.Itoa(l))
- }
-
- h := sha512.New()
- h.Write(privateKey[:32])
-
- var digest1, messageDigest, hramDigest [64]byte
- var expandedSecretKey [32]byte
- h.Sum(digest1[:0])
- copy(expandedSecretKey[:], digest1[:])
- expandedSecretKey[0] &= 248
- expandedSecretKey[31] &= 63
- expandedSecretKey[31] |= 64
-
- h.Reset()
- h.Write(digest1[32:])
- h.Write(message)
- h.Sum(messageDigest[:0])
-
- var messageDigestReduced [32]byte
- edwards25519.ScReduce(&messageDigestReduced, &messageDigest)
- var R edwards25519.ExtendedGroupElement
- edwards25519.GeScalarMultBase(&R, &messageDigestReduced)
-
- var encodedR [32]byte
- R.ToBytes(&encodedR)
-
- h.Reset()
- h.Write(encodedR[:])
- h.Write(privateKey[32:])
- h.Write(message)
- h.Sum(hramDigest[:0])
- var hramDigestReduced [32]byte
- edwards25519.ScReduce(&hramDigestReduced, &hramDigest)
-
- var s [32]byte
- edwards25519.ScMulAdd(&s, &hramDigestReduced, &expandedSecretKey, &messageDigestReduced)
-
- signature := make([]byte, SignatureSize)
- copy(signature[:], encodedR[:])
- copy(signature[32:], s[:])
-
- return signature
-}
-
-// Verify reports whether sig is a valid signature of message by publicKey. It
-// will panic if len(publicKey) is not PublicKeySize.
-func Verify(publicKey PublicKey, message, sig []byte) bool {
- if l := len(publicKey); l != PublicKeySize {
- panic("ed25519: bad public key length: " + strconv.Itoa(l))
- }
-
- if len(sig) != SignatureSize || sig[63]&224 != 0 {
- return false
- }
-
- var A edwards25519.ExtendedGroupElement
- var publicKeyBytes [32]byte
- copy(publicKeyBytes[:], publicKey)
- if !A.FromBytes(&publicKeyBytes) {
- return false
- }
- edwards25519.FeNeg(&A.X, &A.X)
- edwards25519.FeNeg(&A.T, &A.T)
-
- h := sha512.New()
- h.Write(sig[:32])
- h.Write(publicKey[:])
- h.Write(message)
- var digest [64]byte
- h.Sum(digest[:0])
-
- var hReduced [32]byte
- edwards25519.ScReduce(&hReduced, &digest)
-
- var R edwards25519.ProjectiveGroupElement
- var s [32]byte
- copy(s[:], sig[32:])
-
- // https://tools.ietf.org/html/rfc8032#section-5.1.7 requires that s be in
- // the range [0, order) in order to prevent signature malleability.
- if !edwards25519.ScMinimal(&s) {
- return false
- }
-
- edwards25519.GeDoubleScalarMultVartime(&R, &hReduced, &A, &s)
-
- var checkR [32]byte
- R.ToBytes(&checkR)
- return bytes.Equal(sig[:32], checkR[:])
-}
diff --git a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go b/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go
deleted file mode 100644
index e39f086c..00000000
--- a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go
+++ /dev/null
@@ -1,1422 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package edwards25519
-
-// These values are from the public domain, “ref10” implementation of ed25519
-// from SUPERCOP.
-
-// d is a constant in the Edwards curve equation.
-var d = FieldElement{
- -10913610, 13857413, -15372611, 6949391, 114729, -8787816, -6275908, -3247719, -18696448, -12055116,
-}
-
-// d2 is 2*d.
-var d2 = FieldElement{
- -21827239, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199,
-}
-
-// SqrtM1 is the square-root of -1 in the field.
-var SqrtM1 = FieldElement{
- -32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482,
-}
-
-// A is a constant in the Montgomery-form of curve25519.
-var A = FieldElement{
- 486662, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-}
-
-// bi contains precomputed multiples of the base-point. See the Ed25519 paper
-// for a discussion about how these values are used.
-var bi = [8]PreComputedGroupElement{
- {
- FieldElement{25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605},
- FieldElement{-12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378},
- FieldElement{-8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546},
- },
- {
- FieldElement{15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024},
- FieldElement{16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574},
- FieldElement{30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357},
- },
- {
- FieldElement{10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380},
- FieldElement{4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306},
- FieldElement{19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942},
- },
- {
- FieldElement{5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766},
- FieldElement{-30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701},
- FieldElement{28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300},
- },
- {
- FieldElement{-22518993, -6692182, 14201702, -8745502, -23510406, 8844726, 18474211, -1361450, -13062696, 13821877},
- FieldElement{-6455177, -7839871, 3374702, -4740862, -27098617, -10571707, 31655028, -7212327, 18853322, -14220951},
- FieldElement{4566830, -12963868, -28974889, -12240689, -7602672, -2830569, -8514358, -10431137, 2207753, -3209784},
- },
- {
- FieldElement{-25154831, -4185821, 29681144, 7868801, -6854661, -9423865, -12437364, -663000, -31111463, -16132436},
- FieldElement{25576264, -2703214, 7349804, -11814844, 16472782, 9300885, 3844789, 15725684, 171356, 6466918},
- FieldElement{23103977, 13316479, 9739013, -16149481, 817875, -15038942, 8965339, -14088058, -30714912, 16193877},
- },
- {
- FieldElement{-33521811, 3180713, -2394130, 14003687, -16903474, -16270840, 17238398, 4729455, -18074513, 9256800},
- FieldElement{-25182317, -4174131, 32336398, 5036987, -21236817, 11360617, 22616405, 9761698, -19827198, 630305},
- FieldElement{-13720693, 2639453, -24237460, -7406481, 9494427, -5774029, -6554551, -15960994, -2449256, -14291300},
- },
- {
- FieldElement{-3151181, -5046075, 9282714, 6866145, -31907062, -863023, -18940575, 15033784, 25105118, -7894876},
- FieldElement{-24326370, 15950226, -31801215, -14592823, -11662737, -5090925, 1573892, -2625887, 2198790, -15804619},
- FieldElement{-3099351, 10324967, -2241613, 7453183, -5446979, -2735503, -13812022, -16236442, -32461234, -12290683},
- },
-}
-
-// base contains precomputed multiples of the base-point. See the Ed25519 paper
-// for a discussion about how these values are used.
-var base = [32][8]PreComputedGroupElement{
- {
- {
- FieldElement{25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605},
- FieldElement{-12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378},
- FieldElement{-8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546},
- },
- {
- FieldElement{-12815894, -12976347, -21581243, 11784320, -25355658, -2750717, -11717903, -3814571, -358445, -10211303},
- FieldElement{-21703237, 6903825, 27185491, 6451973, -29577724, -9554005, -15616551, 11189268, -26829678, -5319081},
- FieldElement{26966642, 11152617, 32442495, 15396054, 14353839, -12752335, -3128826, -9541118, -15472047, -4166697},
- },
- {
- FieldElement{15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024},
- FieldElement{16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574},
- FieldElement{30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357},
- },
- {
- FieldElement{-17036878, 13921892, 10945806, -6033431, 27105052, -16084379, -28926210, 15006023, 3284568, -6276540},
- FieldElement{23599295, -8306047, -11193664, -7687416, 13236774, 10506355, 7464579, 9656445, 13059162, 10374397},
- FieldElement{7798556, 16710257, 3033922, 2874086, 28997861, 2835604, 32406664, -3839045, -641708, -101325},
- },
- {
- FieldElement{10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380},
- FieldElement{4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306},
- FieldElement{19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942},
- },
- {
- FieldElement{-15371964, -12862754, 32573250, 4720197, -26436522, 5875511, -19188627, -15224819, -9818940, -12085777},
- FieldElement{-8549212, 109983, 15149363, 2178705, 22900618, 4543417, 3044240, -15689887, 1762328, 14866737},
- FieldElement{-18199695, -15951423, -10473290, 1707278, -17185920, 3916101, -28236412, 3959421, 27914454, 4383652},
- },
- {
- FieldElement{5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766},
- FieldElement{-30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701},
- FieldElement{28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300},
- },
- {
- FieldElement{14499471, -2729599, -33191113, -4254652, 28494862, 14271267, 30290735, 10876454, -33154098, 2381726},
- FieldElement{-7195431, -2655363, -14730155, 462251, -27724326, 3941372, -6236617, 3696005, -32300832, 15351955},
- FieldElement{27431194, 8222322, 16448760, -3907995, -18707002, 11938355, -32961401, -2970515, 29551813, 10109425},
- },
- },
- {
- {
- FieldElement{-13657040, -13155431, -31283750, 11777098, 21447386, 6519384, -2378284, -1627556, 10092783, -4764171},
- FieldElement{27939166, 14210322, 4677035, 16277044, -22964462, -12398139, -32508754, 12005538, -17810127, 12803510},
- FieldElement{17228999, -15661624, -1233527, 300140, -1224870, -11714777, 30364213, -9038194, 18016357, 4397660},
- },
- {
- FieldElement{-10958843, -7690207, 4776341, -14954238, 27850028, -15602212, -26619106, 14544525, -17477504, 982639},
- FieldElement{29253598, 15796703, -2863982, -9908884, 10057023, 3163536, 7332899, -4120128, -21047696, 9934963},
- FieldElement{5793303, 16271923, -24131614, -10116404, 29188560, 1206517, -14747930, 4559895, -30123922, -10897950},
- },
- {
- FieldElement{-27643952, -11493006, 16282657, -11036493, 28414021, -15012264, 24191034, 4541697, -13338309, 5500568},
- FieldElement{12650548, -1497113, 9052871, 11355358, -17680037, -8400164, -17430592, 12264343, 10874051, 13524335},
- FieldElement{25556948, -3045990, 714651, 2510400, 23394682, -10415330, 33119038, 5080568, -22528059, 5376628},
- },
- {
- FieldElement{-26088264, -4011052, -17013699, -3537628, -6726793, 1920897, -22321305, -9447443, 4535768, 1569007},
- FieldElement{-2255422, 14606630, -21692440, -8039818, 28430649, 8775819, -30494562, 3044290, 31848280, 12543772},
- FieldElement{-22028579, 2943893, -31857513, 6777306, 13784462, -4292203, -27377195, -2062731, 7718482, 14474653},
- },
- {
- FieldElement{2385315, 2454213, -22631320, 46603, -4437935, -15680415, 656965, -7236665, 24316168, -5253567},
- FieldElement{13741529, 10911568, -33233417, -8603737, -20177830, -1033297, 33040651, -13424532, -20729456, 8321686},
- FieldElement{21060490, -2212744, 15712757, -4336099, 1639040, 10656336, 23845965, -11874838, -9984458, 608372},
- },
- {
- FieldElement{-13672732, -15087586, -10889693, -7557059, -6036909, 11305547, 1123968, -6780577, 27229399, 23887},
- FieldElement{-23244140, -294205, -11744728, 14712571, -29465699, -2029617, 12797024, -6440308, -1633405, 16678954},
- FieldElement{-29500620, 4770662, -16054387, 14001338, 7830047, 9564805, -1508144, -4795045, -17169265, 4904953},
- },
- {
- FieldElement{24059557, 14617003, 19037157, -15039908, 19766093, -14906429, 5169211, 16191880, 2128236, -4326833},
- FieldElement{-16981152, 4124966, -8540610, -10653797, 30336522, -14105247, -29806336, 916033, -6882542, -2986532},
- FieldElement{-22630907, 12419372, -7134229, -7473371, -16478904, 16739175, 285431, 2763829, 15736322, 4143876},
- },
- {
- FieldElement{2379352, 11839345, -4110402, -5988665, 11274298, 794957, 212801, -14594663, 23527084, -16458268},
- FieldElement{33431127, -11130478, -17838966, -15626900, 8909499, 8376530, -32625340, 4087881, -15188911, -14416214},
- FieldElement{1767683, 7197987, -13205226, -2022635, -13091350, 448826, 5799055, 4357868, -4774191, -16323038},
- },
- },
- {
- {
- FieldElement{6721966, 13833823, -23523388, -1551314, 26354293, -11863321, 23365147, -3949732, 7390890, 2759800},
- FieldElement{4409041, 2052381, 23373853, 10530217, 7676779, -12885954, 21302353, -4264057, 1244380, -12919645},
- FieldElement{-4421239, 7169619, 4982368, -2957590, 30256825, -2777540, 14086413, 9208236, 15886429, 16489664},
- },
- {
- FieldElement{1996075, 10375649, 14346367, 13311202, -6874135, -16438411, -13693198, 398369, -30606455, -712933},
- FieldElement{-25307465, 9795880, -2777414, 14878809, -33531835, 14780363, 13348553, 12076947, -30836462, 5113182},
- FieldElement{-17770784, 11797796, 31950843, 13929123, -25888302, 12288344, -30341101, -7336386, 13847711, 5387222},
- },
- {
- FieldElement{-18582163, -3416217, 17824843, -2340966, 22744343, -10442611, 8763061, 3617786, -19600662, 10370991},
- FieldElement{20246567, -14369378, 22358229, -543712, 18507283, -10413996, 14554437, -8746092, 32232924, 16763880},
- FieldElement{9648505, 10094563, 26416693, 14745928, -30374318, -6472621, 11094161, 15689506, 3140038, -16510092},
- },
- {
- FieldElement{-16160072, 5472695, 31895588, 4744994, 8823515, 10365685, -27224800, 9448613, -28774454, 366295},
- FieldElement{19153450, 11523972, -11096490, -6503142, -24647631, 5420647, 28344573, 8041113, 719605, 11671788},
- FieldElement{8678025, 2694440, -6808014, 2517372, 4964326, 11152271, -15432916, -15266516, 27000813, -10195553},
- },
- {
- FieldElement{-15157904, 7134312, 8639287, -2814877, -7235688, 10421742, 564065, 5336097, 6750977, -14521026},
- FieldElement{11836410, -3979488, 26297894, 16080799, 23455045, 15735944, 1695823, -8819122, 8169720, 16220347},
- FieldElement{-18115838, 8653647, 17578566, -6092619, -8025777, -16012763, -11144307, -2627664, -5990708, -14166033},
- },
- {
- FieldElement{-23308498, -10968312, 15213228, -10081214, -30853605, -11050004, 27884329, 2847284, 2655861, 1738395},
- FieldElement{-27537433, -14253021, -25336301, -8002780, -9370762, 8129821, 21651608, -3239336, -19087449, -11005278},
- FieldElement{1533110, 3437855, 23735889, 459276, 29970501, 11335377, 26030092, 5821408, 10478196, 8544890},
- },
- {
- FieldElement{32173121, -16129311, 24896207, 3921497, 22579056, -3410854, 19270449, 12217473, 17789017, -3395995},
- FieldElement{-30552961, -2228401, -15578829, -10147201, 13243889, 517024, 15479401, -3853233, 30460520, 1052596},
- FieldElement{-11614875, 13323618, 32618793, 8175907, -15230173, 12596687, 27491595, -4612359, 3179268, -9478891},
- },
- {
- FieldElement{31947069, -14366651, -4640583, -15339921, -15125977, -6039709, -14756777, -16411740, 19072640, -9511060},
- FieldElement{11685058, 11822410, 3158003, -13952594, 33402194, -4165066, 5977896, -5215017, 473099, 5040608},
- FieldElement{-20290863, 8198642, -27410132, 11602123, 1290375, -2799760, 28326862, 1721092, -19558642, -3131606},
- },
- },
- {
- {
- FieldElement{7881532, 10687937, 7578723, 7738378, -18951012, -2553952, 21820786, 8076149, -27868496, 11538389},
- FieldElement{-19935666, 3899861, 18283497, -6801568, -15728660, -11249211, 8754525, 7446702, -5676054, 5797016},
- FieldElement{-11295600, -3793569, -15782110, -7964573, 12708869, -8456199, 2014099, -9050574, -2369172, -5877341},
- },
- {
- FieldElement{-22472376, -11568741, -27682020, 1146375, 18956691, 16640559, 1192730, -3714199, 15123619, 10811505},
- FieldElement{14352098, -3419715, -18942044, 10822655, 32750596, 4699007, -70363, 15776356, -28886779, -11974553},
- FieldElement{-28241164, -8072475, -4978962, -5315317, 29416931, 1847569, -20654173, -16484855, 4714547, -9600655},
- },
- {
- FieldElement{15200332, 8368572, 19679101, 15970074, -31872674, 1959451, 24611599, -4543832, -11745876, 12340220},
- FieldElement{12876937, -10480056, 33134381, 6590940, -6307776, 14872440, 9613953, 8241152, 15370987, 9608631},
- FieldElement{-4143277, -12014408, 8446281, -391603, 4407738, 13629032, -7724868, 15866074, -28210621, -8814099},
- },
- {
- FieldElement{26660628, -15677655, 8393734, 358047, -7401291, 992988, -23904233, 858697, 20571223, 8420556},
- FieldElement{14620715, 13067227, -15447274, 8264467, 14106269, 15080814, 33531827, 12516406, -21574435, -12476749},
- FieldElement{236881, 10476226, 57258, -14677024, 6472998, 2466984, 17258519, 7256740, 8791136, 15069930},
- },
- {
- FieldElement{1276410, -9371918, 22949635, -16322807, -23493039, -5702186, 14711875, 4874229, -30663140, -2331391},
- FieldElement{5855666, 4990204, -13711848, 7294284, -7804282, 1924647, -1423175, -7912378, -33069337, 9234253},
- FieldElement{20590503, -9018988, 31529744, -7352666, -2706834, 10650548, 31559055, -11609587, 18979186, 13396066},
- },
- {
- FieldElement{24474287, 4968103, 22267082, 4407354, 24063882, -8325180, -18816887, 13594782, 33514650, 7021958},
- FieldElement{-11566906, -6565505, -21365085, 15928892, -26158305, 4315421, -25948728, -3916677, -21480480, 12868082},
- FieldElement{-28635013, 13504661, 19988037, -2132761, 21078225, 6443208, -21446107, 2244500, -12455797, -8089383},
- },
- {
- FieldElement{-30595528, 13793479, -5852820, 319136, -25723172, -6263899, 33086546, 8957937, -15233648, 5540521},
- FieldElement{-11630176, -11503902, -8119500, -7643073, 2620056, 1022908, -23710744, -1568984, -16128528, -14962807},
- FieldElement{23152971, 775386, 27395463, 14006635, -9701118, 4649512, 1689819, 892185, -11513277, -15205948},
- },
- {
- FieldElement{9770129, 9586738, 26496094, 4324120, 1556511, -3550024, 27453819, 4763127, -19179614, 5867134},
- FieldElement{-32765025, 1927590, 31726409, -4753295, 23962434, -16019500, 27846559, 5931263, -29749703, -16108455},
- FieldElement{27461885, -2977536, 22380810, 1815854, -23033753, -3031938, 7283490, -15148073, -19526700, 7734629},
- },
- },
- {
- {
- FieldElement{-8010264, -9590817, -11120403, 6196038, 29344158, -13430885, 7585295, -3176626, 18549497, 15302069},
- FieldElement{-32658337, -6171222, -7672793, -11051681, 6258878, 13504381, 10458790, -6418461, -8872242, 8424746},
- FieldElement{24687205, 8613276, -30667046, -3233545, 1863892, -1830544, 19206234, 7134917, -11284482, -828919},
- },
- {
- FieldElement{11334899, -9218022, 8025293, 12707519, 17523892, -10476071, 10243738, -14685461, -5066034, 16498837},
- FieldElement{8911542, 6887158, -9584260, -6958590, 11145641, -9543680, 17303925, -14124238, 6536641, 10543906},
- FieldElement{-28946384, 15479763, -17466835, 568876, -1497683, 11223454, -2669190, -16625574, -27235709, 8876771},
- },
- {
- FieldElement{-25742899, -12566864, -15649966, -846607, -33026686, -796288, -33481822, 15824474, -604426, -9039817},
- FieldElement{10330056, 70051, 7957388, -9002667, 9764902, 15609756, 27698697, -4890037, 1657394, 3084098},
- FieldElement{10477963, -7470260, 12119566, -13250805, 29016247, -5365589, 31280319, 14396151, -30233575, 15272409},
- },
- {
- FieldElement{-12288309, 3169463, 28813183, 16658753, 25116432, -5630466, -25173957, -12636138, -25014757, 1950504},
- FieldElement{-26180358, 9489187, 11053416, -14746161, -31053720, 5825630, -8384306, -8767532, 15341279, 8373727},
- FieldElement{28685821, 7759505, -14378516, -12002860, -31971820, 4079242, 298136, -10232602, -2878207, 15190420},
- },
- {
- FieldElement{-32932876, 13806336, -14337485, -15794431, -24004620, 10940928, 8669718, 2742393, -26033313, -6875003},
- FieldElement{-1580388, -11729417, -25979658, -11445023, -17411874, -10912854, 9291594, -16247779, -12154742, 6048605},
- FieldElement{-30305315, 14843444, 1539301, 11864366, 20201677, 1900163, 13934231, 5128323, 11213262, 9168384},
- },
- {
- FieldElement{-26280513, 11007847, 19408960, -940758, -18592965, -4328580, -5088060, -11105150, 20470157, -16398701},
- FieldElement{-23136053, 9282192, 14855179, -15390078, -7362815, -14408560, -22783952, 14461608, 14042978, 5230683},
- FieldElement{29969567, -2741594, -16711867, -8552442, 9175486, -2468974, 21556951, 3506042, -5933891, -12449708},
- },
- {
- FieldElement{-3144746, 8744661, 19704003, 4581278, -20430686, 6830683, -21284170, 8971513, -28539189, 15326563},
- FieldElement{-19464629, 10110288, -17262528, -3503892, -23500387, 1355669, -15523050, 15300988, -20514118, 9168260},
- FieldElement{-5353335, 4488613, -23803248, 16314347, 7780487, -15638939, -28948358, 9601605, 33087103, -9011387},
- },
- {
- FieldElement{-19443170, -15512900, -20797467, -12445323, -29824447, 10229461, -27444329, -15000531, -5996870, 15664672},
- FieldElement{23294591, -16632613, -22650781, -8470978, 27844204, 11461195, 13099750, -2460356, 18151676, 13417686},
- FieldElement{-24722913, -4176517, -31150679, 5988919, -26858785, 6685065, 1661597, -12551441, 15271676, -15452665},
- },
- },
- {
- {
- FieldElement{11433042, -13228665, 8239631, -5279517, -1985436, -725718, -18698764, 2167544, -6921301, -13440182},
- FieldElement{-31436171, 15575146, 30436815, 12192228, -22463353, 9395379, -9917708, -8638997, 12215110, 12028277},
- FieldElement{14098400, 6555944, 23007258, 5757252, -15427832, -12950502, 30123440, 4617780, -16900089, -655628},
- },
- {
- FieldElement{-4026201, -15240835, 11893168, 13718664, -14809462, 1847385, -15819999, 10154009, 23973261, -12684474},
- FieldElement{-26531820, -3695990, -1908898, 2534301, -31870557, -16550355, 18341390, -11419951, 32013174, -10103539},
- FieldElement{-25479301, 10876443, -11771086, -14625140, -12369567, 1838104, 21911214, 6354752, 4425632, -837822},
- },
- {
- FieldElement{-10433389, -14612966, 22229858, -3091047, -13191166, 776729, -17415375, -12020462, 4725005, 14044970},
- FieldElement{19268650, -7304421, 1555349, 8692754, -21474059, -9910664, 6347390, -1411784, -19522291, -16109756},
- FieldElement{-24864089, 12986008, -10898878, -5558584, -11312371, -148526, 19541418, 8180106, 9282262, 10282508},
- },
- {
- FieldElement{-26205082, 4428547, -8661196, -13194263, 4098402, -14165257, 15522535, 8372215, 5542595, -10702683},
- FieldElement{-10562541, 14895633, 26814552, -16673850, -17480754, -2489360, -2781891, 6993761, -18093885, 10114655},
- FieldElement{-20107055, -929418, 31422704, 10427861, -7110749, 6150669, -29091755, -11529146, 25953725, -106158},
- },
- {
- FieldElement{-4234397, -8039292, -9119125, 3046000, 2101609, -12607294, 19390020, 6094296, -3315279, 12831125},
- FieldElement{-15998678, 7578152, 5310217, 14408357, -33548620, -224739, 31575954, 6326196, 7381791, -2421839},
- FieldElement{-20902779, 3296811, 24736065, -16328389, 18374254, 7318640, 6295303, 8082724, -15362489, 12339664},
- },
- {
- FieldElement{27724736, 2291157, 6088201, -14184798, 1792727, 5857634, 13848414, 15768922, 25091167, 14856294},
- FieldElement{-18866652, 8331043, 24373479, 8541013, -701998, -9269457, 12927300, -12695493, -22182473, -9012899},
- FieldElement{-11423429, -5421590, 11632845, 3405020, 30536730, -11674039, -27260765, 13866390, 30146206, 9142070},
- },
- {
- FieldElement{3924129, -15307516, -13817122, -10054960, 12291820, -668366, -27702774, 9326384, -8237858, 4171294},
- FieldElement{-15921940, 16037937, 6713787, 16606682, -21612135, 2790944, 26396185, 3731949, 345228, -5462949},
- FieldElement{-21327538, 13448259, 25284571, 1143661, 20614966, -8849387, 2031539, -12391231, -16253183, -13582083},
- },
- {
- FieldElement{31016211, -16722429, 26371392, -14451233, -5027349, 14854137, 17477601, 3842657, 28012650, -16405420},
- FieldElement{-5075835, 9368966, -8562079, -4600902, -15249953, 6970560, -9189873, 16292057, -8867157, 3507940},
- FieldElement{29439664, 3537914, 23333589, 6997794, -17555561, -11018068, -15209202, -15051267, -9164929, 6580396},
- },
- },
- {
- {
- FieldElement{-12185861, -7679788, 16438269, 10826160, -8696817, -6235611, 17860444, -9273846, -2095802, 9304567},
- FieldElement{20714564, -4336911, 29088195, 7406487, 11426967, -5095705, 14792667, -14608617, 5289421, -477127},
- FieldElement{-16665533, -10650790, -6160345, -13305760, 9192020, -1802462, 17271490, 12349094, 26939669, -3752294},
- },
- {
- FieldElement{-12889898, 9373458, 31595848, 16374215, 21471720, 13221525, -27283495, -12348559, -3698806, 117887},
- FieldElement{22263325, -6560050, 3984570, -11174646, -15114008, -566785, 28311253, 5358056, -23319780, 541964},
- FieldElement{16259219, 3261970, 2309254, -15534474, -16885711, -4581916, 24134070, -16705829, -13337066, -13552195},
- },
- {
- FieldElement{9378160, -13140186, -22845982, -12745264, 28198281, -7244098, -2399684, -717351, 690426, 14876244},
- FieldElement{24977353, -314384, -8223969, -13465086, 28432343, -1176353, -13068804, -12297348, -22380984, 6618999},
- FieldElement{-1538174, 11685646, 12944378, 13682314, -24389511, -14413193, 8044829, -13817328, 32239829, -5652762},
- },
- {
- FieldElement{-18603066, 4762990, -926250, 8885304, -28412480, -3187315, 9781647, -10350059, 32779359, 5095274},
- FieldElement{-33008130, -5214506, -32264887, -3685216, 9460461, -9327423, -24601656, 14506724, 21639561, -2630236},
- FieldElement{-16400943, -13112215, 25239338, 15531969, 3987758, -4499318, -1289502, -6863535, 17874574, 558605},
- },
- {
- FieldElement{-13600129, 10240081, 9171883, 16131053, -20869254, 9599700, 33499487, 5080151, 2085892, 5119761},
- FieldElement{-22205145, -2519528, -16381601, 414691, -25019550, 2170430, 30634760, -8363614, -31999993, -5759884},
- FieldElement{-6845704, 15791202, 8550074, -1312654, 29928809, -12092256, 27534430, -7192145, -22351378, 12961482},
- },
- {
- FieldElement{-24492060, -9570771, 10368194, 11582341, -23397293, -2245287, 16533930, 8206996, -30194652, -5159638},
- FieldElement{-11121496, -3382234, 2307366, 6362031, -135455, 8868177, -16835630, 7031275, 7589640, 8945490},
- FieldElement{-32152748, 8917967, 6661220, -11677616, -1192060, -15793393, 7251489, -11182180, 24099109, -14456170},
- },
- {
- FieldElement{5019558, -7907470, 4244127, -14714356, -26933272, 6453165, -19118182, -13289025, -6231896, -10280736},
- FieldElement{10853594, 10721687, 26480089, 5861829, -22995819, 1972175, -1866647, -10557898, -3363451, -6441124},
- FieldElement{-17002408, 5906790, 221599, -6563147, 7828208, -13248918, 24362661, -2008168, -13866408, 7421392},
- },
- {
- FieldElement{8139927, -6546497, 32257646, -5890546, 30375719, 1886181, -21175108, 15441252, 28826358, -4123029},
- FieldElement{6267086, 9695052, 7709135, -16603597, -32869068, -1886135, 14795160, -7840124, 13746021, -1742048},
- FieldElement{28584902, 7787108, -6732942, -15050729, 22846041, -7571236, -3181936, -363524, 4771362, -8419958},
- },
- },
- {
- {
- FieldElement{24949256, 6376279, -27466481, -8174608, -18646154, -9930606, 33543569, -12141695, 3569627, 11342593},
- FieldElement{26514989, 4740088, 27912651, 3697550, 19331575, -11472339, 6809886, 4608608, 7325975, -14801071},
- FieldElement{-11618399, -14554430, -24321212, 7655128, -1369274, 5214312, -27400540, 10258390, -17646694, -8186692},
- },
- {
- FieldElement{11431204, 15823007, 26570245, 14329124, 18029990, 4796082, -31446179, 15580664, 9280358, -3973687},
- FieldElement{-160783, -10326257, -22855316, -4304997, -20861367, -13621002, -32810901, -11181622, -15545091, 4387441},
- FieldElement{-20799378, 12194512, 3937617, -5805892, -27154820, 9340370, -24513992, 8548137, 20617071, -7482001},
- },
- {
- FieldElement{-938825, -3930586, -8714311, 16124718, 24603125, -6225393, -13775352, -11875822, 24345683, 10325460},
- FieldElement{-19855277, -1568885, -22202708, 8714034, 14007766, 6928528, 16318175, -1010689, 4766743, 3552007},
- FieldElement{-21751364, -16730916, 1351763, -803421, -4009670, 3950935, 3217514, 14481909, 10988822, -3994762},
- },
- {
- FieldElement{15564307, -14311570, 3101243, 5684148, 30446780, -8051356, 12677127, -6505343, -8295852, 13296005},
- FieldElement{-9442290, 6624296, -30298964, -11913677, -4670981, -2057379, 31521204, 9614054, -30000824, 12074674},
- FieldElement{4771191, -135239, 14290749, -13089852, 27992298, 14998318, -1413936, -1556716, 29832613, -16391035},
- },
- {
- FieldElement{7064884, -7541174, -19161962, -5067537, -18891269, -2912736, 25825242, 5293297, -27122660, 13101590},
- FieldElement{-2298563, 2439670, -7466610, 1719965, -27267541, -16328445, 32512469, -5317593, -30356070, -4190957},
- FieldElement{-30006540, 10162316, -33180176, 3981723, -16482138, -13070044, 14413974, 9515896, 19568978, 9628812},
- },
- {
- FieldElement{33053803, 199357, 15894591, 1583059, 27380243, -4580435, -17838894, -6106839, -6291786, 3437740},
- FieldElement{-18978877, 3884493, 19469877, 12726490, 15913552, 13614290, -22961733, 70104, 7463304, 4176122},
- FieldElement{-27124001, 10659917, 11482427, -16070381, 12771467, -6635117, -32719404, -5322751, 24216882, 5944158},
- },
- {
- FieldElement{8894125, 7450974, -2664149, -9765752, -28080517, -12389115, 19345746, 14680796, 11632993, 5847885},
- FieldElement{26942781, -2315317, 9129564, -4906607, 26024105, 11769399, -11518837, 6367194, -9727230, 4782140},
- FieldElement{19916461, -4828410, -22910704, -11414391, 25606324, -5972441, 33253853, 8220911, 6358847, -1873857},
- },
- {
- FieldElement{801428, -2081702, 16569428, 11065167, 29875704, 96627, 7908388, -4480480, -13538503, 1387155},
- FieldElement{19646058, 5720633, -11416706, 12814209, 11607948, 12749789, 14147075, 15156355, -21866831, 11835260},
- FieldElement{19299512, 1155910, 28703737, 14890794, 2925026, 7269399, 26121523, 15467869, -26560550, 5052483},
- },
- },
- {
- {
- FieldElement{-3017432, 10058206, 1980837, 3964243, 22160966, 12322533, -6431123, -12618185, 12228557, -7003677},
- FieldElement{32944382, 14922211, -22844894, 5188528, 21913450, -8719943, 4001465, 13238564, -6114803, 8653815},
- FieldElement{22865569, -4652735, 27603668, -12545395, 14348958, 8234005, 24808405, 5719875, 28483275, 2841751},
- },
- {
- FieldElement{-16420968, -1113305, -327719, -12107856, 21886282, -15552774, -1887966, -315658, 19932058, -12739203},
- FieldElement{-11656086, 10087521, -8864888, -5536143, -19278573, -3055912, 3999228, 13239134, -4777469, -13910208},
- FieldElement{1382174, -11694719, 17266790, 9194690, -13324356, 9720081, 20403944, 11284705, -14013818, 3093230},
- },
- {
- FieldElement{16650921, -11037932, -1064178, 1570629, -8329746, 7352753, -302424, 16271225, -24049421, -6691850},
- FieldElement{-21911077, -5927941, -4611316, -5560156, -31744103, -10785293, 24123614, 15193618, -21652117, -16739389},
- FieldElement{-9935934, -4289447, -25279823, 4372842, 2087473, 10399484, 31870908, 14690798, 17361620, 11864968},
- },
- {
- FieldElement{-11307610, 6210372, 13206574, 5806320, -29017692, -13967200, -12331205, -7486601, -25578460, -16240689},
- FieldElement{14668462, -12270235, 26039039, 15305210, 25515617, 4542480, 10453892, 6577524, 9145645, -6443880},
- FieldElement{5974874, 3053895, -9433049, -10385191, -31865124, 3225009, -7972642, 3936128, -5652273, -3050304},
- },
- {
- FieldElement{30625386, -4729400, -25555961, -12792866, -20484575, 7695099, 17097188, -16303496, -27999779, 1803632},
- FieldElement{-3553091, 9865099, -5228566, 4272701, -5673832, -16689700, 14911344, 12196514, -21405489, 7047412},
- FieldElement{20093277, 9920966, -11138194, -5343857, 13161587, 12044805, -32856851, 4124601, -32343828, -10257566},
- },
- {
- FieldElement{-20788824, 14084654, -13531713, 7842147, 19119038, -13822605, 4752377, -8714640, -21679658, 2288038},
- FieldElement{-26819236, -3283715, 29965059, 3039786, -14473765, 2540457, 29457502, 14625692, -24819617, 12570232},
- FieldElement{-1063558, -11551823, 16920318, 12494842, 1278292, -5869109, -21159943, -3498680, -11974704, 4724943},
- },
- {
- FieldElement{17960970, -11775534, -4140968, -9702530, -8876562, -1410617, -12907383, -8659932, -29576300, 1903856},
- FieldElement{23134274, -14279132, -10681997, -1611936, 20684485, 15770816, -12989750, 3190296, 26955097, 14109738},
- FieldElement{15308788, 5320727, -30113809, -14318877, 22902008, 7767164, 29425325, -11277562, 31960942, 11934971},
- },
- {
- FieldElement{-27395711, 8435796, 4109644, 12222639, -24627868, 14818669, 20638173, 4875028, 10491392, 1379718},
- FieldElement{-13159415, 9197841, 3875503, -8936108, -1383712, -5879801, 33518459, 16176658, 21432314, 12180697},
- FieldElement{-11787308, 11500838, 13787581, -13832590, -22430679, 10140205, 1465425, 12689540, -10301319, -13872883},
- },
- },
- {
- {
- FieldElement{5414091, -15386041, -21007664, 9643570, 12834970, 1186149, -2622916, -1342231, 26128231, 6032912},
- FieldElement{-26337395, -13766162, 32496025, -13653919, 17847801, -12669156, 3604025, 8316894, -25875034, -10437358},
- FieldElement{3296484, 6223048, 24680646, -12246460, -23052020, 5903205, -8862297, -4639164, 12376617, 3188849},
- },
- {
- FieldElement{29190488, -14659046, 27549113, -1183516, 3520066, -10697301, 32049515, -7309113, -16109234, -9852307},
- FieldElement{-14744486, -9309156, 735818, -598978, -20407687, -5057904, 25246078, -15795669, 18640741, -960977},
- FieldElement{-6928835, -16430795, 10361374, 5642961, 4910474, 12345252, -31638386, -494430, 10530747, 1053335},
- },
- {
- FieldElement{-29265967, -14186805, -13538216, -12117373, -19457059, -10655384, -31462369, -2948985, 24018831, 15026644},
- FieldElement{-22592535, -3145277, -2289276, 5953843, -13440189, 9425631, 25310643, 13003497, -2314791, -15145616},
- FieldElement{-27419985, -603321, -8043984, -1669117, -26092265, 13987819, -27297622, 187899, -23166419, -2531735},
- },
- {
- FieldElement{-21744398, -13810475, 1844840, 5021428, -10434399, -15911473, 9716667, 16266922, -5070217, 726099},
- FieldElement{29370922, -6053998, 7334071, -15342259, 9385287, 2247707, -13661962, -4839461, 30007388, -15823341},
- FieldElement{-936379, 16086691, 23751945, -543318, -1167538, -5189036, 9137109, 730663, 9835848, 4555336},
- },
- {
- FieldElement{-23376435, 1410446, -22253753, -12899614, 30867635, 15826977, 17693930, 544696, -11985298, 12422646},
- FieldElement{31117226, -12215734, -13502838, 6561947, -9876867, -12757670, -5118685, -4096706, 29120153, 13924425},
- FieldElement{-17400879, -14233209, 19675799, -2734756, -11006962, -5858820, -9383939, -11317700, 7240931, -237388},
- },
- {
- FieldElement{-31361739, -11346780, -15007447, -5856218, -22453340, -12152771, 1222336, 4389483, 3293637, -15551743},
- FieldElement{-16684801, -14444245, 11038544, 11054958, -13801175, -3338533, -24319580, 7733547, 12796905, -6335822},
- FieldElement{-8759414, -10817836, -25418864, 10783769, -30615557, -9746811, -28253339, 3647836, 3222231, -11160462},
- },
- {
- FieldElement{18606113, 1693100, -25448386, -15170272, 4112353, 10045021, 23603893, -2048234, -7550776, 2484985},
- FieldElement{9255317, -3131197, -12156162, -1004256, 13098013, -9214866, 16377220, -2102812, -19802075, -3034702},
- FieldElement{-22729289, 7496160, -5742199, 11329249, 19991973, -3347502, -31718148, 9936966, -30097688, -10618797},
- },
- {
- FieldElement{21878590, -5001297, 4338336, 13643897, -3036865, 13160960, 19708896, 5415497, -7360503, -4109293},
- FieldElement{27736861, 10103576, 12500508, 8502413, -3413016, -9633558, 10436918, -1550276, -23659143, -8132100},
- FieldElement{19492550, -12104365, -29681976, -852630, -3208171, 12403437, 30066266, 8367329, 13243957, 8709688},
- },
- },
- {
- {
- FieldElement{12015105, 2801261, 28198131, 10151021, 24818120, -4743133, -11194191, -5645734, 5150968, 7274186},
- FieldElement{2831366, -12492146, 1478975, 6122054, 23825128, -12733586, 31097299, 6083058, 31021603, -9793610},
- FieldElement{-2529932, -2229646, 445613, 10720828, -13849527, -11505937, -23507731, 16354465, 15067285, -14147707},
- },
- {
- FieldElement{7840942, 14037873, -33364863, 15934016, -728213, -3642706, 21403988, 1057586, -19379462, -12403220},
- FieldElement{915865, -16469274, 15608285, -8789130, -24357026, 6060030, -17371319, 8410997, -7220461, 16527025},
- FieldElement{32922597, -556987, 20336074, -16184568, 10903705, -5384487, 16957574, 52992, 23834301, 6588044},
- },
- {
- FieldElement{32752030, 11232950, 3381995, -8714866, 22652988, -10744103, 17159699, 16689107, -20314580, -1305992},
- FieldElement{-4689649, 9166776, -25710296, -10847306, 11576752, 12733943, 7924251, -2752281, 1976123, -7249027},
- FieldElement{21251222, 16309901, -2983015, -6783122, 30810597, 12967303, 156041, -3371252, 12331345, -8237197},
- },
- {
- FieldElement{8651614, -4477032, -16085636, -4996994, 13002507, 2950805, 29054427, -5106970, 10008136, -4667901},
- FieldElement{31486080, 15114593, -14261250, 12951354, 14369431, -7387845, 16347321, -13662089, 8684155, -10532952},
- FieldElement{19443825, 11385320, 24468943, -9659068, -23919258, 2187569, -26263207, -6086921, 31316348, 14219878},
- },
- {
- FieldElement{-28594490, 1193785, 32245219, 11392485, 31092169, 15722801, 27146014, 6992409, 29126555, 9207390},
- FieldElement{32382935, 1110093, 18477781, 11028262, -27411763, -7548111, -4980517, 10843782, -7957600, -14435730},
- FieldElement{2814918, 7836403, 27519878, -7868156, -20894015, -11553689, -21494559, 8550130, 28346258, 1994730},
- },
- {
- FieldElement{-19578299, 8085545, -14000519, -3948622, 2785838, -16231307, -19516951, 7174894, 22628102, 8115180},
- FieldElement{-30405132, 955511, -11133838, -15078069, -32447087, -13278079, -25651578, 3317160, -9943017, 930272},
- FieldElement{-15303681, -6833769, 28856490, 1357446, 23421993, 1057177, 24091212, -1388970, -22765376, -10650715},
- },
- {
- FieldElement{-22751231, -5303997, -12907607, -12768866, -15811511, -7797053, -14839018, -16554220, -1867018, 8398970},
- FieldElement{-31969310, 2106403, -4736360, 1362501, 12813763, 16200670, 22981545, -6291273, 18009408, -15772772},
- FieldElement{-17220923, -9545221, -27784654, 14166835, 29815394, 7444469, 29551787, -3727419, 19288549, 1325865},
- },
- {
- FieldElement{15100157, -15835752, -23923978, -1005098, -26450192, 15509408, 12376730, -3479146, 33166107, -8042750},
- FieldElement{20909231, 13023121, -9209752, 16251778, -5778415, -8094914, 12412151, 10018715, 2213263, -13878373},
- FieldElement{32529814, -11074689, 30361439, -16689753, -9135940, 1513226, 22922121, 6382134, -5766928, 8371348},
- },
- },
- {
- {
- FieldElement{9923462, 11271500, 12616794, 3544722, -29998368, -1721626, 12891687, -8193132, -26442943, 10486144},
- FieldElement{-22597207, -7012665, 8587003, -8257861, 4084309, -12970062, 361726, 2610596, -23921530, -11455195},
- FieldElement{5408411, -1136691, -4969122, 10561668, 24145918, 14240566, 31319731, -4235541, 19985175, -3436086},
- },
- {
- FieldElement{-13994457, 16616821, 14549246, 3341099, 32155958, 13648976, -17577068, 8849297, 65030, 8370684},
- FieldElement{-8320926, -12049626, 31204563, 5839400, -20627288, -1057277, -19442942, 6922164, 12743482, -9800518},
- FieldElement{-2361371, 12678785, 28815050, 4759974, -23893047, 4884717, 23783145, 11038569, 18800704, 255233},
- },
- {
- FieldElement{-5269658, -1773886, 13957886, 7990715, 23132995, 728773, 13393847, 9066957, 19258688, -14753793},
- FieldElement{-2936654, -10827535, -10432089, 14516793, -3640786, 4372541, -31934921, 2209390, -1524053, 2055794},
- FieldElement{580882, 16705327, 5468415, -2683018, -30926419, -14696000, -7203346, -8994389, -30021019, 7394435},
- },
- {
- FieldElement{23838809, 1822728, -15738443, 15242727, 8318092, -3733104, -21672180, -3492205, -4821741, 14799921},
- FieldElement{13345610, 9759151, 3371034, -16137791, 16353039, 8577942, 31129804, 13496856, -9056018, 7402518},
- FieldElement{2286874, -4435931, -20042458, -2008336, -13696227, 5038122, 11006906, -15760352, 8205061, 1607563},
- },
- {
- FieldElement{14414086, -8002132, 3331830, -3208217, 22249151, -5594188, 18364661, -2906958, 30019587, -9029278},
- FieldElement{-27688051, 1585953, -10775053, 931069, -29120221, -11002319, -14410829, 12029093, 9944378, 8024},
- FieldElement{4368715, -3709630, 29874200, -15022983, -20230386, -11410704, -16114594, -999085, -8142388, 5640030},
- },
- {
- FieldElement{10299610, 13746483, 11661824, 16234854, 7630238, 5998374, 9809887, -16694564, 15219798, -14327783},
- FieldElement{27425505, -5719081, 3055006, 10660664, 23458024, 595578, -15398605, -1173195, -18342183, 9742717},
- FieldElement{6744077, 2427284, 26042789, 2720740, -847906, 1118974, 32324614, 7406442, 12420155, 1994844},
- },
- {
- FieldElement{14012521, -5024720, -18384453, -9578469, -26485342, -3936439, -13033478, -10909803, 24319929, -6446333},
- FieldElement{16412690, -4507367, 10772641, 15929391, -17068788, -4658621, 10555945, -10484049, -30102368, -4739048},
- FieldElement{22397382, -7767684, -9293161, -12792868, 17166287, -9755136, -27333065, 6199366, 21880021, -12250760},
- },
- {
- FieldElement{-4283307, 5368523, -31117018, 8163389, -30323063, 3209128, 16557151, 8890729, 8840445, 4957760},
- FieldElement{-15447727, 709327, -6919446, -10870178, -29777922, 6522332, -21720181, 12130072, -14796503, 5005757},
- FieldElement{-2114751, -14308128, 23019042, 15765735, -25269683, 6002752, 10183197, -13239326, -16395286, -2176112},
- },
- },
- {
- {
- FieldElement{-19025756, 1632005, 13466291, -7995100, -23640451, 16573537, -32013908, -3057104, 22208662, 2000468},
- FieldElement{3065073, -1412761, -25598674, -361432, -17683065, -5703415, -8164212, 11248527, -3691214, -7414184},
- FieldElement{10379208, -6045554, 8877319, 1473647, -29291284, -12507580, 16690915, 2553332, -3132688, 16400289},
- },
- {
- FieldElement{15716668, 1254266, -18472690, 7446274, -8448918, 6344164, -22097271, -7285580, 26894937, 9132066},
- FieldElement{24158887, 12938817, 11085297, -8177598, -28063478, -4457083, -30576463, 64452, -6817084, -2692882},
- FieldElement{13488534, 7794716, 22236231, 5989356, 25426474, -12578208, 2350710, -3418511, -4688006, 2364226},
- },
- {
- FieldElement{16335052, 9132434, 25640582, 6678888, 1725628, 8517937, -11807024, -11697457, 15445875, -7798101},
- FieldElement{29004207, -7867081, 28661402, -640412, -12794003, -7943086, 31863255, -4135540, -278050, -15759279},
- FieldElement{-6122061, -14866665, -28614905, 14569919, -10857999, -3591829, 10343412, -6976290, -29828287, -10815811},
- },
- {
- FieldElement{27081650, 3463984, 14099042, -4517604, 1616303, -6205604, 29542636, 15372179, 17293797, 960709},
- FieldElement{20263915, 11434237, -5765435, 11236810, 13505955, -10857102, -16111345, 6493122, -19384511, 7639714},
- FieldElement{-2830798, -14839232, 25403038, -8215196, -8317012, -16173699, 18006287, -16043750, 29994677, -15808121},
- },
- {
- FieldElement{9769828, 5202651, -24157398, -13631392, -28051003, -11561624, -24613141, -13860782, -31184575, 709464},
- FieldElement{12286395, 13076066, -21775189, -1176622, -25003198, 4057652, -32018128, -8890874, 16102007, 13205847},
- FieldElement{13733362, 5599946, 10557076, 3195751, -5557991, 8536970, -25540170, 8525972, 10151379, 10394400},
- },
- {
- FieldElement{4024660, -16137551, 22436262, 12276534, -9099015, -2686099, 19698229, 11743039, -33302334, 8934414},
- FieldElement{-15879800, -4525240, -8580747, -2934061, 14634845, -698278, -9449077, 3137094, -11536886, 11721158},
- FieldElement{17555939, -5013938, 8268606, 2331751, -22738815, 9761013, 9319229, 8835153, -9205489, -1280045},
- },
- {
- FieldElement{-461409, -7830014, 20614118, 16688288, -7514766, -4807119, 22300304, 505429, 6108462, -6183415},
- FieldElement{-5070281, 12367917, -30663534, 3234473, 32617080, -8422642, 29880583, -13483331, -26898490, -7867459},
- FieldElement{-31975283, 5726539, 26934134, 10237677, -3173717, -605053, 24199304, 3795095, 7592688, -14992079},
- },
- {
- FieldElement{21594432, -14964228, 17466408, -4077222, 32537084, 2739898, 6407723, 12018833, -28256052, 4298412},
- FieldElement{-20650503, -11961496, -27236275, 570498, 3767144, -1717540, 13891942, -1569194, 13717174, 10805743},
- FieldElement{-14676630, -15644296, 15287174, 11927123, 24177847, -8175568, -796431, 14860609, -26938930, -5863836},
- },
- },
- {
- {
- FieldElement{12962541, 5311799, -10060768, 11658280, 18855286, -7954201, 13286263, -12808704, -4381056, 9882022},
- FieldElement{18512079, 11319350, -20123124, 15090309, 18818594, 5271736, -22727904, 3666879, -23967430, -3299429},
- FieldElement{-6789020, -3146043, 16192429, 13241070, 15898607, -14206114, -10084880, -6661110, -2403099, 5276065},
- },
- {
- FieldElement{30169808, -5317648, 26306206, -11750859, 27814964, 7069267, 7152851, 3684982, 1449224, 13082861},
- FieldElement{10342826, 3098505, 2119311, 193222, 25702612, 12233820, 23697382, 15056736, -21016438, -8202000},
- FieldElement{-33150110, 3261608, 22745853, 7948688, 19370557, -15177665, -26171976, 6482814, -10300080, -11060101},
- },
- {
- FieldElement{32869458, -5408545, 25609743, 15678670, -10687769, -15471071, 26112421, 2521008, -22664288, 6904815},
- FieldElement{29506923, 4457497, 3377935, -9796444, -30510046, 12935080, 1561737, 3841096, -29003639, -6657642},
- FieldElement{10340844, -6630377, -18656632, -2278430, 12621151, -13339055, 30878497, -11824370, -25584551, 5181966},
- },
- {
- FieldElement{25940115, -12658025, 17324188, -10307374, -8671468, 15029094, 24396252, -16450922, -2322852, -12388574},
- FieldElement{-21765684, 9916823, -1300409, 4079498, -1028346, 11909559, 1782390, 12641087, 20603771, -6561742},
- FieldElement{-18882287, -11673380, 24849422, 11501709, 13161720, -4768874, 1925523, 11914390, 4662781, 7820689},
- },
- {
- FieldElement{12241050, -425982, 8132691, 9393934, 32846760, -1599620, 29749456, 12172924, 16136752, 15264020},
- FieldElement{-10349955, -14680563, -8211979, 2330220, -17662549, -14545780, 10658213, 6671822, 19012087, 3772772},
- FieldElement{3753511, -3421066, 10617074, 2028709, 14841030, -6721664, 28718732, -15762884, 20527771, 12988982},
- },
- {
- FieldElement{-14822485, -5797269, -3707987, 12689773, -898983, -10914866, -24183046, -10564943, 3299665, -12424953},
- FieldElement{-16777703, -15253301, -9642417, 4978983, 3308785, 8755439, 6943197, 6461331, -25583147, 8991218},
- FieldElement{-17226263, 1816362, -1673288, -6086439, 31783888, -8175991, -32948145, 7417950, -30242287, 1507265},
- },
- {
- FieldElement{29692663, 6829891, -10498800, 4334896, 20945975, -11906496, -28887608, 8209391, 14606362, -10647073},
- FieldElement{-3481570, 8707081, 32188102, 5672294, 22096700, 1711240, -33020695, 9761487, 4170404, -2085325},
- FieldElement{-11587470, 14855945, -4127778, -1531857, -26649089, 15084046, 22186522, 16002000, -14276837, -8400798},
- },
- {
- FieldElement{-4811456, 13761029, -31703877, -2483919, -3312471, 7869047, -7113572, -9620092, 13240845, 10965870},
- FieldElement{-7742563, -8256762, -14768334, -13656260, -23232383, 12387166, 4498947, 14147411, 29514390, 4302863},
- FieldElement{-13413405, -12407859, 20757302, -13801832, 14785143, 8976368, -5061276, -2144373, 17846988, -13971927},
- },
- },
- {
- {
- FieldElement{-2244452, -754728, -4597030, -1066309, -6247172, 1455299, -21647728, -9214789, -5222701, 12650267},
- FieldElement{-9906797, -16070310, 21134160, 12198166, -27064575, 708126, 387813, 13770293, -19134326, 10958663},
- FieldElement{22470984, 12369526, 23446014, -5441109, -21520802, -9698723, -11772496, -11574455, -25083830, 4271862},
- },
- {
- FieldElement{-25169565, -10053642, -19909332, 15361595, -5984358, 2159192, 75375, -4278529, -32526221, 8469673},
- FieldElement{15854970, 4148314, -8893890, 7259002, 11666551, 13824734, -30531198, 2697372, 24154791, -9460943},
- FieldElement{15446137, -15806644, 29759747, 14019369, 30811221, -9610191, -31582008, 12840104, 24913809, 9815020},
- },
- {
- FieldElement{-4709286, -5614269, -31841498, -12288893, -14443537, 10799414, -9103676, 13438769, 18735128, 9466238},
- FieldElement{11933045, 9281483, 5081055, -5183824, -2628162, -4905629, -7727821, -10896103, -22728655, 16199064},
- FieldElement{14576810, 379472, -26786533, -8317236, -29426508, -10812974, -102766, 1876699, 30801119, 2164795},
- },
- {
- FieldElement{15995086, 3199873, 13672555, 13712240, -19378835, -4647646, -13081610, -15496269, -13492807, 1268052},
- FieldElement{-10290614, -3659039, -3286592, 10948818, 23037027, 3794475, -3470338, -12600221, -17055369, 3565904},
- FieldElement{29210088, -9419337, -5919792, -4952785, 10834811, -13327726, -16512102, -10820713, -27162222, -14030531},
- },
- {
- FieldElement{-13161890, 15508588, 16663704, -8156150, -28349942, 9019123, -29183421, -3769423, 2244111, -14001979},
- FieldElement{-5152875, -3800936, -9306475, -6071583, 16243069, 14684434, -25673088, -16180800, 13491506, 4641841},
- FieldElement{10813417, 643330, -19188515, -728916, 30292062, -16600078, 27548447, -7721242, 14476989, -12767431},
- },
- {
- FieldElement{10292079, 9984945, 6481436, 8279905, -7251514, 7032743, 27282937, -1644259, -27912810, 12651324},
- FieldElement{-31185513, -813383, 22271204, 11835308, 10201545, 15351028, 17099662, 3988035, 21721536, -3148940},
- FieldElement{10202177, -6545839, -31373232, -9574638, -32150642, -8119683, -12906320, 3852694, 13216206, 14842320},
- },
- {
- FieldElement{-15815640, -10601066, -6538952, -7258995, -6984659, -6581778, -31500847, 13765824, -27434397, 9900184},
- FieldElement{14465505, -13833331, -32133984, -14738873, -27443187, 12990492, 33046193, 15796406, -7051866, -8040114},
- FieldElement{30924417, -8279620, 6359016, -12816335, 16508377, 9071735, -25488601, 15413635, 9524356, -7018878},
- },
- {
- FieldElement{12274201, -13175547, 32627641, -1785326, 6736625, 13267305, 5237659, -5109483, 15663516, 4035784},
- FieldElement{-2951309, 8903985, 17349946, 601635, -16432815, -4612556, -13732739, -15889334, -22258478, 4659091},
- FieldElement{-16916263, -4952973, -30393711, -15158821, 20774812, 15897498, 5736189, 15026997, -2178256, -13455585},
- },
- },
- {
- {
- FieldElement{-8858980, -2219056, 28571666, -10155518, -474467, -10105698, -3801496, 278095, 23440562, -290208},
- FieldElement{10226241, -5928702, 15139956, 120818, -14867693, 5218603, 32937275, 11551483, -16571960, -7442864},
- FieldElement{17932739, -12437276, -24039557, 10749060, 11316803, 7535897, 22503767, 5561594, -3646624, 3898661},
- },
- {
- FieldElement{7749907, -969567, -16339731, -16464, -25018111, 15122143, -1573531, 7152530, 21831162, 1245233},
- FieldElement{26958459, -14658026, 4314586, 8346991, -5677764, 11960072, -32589295, -620035, -30402091, -16716212},
- FieldElement{-12165896, 9166947, 33491384, 13673479, 29787085, 13096535, 6280834, 14587357, -22338025, 13987525},
- },
- {
- FieldElement{-24349909, 7778775, 21116000, 15572597, -4833266, -5357778, -4300898, -5124639, -7469781, -2858068},
- FieldElement{9681908, -6737123, -31951644, 13591838, -6883821, 386950, 31622781, 6439245, -14581012, 4091397},
- FieldElement{-8426427, 1470727, -28109679, -1596990, 3978627, -5123623, -19622683, 12092163, 29077877, -14741988},
- },
- {
- FieldElement{5269168, -6859726, -13230211, -8020715, 25932563, 1763552, -5606110, -5505881, -20017847, 2357889},
- FieldElement{32264008, -15407652, -5387735, -1160093, -2091322, -3946900, 23104804, -12869908, 5727338, 189038},
- FieldElement{14609123, -8954470, -6000566, -16622781, -14577387, -7743898, -26745169, 10942115, -25888931, -14884697},
- },
- {
- FieldElement{20513500, 5557931, -15604613, 7829531, 26413943, -2019404, -21378968, 7471781, 13913677, -5137875},
- FieldElement{-25574376, 11967826, 29233242, 12948236, -6754465, 4713227, -8940970, 14059180, 12878652, 8511905},
- FieldElement{-25656801, 3393631, -2955415, -7075526, -2250709, 9366908, -30223418, 6812974, 5568676, -3127656},
- },
- {
- FieldElement{11630004, 12144454, 2116339, 13606037, 27378885, 15676917, -17408753, -13504373, -14395196, 8070818},
- FieldElement{27117696, -10007378, -31282771, -5570088, 1127282, 12772488, -29845906, 10483306, -11552749, -1028714},
- FieldElement{10637467, -5688064, 5674781, 1072708, -26343588, -6982302, -1683975, 9177853, -27493162, 15431203},
- },
- {
- FieldElement{20525145, 10892566, -12742472, 12779443, -29493034, 16150075, -28240519, 14943142, -15056790, -7935931},
- FieldElement{-30024462, 5626926, -551567, -9981087, 753598, 11981191, 25244767, -3239766, -3356550, 9594024},
- FieldElement{-23752644, 2636870, -5163910, -10103818, 585134, 7877383, 11345683, -6492290, 13352335, -10977084},
- },
- {
- FieldElement{-1931799, -5407458, 3304649, -12884869, 17015806, -4877091, -29783850, -7752482, -13215537, -319204},
- FieldElement{20239939, 6607058, 6203985, 3483793, -18386976, -779229, -20723742, 15077870, -22750759, 14523817},
- FieldElement{27406042, -6041657, 27423596, -4497394, 4996214, 10002360, -28842031, -4545494, -30172742, -4805667},
- },
- },
- {
- {
- FieldElement{11374242, 12660715, 17861383, -12540833, 10935568, 1099227, -13886076, -9091740, -27727044, 11358504},
- FieldElement{-12730809, 10311867, 1510375, 10778093, -2119455, -9145702, 32676003, 11149336, -26123651, 4985768},
- FieldElement{-19096303, 341147, -6197485, -239033, 15756973, -8796662, -983043, 13794114, -19414307, -15621255},
- },
- {
- FieldElement{6490081, 11940286, 25495923, -7726360, 8668373, -8751316, 3367603, 6970005, -1691065, -9004790},
- FieldElement{1656497, 13457317, 15370807, 6364910, 13605745, 8362338, -19174622, -5475723, -16796596, -5031438},
- FieldElement{-22273315, -13524424, -64685, -4334223, -18605636, -10921968, -20571065, -7007978, -99853, -10237333},
- },
- {
- FieldElement{17747465, 10039260, 19368299, -4050591, -20630635, -16041286, 31992683, -15857976, -29260363, -5511971},
- FieldElement{31932027, -4986141, -19612382, 16366580, 22023614, 88450, 11371999, -3744247, 4882242, -10626905},
- FieldElement{29796507, 37186, 19818052, 10115756, -11829032, 3352736, 18551198, 3272828, -5190932, -4162409},
- },
- {
- FieldElement{12501286, 4044383, -8612957, -13392385, -32430052, 5136599, -19230378, -3529697, 330070, -3659409},
- FieldElement{6384877, 2899513, 17807477, 7663917, -2358888, 12363165, 25366522, -8573892, -271295, 12071499},
- FieldElement{-8365515, -4042521, 25133448, -4517355, -6211027, 2265927, -32769618, 1936675, -5159697, 3829363},
- },
- {
- FieldElement{28425966, -5835433, -577090, -4697198, -14217555, 6870930, 7921550, -6567787, 26333140, 14267664},
- FieldElement{-11067219, 11871231, 27385719, -10559544, -4585914, -11189312, 10004786, -8709488, -21761224, 8930324},
- FieldElement{-21197785, -16396035, 25654216, -1725397, 12282012, 11008919, 1541940, 4757911, -26491501, -16408940},
- },
- {
- FieldElement{13537262, -7759490, -20604840, 10961927, -5922820, -13218065, -13156584, 6217254, -15943699, 13814990},
- FieldElement{-17422573, 15157790, 18705543, 29619, 24409717, -260476, 27361681, 9257833, -1956526, -1776914},
- FieldElement{-25045300, -10191966, 15366585, 15166509, -13105086, 8423556, -29171540, 12361135, -18685978, 4578290},
- },
- {
- FieldElement{24579768, 3711570, 1342322, -11180126, -27005135, 14124956, -22544529, 14074919, 21964432, 8235257},
- FieldElement{-6528613, -2411497, 9442966, -5925588, 12025640, -1487420, -2981514, -1669206, 13006806, 2355433},
- FieldElement{-16304899, -13605259, -6632427, -5142349, 16974359, -10911083, 27202044, 1719366, 1141648, -12796236},
- },
- {
- FieldElement{-12863944, -13219986, -8318266, -11018091, -6810145, -4843894, 13475066, -3133972, 32674895, 13715045},
- FieldElement{11423335, -5468059, 32344216, 8962751, 24989809, 9241752, -13265253, 16086212, -28740881, -15642093},
- FieldElement{-1409668, 12530728, -6368726, 10847387, 19531186, -14132160, -11709148, 7791794, -27245943, 4383347},
- },
- },
- {
- {
- FieldElement{-28970898, 5271447, -1266009, -9736989, -12455236, 16732599, -4862407, -4906449, 27193557, 6245191},
- FieldElement{-15193956, 5362278, -1783893, 2695834, 4960227, 12840725, 23061898, 3260492, 22510453, 8577507},
- FieldElement{-12632451, 11257346, -32692994, 13548177, -721004, 10879011, 31168030, 13952092, -29571492, -3635906},
- },
- {
- FieldElement{3877321, -9572739, 32416692, 5405324, -11004407, -13656635, 3759769, 11935320, 5611860, 8164018},
- FieldElement{-16275802, 14667797, 15906460, 12155291, -22111149, -9039718, 32003002, -8832289, 5773085, -8422109},
- FieldElement{-23788118, -8254300, 1950875, 8937633, 18686727, 16459170, -905725, 12376320, 31632953, 190926},
- },
- {
- FieldElement{-24593607, -16138885, -8423991, 13378746, 14162407, 6901328, -8288749, 4508564, -25341555, -3627528},
- FieldElement{8884438, -5884009, 6023974, 10104341, -6881569, -4941533, 18722941, -14786005, -1672488, 827625},
- FieldElement{-32720583, -16289296, -32503547, 7101210, 13354605, 2659080, -1800575, -14108036, -24878478, 1541286},
- },
- {
- FieldElement{2901347, -1117687, 3880376, -10059388, -17620940, -3612781, -21802117, -3567481, 20456845, -1885033},
- FieldElement{27019610, 12299467, -13658288, -1603234, -12861660, -4861471, -19540150, -5016058, 29439641, 15138866},
- FieldElement{21536104, -6626420, -32447818, -10690208, -22408077, 5175814, -5420040, -16361163, 7779328, 109896},
- },
- {
- FieldElement{30279744, 14648750, -8044871, 6425558, 13639621, -743509, 28698390, 12180118, 23177719, -554075},
- FieldElement{26572847, 3405927, -31701700, 12890905, -19265668, 5335866, -6493768, 2378492, 4439158, -13279347},
- FieldElement{-22716706, 3489070, -9225266, -332753, 18875722, -1140095, 14819434, -12731527, -17717757, -5461437},
- },
- {
- FieldElement{-5056483, 16566551, 15953661, 3767752, -10436499, 15627060, -820954, 2177225, 8550082, -15114165},
- FieldElement{-18473302, 16596775, -381660, 15663611, 22860960, 15585581, -27844109, -3582739, -23260460, -8428588},
- FieldElement{-32480551, 15707275, -8205912, -5652081, 29464558, 2713815, -22725137, 15860482, -21902570, 1494193},
- },
- {
- FieldElement{-19562091, -14087393, -25583872, -9299552, 13127842, 759709, 21923482, 16529112, 8742704, 12967017},
- FieldElement{-28464899, 1553205, 32536856, -10473729, -24691605, -406174, -8914625, -2933896, -29903758, 15553883},
- FieldElement{21877909, 3230008, 9881174, 10539357, -4797115, 2841332, 11543572, 14513274, 19375923, -12647961},
- },
- {
- FieldElement{8832269, -14495485, 13253511, 5137575, 5037871, 4078777, 24880818, -6222716, 2862653, 9455043},
- FieldElement{29306751, 5123106, 20245049, -14149889, 9592566, 8447059, -2077124, -2990080, 15511449, 4789663},
- FieldElement{-20679756, 7004547, 8824831, -9434977, -4045704, -3750736, -5754762, 108893, 23513200, 16652362},
- },
- },
- {
- {
- FieldElement{-33256173, 4144782, -4476029, -6579123, 10770039, -7155542, -6650416, -12936300, -18319198, 10212860},
- FieldElement{2756081, 8598110, 7383731, -6859892, 22312759, -1105012, 21179801, 2600940, -9988298, -12506466},
- FieldElement{-24645692, 13317462, -30449259, -15653928, 21365574, -10869657, 11344424, 864440, -2499677, -16710063},
- },
- {
- FieldElement{-26432803, 6148329, -17184412, -14474154, 18782929, -275997, -22561534, 211300, 2719757, 4940997},
- FieldElement{-1323882, 3911313, -6948744, 14759765, -30027150, 7851207, 21690126, 8518463, 26699843, 5276295},
- FieldElement{-13149873, -6429067, 9396249, 365013, 24703301, -10488939, 1321586, 149635, -15452774, 7159369},
- },
- {
- FieldElement{9987780, -3404759, 17507962, 9505530, 9731535, -2165514, 22356009, 8312176, 22477218, -8403385},
- FieldElement{18155857, -16504990, 19744716, 9006923, 15154154, -10538976, 24256460, -4864995, -22548173, 9334109},
- FieldElement{2986088, -4911893, 10776628, -3473844, 10620590, -7083203, -21413845, 14253545, -22587149, 536906},
- },
- {
- FieldElement{4377756, 8115836, 24567078, 15495314, 11625074, 13064599, 7390551, 10589625, 10838060, -15420424},
- FieldElement{-19342404, 867880, 9277171, -3218459, -14431572, -1986443, 19295826, -15796950, 6378260, 699185},
- FieldElement{7895026, 4057113, -7081772, -13077756, -17886831, -323126, -716039, 15693155, -5045064, -13373962},
- },
- {
- FieldElement{-7737563, -5869402, -14566319, -7406919, 11385654, 13201616, 31730678, -10962840, -3918636, -9669325},
- FieldElement{10188286, -15770834, -7336361, 13427543, 22223443, 14896287, 30743455, 7116568, -21786507, 5427593},
- FieldElement{696102, 13206899, 27047647, -10632082, 15285305, -9853179, 10798490, -4578720, 19236243, 12477404},
- },
- {
- FieldElement{-11229439, 11243796, -17054270, -8040865, -788228, -8167967, -3897669, 11180504, -23169516, 7733644},
- FieldElement{17800790, -14036179, -27000429, -11766671, 23887827, 3149671, 23466177, -10538171, 10322027, 15313801},
- FieldElement{26246234, 11968874, 32263343, -5468728, 6830755, -13323031, -15794704, -101982, -24449242, 10890804},
- },
- {
- FieldElement{-31365647, 10271363, -12660625, -6267268, 16690207, -13062544, -14982212, 16484931, 25180797, -5334884},
- FieldElement{-586574, 10376444, -32586414, -11286356, 19801893, 10997610, 2276632, 9482883, 316878, 13820577},
- FieldElement{-9882808, -4510367, -2115506, 16457136, -11100081, 11674996, 30756178, -7515054, 30696930, -3712849},
- },
- {
- FieldElement{32988917, -9603412, 12499366, 7910787, -10617257, -11931514, -7342816, -9985397, -32349517, 7392473},
- FieldElement{-8855661, 15927861, 9866406, -3649411, -2396914, -16655781, -30409476, -9134995, 25112947, -2926644},
- FieldElement{-2504044, -436966, 25621774, -5678772, 15085042, -5479877, -24884878, -13526194, 5537438, -13914319},
- },
- },
- {
- {
- FieldElement{-11225584, 2320285, -9584280, 10149187, -33444663, 5808648, -14876251, -1729667, 31234590, 6090599},
- FieldElement{-9633316, 116426, 26083934, 2897444, -6364437, -2688086, 609721, 15878753, -6970405, -9034768},
- FieldElement{-27757857, 247744, -15194774, -9002551, 23288161, -10011936, -23869595, 6503646, 20650474, 1804084},
- },
- {
- FieldElement{-27589786, 15456424, 8972517, 8469608, 15640622, 4439847, 3121995, -10329713, 27842616, -202328},
- FieldElement{-15306973, 2839644, 22530074, 10026331, 4602058, 5048462, 28248656, 5031932, -11375082, 12714369},
- FieldElement{20807691, -7270825, 29286141, 11421711, -27876523, -13868230, -21227475, 1035546, -19733229, 12796920},
- },
- {
- FieldElement{12076899, -14301286, -8785001, -11848922, -25012791, 16400684, -17591495, -12899438, 3480665, -15182815},
- FieldElement{-32361549, 5457597, 28548107, 7833186, 7303070, -11953545, -24363064, -15921875, -33374054, 2771025},
- FieldElement{-21389266, 421932, 26597266, 6860826, 22486084, -6737172, -17137485, -4210226, -24552282, 15673397},
- },
- {
- FieldElement{-20184622, 2338216, 19788685, -9620956, -4001265, -8740893, -20271184, 4733254, 3727144, -12934448},
- FieldElement{6120119, 814863, -11794402, -622716, 6812205, -15747771, 2019594, 7975683, 31123697, -10958981},
- FieldElement{30069250, -11435332, 30434654, 2958439, 18399564, -976289, 12296869, 9204260, -16432438, 9648165},
- },
- {
- FieldElement{32705432, -1550977, 30705658, 7451065, -11805606, 9631813, 3305266, 5248604, -26008332, -11377501},
- FieldElement{17219865, 2375039, -31570947, -5575615, -19459679, 9219903, 294711, 15298639, 2662509, -16297073},
- FieldElement{-1172927, -7558695, -4366770, -4287744, -21346413, -8434326, 32087529, -1222777, 32247248, -14389861},
- },
- {
- FieldElement{14312628, 1221556, 17395390, -8700143, -4945741, -8684635, -28197744, -9637817, -16027623, -13378845},
- FieldElement{-1428825, -9678990, -9235681, 6549687, -7383069, -468664, 23046502, 9803137, 17597934, 2346211},
- FieldElement{18510800, 15337574, 26171504, 981392, -22241552, 7827556, -23491134, -11323352, 3059833, -11782870},
- },
- {
- FieldElement{10141598, 6082907, 17829293, -1947643, 9830092, 13613136, -25556636, -5544586, -33502212, 3592096},
- FieldElement{33114168, -15889352, -26525686, -13343397, 33076705, 8716171, 1151462, 1521897, -982665, -6837803},
- FieldElement{-32939165, -4255815, 23947181, -324178, -33072974, -12305637, -16637686, 3891704, 26353178, 693168},
- },
- {
- FieldElement{30374239, 1595580, -16884039, 13186931, 4600344, 406904, 9585294, -400668, 31375464, 14369965},
- FieldElement{-14370654, -7772529, 1510301, 6434173, -18784789, -6262728, 32732230, -13108839, 17901441, 16011505},
- FieldElement{18171223, -11934626, -12500402, 15197122, -11038147, -15230035, -19172240, -16046376, 8764035, 12309598},
- },
- },
- {
- {
- FieldElement{5975908, -5243188, -19459362, -9681747, -11541277, 14015782, -23665757, 1228319, 17544096, -10593782},
- FieldElement{5811932, -1715293, 3442887, -2269310, -18367348, -8359541, -18044043, -15410127, -5565381, 12348900},
- FieldElement{-31399660, 11407555, 25755363, 6891399, -3256938, 14872274, -24849353, 8141295, -10632534, -585479},
- },
- {
- FieldElement{-12675304, 694026, -5076145, 13300344, 14015258, -14451394, -9698672, -11329050, 30944593, 1130208},
- FieldElement{8247766, -6710942, -26562381, -7709309, -14401939, -14648910, 4652152, 2488540, 23550156, -271232},
- FieldElement{17294316, -3788438, 7026748, 15626851, 22990044, 113481, 2267737, -5908146, -408818, -137719},
- },
- {
- FieldElement{16091085, -16253926, 18599252, 7340678, 2137637, -1221657, -3364161, 14550936, 3260525, -7166271},
- FieldElement{-4910104, -13332887, 18550887, 10864893, -16459325, -7291596, -23028869, -13204905, -12748722, 2701326},
- FieldElement{-8574695, 16099415, 4629974, -16340524, -20786213, -6005432, -10018363, 9276971, 11329923, 1862132},
- },
- {
- FieldElement{14763076, -15903608, -30918270, 3689867, 3511892, 10313526, -21951088, 12219231, -9037963, -940300},
- FieldElement{8894987, -3446094, 6150753, 3013931, 301220, 15693451, -31981216, -2909717, -15438168, 11595570},
- FieldElement{15214962, 3537601, -26238722, -14058872, 4418657, -15230761, 13947276, 10730794, -13489462, -4363670},
- },
- {
- FieldElement{-2538306, 7682793, 32759013, 263109, -29984731, -7955452, -22332124, -10188635, 977108, 699994},
- FieldElement{-12466472, 4195084, -9211532, 550904, -15565337, 12917920, 19118110, -439841, -30534533, -14337913},
- FieldElement{31788461, -14507657, 4799989, 7372237, 8808585, -14747943, 9408237, -10051775, 12493932, -5409317},
- },
- {
- FieldElement{-25680606, 5260744, -19235809, -6284470, -3695942, 16566087, 27218280, 2607121, 29375955, 6024730},
- FieldElement{842132, -2794693, -4763381, -8722815, 26332018, -12405641, 11831880, 6985184, -9940361, 2854096},
- FieldElement{-4847262, -7969331, 2516242, -5847713, 9695691, -7221186, 16512645, 960770, 12121869, 16648078},
- },
- {
- FieldElement{-15218652, 14667096, -13336229, 2013717, 30598287, -464137, -31504922, -7882064, 20237806, 2838411},
- FieldElement{-19288047, 4453152, 15298546, -16178388, 22115043, -15972604, 12544294, -13470457, 1068881, -12499905},
- FieldElement{-9558883, -16518835, 33238498, 13506958, 30505848, -1114596, -8486907, -2630053, 12521378, 4845654},
- },
- {
- FieldElement{-28198521, 10744108, -2958380, 10199664, 7759311, -13088600, 3409348, -873400, -6482306, -12885870},
- FieldElement{-23561822, 6230156, -20382013, 10655314, -24040585, -11621172, 10477734, -1240216, -3113227, 13974498},
- FieldElement{12966261, 15550616, -32038948, -1615346, 21025980, -629444, 5642325, 7188737, 18895762, 12629579},
- },
- },
- {
- {
- FieldElement{14741879, -14946887, 22177208, -11721237, 1279741, 8058600, 11758140, 789443, 32195181, 3895677},
- FieldElement{10758205, 15755439, -4509950, 9243698, -4879422, 6879879, -2204575, -3566119, -8982069, 4429647},
- FieldElement{-2453894, 15725973, -20436342, -10410672, -5803908, -11040220, -7135870, -11642895, 18047436, -15281743},
- },
- {
- FieldElement{-25173001, -11307165, 29759956, 11776784, -22262383, -15820455, 10993114, -12850837, -17620701, -9408468},
- FieldElement{21987233, 700364, -24505048, 14972008, -7774265, -5718395, 32155026, 2581431, -29958985, 8773375},
- FieldElement{-25568350, 454463, -13211935, 16126715, 25240068, 8594567, 20656846, 12017935, -7874389, -13920155},
- },
- {
- FieldElement{6028182, 6263078, -31011806, -11301710, -818919, 2461772, -31841174, -5468042, -1721788, -2776725},
- FieldElement{-12278994, 16624277, 987579, -5922598, 32908203, 1248608, 7719845, -4166698, 28408820, 6816612},
- FieldElement{-10358094, -8237829, 19549651, -12169222, 22082623, 16147817, 20613181, 13982702, -10339570, 5067943},
- },
- {
- FieldElement{-30505967, -3821767, 12074681, 13582412, -19877972, 2443951, -19719286, 12746132, 5331210, -10105944},
- FieldElement{30528811, 3601899, -1957090, 4619785, -27361822, -15436388, 24180793, -12570394, 27679908, -1648928},
- FieldElement{9402404, -13957065, 32834043, 10838634, -26580150, -13237195, 26653274, -8685565, 22611444, -12715406},
- },
- {
- FieldElement{22190590, 1118029, 22736441, 15130463, -30460692, -5991321, 19189625, -4648942, 4854859, 6622139},
- FieldElement{-8310738, -2953450, -8262579, -3388049, -10401731, -271929, 13424426, -3567227, 26404409, 13001963},
- FieldElement{-31241838, -15415700, -2994250, 8939346, 11562230, -12840670, -26064365, -11621720, -15405155, 11020693},
- },
- {
- FieldElement{1866042, -7949489, -7898649, -10301010, 12483315, 13477547, 3175636, -12424163, 28761762, 1406734},
- FieldElement{-448555, -1777666, 13018551, 3194501, -9580420, -11161737, 24760585, -4347088, 25577411, -13378680},
- FieldElement{-24290378, 4759345, -690653, -1852816, 2066747, 10693769, -29595790, 9884936, -9368926, 4745410},
- },
- {
- FieldElement{-9141284, 6049714, -19531061, -4341411, -31260798, 9944276, -15462008, -11311852, 10931924, -11931931},
- FieldElement{-16561513, 14112680, -8012645, 4817318, -8040464, -11414606, -22853429, 10856641, -20470770, 13434654},
- FieldElement{22759489, -10073434, -16766264, -1871422, 13637442, -10168091, 1765144, -12654326, 28445307, -5364710},
- },
- {
- FieldElement{29875063, 12493613, 2795536, -3786330, 1710620, 15181182, -10195717, -8788675, 9074234, 1167180},
- FieldElement{-26205683, 11014233, -9842651, -2635485, -26908120, 7532294, -18716888, -9535498, 3843903, 9367684},
- FieldElement{-10969595, -6403711, 9591134, 9582310, 11349256, 108879, 16235123, 8601684, -139197, 4242895},
- },
- },
- {
- {
- FieldElement{22092954, -13191123, -2042793, -11968512, 32186753, -11517388, -6574341, 2470660, -27417366, 16625501},
- FieldElement{-11057722, 3042016, 13770083, -9257922, 584236, -544855, -7770857, 2602725, -27351616, 14247413},
- FieldElement{6314175, -10264892, -32772502, 15957557, -10157730, 168750, -8618807, 14290061, 27108877, -1180880},
- },
- {
- FieldElement{-8586597, -7170966, 13241782, 10960156, -32991015, -13794596, 33547976, -11058889, -27148451, 981874},
- FieldElement{22833440, 9293594, -32649448, -13618667, -9136966, 14756819, -22928859, -13970780, -10479804, -16197962},
- FieldElement{-7768587, 3326786, -28111797, 10783824, 19178761, 14905060, 22680049, 13906969, -15933690, 3797899},
- },
- {
- FieldElement{21721356, -4212746, -12206123, 9310182, -3882239, -13653110, 23740224, -2709232, 20491983, -8042152},
- FieldElement{9209270, -15135055, -13256557, -6167798, -731016, 15289673, 25947805, 15286587, 30997318, -6703063},
- FieldElement{7392032, 16618386, 23946583, -8039892, -13265164, -1533858, -14197445, -2321576, 17649998, -250080},
- },
- {
- FieldElement{-9301088, -14193827, 30609526, -3049543, -25175069, -1283752, -15241566, -9525724, -2233253, 7662146},
- FieldElement{-17558673, 1763594, -33114336, 15908610, -30040870, -12174295, 7335080, -8472199, -3174674, 3440183},
- FieldElement{-19889700, -5977008, -24111293, -9688870, 10799743, -16571957, 40450, -4431835, 4862400, 1133},
- },
- {
- FieldElement{-32856209, -7873957, -5422389, 14860950, -16319031, 7956142, 7258061, 311861, -30594991, -7379421},
- FieldElement{-3773428, -1565936, 28985340, 7499440, 24445838, 9325937, 29727763, 16527196, 18278453, 15405622},
- FieldElement{-4381906, 8508652, -19898366, -3674424, -5984453, 15149970, -13313598, 843523, -21875062, 13626197},
- },
- {
- FieldElement{2281448, -13487055, -10915418, -2609910, 1879358, 16164207, -10783882, 3953792, 13340839, 15928663},
- FieldElement{31727126, -7179855, -18437503, -8283652, 2875793, -16390330, -25269894, -7014826, -23452306, 5964753},
- FieldElement{4100420, -5959452, -17179337, 6017714, -18705837, 12227141, -26684835, 11344144, 2538215, -7570755},
- },
- {
- FieldElement{-9433605, 6123113, 11159803, -2156608, 30016280, 14966241, -20474983, 1485421, -629256, -15958862},
- FieldElement{-26804558, 4260919, 11851389, 9658551, -32017107, 16367492, -20205425, -13191288, 11659922, -11115118},
- FieldElement{26180396, 10015009, -30844224, -8581293, 5418197, 9480663, 2231568, -10170080, 33100372, -1306171},
- },
- {
- FieldElement{15121113, -5201871, -10389905, 15427821, -27509937, -15992507, 21670947, 4486675, -5931810, -14466380},
- FieldElement{16166486, -9483733, -11104130, 6023908, -31926798, -1364923, 2340060, -16254968, -10735770, -10039824},
- FieldElement{28042865, -3557089, -12126526, 12259706, -3717498, -6945899, 6766453, -8689599, 18036436, 5803270},
- },
- },
- {
- {
- FieldElement{-817581, 6763912, 11803561, 1585585, 10958447, -2671165, 23855391, 4598332, -6159431, -14117438},
- FieldElement{-31031306, -14256194, 17332029, -2383520, 31312682, -5967183, 696309, 50292, -20095739, 11763584},
- FieldElement{-594563, -2514283, -32234153, 12643980, 12650761, 14811489, 665117, -12613632, -19773211, -10713562},
- },
- {
- FieldElement{30464590, -11262872, -4127476, -12734478, 19835327, -7105613, -24396175, 2075773, -17020157, 992471},
- FieldElement{18357185, -6994433, 7766382, 16342475, -29324918, 411174, 14578841, 8080033, -11574335, -10601610},
- FieldElement{19598397, 10334610, 12555054, 2555664, 18821899, -10339780, 21873263, 16014234, 26224780, 16452269},
- },
- {
- FieldElement{-30223925, 5145196, 5944548, 16385966, 3976735, 2009897, -11377804, -7618186, -20533829, 3698650},
- FieldElement{14187449, 3448569, -10636236, -10810935, -22663880, -3433596, 7268410, -10890444, 27394301, 12015369},
- FieldElement{19695761, 16087646, 28032085, 12999827, 6817792, 11427614, 20244189, -1312777, -13259127, -3402461},
- },
- {
- FieldElement{30860103, 12735208, -1888245, -4699734, -16974906, 2256940, -8166013, 12298312, -8550524, -10393462},
- FieldElement{-5719826, -11245325, -1910649, 15569035, 26642876, -7587760, -5789354, -15118654, -4976164, 12651793},
- FieldElement{-2848395, 9953421, 11531313, -5282879, 26895123, -12697089, -13118820, -16517902, 9768698, -2533218},
- },
- {
- FieldElement{-24719459, 1894651, -287698, -4704085, 15348719, -8156530, 32767513, 12765450, 4940095, 10678226},
- FieldElement{18860224, 15980149, -18987240, -1562570, -26233012, -11071856, -7843882, 13944024, -24372348, 16582019},
- FieldElement{-15504260, 4970268, -29893044, 4175593, -20993212, -2199756, -11704054, 15444560, -11003761, 7989037},
- },
- {
- FieldElement{31490452, 5568061, -2412803, 2182383, -32336847, 4531686, -32078269, 6200206, -19686113, -14800171},
- FieldElement{-17308668, -15879940, -31522777, -2831, -32887382, 16375549, 8680158, -16371713, 28550068, -6857132},
- FieldElement{-28126887, -5688091, 16837845, -1820458, -6850681, 12700016, -30039981, 4364038, 1155602, 5988841},
- },
- {
- FieldElement{21890435, -13272907, -12624011, 12154349, -7831873, 15300496, 23148983, -4470481, 24618407, 8283181},
- FieldElement{-33136107, -10512751, 9975416, 6841041, -31559793, 16356536, 3070187, -7025928, 1466169, 10740210},
- FieldElement{-1509399, -15488185, -13503385, -10655916, 32799044, 909394, -13938903, -5779719, -32164649, -15327040},
- },
- {
- FieldElement{3960823, -14267803, -28026090, -15918051, -19404858, 13146868, 15567327, 951507, -3260321, -573935},
- FieldElement{24740841, 5052253, -30094131, 8961361, 25877428, 6165135, -24368180, 14397372, -7380369, -6144105},
- FieldElement{-28888365, 3510803, -28103278, -1158478, -11238128, -10631454, -15441463, -14453128, -1625486, -6494814},
- },
- },
- {
- {
- FieldElement{793299, -9230478, 8836302, -6235707, -27360908, -2369593, 33152843, -4885251, -9906200, -621852},
- FieldElement{5666233, 525582, 20782575, -8038419, -24538499, 14657740, 16099374, 1468826, -6171428, -15186581},
- FieldElement{-4859255, -3779343, -2917758, -6748019, 7778750, 11688288, -30404353, -9871238, -1558923, -9863646},
- },
- {
- FieldElement{10896332, -7719704, 824275, 472601, -19460308, 3009587, 25248958, 14783338, -30581476, -15757844},
- FieldElement{10566929, 12612572, -31944212, 11118703, -12633376, 12362879, 21752402, 8822496, 24003793, 14264025},
- FieldElement{27713862, -7355973, -11008240, 9227530, 27050101, 2504721, 23886875, -13117525, 13958495, -5732453},
- },
- {
- FieldElement{-23481610, 4867226, -27247128, 3900521, 29838369, -8212291, -31889399, -10041781, 7340521, -15410068},
- FieldElement{4646514, -8011124, -22766023, -11532654, 23184553, 8566613, 31366726, -1381061, -15066784, -10375192},
- FieldElement{-17270517, 12723032, -16993061, 14878794, 21619651, -6197576, 27584817, 3093888, -8843694, 3849921},
- },
- {
- FieldElement{-9064912, 2103172, 25561640, -15125738, -5239824, 9582958, 32477045, -9017955, 5002294, -15550259},
- FieldElement{-12057553, -11177906, 21115585, -13365155, 8808712, -12030708, 16489530, 13378448, -25845716, 12741426},
- FieldElement{-5946367, 10645103, -30911586, 15390284, -3286982, -7118677, 24306472, 15852464, 28834118, -7646072},
- },
- {
- FieldElement{-17335748, -9107057, -24531279, 9434953, -8472084, -583362, -13090771, 455841, 20461858, 5491305},
- FieldElement{13669248, -16095482, -12481974, -10203039, -14569770, -11893198, -24995986, 11293807, -28588204, -9421832},
- FieldElement{28497928, 6272777, -33022994, 14470570, 8906179, -1225630, 18504674, -14165166, 29867745, -8795943},
- },
- {
- FieldElement{-16207023, 13517196, -27799630, -13697798, 24009064, -6373891, -6367600, -13175392, 22853429, -4012011},
- FieldElement{24191378, 16712145, -13931797, 15217831, 14542237, 1646131, 18603514, -11037887, 12876623, -2112447},
- FieldElement{17902668, 4518229, -411702, -2829247, 26878217, 5258055, -12860753, 608397, 16031844, 3723494},
- },
- {
- FieldElement{-28632773, 12763728, -20446446, 7577504, 33001348, -13017745, 17558842, -7872890, 23896954, -4314245},
- FieldElement{-20005381, -12011952, 31520464, 605201, 2543521, 5991821, -2945064, 7229064, -9919646, -8826859},
- FieldElement{28816045, 298879, -28165016, -15920938, 19000928, -1665890, -12680833, -2949325, -18051778, -2082915},
- },
- {
- FieldElement{16000882, -344896, 3493092, -11447198, -29504595, -13159789, 12577740, 16041268, -19715240, 7847707},
- FieldElement{10151868, 10572098, 27312476, 7922682, 14825339, 4723128, -32855931, -6519018, -10020567, 3852848},
- FieldElement{-11430470, 15697596, -21121557, -4420647, 5386314, 15063598, 16514493, -15932110, 29330899, -15076224},
- },
- },
- {
- {
- FieldElement{-25499735, -4378794, -15222908, -6901211, 16615731, 2051784, 3303702, 15490, -27548796, 12314391},
- FieldElement{15683520, -6003043, 18109120, -9980648, 15337968, -5997823, -16717435, 15921866, 16103996, -3731215},
- FieldElement{-23169824, -10781249, 13588192, -1628807, -3798557, -1074929, -19273607, 5402699, -29815713, -9841101},
- },
- {
- FieldElement{23190676, 2384583, -32714340, 3462154, -29903655, -1529132, -11266856, 8911517, -25205859, 2739713},
- FieldElement{21374101, -3554250, -33524649, 9874411, 15377179, 11831242, -33529904, 6134907, 4931255, 11987849},
- FieldElement{-7732, -2978858, -16223486, 7277597, 105524, -322051, -31480539, 13861388, -30076310, 10117930},
- },
- {
- FieldElement{-29501170, -10744872, -26163768, 13051539, -25625564, 5089643, -6325503, 6704079, 12890019, 15728940},
- FieldElement{-21972360, -11771379, -951059, -4418840, 14704840, 2695116, 903376, -10428139, 12885167, 8311031},
- FieldElement{-17516482, 5352194, 10384213, -13811658, 7506451, 13453191, 26423267, 4384730, 1888765, -5435404},
- },
- {
- FieldElement{-25817338, -3107312, -13494599, -3182506, 30896459, -13921729, -32251644, -12707869, -19464434, -3340243},
- FieldElement{-23607977, -2665774, -526091, 4651136, 5765089, 4618330, 6092245, 14845197, 17151279, -9854116},
- FieldElement{-24830458, -12733720, -15165978, 10367250, -29530908, -265356, 22825805, -7087279, -16866484, 16176525},
- },
- {
- FieldElement{-23583256, 6564961, 20063689, 3798228, -4740178, 7359225, 2006182, -10363426, -28746253, -10197509},
- FieldElement{-10626600, -4486402, -13320562, -5125317, 3432136, -6393229, 23632037, -1940610, 32808310, 1099883},
- FieldElement{15030977, 5768825, -27451236, -2887299, -6427378, -15361371, -15277896, -6809350, 2051441, -15225865},
- },
- {
- FieldElement{-3362323, -7239372, 7517890, 9824992, 23555850, 295369, 5148398, -14154188, -22686354, 16633660},
- FieldElement{4577086, -16752288, 13249841, -15304328, 19958763, -14537274, 18559670, -10759549, 8402478, -9864273},
- FieldElement{-28406330, -1051581, -26790155, -907698, -17212414, -11030789, 9453451, -14980072, 17983010, 9967138},
- },
- {
- FieldElement{-25762494, 6524722, 26585488, 9969270, 24709298, 1220360, -1677990, 7806337, 17507396, 3651560},
- FieldElement{-10420457, -4118111, 14584639, 15971087, -15768321, 8861010, 26556809, -5574557, -18553322, -11357135},
- FieldElement{2839101, 14284142, 4029895, 3472686, 14402957, 12689363, -26642121, 8459447, -5605463, -7621941},
- },
- {
- FieldElement{-4839289, -3535444, 9744961, 2871048, 25113978, 3187018, -25110813, -849066, 17258084, -7977739},
- FieldElement{18164541, -10595176, -17154882, -1542417, 19237078, -9745295, 23357533, -15217008, 26908270, 12150756},
- FieldElement{-30264870, -7647865, 5112249, -7036672, -1499807, -6974257, 43168, -5537701, -32302074, 16215819},
- },
- },
- {
- {
- FieldElement{-6898905, 9824394, -12304779, -4401089, -31397141, -6276835, 32574489, 12532905, -7503072, -8675347},
- FieldElement{-27343522, -16515468, -27151524, -10722951, 946346, 16291093, 254968, 7168080, 21676107, -1943028},
- FieldElement{21260961, -8424752, -16831886, -11920822, -23677961, 3968121, -3651949, -6215466, -3556191, -7913075},
- },
- {
- FieldElement{16544754, 13250366, -16804428, 15546242, -4583003, 12757258, -2462308, -8680336, -18907032, -9662799},
- FieldElement{-2415239, -15577728, 18312303, 4964443, -15272530, -12653564, 26820651, 16690659, 25459437, -4564609},
- FieldElement{-25144690, 11425020, 28423002, -11020557, -6144921, -15826224, 9142795, -2391602, -6432418, -1644817},
- },
- {
- FieldElement{-23104652, 6253476, 16964147, -3768872, -25113972, -12296437, -27457225, -16344658, 6335692, 7249989},
- FieldElement{-30333227, 13979675, 7503222, -12368314, -11956721, -4621693, -30272269, 2682242, 25993170, -12478523},
- FieldElement{4364628, 5930691, 32304656, -10044554, -8054781, 15091131, 22857016, -10598955, 31820368, 15075278},
- },
- {
- FieldElement{31879134, -8918693, 17258761, 90626, -8041836, -4917709, 24162788, -9650886, -17970238, 12833045},
- FieldElement{19073683, 14851414, -24403169, -11860168, 7625278, 11091125, -19619190, 2074449, -9413939, 14905377},
- FieldElement{24483667, -11935567, -2518866, -11547418, -1553130, 15355506, -25282080, 9253129, 27628530, -7555480},
- },
- {
- FieldElement{17597607, 8340603, 19355617, 552187, 26198470, -3176583, 4593324, -9157582, -14110875, 15297016},
- FieldElement{510886, 14337390, -31785257, 16638632, 6328095, 2713355, -20217417, -11864220, 8683221, 2921426},
- FieldElement{18606791, 11874196, 27155355, -5281482, -24031742, 6265446, -25178240, -1278924, 4674690, 13890525},
- },
- {
- FieldElement{13609624, 13069022, -27372361, -13055908, 24360586, 9592974, 14977157, 9835105, 4389687, 288396},
- FieldElement{9922506, -519394, 13613107, 5883594, -18758345, -434263, -12304062, 8317628, 23388070, 16052080},
- FieldElement{12720016, 11937594, -31970060, -5028689, 26900120, 8561328, -20155687, -11632979, -14754271, -10812892},
- },
- {
- FieldElement{15961858, 14150409, 26716931, -665832, -22794328, 13603569, 11829573, 7467844, -28822128, 929275},
- FieldElement{11038231, -11582396, -27310482, -7316562, -10498527, -16307831, -23479533, -9371869, -21393143, 2465074},
- FieldElement{20017163, -4323226, 27915242, 1529148, 12396362, 15675764, 13817261, -9658066, 2463391, -4622140},
- },
- {
- FieldElement{-16358878, -12663911, -12065183, 4996454, -1256422, 1073572, 9583558, 12851107, 4003896, 12673717},
- FieldElement{-1731589, -15155870, -3262930, 16143082, 19294135, 13385325, 14741514, -9103726, 7903886, 2348101},
- FieldElement{24536016, -16515207, 12715592, -3862155, 1511293, 10047386, -3842346, -7129159, -28377538, 10048127},
- },
- },
- {
- {
- FieldElement{-12622226, -6204820, 30718825, 2591312, -10617028, 12192840, 18873298, -7297090, -32297756, 15221632},
- FieldElement{-26478122, -11103864, 11546244, -1852483, 9180880, 7656409, -21343950, 2095755, 29769758, 6593415},
- FieldElement{-31994208, -2907461, 4176912, 3264766, 12538965, -868111, 26312345, -6118678, 30958054, 8292160},
- },
- {
- FieldElement{31429822, -13959116, 29173532, 15632448, 12174511, -2760094, 32808831, 3977186, 26143136, -3148876},
- FieldElement{22648901, 1402143, -22799984, 13746059, 7936347, 365344, -8668633, -1674433, -3758243, -2304625},
- FieldElement{-15491917, 8012313, -2514730, -12702462, -23965846, -10254029, -1612713, -1535569, -16664475, 8194478},
- },
- {
- FieldElement{27338066, -7507420, -7414224, 10140405, -19026427, -6589889, 27277191, 8855376, 28572286, 3005164},
- FieldElement{26287124, 4821776, 25476601, -4145903, -3764513, -15788984, -18008582, 1182479, -26094821, -13079595},
- FieldElement{-7171154, 3178080, 23970071, 6201893, -17195577, -4489192, -21876275, -13982627, 32208683, -1198248},
- },
- {
- FieldElement{-16657702, 2817643, -10286362, 14811298, 6024667, 13349505, -27315504, -10497842, -27672585, -11539858},
- FieldElement{15941029, -9405932, -21367050, 8062055, 31876073, -238629, -15278393, -1444429, 15397331, -4130193},
- FieldElement{8934485, -13485467, -23286397, -13423241, -32446090, 14047986, 31170398, -1441021, -27505566, 15087184},
- },
- {
- FieldElement{-18357243, -2156491, 24524913, -16677868, 15520427, -6360776, -15502406, 11461896, 16788528, -5868942},
- FieldElement{-1947386, 16013773, 21750665, 3714552, -17401782, -16055433, -3770287, -10323320, 31322514, -11615635},
- FieldElement{21426655, -5650218, -13648287, -5347537, -28812189, -4920970, -18275391, -14621414, 13040862, -12112948},
- },
- {
- FieldElement{11293895, 12478086, -27136401, 15083750, -29307421, 14748872, 14555558, -13417103, 1613711, 4896935},
- FieldElement{-25894883, 15323294, -8489791, -8057900, 25967126, -13425460, 2825960, -4897045, -23971776, -11267415},
- FieldElement{-15924766, -5229880, -17443532, 6410664, 3622847, 10243618, 20615400, 12405433, -23753030, -8436416},
- },
- {
- FieldElement{-7091295, 12556208, -20191352, 9025187, -17072479, 4333801, 4378436, 2432030, 23097949, -566018},
- FieldElement{4565804, -16025654, 20084412, -7842817, 1724999, 189254, 24767264, 10103221, -18512313, 2424778},
- FieldElement{366633, -11976806, 8173090, -6890119, 30788634, 5745705, -7168678, 1344109, -3642553, 12412659},
- },
- {
- FieldElement{-24001791, 7690286, 14929416, -168257, -32210835, -13412986, 24162697, -15326504, -3141501, 11179385},
- FieldElement{18289522, -14724954, 8056945, 16430056, -21729724, 7842514, -6001441, -1486897, -18684645, -11443503},
- FieldElement{476239, 6601091, -6152790, -9723375, 17503545, -4863900, 27672959, 13403813, 11052904, 5219329},
- },
- },
- {
- {
- FieldElement{20678546, -8375738, -32671898, 8849123, -5009758, 14574752, 31186971, -3973730, 9014762, -8579056},
- FieldElement{-13644050, -10350239, -15962508, 5075808, -1514661, -11534600, -33102500, 9160280, 8473550, -3256838},
- FieldElement{24900749, 14435722, 17209120, -15292541, -22592275, 9878983, -7689309, -16335821, -24568481, 11788948},
- },
- {
- FieldElement{-3118155, -11395194, -13802089, 14797441, 9652448, -6845904, -20037437, 10410733, -24568470, -1458691},
- FieldElement{-15659161, 16736706, -22467150, 10215878, -9097177, 7563911, 11871841, -12505194, -18513325, 8464118},
- FieldElement{-23400612, 8348507, -14585951, -861714, -3950205, -6373419, 14325289, 8628612, 33313881, -8370517},
- },
- {
- FieldElement{-20186973, -4967935, 22367356, 5271547, -1097117, -4788838, -24805667, -10236854, -8940735, -5818269},
- FieldElement{-6948785, -1795212, -32625683, -16021179, 32635414, -7374245, 15989197, -12838188, 28358192, -4253904},
- FieldElement{-23561781, -2799059, -32351682, -1661963, -9147719, 10429267, -16637684, 4072016, -5351664, 5596589},
- },
- {
- FieldElement{-28236598, -3390048, 12312896, 6213178, 3117142, 16078565, 29266239, 2557221, 1768301, 15373193},
- FieldElement{-7243358, -3246960, -4593467, -7553353, -127927, -912245, -1090902, -4504991, -24660491, 3442910},
- FieldElement{-30210571, 5124043, 14181784, 8197961, 18964734, -11939093, 22597931, 7176455, -18585478, 13365930},
- },
- {
- FieldElement{-7877390, -1499958, 8324673, 4690079, 6261860, 890446, 24538107, -8570186, -9689599, -3031667},
- FieldElement{25008904, -10771599, -4305031, -9638010, 16265036, 15721635, 683793, -11823784, 15723479, -15163481},
- FieldElement{-9660625, 12374379, -27006999, -7026148, -7724114, -12314514, 11879682, 5400171, 519526, -1235876},
- },
- {
- FieldElement{22258397, -16332233, -7869817, 14613016, -22520255, -2950923, -20353881, 7315967, 16648397, 7605640},
- FieldElement{-8081308, -8464597, -8223311, 9719710, 19259459, -15348212, 23994942, -5281555, -9468848, 4763278},
- FieldElement{-21699244, 9220969, -15730624, 1084137, -25476107, -2852390, 31088447, -7764523, -11356529, 728112},
- },
- {
- FieldElement{26047220, -11751471, -6900323, -16521798, 24092068, 9158119, -4273545, -12555558, -29365436, -5498272},
- FieldElement{17510331, -322857, 5854289, 8403524, 17133918, -3112612, -28111007, 12327945, 10750447, 10014012},
- FieldElement{-10312768, 3936952, 9156313, -8897683, 16498692, -994647, -27481051, -666732, 3424691, 7540221},
- },
- {
- FieldElement{30322361, -6964110, 11361005, -4143317, 7433304, 4989748, -7071422, -16317219, -9244265, 15258046},
- FieldElement{13054562, -2779497, 19155474, 469045, -12482797, 4566042, 5631406, 2711395, 1062915, -5136345},
- FieldElement{-19240248, -11254599, -29509029, -7499965, -5835763, 13005411, -6066489, 12194497, 32960380, 1459310},
- },
- },
- {
- {
- FieldElement{19852034, 7027924, 23669353, 10020366, 8586503, -6657907, 394197, -6101885, 18638003, -11174937},
- FieldElement{31395534, 15098109, 26581030, 8030562, -16527914, -5007134, 9012486, -7584354, -6643087, -5442636},
- FieldElement{-9192165, -2347377, -1997099, 4529534, 25766844, 607986, -13222, 9677543, -32294889, -6456008},
- },
- {
- FieldElement{-2444496, -149937, 29348902, 8186665, 1873760, 12489863, -30934579, -7839692, -7852844, -8138429},
- FieldElement{-15236356, -15433509, 7766470, 746860, 26346930, -10221762, -27333451, 10754588, -9431476, 5203576},
- FieldElement{31834314, 14135496, -770007, 5159118, 20917671, -16768096, -7467973, -7337524, 31809243, 7347066},
- },
- {
- FieldElement{-9606723, -11874240, 20414459, 13033986, 13716524, -11691881, 19797970, -12211255, 15192876, -2087490},
- FieldElement{-12663563, -2181719, 1168162, -3804809, 26747877, -14138091, 10609330, 12694420, 33473243, -13382104},
- FieldElement{33184999, 11180355, 15832085, -11385430, -1633671, 225884, 15089336, -11023903, -6135662, 14480053},
- },
- {
- FieldElement{31308717, -5619998, 31030840, -1897099, 15674547, -6582883, 5496208, 13685227, 27595050, 8737275},
- FieldElement{-20318852, -15150239, 10933843, -16178022, 8335352, -7546022, -31008351, -12610604, 26498114, 66511},
- FieldElement{22644454, -8761729, -16671776, 4884562, -3105614, -13559366, 30540766, -4286747, -13327787, -7515095},
- },
- {
- FieldElement{-28017847, 9834845, 18617207, -2681312, -3401956, -13307506, 8205540, 13585437, -17127465, 15115439},
- FieldElement{23711543, -672915, 31206561, -8362711, 6164647, -9709987, -33535882, -1426096, 8236921, 16492939},
- FieldElement{-23910559, -13515526, -26299483, -4503841, 25005590, -7687270, 19574902, 10071562, 6708380, -6222424},
- },
- {
- FieldElement{2101391, -4930054, 19702731, 2367575, -15427167, 1047675, 5301017, 9328700, 29955601, -11678310},
- FieldElement{3096359, 9271816, -21620864, -15521844, -14847996, -7592937, -25892142, -12635595, -9917575, 6216608},
- FieldElement{-32615849, 338663, -25195611, 2510422, -29213566, -13820213, 24822830, -6146567, -26767480, 7525079},
- },
- {
- FieldElement{-23066649, -13985623, 16133487, -7896178, -3389565, 778788, -910336, -2782495, -19386633, 11994101},
- FieldElement{21691500, -13624626, -641331, -14367021, 3285881, -3483596, -25064666, 9718258, -7477437, 13381418},
- FieldElement{18445390, -4202236, 14979846, 11622458, -1727110, -3582980, 23111648, -6375247, 28535282, 15779576},
- },
- {
- FieldElement{30098053, 3089662, -9234387, 16662135, -21306940, 11308411, -14068454, 12021730, 9955285, -16303356},
- FieldElement{9734894, -14576830, -7473633, -9138735, 2060392, 11313496, -18426029, 9924399, 20194861, 13380996},
- FieldElement{-26378102, -7965207, -22167821, 15789297, -18055342, -6168792, -1984914, 15707771, 26342023, 10146099},
- },
- },
- {
- {
- FieldElement{-26016874, -219943, 21339191, -41388, 19745256, -2878700, -29637280, 2227040, 21612326, -545728},
- FieldElement{-13077387, 1184228, 23562814, -5970442, -20351244, -6348714, 25764461, 12243797, -20856566, 11649658},
- FieldElement{-10031494, 11262626, 27384172, 2271902, 26947504, -15997771, 39944, 6114064, 33514190, 2333242},
- },
- {
- FieldElement{-21433588, -12421821, 8119782, 7219913, -21830522, -9016134, -6679750, -12670638, 24350578, -13450001},
- FieldElement{-4116307, -11271533, -23886186, 4843615, -30088339, 690623, -31536088, -10406836, 8317860, 12352766},
- FieldElement{18200138, -14475911, -33087759, -2696619, -23702521, -9102511, -23552096, -2287550, 20712163, 6719373},
- },
- {
- FieldElement{26656208, 6075253, -7858556, 1886072, -28344043, 4262326, 11117530, -3763210, 26224235, -3297458},
- FieldElement{-17168938, -14854097, -3395676, -16369877, -19954045, 14050420, 21728352, 9493610, 18620611, -16428628},
- FieldElement{-13323321, 13325349, 11432106, 5964811, 18609221, 6062965, -5269471, -9725556, -30701573, -16479657},
- },
- {
- FieldElement{-23860538, -11233159, 26961357, 1640861, -32413112, -16737940, 12248509, -5240639, 13735342, 1934062},
- FieldElement{25089769, 6742589, 17081145, -13406266, 21909293, -16067981, -15136294, -3765346, -21277997, 5473616},
- FieldElement{31883677, -7961101, 1083432, -11572403, 22828471, 13290673, -7125085, 12469656, 29111212, -5451014},
- },
- {
- FieldElement{24244947, -15050407, -26262976, 2791540, -14997599, 16666678, 24367466, 6388839, -10295587, 452383},
- FieldElement{-25640782, -3417841, 5217916, 16224624, 19987036, -4082269, -24236251, -5915248, 15766062, 8407814},
- FieldElement{-20406999, 13990231, 15495425, 16395525, 5377168, 15166495, -8917023, -4388953, -8067909, 2276718},
- },
- {
- FieldElement{30157918, 12924066, -17712050, 9245753, 19895028, 3368142, -23827587, 5096219, 22740376, -7303417},
- FieldElement{2041139, -14256350, 7783687, 13876377, -25946985, -13352459, 24051124, 13742383, -15637599, 13295222},
- FieldElement{33338237, -8505733, 12532113, 7977527, 9106186, -1715251, -17720195, -4612972, -4451357, -14669444},
- },
- {
- FieldElement{-20045281, 5454097, -14346548, 6447146, 28862071, 1883651, -2469266, -4141880, 7770569, 9620597},
- FieldElement{23208068, 7979712, 33071466, 8149229, 1758231, -10834995, 30945528, -1694323, -33502340, -14767970},
- FieldElement{1439958, -16270480, -1079989, -793782, 4625402, 10647766, -5043801, 1220118, 30494170, -11440799},
- },
- {
- FieldElement{-5037580, -13028295, -2970559, -3061767, 15640974, -6701666, -26739026, 926050, -1684339, -13333647},
- FieldElement{13908495, -3549272, 30919928, -6273825, -21521863, 7989039, 9021034, 9078865, 3353509, 4033511},
- FieldElement{-29663431, -15113610, 32259991, -344482, 24295849, -12912123, 23161163, 8839127, 27485041, 7356032},
- },
- },
- {
- {
- FieldElement{9661027, 705443, 11980065, -5370154, -1628543, 14661173, -6346142, 2625015, 28431036, -16771834},
- FieldElement{-23839233, -8311415, -25945511, 7480958, -17681669, -8354183, -22545972, 14150565, 15970762, 4099461},
- FieldElement{29262576, 16756590, 26350592, -8793563, 8529671, -11208050, 13617293, -9937143, 11465739, 8317062},
- },
- {
- FieldElement{-25493081, -6962928, 32500200, -9419051, -23038724, -2302222, 14898637, 3848455, 20969334, -5157516},
- FieldElement{-20384450, -14347713, -18336405, 13884722, -33039454, 2842114, -21610826, -3649888, 11177095, 14989547},
- FieldElement{-24496721, -11716016, 16959896, 2278463, 12066309, 10137771, 13515641, 2581286, -28487508, 9930240},
- },
- {
- FieldElement{-17751622, -2097826, 16544300, -13009300, -15914807, -14949081, 18345767, -13403753, 16291481, -5314038},
- FieldElement{-33229194, 2553288, 32678213, 9875984, 8534129, 6889387, -9676774, 6957617, 4368891, 9788741},
- FieldElement{16660756, 7281060, -10830758, 12911820, 20108584, -8101676, -21722536, -8613148, 16250552, -11111103},
- },
- {
- FieldElement{-19765507, 2390526, -16551031, 14161980, 1905286, 6414907, 4689584, 10604807, -30190403, 4782747},
- FieldElement{-1354539, 14736941, -7367442, -13292886, 7710542, -14155590, -9981571, 4383045, 22546403, 437323},
- FieldElement{31665577, -12180464, -16186830, 1491339, -18368625, 3294682, 27343084, 2786261, -30633590, -14097016},
- },
- {
- FieldElement{-14467279, -683715, -33374107, 7448552, 19294360, 14334329, -19690631, 2355319, -19284671, -6114373},
- FieldElement{15121312, -15796162, 6377020, -6031361, -10798111, -12957845, 18952177, 15496498, -29380133, 11754228},
- FieldElement{-2637277, -13483075, 8488727, -14303896, 12728761, -1622493, 7141596, 11724556, 22761615, -10134141},
- },
- {
- FieldElement{16918416, 11729663, -18083579, 3022987, -31015732, -13339659, -28741185, -12227393, 32851222, 11717399},
- FieldElement{11166634, 7338049, -6722523, 4531520, -29468672, -7302055, 31474879, 3483633, -1193175, -4030831},
- FieldElement{-185635, 9921305, 31456609, -13536438, -12013818, 13348923, 33142652, 6546660, -19985279, -3948376},
- },
- {
- FieldElement{-32460596, 11266712, -11197107, -7899103, 31703694, 3855903, -8537131, -12833048, -30772034, -15486313},
- FieldElement{-18006477, 12709068, 3991746, -6479188, -21491523, -10550425, -31135347, -16049879, 10928917, 3011958},
- FieldElement{-6957757, -15594337, 31696059, 334240, 29576716, 14796075, -30831056, -12805180, 18008031, 10258577},
- },
- {
- FieldElement{-22448644, 15655569, 7018479, -4410003, -30314266, -1201591, -1853465, 1367120, 25127874, 6671743},
- FieldElement{29701166, -14373934, -10878120, 9279288, -17568, 13127210, 21382910, 11042292, 25838796, 4642684},
- FieldElement{-20430234, 14955537, -24126347, 8124619, -5369288, -5990470, 30468147, -13900640, 18423289, 4177476},
- },
- },
-}
diff --git a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go b/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go
deleted file mode 100644
index fd03c252..00000000
--- a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go
+++ /dev/null
@@ -1,1793 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package edwards25519
-
-import "encoding/binary"
-
-// This code is a port of the public domain, “ref10” implementation of ed25519
-// from SUPERCOP.
-
-// FieldElement represents an element of the field GF(2^255 - 19). An element
-// t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77
-// t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on
-// context.
-type FieldElement [10]int32
-
-var zero FieldElement
-
-func FeZero(fe *FieldElement) {
- copy(fe[:], zero[:])
-}
-
-func FeOne(fe *FieldElement) {
- FeZero(fe)
- fe[0] = 1
-}
-
-func FeAdd(dst, a, b *FieldElement) {
- dst[0] = a[0] + b[0]
- dst[1] = a[1] + b[1]
- dst[2] = a[2] + b[2]
- dst[3] = a[3] + b[3]
- dst[4] = a[4] + b[4]
- dst[5] = a[5] + b[5]
- dst[6] = a[6] + b[6]
- dst[7] = a[7] + b[7]
- dst[8] = a[8] + b[8]
- dst[9] = a[9] + b[9]
-}
-
-func FeSub(dst, a, b *FieldElement) {
- dst[0] = a[0] - b[0]
- dst[1] = a[1] - b[1]
- dst[2] = a[2] - b[2]
- dst[3] = a[3] - b[3]
- dst[4] = a[4] - b[4]
- dst[5] = a[5] - b[5]
- dst[6] = a[6] - b[6]
- dst[7] = a[7] - b[7]
- dst[8] = a[8] - b[8]
- dst[9] = a[9] - b[9]
-}
-
-func FeCopy(dst, src *FieldElement) {
- copy(dst[:], src[:])
-}
-
-// Replace (f,g) with (g,g) if b == 1;
-// replace (f,g) with (f,g) if b == 0.
-//
-// Preconditions: b in {0,1}.
-func FeCMove(f, g *FieldElement, b int32) {
- b = -b
- f[0] ^= b & (f[0] ^ g[0])
- f[1] ^= b & (f[1] ^ g[1])
- f[2] ^= b & (f[2] ^ g[2])
- f[3] ^= b & (f[3] ^ g[3])
- f[4] ^= b & (f[4] ^ g[4])
- f[5] ^= b & (f[5] ^ g[5])
- f[6] ^= b & (f[6] ^ g[6])
- f[7] ^= b & (f[7] ^ g[7])
- f[8] ^= b & (f[8] ^ g[8])
- f[9] ^= b & (f[9] ^ g[9])
-}
-
-func load3(in []byte) int64 {
- var r int64
- r = int64(in[0])
- r |= int64(in[1]) << 8
- r |= int64(in[2]) << 16
- return r
-}
-
-func load4(in []byte) int64 {
- var r int64
- r = int64(in[0])
- r |= int64(in[1]) << 8
- r |= int64(in[2]) << 16
- r |= int64(in[3]) << 24
- return r
-}
-
-func FeFromBytes(dst *FieldElement, src *[32]byte) {
- h0 := load4(src[:])
- h1 := load3(src[4:]) << 6
- h2 := load3(src[7:]) << 5
- h3 := load3(src[10:]) << 3
- h4 := load3(src[13:]) << 2
- h5 := load4(src[16:])
- h6 := load3(src[20:]) << 7
- h7 := load3(src[23:]) << 5
- h8 := load3(src[26:]) << 4
- h9 := (load3(src[29:]) & 8388607) << 2
-
- FeCombine(dst, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9)
-}
-
-// FeToBytes marshals h to s.
-// Preconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Write p=2^255-19; q=floor(h/p).
-// Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
-//
-// Proof:
-// Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
-// Also have |h-2^230 h9|<2^230 so |19 2^(-255)(h-2^230 h9)|<1/4.
-//
-// Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
-// Then 0> 25
- q = (h[0] + q) >> 26
- q = (h[1] + q) >> 25
- q = (h[2] + q) >> 26
- q = (h[3] + q) >> 25
- q = (h[4] + q) >> 26
- q = (h[5] + q) >> 25
- q = (h[6] + q) >> 26
- q = (h[7] + q) >> 25
- q = (h[8] + q) >> 26
- q = (h[9] + q) >> 25
-
- // Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20.
- h[0] += 19 * q
- // Goal: Output h-2^255 q, which is between 0 and 2^255-20.
-
- carry[0] = h[0] >> 26
- h[1] += carry[0]
- h[0] -= carry[0] << 26
- carry[1] = h[1] >> 25
- h[2] += carry[1]
- h[1] -= carry[1] << 25
- carry[2] = h[2] >> 26
- h[3] += carry[2]
- h[2] -= carry[2] << 26
- carry[3] = h[3] >> 25
- h[4] += carry[3]
- h[3] -= carry[3] << 25
- carry[4] = h[4] >> 26
- h[5] += carry[4]
- h[4] -= carry[4] << 26
- carry[5] = h[5] >> 25
- h[6] += carry[5]
- h[5] -= carry[5] << 25
- carry[6] = h[6] >> 26
- h[7] += carry[6]
- h[6] -= carry[6] << 26
- carry[7] = h[7] >> 25
- h[8] += carry[7]
- h[7] -= carry[7] << 25
- carry[8] = h[8] >> 26
- h[9] += carry[8]
- h[8] -= carry[8] << 26
- carry[9] = h[9] >> 25
- h[9] -= carry[9] << 25
- // h10 = carry9
-
- // Goal: Output h[0]+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
- // Have h[0]+...+2^230 h[9] between 0 and 2^255-1;
- // evidently 2^255 h10-2^255 q = 0.
- // Goal: Output h[0]+...+2^230 h[9].
-
- s[0] = byte(h[0] >> 0)
- s[1] = byte(h[0] >> 8)
- s[2] = byte(h[0] >> 16)
- s[3] = byte((h[0] >> 24) | (h[1] << 2))
- s[4] = byte(h[1] >> 6)
- s[5] = byte(h[1] >> 14)
- s[6] = byte((h[1] >> 22) | (h[2] << 3))
- s[7] = byte(h[2] >> 5)
- s[8] = byte(h[2] >> 13)
- s[9] = byte((h[2] >> 21) | (h[3] << 5))
- s[10] = byte(h[3] >> 3)
- s[11] = byte(h[3] >> 11)
- s[12] = byte((h[3] >> 19) | (h[4] << 6))
- s[13] = byte(h[4] >> 2)
- s[14] = byte(h[4] >> 10)
- s[15] = byte(h[4] >> 18)
- s[16] = byte(h[5] >> 0)
- s[17] = byte(h[5] >> 8)
- s[18] = byte(h[5] >> 16)
- s[19] = byte((h[5] >> 24) | (h[6] << 1))
- s[20] = byte(h[6] >> 7)
- s[21] = byte(h[6] >> 15)
- s[22] = byte((h[6] >> 23) | (h[7] << 3))
- s[23] = byte(h[7] >> 5)
- s[24] = byte(h[7] >> 13)
- s[25] = byte((h[7] >> 21) | (h[8] << 4))
- s[26] = byte(h[8] >> 4)
- s[27] = byte(h[8] >> 12)
- s[28] = byte((h[8] >> 20) | (h[9] << 6))
- s[29] = byte(h[9] >> 2)
- s[30] = byte(h[9] >> 10)
- s[31] = byte(h[9] >> 18)
-}
-
-func FeIsNegative(f *FieldElement) byte {
- var s [32]byte
- FeToBytes(&s, f)
- return s[0] & 1
-}
-
-func FeIsNonZero(f *FieldElement) int32 {
- var s [32]byte
- FeToBytes(&s, f)
- var x uint8
- for _, b := range s {
- x |= b
- }
- x |= x >> 4
- x |= x >> 2
- x |= x >> 1
- return int32(x & 1)
-}
-
-// FeNeg sets h = -f
-//
-// Preconditions:
-// |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-func FeNeg(h, f *FieldElement) {
- h[0] = -f[0]
- h[1] = -f[1]
- h[2] = -f[2]
- h[3] = -f[3]
- h[4] = -f[4]
- h[5] = -f[5]
- h[6] = -f[6]
- h[7] = -f[7]
- h[8] = -f[8]
- h[9] = -f[9]
-}
-
-func FeCombine(h *FieldElement, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 int64) {
- var c0, c1, c2, c3, c4, c5, c6, c7, c8, c9 int64
-
- /*
- |h0| <= (1.1*1.1*2^52*(1+19+19+19+19)+1.1*1.1*2^50*(38+38+38+38+38))
- i.e. |h0| <= 1.2*2^59; narrower ranges for h2, h4, h6, h8
- |h1| <= (1.1*1.1*2^51*(1+1+19+19+19+19+19+19+19+19))
- i.e. |h1| <= 1.5*2^58; narrower ranges for h3, h5, h7, h9
- */
-
- c0 = (h0 + (1 << 25)) >> 26
- h1 += c0
- h0 -= c0 << 26
- c4 = (h4 + (1 << 25)) >> 26
- h5 += c4
- h4 -= c4 << 26
- /* |h0| <= 2^25 */
- /* |h4| <= 2^25 */
- /* |h1| <= 1.51*2^58 */
- /* |h5| <= 1.51*2^58 */
-
- c1 = (h1 + (1 << 24)) >> 25
- h2 += c1
- h1 -= c1 << 25
- c5 = (h5 + (1 << 24)) >> 25
- h6 += c5
- h5 -= c5 << 25
- /* |h1| <= 2^24; from now on fits into int32 */
- /* |h5| <= 2^24; from now on fits into int32 */
- /* |h2| <= 1.21*2^59 */
- /* |h6| <= 1.21*2^59 */
-
- c2 = (h2 + (1 << 25)) >> 26
- h3 += c2
- h2 -= c2 << 26
- c6 = (h6 + (1 << 25)) >> 26
- h7 += c6
- h6 -= c6 << 26
- /* |h2| <= 2^25; from now on fits into int32 unchanged */
- /* |h6| <= 2^25; from now on fits into int32 unchanged */
- /* |h3| <= 1.51*2^58 */
- /* |h7| <= 1.51*2^58 */
-
- c3 = (h3 + (1 << 24)) >> 25
- h4 += c3
- h3 -= c3 << 25
- c7 = (h7 + (1 << 24)) >> 25
- h8 += c7
- h7 -= c7 << 25
- /* |h3| <= 2^24; from now on fits into int32 unchanged */
- /* |h7| <= 2^24; from now on fits into int32 unchanged */
- /* |h4| <= 1.52*2^33 */
- /* |h8| <= 1.52*2^33 */
-
- c4 = (h4 + (1 << 25)) >> 26
- h5 += c4
- h4 -= c4 << 26
- c8 = (h8 + (1 << 25)) >> 26
- h9 += c8
- h8 -= c8 << 26
- /* |h4| <= 2^25; from now on fits into int32 unchanged */
- /* |h8| <= 2^25; from now on fits into int32 unchanged */
- /* |h5| <= 1.01*2^24 */
- /* |h9| <= 1.51*2^58 */
-
- c9 = (h9 + (1 << 24)) >> 25
- h0 += c9 * 19
- h9 -= c9 << 25
- /* |h9| <= 2^24; from now on fits into int32 unchanged */
- /* |h0| <= 1.8*2^37 */
-
- c0 = (h0 + (1 << 25)) >> 26
- h1 += c0
- h0 -= c0 << 26
- /* |h0| <= 2^25; from now on fits into int32 unchanged */
- /* |h1| <= 1.01*2^24 */
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// FeMul calculates h = f * g
-// Can overlap h with f or g.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-// |g| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Notes on implementation strategy:
-//
-// Using schoolbook multiplication.
-// Karatsuba would save a little in some cost models.
-//
-// Most multiplications by 2 and 19 are 32-bit precomputations;
-// cheaper than 64-bit postcomputations.
-//
-// There is one remaining multiplication by 19 in the carry chain;
-// one *19 precomputation can be merged into this,
-// but the resulting data flow is considerably less clean.
-//
-// There are 12 carries below.
-// 10 of them are 2-way parallelizable and vectorizable.
-// Can get away with 11 carries, but then data flow is much deeper.
-//
-// With tighter constraints on inputs, can squeeze carries into int32.
-func FeMul(h, f, g *FieldElement) {
- f0 := int64(f[0])
- f1 := int64(f[1])
- f2 := int64(f[2])
- f3 := int64(f[3])
- f4 := int64(f[4])
- f5 := int64(f[5])
- f6 := int64(f[6])
- f7 := int64(f[7])
- f8 := int64(f[8])
- f9 := int64(f[9])
-
- f1_2 := int64(2 * f[1])
- f3_2 := int64(2 * f[3])
- f5_2 := int64(2 * f[5])
- f7_2 := int64(2 * f[7])
- f9_2 := int64(2 * f[9])
-
- g0 := int64(g[0])
- g1 := int64(g[1])
- g2 := int64(g[2])
- g3 := int64(g[3])
- g4 := int64(g[4])
- g5 := int64(g[5])
- g6 := int64(g[6])
- g7 := int64(g[7])
- g8 := int64(g[8])
- g9 := int64(g[9])
-
- g1_19 := int64(19 * g[1]) /* 1.4*2^29 */
- g2_19 := int64(19 * g[2]) /* 1.4*2^30; still ok */
- g3_19 := int64(19 * g[3])
- g4_19 := int64(19 * g[4])
- g5_19 := int64(19 * g[5])
- g6_19 := int64(19 * g[6])
- g7_19 := int64(19 * g[7])
- g8_19 := int64(19 * g[8])
- g9_19 := int64(19 * g[9])
-
- h0 := f0*g0 + f1_2*g9_19 + f2*g8_19 + f3_2*g7_19 + f4*g6_19 + f5_2*g5_19 + f6*g4_19 + f7_2*g3_19 + f8*g2_19 + f9_2*g1_19
- h1 := f0*g1 + f1*g0 + f2*g9_19 + f3*g8_19 + f4*g7_19 + f5*g6_19 + f6*g5_19 + f7*g4_19 + f8*g3_19 + f9*g2_19
- h2 := f0*g2 + f1_2*g1 + f2*g0 + f3_2*g9_19 + f4*g8_19 + f5_2*g7_19 + f6*g6_19 + f7_2*g5_19 + f8*g4_19 + f9_2*g3_19
- h3 := f0*g3 + f1*g2 + f2*g1 + f3*g0 + f4*g9_19 + f5*g8_19 + f6*g7_19 + f7*g6_19 + f8*g5_19 + f9*g4_19
- h4 := f0*g4 + f1_2*g3 + f2*g2 + f3_2*g1 + f4*g0 + f5_2*g9_19 + f6*g8_19 + f7_2*g7_19 + f8*g6_19 + f9_2*g5_19
- h5 := f0*g5 + f1*g4 + f2*g3 + f3*g2 + f4*g1 + f5*g0 + f6*g9_19 + f7*g8_19 + f8*g7_19 + f9*g6_19
- h6 := f0*g6 + f1_2*g5 + f2*g4 + f3_2*g3 + f4*g2 + f5_2*g1 + f6*g0 + f7_2*g9_19 + f8*g8_19 + f9_2*g7_19
- h7 := f0*g7 + f1*g6 + f2*g5 + f3*g4 + f4*g3 + f5*g2 + f6*g1 + f7*g0 + f8*g9_19 + f9*g8_19
- h8 := f0*g8 + f1_2*g7 + f2*g6 + f3_2*g5 + f4*g4 + f5_2*g3 + f6*g2 + f7_2*g1 + f8*g0 + f9_2*g9_19
- h9 := f0*g9 + f1*g8 + f2*g7 + f3*g6 + f4*g5 + f5*g4 + f6*g3 + f7*g2 + f8*g1 + f9*g0
-
- FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9)
-}
-
-func feSquare(f *FieldElement) (h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 int64) {
- f0 := int64(f[0])
- f1 := int64(f[1])
- f2 := int64(f[2])
- f3 := int64(f[3])
- f4 := int64(f[4])
- f5 := int64(f[5])
- f6 := int64(f[6])
- f7 := int64(f[7])
- f8 := int64(f[8])
- f9 := int64(f[9])
- f0_2 := int64(2 * f[0])
- f1_2 := int64(2 * f[1])
- f2_2 := int64(2 * f[2])
- f3_2 := int64(2 * f[3])
- f4_2 := int64(2 * f[4])
- f5_2 := int64(2 * f[5])
- f6_2 := int64(2 * f[6])
- f7_2 := int64(2 * f[7])
- f5_38 := 38 * f5 // 1.31*2^30
- f6_19 := 19 * f6 // 1.31*2^30
- f7_38 := 38 * f7 // 1.31*2^30
- f8_19 := 19 * f8 // 1.31*2^30
- f9_38 := 38 * f9 // 1.31*2^30
-
- h0 = f0*f0 + f1_2*f9_38 + f2_2*f8_19 + f3_2*f7_38 + f4_2*f6_19 + f5*f5_38
- h1 = f0_2*f1 + f2*f9_38 + f3_2*f8_19 + f4*f7_38 + f5_2*f6_19
- h2 = f0_2*f2 + f1_2*f1 + f3_2*f9_38 + f4_2*f8_19 + f5_2*f7_38 + f6*f6_19
- h3 = f0_2*f3 + f1_2*f2 + f4*f9_38 + f5_2*f8_19 + f6*f7_38
- h4 = f0_2*f4 + f1_2*f3_2 + f2*f2 + f5_2*f9_38 + f6_2*f8_19 + f7*f7_38
- h5 = f0_2*f5 + f1_2*f4 + f2_2*f3 + f6*f9_38 + f7_2*f8_19
- h6 = f0_2*f6 + f1_2*f5_2 + f2_2*f4 + f3_2*f3 + f7_2*f9_38 + f8*f8_19
- h7 = f0_2*f7 + f1_2*f6 + f2_2*f5 + f3_2*f4 + f8*f9_38
- h8 = f0_2*f8 + f1_2*f7_2 + f2_2*f6 + f3_2*f5_2 + f4*f4 + f9*f9_38
- h9 = f0_2*f9 + f1_2*f8 + f2_2*f7 + f3_2*f6 + f4_2*f5
-
- return
-}
-
-// FeSquare calculates h = f*f. Can overlap h with f.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-func FeSquare(h, f *FieldElement) {
- h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 := feSquare(f)
- FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9)
-}
-
-// FeSquare2 sets h = 2 * f * f
-//
-// Can overlap h with f.
-//
-// Preconditions:
-// |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
-// See fe_mul.c for discussion of implementation strategy.
-func FeSquare2(h, f *FieldElement) {
- h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 := feSquare(f)
-
- h0 += h0
- h1 += h1
- h2 += h2
- h3 += h3
- h4 += h4
- h5 += h5
- h6 += h6
- h7 += h7
- h8 += h8
- h9 += h9
-
- FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9)
-}
-
-func FeInvert(out, z *FieldElement) {
- var t0, t1, t2, t3 FieldElement
- var i int
-
- FeSquare(&t0, z) // 2^1
- FeSquare(&t1, &t0) // 2^2
- for i = 1; i < 2; i++ { // 2^3
- FeSquare(&t1, &t1)
- }
- FeMul(&t1, z, &t1) // 2^3 + 2^0
- FeMul(&t0, &t0, &t1) // 2^3 + 2^1 + 2^0
- FeSquare(&t2, &t0) // 2^4 + 2^2 + 2^1
- FeMul(&t1, &t1, &t2) // 2^4 + 2^3 + 2^2 + 2^1 + 2^0
- FeSquare(&t2, &t1) // 5,4,3,2,1
- for i = 1; i < 5; i++ { // 9,8,7,6,5
- FeSquare(&t2, &t2)
- }
- FeMul(&t1, &t2, &t1) // 9,8,7,6,5,4,3,2,1,0
- FeSquare(&t2, &t1) // 10..1
- for i = 1; i < 10; i++ { // 19..10
- FeSquare(&t2, &t2)
- }
- FeMul(&t2, &t2, &t1) // 19..0
- FeSquare(&t3, &t2) // 20..1
- for i = 1; i < 20; i++ { // 39..20
- FeSquare(&t3, &t3)
- }
- FeMul(&t2, &t3, &t2) // 39..0
- FeSquare(&t2, &t2) // 40..1
- for i = 1; i < 10; i++ { // 49..10
- FeSquare(&t2, &t2)
- }
- FeMul(&t1, &t2, &t1) // 49..0
- FeSquare(&t2, &t1) // 50..1
- for i = 1; i < 50; i++ { // 99..50
- FeSquare(&t2, &t2)
- }
- FeMul(&t2, &t2, &t1) // 99..0
- FeSquare(&t3, &t2) // 100..1
- for i = 1; i < 100; i++ { // 199..100
- FeSquare(&t3, &t3)
- }
- FeMul(&t2, &t3, &t2) // 199..0
- FeSquare(&t2, &t2) // 200..1
- for i = 1; i < 50; i++ { // 249..50
- FeSquare(&t2, &t2)
- }
- FeMul(&t1, &t2, &t1) // 249..0
- FeSquare(&t1, &t1) // 250..1
- for i = 1; i < 5; i++ { // 254..5
- FeSquare(&t1, &t1)
- }
- FeMul(out, &t1, &t0) // 254..5,3,1,0
-}
-
-func fePow22523(out, z *FieldElement) {
- var t0, t1, t2 FieldElement
- var i int
-
- FeSquare(&t0, z)
- for i = 1; i < 1; i++ {
- FeSquare(&t0, &t0)
- }
- FeSquare(&t1, &t0)
- for i = 1; i < 2; i++ {
- FeSquare(&t1, &t1)
- }
- FeMul(&t1, z, &t1)
- FeMul(&t0, &t0, &t1)
- FeSquare(&t0, &t0)
- for i = 1; i < 1; i++ {
- FeSquare(&t0, &t0)
- }
- FeMul(&t0, &t1, &t0)
- FeSquare(&t1, &t0)
- for i = 1; i < 5; i++ {
- FeSquare(&t1, &t1)
- }
- FeMul(&t0, &t1, &t0)
- FeSquare(&t1, &t0)
- for i = 1; i < 10; i++ {
- FeSquare(&t1, &t1)
- }
- FeMul(&t1, &t1, &t0)
- FeSquare(&t2, &t1)
- for i = 1; i < 20; i++ {
- FeSquare(&t2, &t2)
- }
- FeMul(&t1, &t2, &t1)
- FeSquare(&t1, &t1)
- for i = 1; i < 10; i++ {
- FeSquare(&t1, &t1)
- }
- FeMul(&t0, &t1, &t0)
- FeSquare(&t1, &t0)
- for i = 1; i < 50; i++ {
- FeSquare(&t1, &t1)
- }
- FeMul(&t1, &t1, &t0)
- FeSquare(&t2, &t1)
- for i = 1; i < 100; i++ {
- FeSquare(&t2, &t2)
- }
- FeMul(&t1, &t2, &t1)
- FeSquare(&t1, &t1)
- for i = 1; i < 50; i++ {
- FeSquare(&t1, &t1)
- }
- FeMul(&t0, &t1, &t0)
- FeSquare(&t0, &t0)
- for i = 1; i < 2; i++ {
- FeSquare(&t0, &t0)
- }
- FeMul(out, &t0, z)
-}
-
-// Group elements are members of the elliptic curve -x^2 + y^2 = 1 + d * x^2 *
-// y^2 where d = -121665/121666.
-//
-// Several representations are used:
-// ProjectiveGroupElement: (X:Y:Z) satisfying x=X/Z, y=Y/Z
-// ExtendedGroupElement: (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
-// CompletedGroupElement: ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
-// PreComputedGroupElement: (y+x,y-x,2dxy)
-
-type ProjectiveGroupElement struct {
- X, Y, Z FieldElement
-}
-
-type ExtendedGroupElement struct {
- X, Y, Z, T FieldElement
-}
-
-type CompletedGroupElement struct {
- X, Y, Z, T FieldElement
-}
-
-type PreComputedGroupElement struct {
- yPlusX, yMinusX, xy2d FieldElement
-}
-
-type CachedGroupElement struct {
- yPlusX, yMinusX, Z, T2d FieldElement
-}
-
-func (p *ProjectiveGroupElement) Zero() {
- FeZero(&p.X)
- FeOne(&p.Y)
- FeOne(&p.Z)
-}
-
-func (p *ProjectiveGroupElement) Double(r *CompletedGroupElement) {
- var t0 FieldElement
-
- FeSquare(&r.X, &p.X)
- FeSquare(&r.Z, &p.Y)
- FeSquare2(&r.T, &p.Z)
- FeAdd(&r.Y, &p.X, &p.Y)
- FeSquare(&t0, &r.Y)
- FeAdd(&r.Y, &r.Z, &r.X)
- FeSub(&r.Z, &r.Z, &r.X)
- FeSub(&r.X, &t0, &r.Y)
- FeSub(&r.T, &r.T, &r.Z)
-}
-
-func (p *ProjectiveGroupElement) ToBytes(s *[32]byte) {
- var recip, x, y FieldElement
-
- FeInvert(&recip, &p.Z)
- FeMul(&x, &p.X, &recip)
- FeMul(&y, &p.Y, &recip)
- FeToBytes(s, &y)
- s[31] ^= FeIsNegative(&x) << 7
-}
-
-func (p *ExtendedGroupElement) Zero() {
- FeZero(&p.X)
- FeOne(&p.Y)
- FeOne(&p.Z)
- FeZero(&p.T)
-}
-
-func (p *ExtendedGroupElement) Double(r *CompletedGroupElement) {
- var q ProjectiveGroupElement
- p.ToProjective(&q)
- q.Double(r)
-}
-
-func (p *ExtendedGroupElement) ToCached(r *CachedGroupElement) {
- FeAdd(&r.yPlusX, &p.Y, &p.X)
- FeSub(&r.yMinusX, &p.Y, &p.X)
- FeCopy(&r.Z, &p.Z)
- FeMul(&r.T2d, &p.T, &d2)
-}
-
-func (p *ExtendedGroupElement) ToProjective(r *ProjectiveGroupElement) {
- FeCopy(&r.X, &p.X)
- FeCopy(&r.Y, &p.Y)
- FeCopy(&r.Z, &p.Z)
-}
-
-func (p *ExtendedGroupElement) ToBytes(s *[32]byte) {
- var recip, x, y FieldElement
-
- FeInvert(&recip, &p.Z)
- FeMul(&x, &p.X, &recip)
- FeMul(&y, &p.Y, &recip)
- FeToBytes(s, &y)
- s[31] ^= FeIsNegative(&x) << 7
-}
-
-func (p *ExtendedGroupElement) FromBytes(s *[32]byte) bool {
- var u, v, v3, vxx, check FieldElement
-
- FeFromBytes(&p.Y, s)
- FeOne(&p.Z)
- FeSquare(&u, &p.Y)
- FeMul(&v, &u, &d)
- FeSub(&u, &u, &p.Z) // y = y^2-1
- FeAdd(&v, &v, &p.Z) // v = dy^2+1
-
- FeSquare(&v3, &v)
- FeMul(&v3, &v3, &v) // v3 = v^3
- FeSquare(&p.X, &v3)
- FeMul(&p.X, &p.X, &v)
- FeMul(&p.X, &p.X, &u) // x = uv^7
-
- fePow22523(&p.X, &p.X) // x = (uv^7)^((q-5)/8)
- FeMul(&p.X, &p.X, &v3)
- FeMul(&p.X, &p.X, &u) // x = uv^3(uv^7)^((q-5)/8)
-
- var tmpX, tmp2 [32]byte
-
- FeSquare(&vxx, &p.X)
- FeMul(&vxx, &vxx, &v)
- FeSub(&check, &vxx, &u) // vx^2-u
- if FeIsNonZero(&check) == 1 {
- FeAdd(&check, &vxx, &u) // vx^2+u
- if FeIsNonZero(&check) == 1 {
- return false
- }
- FeMul(&p.X, &p.X, &SqrtM1)
-
- FeToBytes(&tmpX, &p.X)
- for i, v := range tmpX {
- tmp2[31-i] = v
- }
- }
-
- if FeIsNegative(&p.X) != (s[31] >> 7) {
- FeNeg(&p.X, &p.X)
- }
-
- FeMul(&p.T, &p.X, &p.Y)
- return true
-}
-
-func (p *CompletedGroupElement) ToProjective(r *ProjectiveGroupElement) {
- FeMul(&r.X, &p.X, &p.T)
- FeMul(&r.Y, &p.Y, &p.Z)
- FeMul(&r.Z, &p.Z, &p.T)
-}
-
-func (p *CompletedGroupElement) ToExtended(r *ExtendedGroupElement) {
- FeMul(&r.X, &p.X, &p.T)
- FeMul(&r.Y, &p.Y, &p.Z)
- FeMul(&r.Z, &p.Z, &p.T)
- FeMul(&r.T, &p.X, &p.Y)
-}
-
-func (p *PreComputedGroupElement) Zero() {
- FeOne(&p.yPlusX)
- FeOne(&p.yMinusX)
- FeZero(&p.xy2d)
-}
-
-func geAdd(r *CompletedGroupElement, p *ExtendedGroupElement, q *CachedGroupElement) {
- var t0 FieldElement
-
- FeAdd(&r.X, &p.Y, &p.X)
- FeSub(&r.Y, &p.Y, &p.X)
- FeMul(&r.Z, &r.X, &q.yPlusX)
- FeMul(&r.Y, &r.Y, &q.yMinusX)
- FeMul(&r.T, &q.T2d, &p.T)
- FeMul(&r.X, &p.Z, &q.Z)
- FeAdd(&t0, &r.X, &r.X)
- FeSub(&r.X, &r.Z, &r.Y)
- FeAdd(&r.Y, &r.Z, &r.Y)
- FeAdd(&r.Z, &t0, &r.T)
- FeSub(&r.T, &t0, &r.T)
-}
-
-func geSub(r *CompletedGroupElement, p *ExtendedGroupElement, q *CachedGroupElement) {
- var t0 FieldElement
-
- FeAdd(&r.X, &p.Y, &p.X)
- FeSub(&r.Y, &p.Y, &p.X)
- FeMul(&r.Z, &r.X, &q.yMinusX)
- FeMul(&r.Y, &r.Y, &q.yPlusX)
- FeMul(&r.T, &q.T2d, &p.T)
- FeMul(&r.X, &p.Z, &q.Z)
- FeAdd(&t0, &r.X, &r.X)
- FeSub(&r.X, &r.Z, &r.Y)
- FeAdd(&r.Y, &r.Z, &r.Y)
- FeSub(&r.Z, &t0, &r.T)
- FeAdd(&r.T, &t0, &r.T)
-}
-
-func geMixedAdd(r *CompletedGroupElement, p *ExtendedGroupElement, q *PreComputedGroupElement) {
- var t0 FieldElement
-
- FeAdd(&r.X, &p.Y, &p.X)
- FeSub(&r.Y, &p.Y, &p.X)
- FeMul(&r.Z, &r.X, &q.yPlusX)
- FeMul(&r.Y, &r.Y, &q.yMinusX)
- FeMul(&r.T, &q.xy2d, &p.T)
- FeAdd(&t0, &p.Z, &p.Z)
- FeSub(&r.X, &r.Z, &r.Y)
- FeAdd(&r.Y, &r.Z, &r.Y)
- FeAdd(&r.Z, &t0, &r.T)
- FeSub(&r.T, &t0, &r.T)
-}
-
-func geMixedSub(r *CompletedGroupElement, p *ExtendedGroupElement, q *PreComputedGroupElement) {
- var t0 FieldElement
-
- FeAdd(&r.X, &p.Y, &p.X)
- FeSub(&r.Y, &p.Y, &p.X)
- FeMul(&r.Z, &r.X, &q.yMinusX)
- FeMul(&r.Y, &r.Y, &q.yPlusX)
- FeMul(&r.T, &q.xy2d, &p.T)
- FeAdd(&t0, &p.Z, &p.Z)
- FeSub(&r.X, &r.Z, &r.Y)
- FeAdd(&r.Y, &r.Z, &r.Y)
- FeSub(&r.Z, &t0, &r.T)
- FeAdd(&r.T, &t0, &r.T)
-}
-
-func slide(r *[256]int8, a *[32]byte) {
- for i := range r {
- r[i] = int8(1 & (a[i>>3] >> uint(i&7)))
- }
-
- for i := range r {
- if r[i] != 0 {
- for b := 1; b <= 6 && i+b < 256; b++ {
- if r[i+b] != 0 {
- if r[i]+(r[i+b]<= -15 {
- r[i] -= r[i+b] << uint(b)
- for k := i + b; k < 256; k++ {
- if r[k] == 0 {
- r[k] = 1
- break
- }
- r[k] = 0
- }
- } else {
- break
- }
- }
- }
- }
- }
-}
-
-// GeDoubleScalarMultVartime sets r = a*A + b*B
-// where a = a[0]+256*a[1]+...+256^31 a[31].
-// and b = b[0]+256*b[1]+...+256^31 b[31].
-// B is the Ed25519 base point (x,4/5) with x positive.
-func GeDoubleScalarMultVartime(r *ProjectiveGroupElement, a *[32]byte, A *ExtendedGroupElement, b *[32]byte) {
- var aSlide, bSlide [256]int8
- var Ai [8]CachedGroupElement // A,3A,5A,7A,9A,11A,13A,15A
- var t CompletedGroupElement
- var u, A2 ExtendedGroupElement
- var i int
-
- slide(&aSlide, a)
- slide(&bSlide, b)
-
- A.ToCached(&Ai[0])
- A.Double(&t)
- t.ToExtended(&A2)
-
- for i := 0; i < 7; i++ {
- geAdd(&t, &A2, &Ai[i])
- t.ToExtended(&u)
- u.ToCached(&Ai[i+1])
- }
-
- r.Zero()
-
- for i = 255; i >= 0; i-- {
- if aSlide[i] != 0 || bSlide[i] != 0 {
- break
- }
- }
-
- for ; i >= 0; i-- {
- r.Double(&t)
-
- if aSlide[i] > 0 {
- t.ToExtended(&u)
- geAdd(&t, &u, &Ai[aSlide[i]/2])
- } else if aSlide[i] < 0 {
- t.ToExtended(&u)
- geSub(&t, &u, &Ai[(-aSlide[i])/2])
- }
-
- if bSlide[i] > 0 {
- t.ToExtended(&u)
- geMixedAdd(&t, &u, &bi[bSlide[i]/2])
- } else if bSlide[i] < 0 {
- t.ToExtended(&u)
- geMixedSub(&t, &u, &bi[(-bSlide[i])/2])
- }
-
- t.ToProjective(r)
- }
-}
-
-// equal returns 1 if b == c and 0 otherwise, assuming that b and c are
-// non-negative.
-func equal(b, c int32) int32 {
- x := uint32(b ^ c)
- x--
- return int32(x >> 31)
-}
-
-// negative returns 1 if b < 0 and 0 otherwise.
-func negative(b int32) int32 {
- return (b >> 31) & 1
-}
-
-func PreComputedGroupElementCMove(t, u *PreComputedGroupElement, b int32) {
- FeCMove(&t.yPlusX, &u.yPlusX, b)
- FeCMove(&t.yMinusX, &u.yMinusX, b)
- FeCMove(&t.xy2d, &u.xy2d, b)
-}
-
-func selectPoint(t *PreComputedGroupElement, pos int32, b int32) {
- var minusT PreComputedGroupElement
- bNegative := negative(b)
- bAbs := b - (((-bNegative) & b) << 1)
-
- t.Zero()
- for i := int32(0); i < 8; i++ {
- PreComputedGroupElementCMove(t, &base[pos][i], equal(bAbs, i+1))
- }
- FeCopy(&minusT.yPlusX, &t.yMinusX)
- FeCopy(&minusT.yMinusX, &t.yPlusX)
- FeNeg(&minusT.xy2d, &t.xy2d)
- PreComputedGroupElementCMove(t, &minusT, bNegative)
-}
-
-// GeScalarMultBase computes h = a*B, where
-// a = a[0]+256*a[1]+...+256^31 a[31]
-// B is the Ed25519 base point (x,4/5) with x positive.
-//
-// Preconditions:
-// a[31] <= 127
-func GeScalarMultBase(h *ExtendedGroupElement, a *[32]byte) {
- var e [64]int8
-
- for i, v := range a {
- e[2*i] = int8(v & 15)
- e[2*i+1] = int8((v >> 4) & 15)
- }
-
- // each e[i] is between 0 and 15 and e[63] is between 0 and 7.
-
- carry := int8(0)
- for i := 0; i < 63; i++ {
- e[i] += carry
- carry = (e[i] + 8) >> 4
- e[i] -= carry << 4
- }
- e[63] += carry
- // each e[i] is between -8 and 8.
-
- h.Zero()
- var t PreComputedGroupElement
- var r CompletedGroupElement
- for i := int32(1); i < 64; i += 2 {
- selectPoint(&t, i/2, int32(e[i]))
- geMixedAdd(&r, h, &t)
- r.ToExtended(h)
- }
-
- var s ProjectiveGroupElement
-
- h.Double(&r)
- r.ToProjective(&s)
- s.Double(&r)
- r.ToProjective(&s)
- s.Double(&r)
- r.ToProjective(&s)
- s.Double(&r)
- r.ToExtended(h)
-
- for i := int32(0); i < 64; i += 2 {
- selectPoint(&t, i/2, int32(e[i]))
- geMixedAdd(&r, h, &t)
- r.ToExtended(h)
- }
-}
-
-// The scalars are GF(2^252 + 27742317777372353535851937790883648493).
-
-// Input:
-// a[0]+256*a[1]+...+256^31*a[31] = a
-// b[0]+256*b[1]+...+256^31*b[31] = b
-// c[0]+256*c[1]+...+256^31*c[31] = c
-//
-// Output:
-// s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l
-// where l = 2^252 + 27742317777372353535851937790883648493.
-func ScMulAdd(s, a, b, c *[32]byte) {
- a0 := 2097151 & load3(a[:])
- a1 := 2097151 & (load4(a[2:]) >> 5)
- a2 := 2097151 & (load3(a[5:]) >> 2)
- a3 := 2097151 & (load4(a[7:]) >> 7)
- a4 := 2097151 & (load4(a[10:]) >> 4)
- a5 := 2097151 & (load3(a[13:]) >> 1)
- a6 := 2097151 & (load4(a[15:]) >> 6)
- a7 := 2097151 & (load3(a[18:]) >> 3)
- a8 := 2097151 & load3(a[21:])
- a9 := 2097151 & (load4(a[23:]) >> 5)
- a10 := 2097151 & (load3(a[26:]) >> 2)
- a11 := (load4(a[28:]) >> 7)
- b0 := 2097151 & load3(b[:])
- b1 := 2097151 & (load4(b[2:]) >> 5)
- b2 := 2097151 & (load3(b[5:]) >> 2)
- b3 := 2097151 & (load4(b[7:]) >> 7)
- b4 := 2097151 & (load4(b[10:]) >> 4)
- b5 := 2097151 & (load3(b[13:]) >> 1)
- b6 := 2097151 & (load4(b[15:]) >> 6)
- b7 := 2097151 & (load3(b[18:]) >> 3)
- b8 := 2097151 & load3(b[21:])
- b9 := 2097151 & (load4(b[23:]) >> 5)
- b10 := 2097151 & (load3(b[26:]) >> 2)
- b11 := (load4(b[28:]) >> 7)
- c0 := 2097151 & load3(c[:])
- c1 := 2097151 & (load4(c[2:]) >> 5)
- c2 := 2097151 & (load3(c[5:]) >> 2)
- c3 := 2097151 & (load4(c[7:]) >> 7)
- c4 := 2097151 & (load4(c[10:]) >> 4)
- c5 := 2097151 & (load3(c[13:]) >> 1)
- c6 := 2097151 & (load4(c[15:]) >> 6)
- c7 := 2097151 & (load3(c[18:]) >> 3)
- c8 := 2097151 & load3(c[21:])
- c9 := 2097151 & (load4(c[23:]) >> 5)
- c10 := 2097151 & (load3(c[26:]) >> 2)
- c11 := (load4(c[28:]) >> 7)
- var carry [23]int64
-
- s0 := c0 + a0*b0
- s1 := c1 + a0*b1 + a1*b0
- s2 := c2 + a0*b2 + a1*b1 + a2*b0
- s3 := c3 + a0*b3 + a1*b2 + a2*b1 + a3*b0
- s4 := c4 + a0*b4 + a1*b3 + a2*b2 + a3*b1 + a4*b0
- s5 := c5 + a0*b5 + a1*b4 + a2*b3 + a3*b2 + a4*b1 + a5*b0
- s6 := c6 + a0*b6 + a1*b5 + a2*b4 + a3*b3 + a4*b2 + a5*b1 + a6*b0
- s7 := c7 + a0*b7 + a1*b6 + a2*b5 + a3*b4 + a4*b3 + a5*b2 + a6*b1 + a7*b0
- s8 := c8 + a0*b8 + a1*b7 + a2*b6 + a3*b5 + a4*b4 + a5*b3 + a6*b2 + a7*b1 + a8*b0
- s9 := c9 + a0*b9 + a1*b8 + a2*b7 + a3*b6 + a4*b5 + a5*b4 + a6*b3 + a7*b2 + a8*b1 + a9*b0
- s10 := c10 + a0*b10 + a1*b9 + a2*b8 + a3*b7 + a4*b6 + a5*b5 + a6*b4 + a7*b3 + a8*b2 + a9*b1 + a10*b0
- s11 := c11 + a0*b11 + a1*b10 + a2*b9 + a3*b8 + a4*b7 + a5*b6 + a6*b5 + a7*b4 + a8*b3 + a9*b2 + a10*b1 + a11*b0
- s12 := a1*b11 + a2*b10 + a3*b9 + a4*b8 + a5*b7 + a6*b6 + a7*b5 + a8*b4 + a9*b3 + a10*b2 + a11*b1
- s13 := a2*b11 + a3*b10 + a4*b9 + a5*b8 + a6*b7 + a7*b6 + a8*b5 + a9*b4 + a10*b3 + a11*b2
- s14 := a3*b11 + a4*b10 + a5*b9 + a6*b8 + a7*b7 + a8*b6 + a9*b5 + a10*b4 + a11*b3
- s15 := a4*b11 + a5*b10 + a6*b9 + a7*b8 + a8*b7 + a9*b6 + a10*b5 + a11*b4
- s16 := a5*b11 + a6*b10 + a7*b9 + a8*b8 + a9*b7 + a10*b6 + a11*b5
- s17 := a6*b11 + a7*b10 + a8*b9 + a9*b8 + a10*b7 + a11*b6
- s18 := a7*b11 + a8*b10 + a9*b9 + a10*b8 + a11*b7
- s19 := a8*b11 + a9*b10 + a10*b9 + a11*b8
- s20 := a9*b11 + a10*b10 + a11*b9
- s21 := a10*b11 + a11*b10
- s22 := a11 * b11
- s23 := int64(0)
-
- carry[0] = (s0 + (1 << 20)) >> 21
- s1 += carry[0]
- s0 -= carry[0] << 21
- carry[2] = (s2 + (1 << 20)) >> 21
- s3 += carry[2]
- s2 -= carry[2] << 21
- carry[4] = (s4 + (1 << 20)) >> 21
- s5 += carry[4]
- s4 -= carry[4] << 21
- carry[6] = (s6 + (1 << 20)) >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[8] = (s8 + (1 << 20)) >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[10] = (s10 + (1 << 20)) >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
- carry[12] = (s12 + (1 << 20)) >> 21
- s13 += carry[12]
- s12 -= carry[12] << 21
- carry[14] = (s14 + (1 << 20)) >> 21
- s15 += carry[14]
- s14 -= carry[14] << 21
- carry[16] = (s16 + (1 << 20)) >> 21
- s17 += carry[16]
- s16 -= carry[16] << 21
- carry[18] = (s18 + (1 << 20)) >> 21
- s19 += carry[18]
- s18 -= carry[18] << 21
- carry[20] = (s20 + (1 << 20)) >> 21
- s21 += carry[20]
- s20 -= carry[20] << 21
- carry[22] = (s22 + (1 << 20)) >> 21
- s23 += carry[22]
- s22 -= carry[22] << 21
-
- carry[1] = (s1 + (1 << 20)) >> 21
- s2 += carry[1]
- s1 -= carry[1] << 21
- carry[3] = (s3 + (1 << 20)) >> 21
- s4 += carry[3]
- s3 -= carry[3] << 21
- carry[5] = (s5 + (1 << 20)) >> 21
- s6 += carry[5]
- s5 -= carry[5] << 21
- carry[7] = (s7 + (1 << 20)) >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[9] = (s9 + (1 << 20)) >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[11] = (s11 + (1 << 20)) >> 21
- s12 += carry[11]
- s11 -= carry[11] << 21
- carry[13] = (s13 + (1 << 20)) >> 21
- s14 += carry[13]
- s13 -= carry[13] << 21
- carry[15] = (s15 + (1 << 20)) >> 21
- s16 += carry[15]
- s15 -= carry[15] << 21
- carry[17] = (s17 + (1 << 20)) >> 21
- s18 += carry[17]
- s17 -= carry[17] << 21
- carry[19] = (s19 + (1 << 20)) >> 21
- s20 += carry[19]
- s19 -= carry[19] << 21
- carry[21] = (s21 + (1 << 20)) >> 21
- s22 += carry[21]
- s21 -= carry[21] << 21
-
- s11 += s23 * 666643
- s12 += s23 * 470296
- s13 += s23 * 654183
- s14 -= s23 * 997805
- s15 += s23 * 136657
- s16 -= s23 * 683901
- s23 = 0
-
- s10 += s22 * 666643
- s11 += s22 * 470296
- s12 += s22 * 654183
- s13 -= s22 * 997805
- s14 += s22 * 136657
- s15 -= s22 * 683901
- s22 = 0
-
- s9 += s21 * 666643
- s10 += s21 * 470296
- s11 += s21 * 654183
- s12 -= s21 * 997805
- s13 += s21 * 136657
- s14 -= s21 * 683901
- s21 = 0
-
- s8 += s20 * 666643
- s9 += s20 * 470296
- s10 += s20 * 654183
- s11 -= s20 * 997805
- s12 += s20 * 136657
- s13 -= s20 * 683901
- s20 = 0
-
- s7 += s19 * 666643
- s8 += s19 * 470296
- s9 += s19 * 654183
- s10 -= s19 * 997805
- s11 += s19 * 136657
- s12 -= s19 * 683901
- s19 = 0
-
- s6 += s18 * 666643
- s7 += s18 * 470296
- s8 += s18 * 654183
- s9 -= s18 * 997805
- s10 += s18 * 136657
- s11 -= s18 * 683901
- s18 = 0
-
- carry[6] = (s6 + (1 << 20)) >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[8] = (s8 + (1 << 20)) >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[10] = (s10 + (1 << 20)) >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
- carry[12] = (s12 + (1 << 20)) >> 21
- s13 += carry[12]
- s12 -= carry[12] << 21
- carry[14] = (s14 + (1 << 20)) >> 21
- s15 += carry[14]
- s14 -= carry[14] << 21
- carry[16] = (s16 + (1 << 20)) >> 21
- s17 += carry[16]
- s16 -= carry[16] << 21
-
- carry[7] = (s7 + (1 << 20)) >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[9] = (s9 + (1 << 20)) >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[11] = (s11 + (1 << 20)) >> 21
- s12 += carry[11]
- s11 -= carry[11] << 21
- carry[13] = (s13 + (1 << 20)) >> 21
- s14 += carry[13]
- s13 -= carry[13] << 21
- carry[15] = (s15 + (1 << 20)) >> 21
- s16 += carry[15]
- s15 -= carry[15] << 21
-
- s5 += s17 * 666643
- s6 += s17 * 470296
- s7 += s17 * 654183
- s8 -= s17 * 997805
- s9 += s17 * 136657
- s10 -= s17 * 683901
- s17 = 0
-
- s4 += s16 * 666643
- s5 += s16 * 470296
- s6 += s16 * 654183
- s7 -= s16 * 997805
- s8 += s16 * 136657
- s9 -= s16 * 683901
- s16 = 0
-
- s3 += s15 * 666643
- s4 += s15 * 470296
- s5 += s15 * 654183
- s6 -= s15 * 997805
- s7 += s15 * 136657
- s8 -= s15 * 683901
- s15 = 0
-
- s2 += s14 * 666643
- s3 += s14 * 470296
- s4 += s14 * 654183
- s5 -= s14 * 997805
- s6 += s14 * 136657
- s7 -= s14 * 683901
- s14 = 0
-
- s1 += s13 * 666643
- s2 += s13 * 470296
- s3 += s13 * 654183
- s4 -= s13 * 997805
- s5 += s13 * 136657
- s6 -= s13 * 683901
- s13 = 0
-
- s0 += s12 * 666643
- s1 += s12 * 470296
- s2 += s12 * 654183
- s3 -= s12 * 997805
- s4 += s12 * 136657
- s5 -= s12 * 683901
- s12 = 0
-
- carry[0] = (s0 + (1 << 20)) >> 21
- s1 += carry[0]
- s0 -= carry[0] << 21
- carry[2] = (s2 + (1 << 20)) >> 21
- s3 += carry[2]
- s2 -= carry[2] << 21
- carry[4] = (s4 + (1 << 20)) >> 21
- s5 += carry[4]
- s4 -= carry[4] << 21
- carry[6] = (s6 + (1 << 20)) >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[8] = (s8 + (1 << 20)) >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[10] = (s10 + (1 << 20)) >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
-
- carry[1] = (s1 + (1 << 20)) >> 21
- s2 += carry[1]
- s1 -= carry[1] << 21
- carry[3] = (s3 + (1 << 20)) >> 21
- s4 += carry[3]
- s3 -= carry[3] << 21
- carry[5] = (s5 + (1 << 20)) >> 21
- s6 += carry[5]
- s5 -= carry[5] << 21
- carry[7] = (s7 + (1 << 20)) >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[9] = (s9 + (1 << 20)) >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[11] = (s11 + (1 << 20)) >> 21
- s12 += carry[11]
- s11 -= carry[11] << 21
-
- s0 += s12 * 666643
- s1 += s12 * 470296
- s2 += s12 * 654183
- s3 -= s12 * 997805
- s4 += s12 * 136657
- s5 -= s12 * 683901
- s12 = 0
-
- carry[0] = s0 >> 21
- s1 += carry[0]
- s0 -= carry[0] << 21
- carry[1] = s1 >> 21
- s2 += carry[1]
- s1 -= carry[1] << 21
- carry[2] = s2 >> 21
- s3 += carry[2]
- s2 -= carry[2] << 21
- carry[3] = s3 >> 21
- s4 += carry[3]
- s3 -= carry[3] << 21
- carry[4] = s4 >> 21
- s5 += carry[4]
- s4 -= carry[4] << 21
- carry[5] = s5 >> 21
- s6 += carry[5]
- s5 -= carry[5] << 21
- carry[6] = s6 >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[7] = s7 >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[8] = s8 >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[9] = s9 >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[10] = s10 >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
- carry[11] = s11 >> 21
- s12 += carry[11]
- s11 -= carry[11] << 21
-
- s0 += s12 * 666643
- s1 += s12 * 470296
- s2 += s12 * 654183
- s3 -= s12 * 997805
- s4 += s12 * 136657
- s5 -= s12 * 683901
- s12 = 0
-
- carry[0] = s0 >> 21
- s1 += carry[0]
- s0 -= carry[0] << 21
- carry[1] = s1 >> 21
- s2 += carry[1]
- s1 -= carry[1] << 21
- carry[2] = s2 >> 21
- s3 += carry[2]
- s2 -= carry[2] << 21
- carry[3] = s3 >> 21
- s4 += carry[3]
- s3 -= carry[3] << 21
- carry[4] = s4 >> 21
- s5 += carry[4]
- s4 -= carry[4] << 21
- carry[5] = s5 >> 21
- s6 += carry[5]
- s5 -= carry[5] << 21
- carry[6] = s6 >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[7] = s7 >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[8] = s8 >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[9] = s9 >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[10] = s10 >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
-
- s[0] = byte(s0 >> 0)
- s[1] = byte(s0 >> 8)
- s[2] = byte((s0 >> 16) | (s1 << 5))
- s[3] = byte(s1 >> 3)
- s[4] = byte(s1 >> 11)
- s[5] = byte((s1 >> 19) | (s2 << 2))
- s[6] = byte(s2 >> 6)
- s[7] = byte((s2 >> 14) | (s3 << 7))
- s[8] = byte(s3 >> 1)
- s[9] = byte(s3 >> 9)
- s[10] = byte((s3 >> 17) | (s4 << 4))
- s[11] = byte(s4 >> 4)
- s[12] = byte(s4 >> 12)
- s[13] = byte((s4 >> 20) | (s5 << 1))
- s[14] = byte(s5 >> 7)
- s[15] = byte((s5 >> 15) | (s6 << 6))
- s[16] = byte(s6 >> 2)
- s[17] = byte(s6 >> 10)
- s[18] = byte((s6 >> 18) | (s7 << 3))
- s[19] = byte(s7 >> 5)
- s[20] = byte(s7 >> 13)
- s[21] = byte(s8 >> 0)
- s[22] = byte(s8 >> 8)
- s[23] = byte((s8 >> 16) | (s9 << 5))
- s[24] = byte(s9 >> 3)
- s[25] = byte(s9 >> 11)
- s[26] = byte((s9 >> 19) | (s10 << 2))
- s[27] = byte(s10 >> 6)
- s[28] = byte((s10 >> 14) | (s11 << 7))
- s[29] = byte(s11 >> 1)
- s[30] = byte(s11 >> 9)
- s[31] = byte(s11 >> 17)
-}
-
-// Input:
-// s[0]+256*s[1]+...+256^63*s[63] = s
-//
-// Output:
-// s[0]+256*s[1]+...+256^31*s[31] = s mod l
-// where l = 2^252 + 27742317777372353535851937790883648493.
-func ScReduce(out *[32]byte, s *[64]byte) {
- s0 := 2097151 & load3(s[:])
- s1 := 2097151 & (load4(s[2:]) >> 5)
- s2 := 2097151 & (load3(s[5:]) >> 2)
- s3 := 2097151 & (load4(s[7:]) >> 7)
- s4 := 2097151 & (load4(s[10:]) >> 4)
- s5 := 2097151 & (load3(s[13:]) >> 1)
- s6 := 2097151 & (load4(s[15:]) >> 6)
- s7 := 2097151 & (load3(s[18:]) >> 3)
- s8 := 2097151 & load3(s[21:])
- s9 := 2097151 & (load4(s[23:]) >> 5)
- s10 := 2097151 & (load3(s[26:]) >> 2)
- s11 := 2097151 & (load4(s[28:]) >> 7)
- s12 := 2097151 & (load4(s[31:]) >> 4)
- s13 := 2097151 & (load3(s[34:]) >> 1)
- s14 := 2097151 & (load4(s[36:]) >> 6)
- s15 := 2097151 & (load3(s[39:]) >> 3)
- s16 := 2097151 & load3(s[42:])
- s17 := 2097151 & (load4(s[44:]) >> 5)
- s18 := 2097151 & (load3(s[47:]) >> 2)
- s19 := 2097151 & (load4(s[49:]) >> 7)
- s20 := 2097151 & (load4(s[52:]) >> 4)
- s21 := 2097151 & (load3(s[55:]) >> 1)
- s22 := 2097151 & (load4(s[57:]) >> 6)
- s23 := (load4(s[60:]) >> 3)
-
- s11 += s23 * 666643
- s12 += s23 * 470296
- s13 += s23 * 654183
- s14 -= s23 * 997805
- s15 += s23 * 136657
- s16 -= s23 * 683901
- s23 = 0
-
- s10 += s22 * 666643
- s11 += s22 * 470296
- s12 += s22 * 654183
- s13 -= s22 * 997805
- s14 += s22 * 136657
- s15 -= s22 * 683901
- s22 = 0
-
- s9 += s21 * 666643
- s10 += s21 * 470296
- s11 += s21 * 654183
- s12 -= s21 * 997805
- s13 += s21 * 136657
- s14 -= s21 * 683901
- s21 = 0
-
- s8 += s20 * 666643
- s9 += s20 * 470296
- s10 += s20 * 654183
- s11 -= s20 * 997805
- s12 += s20 * 136657
- s13 -= s20 * 683901
- s20 = 0
-
- s7 += s19 * 666643
- s8 += s19 * 470296
- s9 += s19 * 654183
- s10 -= s19 * 997805
- s11 += s19 * 136657
- s12 -= s19 * 683901
- s19 = 0
-
- s6 += s18 * 666643
- s7 += s18 * 470296
- s8 += s18 * 654183
- s9 -= s18 * 997805
- s10 += s18 * 136657
- s11 -= s18 * 683901
- s18 = 0
-
- var carry [17]int64
-
- carry[6] = (s6 + (1 << 20)) >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[8] = (s8 + (1 << 20)) >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[10] = (s10 + (1 << 20)) >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
- carry[12] = (s12 + (1 << 20)) >> 21
- s13 += carry[12]
- s12 -= carry[12] << 21
- carry[14] = (s14 + (1 << 20)) >> 21
- s15 += carry[14]
- s14 -= carry[14] << 21
- carry[16] = (s16 + (1 << 20)) >> 21
- s17 += carry[16]
- s16 -= carry[16] << 21
-
- carry[7] = (s7 + (1 << 20)) >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[9] = (s9 + (1 << 20)) >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[11] = (s11 + (1 << 20)) >> 21
- s12 += carry[11]
- s11 -= carry[11] << 21
- carry[13] = (s13 + (1 << 20)) >> 21
- s14 += carry[13]
- s13 -= carry[13] << 21
- carry[15] = (s15 + (1 << 20)) >> 21
- s16 += carry[15]
- s15 -= carry[15] << 21
-
- s5 += s17 * 666643
- s6 += s17 * 470296
- s7 += s17 * 654183
- s8 -= s17 * 997805
- s9 += s17 * 136657
- s10 -= s17 * 683901
- s17 = 0
-
- s4 += s16 * 666643
- s5 += s16 * 470296
- s6 += s16 * 654183
- s7 -= s16 * 997805
- s8 += s16 * 136657
- s9 -= s16 * 683901
- s16 = 0
-
- s3 += s15 * 666643
- s4 += s15 * 470296
- s5 += s15 * 654183
- s6 -= s15 * 997805
- s7 += s15 * 136657
- s8 -= s15 * 683901
- s15 = 0
-
- s2 += s14 * 666643
- s3 += s14 * 470296
- s4 += s14 * 654183
- s5 -= s14 * 997805
- s6 += s14 * 136657
- s7 -= s14 * 683901
- s14 = 0
-
- s1 += s13 * 666643
- s2 += s13 * 470296
- s3 += s13 * 654183
- s4 -= s13 * 997805
- s5 += s13 * 136657
- s6 -= s13 * 683901
- s13 = 0
-
- s0 += s12 * 666643
- s1 += s12 * 470296
- s2 += s12 * 654183
- s3 -= s12 * 997805
- s4 += s12 * 136657
- s5 -= s12 * 683901
- s12 = 0
-
- carry[0] = (s0 + (1 << 20)) >> 21
- s1 += carry[0]
- s0 -= carry[0] << 21
- carry[2] = (s2 + (1 << 20)) >> 21
- s3 += carry[2]
- s2 -= carry[2] << 21
- carry[4] = (s4 + (1 << 20)) >> 21
- s5 += carry[4]
- s4 -= carry[4] << 21
- carry[6] = (s6 + (1 << 20)) >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[8] = (s8 + (1 << 20)) >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[10] = (s10 + (1 << 20)) >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
-
- carry[1] = (s1 + (1 << 20)) >> 21
- s2 += carry[1]
- s1 -= carry[1] << 21
- carry[3] = (s3 + (1 << 20)) >> 21
- s4 += carry[3]
- s3 -= carry[3] << 21
- carry[5] = (s5 + (1 << 20)) >> 21
- s6 += carry[5]
- s5 -= carry[5] << 21
- carry[7] = (s7 + (1 << 20)) >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[9] = (s9 + (1 << 20)) >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[11] = (s11 + (1 << 20)) >> 21
- s12 += carry[11]
- s11 -= carry[11] << 21
-
- s0 += s12 * 666643
- s1 += s12 * 470296
- s2 += s12 * 654183
- s3 -= s12 * 997805
- s4 += s12 * 136657
- s5 -= s12 * 683901
- s12 = 0
-
- carry[0] = s0 >> 21
- s1 += carry[0]
- s0 -= carry[0] << 21
- carry[1] = s1 >> 21
- s2 += carry[1]
- s1 -= carry[1] << 21
- carry[2] = s2 >> 21
- s3 += carry[2]
- s2 -= carry[2] << 21
- carry[3] = s3 >> 21
- s4 += carry[3]
- s3 -= carry[3] << 21
- carry[4] = s4 >> 21
- s5 += carry[4]
- s4 -= carry[4] << 21
- carry[5] = s5 >> 21
- s6 += carry[5]
- s5 -= carry[5] << 21
- carry[6] = s6 >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[7] = s7 >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[8] = s8 >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[9] = s9 >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[10] = s10 >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
- carry[11] = s11 >> 21
- s12 += carry[11]
- s11 -= carry[11] << 21
-
- s0 += s12 * 666643
- s1 += s12 * 470296
- s2 += s12 * 654183
- s3 -= s12 * 997805
- s4 += s12 * 136657
- s5 -= s12 * 683901
- s12 = 0
-
- carry[0] = s0 >> 21
- s1 += carry[0]
- s0 -= carry[0] << 21
- carry[1] = s1 >> 21
- s2 += carry[1]
- s1 -= carry[1] << 21
- carry[2] = s2 >> 21
- s3 += carry[2]
- s2 -= carry[2] << 21
- carry[3] = s3 >> 21
- s4 += carry[3]
- s3 -= carry[3] << 21
- carry[4] = s4 >> 21
- s5 += carry[4]
- s4 -= carry[4] << 21
- carry[5] = s5 >> 21
- s6 += carry[5]
- s5 -= carry[5] << 21
- carry[6] = s6 >> 21
- s7 += carry[6]
- s6 -= carry[6] << 21
- carry[7] = s7 >> 21
- s8 += carry[7]
- s7 -= carry[7] << 21
- carry[8] = s8 >> 21
- s9 += carry[8]
- s8 -= carry[8] << 21
- carry[9] = s9 >> 21
- s10 += carry[9]
- s9 -= carry[9] << 21
- carry[10] = s10 >> 21
- s11 += carry[10]
- s10 -= carry[10] << 21
-
- out[0] = byte(s0 >> 0)
- out[1] = byte(s0 >> 8)
- out[2] = byte((s0 >> 16) | (s1 << 5))
- out[3] = byte(s1 >> 3)
- out[4] = byte(s1 >> 11)
- out[5] = byte((s1 >> 19) | (s2 << 2))
- out[6] = byte(s2 >> 6)
- out[7] = byte((s2 >> 14) | (s3 << 7))
- out[8] = byte(s3 >> 1)
- out[9] = byte(s3 >> 9)
- out[10] = byte((s3 >> 17) | (s4 << 4))
- out[11] = byte(s4 >> 4)
- out[12] = byte(s4 >> 12)
- out[13] = byte((s4 >> 20) | (s5 << 1))
- out[14] = byte(s5 >> 7)
- out[15] = byte((s5 >> 15) | (s6 << 6))
- out[16] = byte(s6 >> 2)
- out[17] = byte(s6 >> 10)
- out[18] = byte((s6 >> 18) | (s7 << 3))
- out[19] = byte(s7 >> 5)
- out[20] = byte(s7 >> 13)
- out[21] = byte(s8 >> 0)
- out[22] = byte(s8 >> 8)
- out[23] = byte((s8 >> 16) | (s9 << 5))
- out[24] = byte(s9 >> 3)
- out[25] = byte(s9 >> 11)
- out[26] = byte((s9 >> 19) | (s10 << 2))
- out[27] = byte(s10 >> 6)
- out[28] = byte((s10 >> 14) | (s11 << 7))
- out[29] = byte(s11 >> 1)
- out[30] = byte(s11 >> 9)
- out[31] = byte(s11 >> 17)
-}
-
-// order is the order of Curve25519 in little-endian form.
-var order = [4]uint64{0x5812631a5cf5d3ed, 0x14def9dea2f79cd6, 0, 0x1000000000000000}
-
-// ScMinimal returns true if the given scalar is less than the order of the
-// curve.
-func ScMinimal(scalar *[32]byte) bool {
- for i := 3; ; i-- {
- v := binary.LittleEndian.Uint64(scalar[i*8:])
- if v > order[i] {
- return false
- } else if v < order[i] {
- break
- } else if i == 0 {
- return false
- }
- }
-
- return true
-}
diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_generic.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_generic.go
deleted file mode 100644
index 6570847f..00000000
--- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_generic.go
+++ /dev/null
@@ -1,264 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package ChaCha20 implements the core ChaCha20 function as specified
-// in https://tools.ietf.org/html/rfc7539#section-2.3.
-package chacha20
-
-import (
- "crypto/cipher"
- "encoding/binary"
-
- "golang.org/x/crypto/internal/subtle"
-)
-
-// assert that *Cipher implements cipher.Stream
-var _ cipher.Stream = (*Cipher)(nil)
-
-// Cipher is a stateful instance of ChaCha20 using a particular key
-// and nonce. A *Cipher implements the cipher.Stream interface.
-type Cipher struct {
- key [8]uint32
- counter uint32 // incremented after each block
- nonce [3]uint32
- buf [bufSize]byte // buffer for unused keystream bytes
- len int // number of unused keystream bytes at end of buf
-}
-
-// New creates a new ChaCha20 stream cipher with the given key and nonce.
-// The initial counter value is set to 0.
-func New(key [8]uint32, nonce [3]uint32) *Cipher {
- return &Cipher{key: key, nonce: nonce}
-}
-
-// ChaCha20 constants spelling "expand 32-byte k"
-const (
- j0 uint32 = 0x61707865
- j1 uint32 = 0x3320646e
- j2 uint32 = 0x79622d32
- j3 uint32 = 0x6b206574
-)
-
-func quarterRound(a, b, c, d uint32) (uint32, uint32, uint32, uint32) {
- a += b
- d ^= a
- d = (d << 16) | (d >> 16)
- c += d
- b ^= c
- b = (b << 12) | (b >> 20)
- a += b
- d ^= a
- d = (d << 8) | (d >> 24)
- c += d
- b ^= c
- b = (b << 7) | (b >> 25)
- return a, b, c, d
-}
-
-// XORKeyStream XORs each byte in the given slice with a byte from the
-// cipher's key stream. Dst and src must overlap entirely or not at all.
-//
-// If len(dst) < len(src), XORKeyStream will panic. It is acceptable
-// to pass a dst bigger than src, and in that case, XORKeyStream will
-// only update dst[:len(src)] and will not touch the rest of dst.
-//
-// Multiple calls to XORKeyStream behave as if the concatenation of
-// the src buffers was passed in a single run. That is, Cipher
-// maintains state and does not reset at each XORKeyStream call.
-func (s *Cipher) XORKeyStream(dst, src []byte) {
- if len(dst) < len(src) {
- panic("chacha20: output smaller than input")
- }
- if subtle.InexactOverlap(dst[:len(src)], src) {
- panic("chacha20: invalid buffer overlap")
- }
-
- // xor src with buffered keystream first
- if s.len != 0 {
- buf := s.buf[len(s.buf)-s.len:]
- if len(src) < len(buf) {
- buf = buf[:len(src)]
- }
- td, ts := dst[:len(buf)], src[:len(buf)] // BCE hint
- for i, b := range buf {
- td[i] = ts[i] ^ b
- }
- s.len -= len(buf)
- if s.len != 0 {
- return
- }
- s.buf = [len(s.buf)]byte{} // zero the empty buffer
- src = src[len(buf):]
- dst = dst[len(buf):]
- }
-
- if len(src) == 0 {
- return
- }
- if haveAsm {
- if uint64(len(src))+uint64(s.counter)*64 > (1<<38)-64 {
- panic("chacha20: counter overflow")
- }
- s.xorKeyStreamAsm(dst, src)
- return
- }
-
- // set up a 64-byte buffer to pad out the final block if needed
- // (hoisted out of the main loop to avoid spills)
- rem := len(src) % 64 // length of final block
- fin := len(src) - rem // index of final block
- if rem > 0 {
- copy(s.buf[len(s.buf)-64:], src[fin:])
- }
-
- // pre-calculate most of the first round
- s1, s5, s9, s13 := quarterRound(j1, s.key[1], s.key[5], s.nonce[0])
- s2, s6, s10, s14 := quarterRound(j2, s.key[2], s.key[6], s.nonce[1])
- s3, s7, s11, s15 := quarterRound(j3, s.key[3], s.key[7], s.nonce[2])
-
- n := len(src)
- src, dst = src[:n:n], dst[:n:n] // BCE hint
- for i := 0; i < n; i += 64 {
- // calculate the remainder of the first round
- s0, s4, s8, s12 := quarterRound(j0, s.key[0], s.key[4], s.counter)
-
- // execute the second round
- x0, x5, x10, x15 := quarterRound(s0, s5, s10, s15)
- x1, x6, x11, x12 := quarterRound(s1, s6, s11, s12)
- x2, x7, x8, x13 := quarterRound(s2, s7, s8, s13)
- x3, x4, x9, x14 := quarterRound(s3, s4, s9, s14)
-
- // execute the remaining 18 rounds
- for i := 0; i < 9; i++ {
- x0, x4, x8, x12 = quarterRound(x0, x4, x8, x12)
- x1, x5, x9, x13 = quarterRound(x1, x5, x9, x13)
- x2, x6, x10, x14 = quarterRound(x2, x6, x10, x14)
- x3, x7, x11, x15 = quarterRound(x3, x7, x11, x15)
-
- x0, x5, x10, x15 = quarterRound(x0, x5, x10, x15)
- x1, x6, x11, x12 = quarterRound(x1, x6, x11, x12)
- x2, x7, x8, x13 = quarterRound(x2, x7, x8, x13)
- x3, x4, x9, x14 = quarterRound(x3, x4, x9, x14)
- }
-
- x0 += j0
- x1 += j1
- x2 += j2
- x3 += j3
-
- x4 += s.key[0]
- x5 += s.key[1]
- x6 += s.key[2]
- x7 += s.key[3]
- x8 += s.key[4]
- x9 += s.key[5]
- x10 += s.key[6]
- x11 += s.key[7]
-
- x12 += s.counter
- x13 += s.nonce[0]
- x14 += s.nonce[1]
- x15 += s.nonce[2]
-
- // increment the counter
- s.counter += 1
- if s.counter == 0 {
- panic("chacha20: counter overflow")
- }
-
- // pad to 64 bytes if needed
- in, out := src[i:], dst[i:]
- if i == fin {
- // src[fin:] has already been copied into s.buf before
- // the main loop
- in, out = s.buf[len(s.buf)-64:], s.buf[len(s.buf)-64:]
- }
- in, out = in[:64], out[:64] // BCE hint
-
- // XOR the key stream with the source and write out the result
- xor(out[0:], in[0:], x0)
- xor(out[4:], in[4:], x1)
- xor(out[8:], in[8:], x2)
- xor(out[12:], in[12:], x3)
- xor(out[16:], in[16:], x4)
- xor(out[20:], in[20:], x5)
- xor(out[24:], in[24:], x6)
- xor(out[28:], in[28:], x7)
- xor(out[32:], in[32:], x8)
- xor(out[36:], in[36:], x9)
- xor(out[40:], in[40:], x10)
- xor(out[44:], in[44:], x11)
- xor(out[48:], in[48:], x12)
- xor(out[52:], in[52:], x13)
- xor(out[56:], in[56:], x14)
- xor(out[60:], in[60:], x15)
- }
- // copy any trailing bytes out of the buffer and into dst
- if rem != 0 {
- s.len = 64 - rem
- copy(dst[fin:], s.buf[len(s.buf)-64:])
- }
-}
-
-// Advance discards bytes in the key stream until the next 64 byte block
-// boundary is reached and updates the counter accordingly. If the key
-// stream is already at a block boundary no bytes will be discarded and
-// the counter will be unchanged.
-func (s *Cipher) Advance() {
- s.len -= s.len % 64
- if s.len == 0 {
- s.buf = [len(s.buf)]byte{}
- }
-}
-
-// XORKeyStream crypts bytes from in to out using the given key and counters.
-// In and out must overlap entirely or not at all. Counter contains the raw
-// ChaCha20 counter bytes (i.e. block counter followed by nonce).
-func XORKeyStream(out, in []byte, counter *[16]byte, key *[32]byte) {
- s := Cipher{
- key: [8]uint32{
- binary.LittleEndian.Uint32(key[0:4]),
- binary.LittleEndian.Uint32(key[4:8]),
- binary.LittleEndian.Uint32(key[8:12]),
- binary.LittleEndian.Uint32(key[12:16]),
- binary.LittleEndian.Uint32(key[16:20]),
- binary.LittleEndian.Uint32(key[20:24]),
- binary.LittleEndian.Uint32(key[24:28]),
- binary.LittleEndian.Uint32(key[28:32]),
- },
- nonce: [3]uint32{
- binary.LittleEndian.Uint32(counter[4:8]),
- binary.LittleEndian.Uint32(counter[8:12]),
- binary.LittleEndian.Uint32(counter[12:16]),
- },
- counter: binary.LittleEndian.Uint32(counter[0:4]),
- }
- s.XORKeyStream(out, in)
-}
-
-// HChaCha20 uses the ChaCha20 core to generate a derived key from a key and a
-// nonce. It should only be used as part of the XChaCha20 construction.
-func HChaCha20(key *[8]uint32, nonce *[4]uint32) [8]uint32 {
- x0, x1, x2, x3 := j0, j1, j2, j3
- x4, x5, x6, x7 := key[0], key[1], key[2], key[3]
- x8, x9, x10, x11 := key[4], key[5], key[6], key[7]
- x12, x13, x14, x15 := nonce[0], nonce[1], nonce[2], nonce[3]
-
- for i := 0; i < 10; i++ {
- x0, x4, x8, x12 = quarterRound(x0, x4, x8, x12)
- x1, x5, x9, x13 = quarterRound(x1, x5, x9, x13)
- x2, x6, x10, x14 = quarterRound(x2, x6, x10, x14)
- x3, x7, x11, x15 = quarterRound(x3, x7, x11, x15)
-
- x0, x5, x10, x15 = quarterRound(x0, x5, x10, x15)
- x1, x6, x11, x12 = quarterRound(x1, x6, x11, x12)
- x2, x7, x8, x13 = quarterRound(x2, x7, x8, x13)
- x3, x4, x9, x14 = quarterRound(x3, x4, x9, x14)
- }
-
- var out [8]uint32
- out[0], out[1], out[2], out[3] = x0, x1, x2, x3
- out[4], out[5], out[6], out[7] = x12, x13, x14, x15
- return out
-}
diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go
deleted file mode 100644
index 91520d1d..00000000
--- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !s390x gccgo appengine
-
-package chacha20
-
-const (
- bufSize = 64
- haveAsm = false
-)
-
-func (*Cipher) xorKeyStreamAsm(dst, src []byte) {
- panic("not implemented")
-}
diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go
deleted file mode 100644
index 0c1c671c..00000000
--- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build s390x,!gccgo,!appengine
-
-package chacha20
-
-var haveAsm = hasVectorFacility()
-
-const bufSize = 256
-
-// hasVectorFacility reports whether the machine supports the vector
-// facility (vx).
-// Implementation in asm_s390x.s.
-func hasVectorFacility() bool
-
-// xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only
-// be called when the vector facility is available.
-// Implementation in asm_s390x.s.
-//go:noescape
-func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32, buf *[256]byte, len *int)
-
-func (c *Cipher) xorKeyStreamAsm(dst, src []byte) {
- xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter, &c.buf, &c.len)
-}
-
-// EXRL targets, DO NOT CALL!
-func mvcSrcToBuf()
-func mvcBufToDst()
diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s b/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s
deleted file mode 100644
index 98427c5e..00000000
--- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build s390x,!gccgo,!appengine
-
-#include "go_asm.h"
-#include "textflag.h"
-
-// This is an implementation of the ChaCha20 encryption algorithm as
-// specified in RFC 7539. It uses vector instructions to compute
-// 4 keystream blocks in parallel (256 bytes) which are then XORed
-// with the bytes in the input slice.
-
-GLOBL ·constants<>(SB), RODATA|NOPTR, $32
-// BSWAP: swap bytes in each 4-byte element
-DATA ·constants<>+0x00(SB)/4, $0x03020100
-DATA ·constants<>+0x04(SB)/4, $0x07060504
-DATA ·constants<>+0x08(SB)/4, $0x0b0a0908
-DATA ·constants<>+0x0c(SB)/4, $0x0f0e0d0c
-// J0: [j0, j1, j2, j3]
-DATA ·constants<>+0x10(SB)/4, $0x61707865
-DATA ·constants<>+0x14(SB)/4, $0x3320646e
-DATA ·constants<>+0x18(SB)/4, $0x79622d32
-DATA ·constants<>+0x1c(SB)/4, $0x6b206574
-
-// EXRL targets:
-TEXT ·mvcSrcToBuf(SB), NOFRAME|NOSPLIT, $0
- MVC $1, (R1), (R8)
- RET
-
-TEXT ·mvcBufToDst(SB), NOFRAME|NOSPLIT, $0
- MVC $1, (R8), (R9)
- RET
-
-#define BSWAP V5
-#define J0 V6
-#define KEY0 V7
-#define KEY1 V8
-#define NONCE V9
-#define CTR V10
-#define M0 V11
-#define M1 V12
-#define M2 V13
-#define M3 V14
-#define INC V15
-#define X0 V16
-#define X1 V17
-#define X2 V18
-#define X3 V19
-#define X4 V20
-#define X5 V21
-#define X6 V22
-#define X7 V23
-#define X8 V24
-#define X9 V25
-#define X10 V26
-#define X11 V27
-#define X12 V28
-#define X13 V29
-#define X14 V30
-#define X15 V31
-
-#define NUM_ROUNDS 20
-
-#define ROUND4(a0, a1, a2, a3, b0, b1, b2, b3, c0, c1, c2, c3, d0, d1, d2, d3) \
- VAF a1, a0, a0 \
- VAF b1, b0, b0 \
- VAF c1, c0, c0 \
- VAF d1, d0, d0 \
- VX a0, a2, a2 \
- VX b0, b2, b2 \
- VX c0, c2, c2 \
- VX d0, d2, d2 \
- VERLLF $16, a2, a2 \
- VERLLF $16, b2, b2 \
- VERLLF $16, c2, c2 \
- VERLLF $16, d2, d2 \
- VAF a2, a3, a3 \
- VAF b2, b3, b3 \
- VAF c2, c3, c3 \
- VAF d2, d3, d3 \
- VX a3, a1, a1 \
- VX b3, b1, b1 \
- VX c3, c1, c1 \
- VX d3, d1, d1 \
- VERLLF $12, a1, a1 \
- VERLLF $12, b1, b1 \
- VERLLF $12, c1, c1 \
- VERLLF $12, d1, d1 \
- VAF a1, a0, a0 \
- VAF b1, b0, b0 \
- VAF c1, c0, c0 \
- VAF d1, d0, d0 \
- VX a0, a2, a2 \
- VX b0, b2, b2 \
- VX c0, c2, c2 \
- VX d0, d2, d2 \
- VERLLF $8, a2, a2 \
- VERLLF $8, b2, b2 \
- VERLLF $8, c2, c2 \
- VERLLF $8, d2, d2 \
- VAF a2, a3, a3 \
- VAF b2, b3, b3 \
- VAF c2, c3, c3 \
- VAF d2, d3, d3 \
- VX a3, a1, a1 \
- VX b3, b1, b1 \
- VX c3, c1, c1 \
- VX d3, d1, d1 \
- VERLLF $7, a1, a1 \
- VERLLF $7, b1, b1 \
- VERLLF $7, c1, c1 \
- VERLLF $7, d1, d1
-
-#define PERMUTE(mask, v0, v1, v2, v3) \
- VPERM v0, v0, mask, v0 \
- VPERM v1, v1, mask, v1 \
- VPERM v2, v2, mask, v2 \
- VPERM v3, v3, mask, v3
-
-#define ADDV(x, v0, v1, v2, v3) \
- VAF x, v0, v0 \
- VAF x, v1, v1 \
- VAF x, v2, v2 \
- VAF x, v3, v3
-
-#define XORV(off, dst, src, v0, v1, v2, v3) \
- VLM off(src), M0, M3 \
- PERMUTE(BSWAP, v0, v1, v2, v3) \
- VX v0, M0, M0 \
- VX v1, M1, M1 \
- VX v2, M2, M2 \
- VX v3, M3, M3 \
- VSTM M0, M3, off(dst)
-
-#define SHUFFLE(a, b, c, d, t, u, v, w) \
- VMRHF a, c, t \ // t = {a[0], c[0], a[1], c[1]}
- VMRHF b, d, u \ // u = {b[0], d[0], b[1], d[1]}
- VMRLF a, c, v \ // v = {a[2], c[2], a[3], c[3]}
- VMRLF b, d, w \ // w = {b[2], d[2], b[3], d[3]}
- VMRHF t, u, a \ // a = {a[0], b[0], c[0], d[0]}
- VMRLF t, u, b \ // b = {a[1], b[1], c[1], d[1]}
- VMRHF v, w, c \ // c = {a[2], b[2], c[2], d[2]}
- VMRLF v, w, d // d = {a[3], b[3], c[3], d[3]}
-
-// func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32, buf *[256]byte, len *int)
-TEXT ·xorKeyStreamVX(SB), NOSPLIT, $0
- MOVD $·constants<>(SB), R1
- MOVD dst+0(FP), R2 // R2=&dst[0]
- LMG src+24(FP), R3, R4 // R3=&src[0] R4=len(src)
- MOVD key+48(FP), R5 // R5=key
- MOVD nonce+56(FP), R6 // R6=nonce
- MOVD counter+64(FP), R7 // R7=counter
- MOVD buf+72(FP), R8 // R8=buf
- MOVD len+80(FP), R9 // R9=len
-
- // load BSWAP and J0
- VLM (R1), BSWAP, J0
-
- // set up tail buffer
- ADD $-1, R4, R12
- MOVBZ R12, R12
- CMPUBEQ R12, $255, aligned
- MOVD R4, R1
- AND $~255, R1
- MOVD $(R3)(R1*1), R1
- EXRL $·mvcSrcToBuf(SB), R12
- MOVD $255, R0
- SUB R12, R0
- MOVD R0, (R9) // update len
-
-aligned:
- // setup
- MOVD $95, R0
- VLM (R5), KEY0, KEY1
- VLL R0, (R6), NONCE
- VZERO M0
- VLEIB $7, $32, M0
- VSRLB M0, NONCE, NONCE
-
- // initialize counter values
- VLREPF (R7), CTR
- VZERO INC
- VLEIF $1, $1, INC
- VLEIF $2, $2, INC
- VLEIF $3, $3, INC
- VAF INC, CTR, CTR
- VREPIF $4, INC
-
-chacha:
- VREPF $0, J0, X0
- VREPF $1, J0, X1
- VREPF $2, J0, X2
- VREPF $3, J0, X3
- VREPF $0, KEY0, X4
- VREPF $1, KEY0, X5
- VREPF $2, KEY0, X6
- VREPF $3, KEY0, X7
- VREPF $0, KEY1, X8
- VREPF $1, KEY1, X9
- VREPF $2, KEY1, X10
- VREPF $3, KEY1, X11
- VLR CTR, X12
- VREPF $1, NONCE, X13
- VREPF $2, NONCE, X14
- VREPF $3, NONCE, X15
-
- MOVD $(NUM_ROUNDS/2), R1
-
-loop:
- ROUND4(X0, X4, X12, X8, X1, X5, X13, X9, X2, X6, X14, X10, X3, X7, X15, X11)
- ROUND4(X0, X5, X15, X10, X1, X6, X12, X11, X2, X7, X13, X8, X3, X4, X14, X9)
-
- ADD $-1, R1
- BNE loop
-
- // decrement length
- ADD $-256, R4
- BLT tail
-
-continue:
- // rearrange vectors
- SHUFFLE(X0, X1, X2, X3, M0, M1, M2, M3)
- ADDV(J0, X0, X1, X2, X3)
- SHUFFLE(X4, X5, X6, X7, M0, M1, M2, M3)
- ADDV(KEY0, X4, X5, X6, X7)
- SHUFFLE(X8, X9, X10, X11, M0, M1, M2, M3)
- ADDV(KEY1, X8, X9, X10, X11)
- VAF CTR, X12, X12
- SHUFFLE(X12, X13, X14, X15, M0, M1, M2, M3)
- ADDV(NONCE, X12, X13, X14, X15)
-
- // increment counters
- VAF INC, CTR, CTR
-
- // xor keystream with plaintext
- XORV(0*64, R2, R3, X0, X4, X8, X12)
- XORV(1*64, R2, R3, X1, X5, X9, X13)
- XORV(2*64, R2, R3, X2, X6, X10, X14)
- XORV(3*64, R2, R3, X3, X7, X11, X15)
-
- // increment pointers
- MOVD $256(R2), R2
- MOVD $256(R3), R3
-
- CMPBNE R4, $0, chacha
- CMPUBEQ R12, $255, return
- EXRL $·mvcBufToDst(SB), R12 // len was updated during setup
-
-return:
- VSTEF $0, CTR, (R7)
- RET
-
-tail:
- MOVD R2, R9
- MOVD R8, R2
- MOVD R8, R3
- MOVD $0, R4
- JMP continue
-
-// func hasVectorFacility() bool
-TEXT ·hasVectorFacility(SB), NOSPLIT, $24-1
- MOVD $x-24(SP), R1
- XC $24, 0(R1), 0(R1) // clear the storage
- MOVD $2, R0 // R0 is the number of double words stored -1
- WORD $0xB2B01000 // STFLE 0(R1)
- XOR R0, R0 // reset the value of R0
- MOVBZ z-8(SP), R1
- AND $0x40, R1
- BEQ novector
-
-vectorinstalled:
- // check if the vector instruction has been enabled
- VLEIB $0, $0xF, V16
- VLGVB $0, V16, R1
- CMPBNE R1, $0xF, novector
- MOVB $1, ret+0(FP) // have vx
- RET
-
-novector:
- MOVB $0, ret+0(FP) // no vx
- RET
diff --git a/vendor/golang.org/x/crypto/internal/chacha20/xor.go b/vendor/golang.org/x/crypto/internal/chacha20/xor.go
deleted file mode 100644
index 9c5ba0b3..00000000
--- a/vendor/golang.org/x/crypto/internal/chacha20/xor.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found src the LICENSE file.
-
-package chacha20
-
-import (
- "runtime"
-)
-
-// Platforms that have fast unaligned 32-bit little endian accesses.
-const unaligned = runtime.GOARCH == "386" ||
- runtime.GOARCH == "amd64" ||
- runtime.GOARCH == "arm64" ||
- runtime.GOARCH == "ppc64le" ||
- runtime.GOARCH == "s390x"
-
-// xor reads a little endian uint32 from src, XORs it with u and
-// places the result in little endian byte order in dst.
-func xor(dst, src []byte, u uint32) {
- _, _ = src[3], dst[3] // eliminate bounds checks
- if unaligned {
- // The compiler should optimize this code into
- // 32-bit unaligned little endian loads and stores.
- // TODO: delete once the compiler does a reliably
- // good job with the generic code below.
- // See issue #25111 for more details.
- v := uint32(src[0])
- v |= uint32(src[1]) << 8
- v |= uint32(src[2]) << 16
- v |= uint32(src[3]) << 24
- v ^= u
- dst[0] = byte(v)
- dst[1] = byte(v >> 8)
- dst[2] = byte(v >> 16)
- dst[3] = byte(v >> 24)
- } else {
- dst[0] = src[0] ^ byte(u)
- dst[1] = src[1] ^ byte(u>>8)
- dst[2] = src[2] ^ byte(u>>16)
- dst[3] = src[3] ^ byte(u>>24)
- }
-}
diff --git a/vendor/golang.org/x/crypto/internal/subtle/aliasing.go b/vendor/golang.org/x/crypto/internal/subtle/aliasing.go
deleted file mode 100644
index f38797bf..00000000
--- a/vendor/golang.org/x/crypto/internal/subtle/aliasing.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !appengine
-
-// Package subtle implements functions that are often useful in cryptographic
-// code but require careful thought to use correctly.
-package subtle // import "golang.org/x/crypto/internal/subtle"
-
-import "unsafe"
-
-// AnyOverlap reports whether x and y share memory at any (not necessarily
-// corresponding) index. The memory beyond the slice length is ignored.
-func AnyOverlap(x, y []byte) bool {
- return len(x) > 0 && len(y) > 0 &&
- uintptr(unsafe.Pointer(&x[0])) <= uintptr(unsafe.Pointer(&y[len(y)-1])) &&
- uintptr(unsafe.Pointer(&y[0])) <= uintptr(unsafe.Pointer(&x[len(x)-1]))
-}
-
-// InexactOverlap reports whether x and y share memory at any non-corresponding
-// index. The memory beyond the slice length is ignored. Note that x and y can
-// have different lengths and still not have any inexact overlap.
-//
-// InexactOverlap can be used to implement the requirements of the crypto/cipher
-// AEAD, Block, BlockMode and Stream interfaces.
-func InexactOverlap(x, y []byte) bool {
- if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
- return false
- }
- return AnyOverlap(x, y)
-}
diff --git a/vendor/golang.org/x/crypto/internal/subtle/aliasing_appengine.go b/vendor/golang.org/x/crypto/internal/subtle/aliasing_appengine.go
deleted file mode 100644
index 0cc4a8a6..00000000
--- a/vendor/golang.org/x/crypto/internal/subtle/aliasing_appengine.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build appengine
-
-// Package subtle implements functions that are often useful in cryptographic
-// code but require careful thought to use correctly.
-package subtle // import "golang.org/x/crypto/internal/subtle"
-
-// This is the Google App Engine standard variant based on reflect
-// because the unsafe package and cgo are disallowed.
-
-import "reflect"
-
-// AnyOverlap reports whether x and y share memory at any (not necessarily
-// corresponding) index. The memory beyond the slice length is ignored.
-func AnyOverlap(x, y []byte) bool {
- return len(x) > 0 && len(y) > 0 &&
- reflect.ValueOf(&x[0]).Pointer() <= reflect.ValueOf(&y[len(y)-1]).Pointer() &&
- reflect.ValueOf(&y[0]).Pointer() <= reflect.ValueOf(&x[len(x)-1]).Pointer()
-}
-
-// InexactOverlap reports whether x and y share memory at any non-corresponding
-// index. The memory beyond the slice length is ignored. Note that x and y can
-// have different lengths and still not have any inexact overlap.
-//
-// InexactOverlap can be used to implement the requirements of the crypto/cipher
-// AEAD, Block, BlockMode and Stream interfaces.
-func InexactOverlap(x, y []byte) bool {
- if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
- return false
- }
- return AnyOverlap(x, y)
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/armor/armor.go b/vendor/golang.org/x/crypto/openpgp/armor/armor.go
deleted file mode 100644
index 592d1864..00000000
--- a/vendor/golang.org/x/crypto/openpgp/armor/armor.go
+++ /dev/null
@@ -1,219 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package armor implements OpenPGP ASCII Armor, see RFC 4880. OpenPGP Armor is
-// very similar to PEM except that it has an additional CRC checksum.
-package armor // import "golang.org/x/crypto/openpgp/armor"
-
-import (
- "bufio"
- "bytes"
- "encoding/base64"
- "golang.org/x/crypto/openpgp/errors"
- "io"
-)
-
-// A Block represents an OpenPGP armored structure.
-//
-// The encoded form is:
-// -----BEGIN Type-----
-// Headers
-//
-// base64-encoded Bytes
-// '=' base64 encoded checksum
-// -----END Type-----
-// where Headers is a possibly empty sequence of Key: Value lines.
-//
-// Since the armored data can be very large, this package presents a streaming
-// interface.
-type Block struct {
- Type string // The type, taken from the preamble (i.e. "PGP SIGNATURE").
- Header map[string]string // Optional headers.
- Body io.Reader // A Reader from which the contents can be read
- lReader lineReader
- oReader openpgpReader
-}
-
-var ArmorCorrupt error = errors.StructuralError("armor invalid")
-
-const crc24Init = 0xb704ce
-const crc24Poly = 0x1864cfb
-const crc24Mask = 0xffffff
-
-// crc24 calculates the OpenPGP checksum as specified in RFC 4880, section 6.1
-func crc24(crc uint32, d []byte) uint32 {
- for _, b := range d {
- crc ^= uint32(b) << 16
- for i := 0; i < 8; i++ {
- crc <<= 1
- if crc&0x1000000 != 0 {
- crc ^= crc24Poly
- }
- }
- }
- return crc
-}
-
-var armorStart = []byte("-----BEGIN ")
-var armorEnd = []byte("-----END ")
-var armorEndOfLine = []byte("-----")
-
-// lineReader wraps a line based reader. It watches for the end of an armor
-// block and records the expected CRC value.
-type lineReader struct {
- in *bufio.Reader
- buf []byte
- eof bool
- crc uint32
-}
-
-func (l *lineReader) Read(p []byte) (n int, err error) {
- if l.eof {
- return 0, io.EOF
- }
-
- if len(l.buf) > 0 {
- n = copy(p, l.buf)
- l.buf = l.buf[n:]
- return
- }
-
- line, isPrefix, err := l.in.ReadLine()
- if err != nil {
- return
- }
- if isPrefix {
- return 0, ArmorCorrupt
- }
-
- if len(line) == 5 && line[0] == '=' {
- // This is the checksum line
- var expectedBytes [3]byte
- var m int
- m, err = base64.StdEncoding.Decode(expectedBytes[0:], line[1:])
- if m != 3 || err != nil {
- return
- }
- l.crc = uint32(expectedBytes[0])<<16 |
- uint32(expectedBytes[1])<<8 |
- uint32(expectedBytes[2])
-
- line, _, err = l.in.ReadLine()
- if err != nil && err != io.EOF {
- return
- }
- if !bytes.HasPrefix(line, armorEnd) {
- return 0, ArmorCorrupt
- }
-
- l.eof = true
- return 0, io.EOF
- }
-
- if len(line) > 96 {
- return 0, ArmorCorrupt
- }
-
- n = copy(p, line)
- bytesToSave := len(line) - n
- if bytesToSave > 0 {
- if cap(l.buf) < bytesToSave {
- l.buf = make([]byte, 0, bytesToSave)
- }
- l.buf = l.buf[0:bytesToSave]
- copy(l.buf, line[n:])
- }
-
- return
-}
-
-// openpgpReader passes Read calls to the underlying base64 decoder, but keeps
-// a running CRC of the resulting data and checks the CRC against the value
-// found by the lineReader at EOF.
-type openpgpReader struct {
- lReader *lineReader
- b64Reader io.Reader
- currentCRC uint32
-}
-
-func (r *openpgpReader) Read(p []byte) (n int, err error) {
- n, err = r.b64Reader.Read(p)
- r.currentCRC = crc24(r.currentCRC, p[:n])
-
- if err == io.EOF {
- if r.lReader.crc != uint32(r.currentCRC&crc24Mask) {
- return 0, ArmorCorrupt
- }
- }
-
- return
-}
-
-// Decode reads a PGP armored block from the given Reader. It will ignore
-// leading garbage. If it doesn't find a block, it will return nil, io.EOF. The
-// given Reader is not usable after calling this function: an arbitrary amount
-// of data may have been read past the end of the block.
-func Decode(in io.Reader) (p *Block, err error) {
- r := bufio.NewReaderSize(in, 100)
- var line []byte
- ignoreNext := false
-
-TryNextBlock:
- p = nil
-
- // Skip leading garbage
- for {
- ignoreThis := ignoreNext
- line, ignoreNext, err = r.ReadLine()
- if err != nil {
- return
- }
- if ignoreNext || ignoreThis {
- continue
- }
- line = bytes.TrimSpace(line)
- if len(line) > len(armorStart)+len(armorEndOfLine) && bytes.HasPrefix(line, armorStart) {
- break
- }
- }
-
- p = new(Block)
- p.Type = string(line[len(armorStart) : len(line)-len(armorEndOfLine)])
- p.Header = make(map[string]string)
- nextIsContinuation := false
- var lastKey string
-
- // Read headers
- for {
- isContinuation := nextIsContinuation
- line, nextIsContinuation, err = r.ReadLine()
- if err != nil {
- p = nil
- return
- }
- if isContinuation {
- p.Header[lastKey] += string(line)
- continue
- }
- line = bytes.TrimSpace(line)
- if len(line) == 0 {
- break
- }
-
- i := bytes.Index(line, []byte(": "))
- if i == -1 {
- goto TryNextBlock
- }
- lastKey = string(line[:i])
- p.Header[lastKey] = string(line[i+2:])
- }
-
- p.lReader.in = r
- p.oReader.currentCRC = crc24Init
- p.oReader.lReader = &p.lReader
- p.oReader.b64Reader = base64.NewDecoder(base64.StdEncoding, &p.lReader)
- p.Body = &p.oReader
-
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/armor/encode.go b/vendor/golang.org/x/crypto/openpgp/armor/encode.go
deleted file mode 100644
index 6f07582c..00000000
--- a/vendor/golang.org/x/crypto/openpgp/armor/encode.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package armor
-
-import (
- "encoding/base64"
- "io"
-)
-
-var armorHeaderSep = []byte(": ")
-var blockEnd = []byte("\n=")
-var newline = []byte("\n")
-var armorEndOfLineOut = []byte("-----\n")
-
-// writeSlices writes its arguments to the given Writer.
-func writeSlices(out io.Writer, slices ...[]byte) (err error) {
- for _, s := range slices {
- _, err = out.Write(s)
- if err != nil {
- return err
- }
- }
- return
-}
-
-// lineBreaker breaks data across several lines, all of the same byte length
-// (except possibly the last). Lines are broken with a single '\n'.
-type lineBreaker struct {
- lineLength int
- line []byte
- used int
- out io.Writer
- haveWritten bool
-}
-
-func newLineBreaker(out io.Writer, lineLength int) *lineBreaker {
- return &lineBreaker{
- lineLength: lineLength,
- line: make([]byte, lineLength),
- used: 0,
- out: out,
- }
-}
-
-func (l *lineBreaker) Write(b []byte) (n int, err error) {
- n = len(b)
-
- if n == 0 {
- return
- }
-
- if l.used == 0 && l.haveWritten {
- _, err = l.out.Write([]byte{'\n'})
- if err != nil {
- return
- }
- }
-
- if l.used+len(b) < l.lineLength {
- l.used += copy(l.line[l.used:], b)
- return
- }
-
- l.haveWritten = true
- _, err = l.out.Write(l.line[0:l.used])
- if err != nil {
- return
- }
- excess := l.lineLength - l.used
- l.used = 0
-
- _, err = l.out.Write(b[0:excess])
- if err != nil {
- return
- }
-
- _, err = l.Write(b[excess:])
- return
-}
-
-func (l *lineBreaker) Close() (err error) {
- if l.used > 0 {
- _, err = l.out.Write(l.line[0:l.used])
- if err != nil {
- return
- }
- }
-
- return
-}
-
-// encoding keeps track of a running CRC24 over the data which has been written
-// to it and outputs a OpenPGP checksum when closed, followed by an armor
-// trailer.
-//
-// It's built into a stack of io.Writers:
-// encoding -> base64 encoder -> lineBreaker -> out
-type encoding struct {
- out io.Writer
- breaker *lineBreaker
- b64 io.WriteCloser
- crc uint32
- blockType []byte
-}
-
-func (e *encoding) Write(data []byte) (n int, err error) {
- e.crc = crc24(e.crc, data)
- return e.b64.Write(data)
-}
-
-func (e *encoding) Close() (err error) {
- err = e.b64.Close()
- if err != nil {
- return
- }
- e.breaker.Close()
-
- var checksumBytes [3]byte
- checksumBytes[0] = byte(e.crc >> 16)
- checksumBytes[1] = byte(e.crc >> 8)
- checksumBytes[2] = byte(e.crc)
-
- var b64ChecksumBytes [4]byte
- base64.StdEncoding.Encode(b64ChecksumBytes[:], checksumBytes[:])
-
- return writeSlices(e.out, blockEnd, b64ChecksumBytes[:], newline, armorEnd, e.blockType, armorEndOfLine)
-}
-
-// Encode returns a WriteCloser which will encode the data written to it in
-// OpenPGP armor.
-func Encode(out io.Writer, blockType string, headers map[string]string) (w io.WriteCloser, err error) {
- bType := []byte(blockType)
- err = writeSlices(out, armorStart, bType, armorEndOfLineOut)
- if err != nil {
- return
- }
-
- for k, v := range headers {
- err = writeSlices(out, []byte(k), armorHeaderSep, []byte(v), newline)
- if err != nil {
- return
- }
- }
-
- _, err = out.Write(newline)
- if err != nil {
- return
- }
-
- e := &encoding{
- out: out,
- breaker: newLineBreaker(out, 64),
- crc: crc24Init,
- blockType: bType,
- }
- e.b64 = base64.NewEncoder(base64.StdEncoding, e.breaker)
- return e, nil
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/canonical_text.go b/vendor/golang.org/x/crypto/openpgp/canonical_text.go
deleted file mode 100644
index e601e389..00000000
--- a/vendor/golang.org/x/crypto/openpgp/canonical_text.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package openpgp
-
-import "hash"
-
-// NewCanonicalTextHash reformats text written to it into the canonical
-// form and then applies the hash h. See RFC 4880, section 5.2.1.
-func NewCanonicalTextHash(h hash.Hash) hash.Hash {
- return &canonicalTextHash{h, 0}
-}
-
-type canonicalTextHash struct {
- h hash.Hash
- s int
-}
-
-var newline = []byte{'\r', '\n'}
-
-func (cth *canonicalTextHash) Write(buf []byte) (int, error) {
- start := 0
-
- for i, c := range buf {
- switch cth.s {
- case 0:
- if c == '\r' {
- cth.s = 1
- } else if c == '\n' {
- cth.h.Write(buf[start:i])
- cth.h.Write(newline)
- start = i + 1
- }
- case 1:
- cth.s = 0
- }
- }
-
- cth.h.Write(buf[start:])
- return len(buf), nil
-}
-
-func (cth *canonicalTextHash) Sum(in []byte) []byte {
- return cth.h.Sum(in)
-}
-
-func (cth *canonicalTextHash) Reset() {
- cth.h.Reset()
- cth.s = 0
-}
-
-func (cth *canonicalTextHash) Size() int {
- return cth.h.Size()
-}
-
-func (cth *canonicalTextHash) BlockSize() int {
- return cth.h.BlockSize()
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go b/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go
deleted file mode 100644
index 73f4fe37..00000000
--- a/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package elgamal implements ElGamal encryption, suitable for OpenPGP,
-// as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on
-// Discrete Logarithms," IEEE Transactions on Information Theory, v. IT-31,
-// n. 4, 1985, pp. 469-472.
-//
-// This form of ElGamal embeds PKCS#1 v1.5 padding, which may make it
-// unsuitable for other protocols. RSA should be used in preference in any
-// case.
-package elgamal // import "golang.org/x/crypto/openpgp/elgamal"
-
-import (
- "crypto/rand"
- "crypto/subtle"
- "errors"
- "io"
- "math/big"
-)
-
-// PublicKey represents an ElGamal public key.
-type PublicKey struct {
- G, P, Y *big.Int
-}
-
-// PrivateKey represents an ElGamal private key.
-type PrivateKey struct {
- PublicKey
- X *big.Int
-}
-
-// Encrypt encrypts the given message to the given public key. The result is a
-// pair of integers. Errors can result from reading random, or because msg is
-// too large to be encrypted to the public key.
-func Encrypt(random io.Reader, pub *PublicKey, msg []byte) (c1, c2 *big.Int, err error) {
- pLen := (pub.P.BitLen() + 7) / 8
- if len(msg) > pLen-11 {
- err = errors.New("elgamal: message too long")
- return
- }
-
- // EM = 0x02 || PS || 0x00 || M
- em := make([]byte, pLen-1)
- em[0] = 2
- ps, mm := em[1:len(em)-len(msg)-1], em[len(em)-len(msg):]
- err = nonZeroRandomBytes(ps, random)
- if err != nil {
- return
- }
- em[len(em)-len(msg)-1] = 0
- copy(mm, msg)
-
- m := new(big.Int).SetBytes(em)
-
- k, err := rand.Int(random, pub.P)
- if err != nil {
- return
- }
-
- c1 = new(big.Int).Exp(pub.G, k, pub.P)
- s := new(big.Int).Exp(pub.Y, k, pub.P)
- c2 = s.Mul(s, m)
- c2.Mod(c2, pub.P)
-
- return
-}
-
-// Decrypt takes two integers, resulting from an ElGamal encryption, and
-// returns the plaintext of the message. An error can result only if the
-// ciphertext is invalid. Users should keep in mind that this is a padding
-// oracle and thus, if exposed to an adaptive chosen ciphertext attack, can
-// be used to break the cryptosystem. See ``Chosen Ciphertext Attacks
-// Against Protocols Based on the RSA Encryption Standard PKCS #1'', Daniel
-// Bleichenbacher, Advances in Cryptology (Crypto '98),
-func Decrypt(priv *PrivateKey, c1, c2 *big.Int) (msg []byte, err error) {
- s := new(big.Int).Exp(c1, priv.X, priv.P)
- s.ModInverse(s, priv.P)
- s.Mul(s, c2)
- s.Mod(s, priv.P)
- em := s.Bytes()
-
- firstByteIsTwo := subtle.ConstantTimeByteEq(em[0], 2)
-
- // The remainder of the plaintext must be a string of non-zero random
- // octets, followed by a 0, followed by the message.
- // lookingForIndex: 1 iff we are still looking for the zero.
- // index: the offset of the first zero byte.
- var lookingForIndex, index int
- lookingForIndex = 1
-
- for i := 1; i < len(em); i++ {
- equals0 := subtle.ConstantTimeByteEq(em[i], 0)
- index = subtle.ConstantTimeSelect(lookingForIndex&equals0, i, index)
- lookingForIndex = subtle.ConstantTimeSelect(equals0, 0, lookingForIndex)
- }
-
- if firstByteIsTwo != 1 || lookingForIndex != 0 || index < 9 {
- return nil, errors.New("elgamal: decryption error")
- }
- return em[index+1:], nil
-}
-
-// nonZeroRandomBytes fills the given slice with non-zero random octets.
-func nonZeroRandomBytes(s []byte, rand io.Reader) (err error) {
- _, err = io.ReadFull(rand, s)
- if err != nil {
- return
- }
-
- for i := 0; i < len(s); i++ {
- for s[i] == 0 {
- _, err = io.ReadFull(rand, s[i:i+1])
- if err != nil {
- return
- }
- }
- }
-
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/errors/errors.go b/vendor/golang.org/x/crypto/openpgp/errors/errors.go
deleted file mode 100644
index eb0550b2..00000000
--- a/vendor/golang.org/x/crypto/openpgp/errors/errors.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package errors contains common error types for the OpenPGP packages.
-package errors // import "golang.org/x/crypto/openpgp/errors"
-
-import (
- "strconv"
-)
-
-// A StructuralError is returned when OpenPGP data is found to be syntactically
-// invalid.
-type StructuralError string
-
-func (s StructuralError) Error() string {
- return "openpgp: invalid data: " + string(s)
-}
-
-// UnsupportedError indicates that, although the OpenPGP data is valid, it
-// makes use of currently unimplemented features.
-type UnsupportedError string
-
-func (s UnsupportedError) Error() string {
- return "openpgp: unsupported feature: " + string(s)
-}
-
-// InvalidArgumentError indicates that the caller is in error and passed an
-// incorrect value.
-type InvalidArgumentError string
-
-func (i InvalidArgumentError) Error() string {
- return "openpgp: invalid argument: " + string(i)
-}
-
-// SignatureError indicates that a syntactically valid signature failed to
-// validate.
-type SignatureError string
-
-func (b SignatureError) Error() string {
- return "openpgp: invalid signature: " + string(b)
-}
-
-type keyIncorrectError int
-
-func (ki keyIncorrectError) Error() string {
- return "openpgp: incorrect key"
-}
-
-var ErrKeyIncorrect error = keyIncorrectError(0)
-
-type unknownIssuerError int
-
-func (unknownIssuerError) Error() string {
- return "openpgp: signature made by unknown entity"
-}
-
-var ErrUnknownIssuer error = unknownIssuerError(0)
-
-type keyRevokedError int
-
-func (keyRevokedError) Error() string {
- return "openpgp: signature made by revoked key"
-}
-
-var ErrKeyRevoked error = keyRevokedError(0)
-
-type UnknownPacketTypeError uint8
-
-func (upte UnknownPacketTypeError) Error() string {
- return "openpgp: unknown packet type: " + strconv.Itoa(int(upte))
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/keys.go b/vendor/golang.org/x/crypto/openpgp/keys.go
deleted file mode 100644
index efe6e730..00000000
--- a/vendor/golang.org/x/crypto/openpgp/keys.go
+++ /dev/null
@@ -1,668 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package openpgp
-
-import (
- "crypto/rsa"
- "io"
- "time"
-
- "golang.org/x/crypto/openpgp/armor"
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/packet"
-)
-
-// PublicKeyType is the armor type for a PGP public key.
-var PublicKeyType = "PGP PUBLIC KEY BLOCK"
-
-// PrivateKeyType is the armor type for a PGP private key.
-var PrivateKeyType = "PGP PRIVATE KEY BLOCK"
-
-// An Entity represents the components of an OpenPGP key: a primary public key
-// (which must be a signing key), one or more identities claimed by that key,
-// and zero or more subkeys, which may be encryption keys.
-type Entity struct {
- PrimaryKey *packet.PublicKey
- PrivateKey *packet.PrivateKey
- Identities map[string]*Identity // indexed by Identity.Name
- Revocations []*packet.Signature
- Subkeys []Subkey
-}
-
-// An Identity represents an identity claimed by an Entity and zero or more
-// assertions by other entities about that claim.
-type Identity struct {
- Name string // by convention, has the form "Full Name (comment) "
- UserId *packet.UserId
- SelfSignature *packet.Signature
- Signatures []*packet.Signature
-}
-
-// A Subkey is an additional public key in an Entity. Subkeys can be used for
-// encryption.
-type Subkey struct {
- PublicKey *packet.PublicKey
- PrivateKey *packet.PrivateKey
- Sig *packet.Signature
-}
-
-// A Key identifies a specific public key in an Entity. This is either the
-// Entity's primary key or a subkey.
-type Key struct {
- Entity *Entity
- PublicKey *packet.PublicKey
- PrivateKey *packet.PrivateKey
- SelfSignature *packet.Signature
-}
-
-// A KeyRing provides access to public and private keys.
-type KeyRing interface {
- // KeysById returns the set of keys that have the given key id.
- KeysById(id uint64) []Key
- // KeysByIdAndUsage returns the set of keys with the given id
- // that also meet the key usage given by requiredUsage.
- // The requiredUsage is expressed as the bitwise-OR of
- // packet.KeyFlag* values.
- KeysByIdUsage(id uint64, requiredUsage byte) []Key
- // DecryptionKeys returns all private keys that are valid for
- // decryption.
- DecryptionKeys() []Key
-}
-
-// primaryIdentity returns the Identity marked as primary or the first identity
-// if none are so marked.
-func (e *Entity) primaryIdentity() *Identity {
- var firstIdentity *Identity
- for _, ident := range e.Identities {
- if firstIdentity == nil {
- firstIdentity = ident
- }
- if ident.SelfSignature.IsPrimaryId != nil && *ident.SelfSignature.IsPrimaryId {
- return ident
- }
- }
- return firstIdentity
-}
-
-// encryptionKey returns the best candidate Key for encrypting a message to the
-// given Entity.
-func (e *Entity) encryptionKey(now time.Time) (Key, bool) {
- candidateSubkey := -1
-
- // Iterate the keys to find the newest key
- var maxTime time.Time
- for i, subkey := range e.Subkeys {
- if subkey.Sig.FlagsValid &&
- subkey.Sig.FlagEncryptCommunications &&
- subkey.PublicKey.PubKeyAlgo.CanEncrypt() &&
- !subkey.Sig.KeyExpired(now) &&
- (maxTime.IsZero() || subkey.Sig.CreationTime.After(maxTime)) {
- candidateSubkey = i
- maxTime = subkey.Sig.CreationTime
- }
- }
-
- if candidateSubkey != -1 {
- subkey := e.Subkeys[candidateSubkey]
- return Key{e, subkey.PublicKey, subkey.PrivateKey, subkey.Sig}, true
- }
-
- // If we don't have any candidate subkeys for encryption and
- // the primary key doesn't have any usage metadata then we
- // assume that the primary key is ok. Or, if the primary key is
- // marked as ok to encrypt to, then we can obviously use it.
- i := e.primaryIdentity()
- if !i.SelfSignature.FlagsValid || i.SelfSignature.FlagEncryptCommunications &&
- e.PrimaryKey.PubKeyAlgo.CanEncrypt() &&
- !i.SelfSignature.KeyExpired(now) {
- return Key{e, e.PrimaryKey, e.PrivateKey, i.SelfSignature}, true
- }
-
- // This Entity appears to be signing only.
- return Key{}, false
-}
-
-// signingKey return the best candidate Key for signing a message with this
-// Entity.
-func (e *Entity) signingKey(now time.Time) (Key, bool) {
- candidateSubkey := -1
-
- for i, subkey := range e.Subkeys {
- if subkey.Sig.FlagsValid &&
- subkey.Sig.FlagSign &&
- subkey.PublicKey.PubKeyAlgo.CanSign() &&
- !subkey.Sig.KeyExpired(now) {
- candidateSubkey = i
- break
- }
- }
-
- if candidateSubkey != -1 {
- subkey := e.Subkeys[candidateSubkey]
- return Key{e, subkey.PublicKey, subkey.PrivateKey, subkey.Sig}, true
- }
-
- // If we have no candidate subkey then we assume that it's ok to sign
- // with the primary key.
- i := e.primaryIdentity()
- if !i.SelfSignature.FlagsValid || i.SelfSignature.FlagSign &&
- !i.SelfSignature.KeyExpired(now) {
- return Key{e, e.PrimaryKey, e.PrivateKey, i.SelfSignature}, true
- }
-
- return Key{}, false
-}
-
-// An EntityList contains one or more Entities.
-type EntityList []*Entity
-
-// KeysById returns the set of keys that have the given key id.
-func (el EntityList) KeysById(id uint64) (keys []Key) {
- for _, e := range el {
- if e.PrimaryKey.KeyId == id {
- var selfSig *packet.Signature
- for _, ident := range e.Identities {
- if selfSig == nil {
- selfSig = ident.SelfSignature
- } else if ident.SelfSignature.IsPrimaryId != nil && *ident.SelfSignature.IsPrimaryId {
- selfSig = ident.SelfSignature
- break
- }
- }
- keys = append(keys, Key{e, e.PrimaryKey, e.PrivateKey, selfSig})
- }
-
- for _, subKey := range e.Subkeys {
- if subKey.PublicKey.KeyId == id {
- keys = append(keys, Key{e, subKey.PublicKey, subKey.PrivateKey, subKey.Sig})
- }
- }
- }
- return
-}
-
-// KeysByIdAndUsage returns the set of keys with the given id that also meet
-// the key usage given by requiredUsage. The requiredUsage is expressed as
-// the bitwise-OR of packet.KeyFlag* values.
-func (el EntityList) KeysByIdUsage(id uint64, requiredUsage byte) (keys []Key) {
- for _, key := range el.KeysById(id) {
- if len(key.Entity.Revocations) > 0 {
- continue
- }
-
- if key.SelfSignature.RevocationReason != nil {
- continue
- }
-
- if key.SelfSignature.FlagsValid && requiredUsage != 0 {
- var usage byte
- if key.SelfSignature.FlagCertify {
- usage |= packet.KeyFlagCertify
- }
- if key.SelfSignature.FlagSign {
- usage |= packet.KeyFlagSign
- }
- if key.SelfSignature.FlagEncryptCommunications {
- usage |= packet.KeyFlagEncryptCommunications
- }
- if key.SelfSignature.FlagEncryptStorage {
- usage |= packet.KeyFlagEncryptStorage
- }
- if usage&requiredUsage != requiredUsage {
- continue
- }
- }
-
- keys = append(keys, key)
- }
- return
-}
-
-// DecryptionKeys returns all private keys that are valid for decryption.
-func (el EntityList) DecryptionKeys() (keys []Key) {
- for _, e := range el {
- for _, subKey := range e.Subkeys {
- if subKey.PrivateKey != nil && (!subKey.Sig.FlagsValid || subKey.Sig.FlagEncryptStorage || subKey.Sig.FlagEncryptCommunications) {
- keys = append(keys, Key{e, subKey.PublicKey, subKey.PrivateKey, subKey.Sig})
- }
- }
- }
- return
-}
-
-// ReadArmoredKeyRing reads one or more public/private keys from an armor keyring file.
-func ReadArmoredKeyRing(r io.Reader) (EntityList, error) {
- block, err := armor.Decode(r)
- if err == io.EOF {
- return nil, errors.InvalidArgumentError("no armored data found")
- }
- if err != nil {
- return nil, err
- }
- if block.Type != PublicKeyType && block.Type != PrivateKeyType {
- return nil, errors.InvalidArgumentError("expected public or private key block, got: " + block.Type)
- }
-
- return ReadKeyRing(block.Body)
-}
-
-// ReadKeyRing reads one or more public/private keys. Unsupported keys are
-// ignored as long as at least a single valid key is found.
-func ReadKeyRing(r io.Reader) (el EntityList, err error) {
- packets := packet.NewReader(r)
- var lastUnsupportedError error
-
- for {
- var e *Entity
- e, err = ReadEntity(packets)
- if err != nil {
- // TODO: warn about skipped unsupported/unreadable keys
- if _, ok := err.(errors.UnsupportedError); ok {
- lastUnsupportedError = err
- err = readToNextPublicKey(packets)
- } else if _, ok := err.(errors.StructuralError); ok {
- // Skip unreadable, badly-formatted keys
- lastUnsupportedError = err
- err = readToNextPublicKey(packets)
- }
- if err == io.EOF {
- err = nil
- break
- }
- if err != nil {
- el = nil
- break
- }
- } else {
- el = append(el, e)
- }
- }
-
- if len(el) == 0 && err == nil {
- err = lastUnsupportedError
- }
- return
-}
-
-// readToNextPublicKey reads packets until the start of the entity and leaves
-// the first packet of the new entity in the Reader.
-func readToNextPublicKey(packets *packet.Reader) (err error) {
- var p packet.Packet
- for {
- p, err = packets.Next()
- if err == io.EOF {
- return
- } else if err != nil {
- if _, ok := err.(errors.UnsupportedError); ok {
- err = nil
- continue
- }
- return
- }
-
- if pk, ok := p.(*packet.PublicKey); ok && !pk.IsSubkey {
- packets.Unread(p)
- return
- }
- }
-}
-
-// ReadEntity reads an entity (public key, identities, subkeys etc) from the
-// given Reader.
-func ReadEntity(packets *packet.Reader) (*Entity, error) {
- e := new(Entity)
- e.Identities = make(map[string]*Identity)
-
- p, err := packets.Next()
- if err != nil {
- return nil, err
- }
-
- var ok bool
- if e.PrimaryKey, ok = p.(*packet.PublicKey); !ok {
- if e.PrivateKey, ok = p.(*packet.PrivateKey); !ok {
- packets.Unread(p)
- return nil, errors.StructuralError("first packet was not a public/private key")
- }
- e.PrimaryKey = &e.PrivateKey.PublicKey
- }
-
- if !e.PrimaryKey.PubKeyAlgo.CanSign() {
- return nil, errors.StructuralError("primary key cannot be used for signatures")
- }
-
- var revocations []*packet.Signature
-EachPacket:
- for {
- p, err := packets.Next()
- if err == io.EOF {
- break
- } else if err != nil {
- return nil, err
- }
-
- switch pkt := p.(type) {
- case *packet.UserId:
- // Make a new Identity object, that we might wind up throwing away.
- // We'll only add it if we get a valid self-signature over this
- // userID.
- current := new(Identity)
- current.Name = pkt.Id
- current.UserId = pkt
-
- for {
- p, err = packets.Next()
- if err == io.EOF {
- break EachPacket
- } else if err != nil {
- return nil, err
- }
-
- sig, ok := p.(*packet.Signature)
- if !ok {
- packets.Unread(p)
- continue EachPacket
- }
-
- if (sig.SigType == packet.SigTypePositiveCert || sig.SigType == packet.SigTypeGenericCert) && sig.IssuerKeyId != nil && *sig.IssuerKeyId == e.PrimaryKey.KeyId {
- if err = e.PrimaryKey.VerifyUserIdSignature(pkt.Id, e.PrimaryKey, sig); err != nil {
- return nil, errors.StructuralError("user ID self-signature invalid: " + err.Error())
- }
- current.SelfSignature = sig
- e.Identities[pkt.Id] = current
- } else {
- current.Signatures = append(current.Signatures, sig)
- }
- }
- case *packet.Signature:
- if pkt.SigType == packet.SigTypeKeyRevocation {
- revocations = append(revocations, pkt)
- } else if pkt.SigType == packet.SigTypeDirectSignature {
- // TODO: RFC4880 5.2.1 permits signatures
- // directly on keys (eg. to bind additional
- // revocation keys).
- }
- // Else, ignoring the signature as it does not follow anything
- // we would know to attach it to.
- case *packet.PrivateKey:
- if pkt.IsSubkey == false {
- packets.Unread(p)
- break EachPacket
- }
- err = addSubkey(e, packets, &pkt.PublicKey, pkt)
- if err != nil {
- return nil, err
- }
- case *packet.PublicKey:
- if pkt.IsSubkey == false {
- packets.Unread(p)
- break EachPacket
- }
- err = addSubkey(e, packets, pkt, nil)
- if err != nil {
- return nil, err
- }
- default:
- // we ignore unknown packets
- }
- }
-
- if len(e.Identities) == 0 {
- return nil, errors.StructuralError("entity without any identities")
- }
-
- for _, revocation := range revocations {
- err = e.PrimaryKey.VerifyRevocationSignature(revocation)
- if err == nil {
- e.Revocations = append(e.Revocations, revocation)
- } else {
- // TODO: RFC 4880 5.2.3.15 defines revocation keys.
- return nil, errors.StructuralError("revocation signature signed by alternate key")
- }
- }
-
- return e, nil
-}
-
-func addSubkey(e *Entity, packets *packet.Reader, pub *packet.PublicKey, priv *packet.PrivateKey) error {
- var subKey Subkey
- subKey.PublicKey = pub
- subKey.PrivateKey = priv
-
- for {
- p, err := packets.Next()
- if err == io.EOF {
- break
- } else if err != nil {
- return errors.StructuralError("subkey signature invalid: " + err.Error())
- }
-
- sig, ok := p.(*packet.Signature)
- if !ok {
- packets.Unread(p)
- break
- }
-
- if sig.SigType != packet.SigTypeSubkeyBinding && sig.SigType != packet.SigTypeSubkeyRevocation {
- return errors.StructuralError("subkey signature with wrong type")
- }
-
- if err := e.PrimaryKey.VerifyKeySignature(subKey.PublicKey, sig); err != nil {
- return errors.StructuralError("subkey signature invalid: " + err.Error())
- }
-
- switch sig.SigType {
- case packet.SigTypeSubkeyRevocation:
- subKey.Sig = sig
- case packet.SigTypeSubkeyBinding:
- if subKey.Sig == nil {
- subKey.Sig = sig
- }
- }
- }
-
- if subKey.Sig == nil {
- return errors.StructuralError("subkey packet not followed by signature")
- }
-
- e.Subkeys = append(e.Subkeys, subKey)
-
- return nil
-}
-
-const defaultRSAKeyBits = 2048
-
-// NewEntity returns an Entity that contains a fresh RSA/RSA keypair with a
-// single identity composed of the given full name, comment and email, any of
-// which may be empty but must not contain any of "()<>\x00".
-// If config is nil, sensible defaults will be used.
-func NewEntity(name, comment, email string, config *packet.Config) (*Entity, error) {
- currentTime := config.Now()
-
- bits := defaultRSAKeyBits
- if config != nil && config.RSABits != 0 {
- bits = config.RSABits
- }
-
- uid := packet.NewUserId(name, comment, email)
- if uid == nil {
- return nil, errors.InvalidArgumentError("user id field contained invalid characters")
- }
- signingPriv, err := rsa.GenerateKey(config.Random(), bits)
- if err != nil {
- return nil, err
- }
- encryptingPriv, err := rsa.GenerateKey(config.Random(), bits)
- if err != nil {
- return nil, err
- }
-
- e := &Entity{
- PrimaryKey: packet.NewRSAPublicKey(currentTime, &signingPriv.PublicKey),
- PrivateKey: packet.NewRSAPrivateKey(currentTime, signingPriv),
- Identities: make(map[string]*Identity),
- }
- isPrimaryId := true
- e.Identities[uid.Id] = &Identity{
- Name: uid.Id,
- UserId: uid,
- SelfSignature: &packet.Signature{
- CreationTime: currentTime,
- SigType: packet.SigTypePositiveCert,
- PubKeyAlgo: packet.PubKeyAlgoRSA,
- Hash: config.Hash(),
- IsPrimaryId: &isPrimaryId,
- FlagsValid: true,
- FlagSign: true,
- FlagCertify: true,
- IssuerKeyId: &e.PrimaryKey.KeyId,
- },
- }
- err = e.Identities[uid.Id].SelfSignature.SignUserId(uid.Id, e.PrimaryKey, e.PrivateKey, config)
- if err != nil {
- return nil, err
- }
-
- // If the user passes in a DefaultHash via packet.Config,
- // set the PreferredHash for the SelfSignature.
- if config != nil && config.DefaultHash != 0 {
- e.Identities[uid.Id].SelfSignature.PreferredHash = []uint8{hashToHashId(config.DefaultHash)}
- }
-
- // Likewise for DefaultCipher.
- if config != nil && config.DefaultCipher != 0 {
- e.Identities[uid.Id].SelfSignature.PreferredSymmetric = []uint8{uint8(config.DefaultCipher)}
- }
-
- e.Subkeys = make([]Subkey, 1)
- e.Subkeys[0] = Subkey{
- PublicKey: packet.NewRSAPublicKey(currentTime, &encryptingPriv.PublicKey),
- PrivateKey: packet.NewRSAPrivateKey(currentTime, encryptingPriv),
- Sig: &packet.Signature{
- CreationTime: currentTime,
- SigType: packet.SigTypeSubkeyBinding,
- PubKeyAlgo: packet.PubKeyAlgoRSA,
- Hash: config.Hash(),
- FlagsValid: true,
- FlagEncryptStorage: true,
- FlagEncryptCommunications: true,
- IssuerKeyId: &e.PrimaryKey.KeyId,
- },
- }
- e.Subkeys[0].PublicKey.IsSubkey = true
- e.Subkeys[0].PrivateKey.IsSubkey = true
- err = e.Subkeys[0].Sig.SignKey(e.Subkeys[0].PublicKey, e.PrivateKey, config)
- if err != nil {
- return nil, err
- }
- return e, nil
-}
-
-// SerializePrivate serializes an Entity, including private key material, but
-// excluding signatures from other entities, to the given Writer.
-// Identities and subkeys are re-signed in case they changed since NewEntry.
-// If config is nil, sensible defaults will be used.
-func (e *Entity) SerializePrivate(w io.Writer, config *packet.Config) (err error) {
- err = e.PrivateKey.Serialize(w)
- if err != nil {
- return
- }
- for _, ident := range e.Identities {
- err = ident.UserId.Serialize(w)
- if err != nil {
- return
- }
- err = ident.SelfSignature.SignUserId(ident.UserId.Id, e.PrimaryKey, e.PrivateKey, config)
- if err != nil {
- return
- }
- err = ident.SelfSignature.Serialize(w)
- if err != nil {
- return
- }
- }
- for _, subkey := range e.Subkeys {
- err = subkey.PrivateKey.Serialize(w)
- if err != nil {
- return
- }
- err = subkey.Sig.SignKey(subkey.PublicKey, e.PrivateKey, config)
- if err != nil {
- return
- }
- err = subkey.Sig.Serialize(w)
- if err != nil {
- return
- }
- }
- return nil
-}
-
-// Serialize writes the public part of the given Entity to w, including
-// signatures from other entities. No private key material will be output.
-func (e *Entity) Serialize(w io.Writer) error {
- err := e.PrimaryKey.Serialize(w)
- if err != nil {
- return err
- }
- for _, ident := range e.Identities {
- err = ident.UserId.Serialize(w)
- if err != nil {
- return err
- }
- err = ident.SelfSignature.Serialize(w)
- if err != nil {
- return err
- }
- for _, sig := range ident.Signatures {
- err = sig.Serialize(w)
- if err != nil {
- return err
- }
- }
- }
- for _, subkey := range e.Subkeys {
- err = subkey.PublicKey.Serialize(w)
- if err != nil {
- return err
- }
- err = subkey.Sig.Serialize(w)
- if err != nil {
- return err
- }
- }
- return nil
-}
-
-// SignIdentity adds a signature to e, from signer, attesting that identity is
-// associated with e. The provided identity must already be an element of
-// e.Identities and the private key of signer must have been decrypted if
-// necessary.
-// If config is nil, sensible defaults will be used.
-func (e *Entity) SignIdentity(identity string, signer *Entity, config *packet.Config) error {
- if signer.PrivateKey == nil {
- return errors.InvalidArgumentError("signing Entity must have a private key")
- }
- if signer.PrivateKey.Encrypted {
- return errors.InvalidArgumentError("signing Entity's private key must be decrypted")
- }
- ident, ok := e.Identities[identity]
- if !ok {
- return errors.InvalidArgumentError("given identity string not found in Entity")
- }
-
- sig := &packet.Signature{
- SigType: packet.SigTypeGenericCert,
- PubKeyAlgo: signer.PrivateKey.PubKeyAlgo,
- Hash: config.Hash(),
- CreationTime: config.Now(),
- IssuerKeyId: &signer.PrivateKey.KeyId,
- }
- if err := sig.SignUserId(identity, e.PrimaryKey, signer.PrivateKey, config); err != nil {
- return err
- }
- ident.Signatures = append(ident.Signatures, sig)
- return nil
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/compressed.go b/vendor/golang.org/x/crypto/openpgp/packet/compressed.go
deleted file mode 100644
index e8f0b5ca..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/compressed.go
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "compress/bzip2"
- "compress/flate"
- "compress/zlib"
- "golang.org/x/crypto/openpgp/errors"
- "io"
- "strconv"
-)
-
-// Compressed represents a compressed OpenPGP packet. The decompressed contents
-// will contain more OpenPGP packets. See RFC 4880, section 5.6.
-type Compressed struct {
- Body io.Reader
-}
-
-const (
- NoCompression = flate.NoCompression
- BestSpeed = flate.BestSpeed
- BestCompression = flate.BestCompression
- DefaultCompression = flate.DefaultCompression
-)
-
-// CompressionConfig contains compressor configuration settings.
-type CompressionConfig struct {
- // Level is the compression level to use. It must be set to
- // between -1 and 9, with -1 causing the compressor to use the
- // default compression level, 0 causing the compressor to use
- // no compression and 1 to 9 representing increasing (better,
- // slower) compression levels. If Level is less than -1 or
- // more then 9, a non-nil error will be returned during
- // encryption. See the constants above for convenient common
- // settings for Level.
- Level int
-}
-
-func (c *Compressed) parse(r io.Reader) error {
- var buf [1]byte
- _, err := readFull(r, buf[:])
- if err != nil {
- return err
- }
-
- switch buf[0] {
- case 1:
- c.Body = flate.NewReader(r)
- case 2:
- c.Body, err = zlib.NewReader(r)
- case 3:
- c.Body = bzip2.NewReader(r)
- default:
- err = errors.UnsupportedError("unknown compression algorithm: " + strconv.Itoa(int(buf[0])))
- }
-
- return err
-}
-
-// compressedWriterCloser represents the serialized compression stream
-// header and the compressor. Its Close() method ensures that both the
-// compressor and serialized stream header are closed. Its Write()
-// method writes to the compressor.
-type compressedWriteCloser struct {
- sh io.Closer // Stream Header
- c io.WriteCloser // Compressor
-}
-
-func (cwc compressedWriteCloser) Write(p []byte) (int, error) {
- return cwc.c.Write(p)
-}
-
-func (cwc compressedWriteCloser) Close() (err error) {
- err = cwc.c.Close()
- if err != nil {
- return err
- }
-
- return cwc.sh.Close()
-}
-
-// SerializeCompressed serializes a compressed data packet to w and
-// returns a WriteCloser to which the literal data packets themselves
-// can be written and which MUST be closed on completion. If cc is
-// nil, sensible defaults will be used to configure the compression
-// algorithm.
-func SerializeCompressed(w io.WriteCloser, algo CompressionAlgo, cc *CompressionConfig) (literaldata io.WriteCloser, err error) {
- compressed, err := serializeStreamHeader(w, packetTypeCompressed)
- if err != nil {
- return
- }
-
- _, err = compressed.Write([]byte{uint8(algo)})
- if err != nil {
- return
- }
-
- level := DefaultCompression
- if cc != nil {
- level = cc.Level
- }
-
- var compressor io.WriteCloser
- switch algo {
- case CompressionZIP:
- compressor, err = flate.NewWriter(compressed, level)
- case CompressionZLIB:
- compressor, err = zlib.NewWriterLevel(compressed, level)
- default:
- s := strconv.Itoa(int(algo))
- err = errors.UnsupportedError("Unsupported compression algorithm: " + s)
- }
- if err != nil {
- return
- }
-
- literaldata = compressedWriteCloser{compressed, compressor}
-
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/config.go b/vendor/golang.org/x/crypto/openpgp/packet/config.go
deleted file mode 100644
index c76eecc9..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/config.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "crypto"
- "crypto/rand"
- "io"
- "time"
-)
-
-// Config collects a number of parameters along with sensible defaults.
-// A nil *Config is valid and results in all default values.
-type Config struct {
- // Rand provides the source of entropy.
- // If nil, the crypto/rand Reader is used.
- Rand io.Reader
- // DefaultHash is the default hash function to be used.
- // If zero, SHA-256 is used.
- DefaultHash crypto.Hash
- // DefaultCipher is the cipher to be used.
- // If zero, AES-128 is used.
- DefaultCipher CipherFunction
- // Time returns the current time as the number of seconds since the
- // epoch. If Time is nil, time.Now is used.
- Time func() time.Time
- // DefaultCompressionAlgo is the compression algorithm to be
- // applied to the plaintext before encryption. If zero, no
- // compression is done.
- DefaultCompressionAlgo CompressionAlgo
- // CompressionConfig configures the compression settings.
- CompressionConfig *CompressionConfig
- // S2KCount is only used for symmetric encryption. It
- // determines the strength of the passphrase stretching when
- // the said passphrase is hashed to produce a key. S2KCount
- // should be between 1024 and 65011712, inclusive. If Config
- // is nil or S2KCount is 0, the value 65536 used. Not all
- // values in the above range can be represented. S2KCount will
- // be rounded up to the next representable value if it cannot
- // be encoded exactly. When set, it is strongly encrouraged to
- // use a value that is at least 65536. See RFC 4880 Section
- // 3.7.1.3.
- S2KCount int
- // RSABits is the number of bits in new RSA keys made with NewEntity.
- // If zero, then 2048 bit keys are created.
- RSABits int
-}
-
-func (c *Config) Random() io.Reader {
- if c == nil || c.Rand == nil {
- return rand.Reader
- }
- return c.Rand
-}
-
-func (c *Config) Hash() crypto.Hash {
- if c == nil || uint(c.DefaultHash) == 0 {
- return crypto.SHA256
- }
- return c.DefaultHash
-}
-
-func (c *Config) Cipher() CipherFunction {
- if c == nil || uint8(c.DefaultCipher) == 0 {
- return CipherAES128
- }
- return c.DefaultCipher
-}
-
-func (c *Config) Now() time.Time {
- if c == nil || c.Time == nil {
- return time.Now()
- }
- return c.Time()
-}
-
-func (c *Config) Compression() CompressionAlgo {
- if c == nil {
- return CompressionNone
- }
- return c.DefaultCompressionAlgo
-}
-
-func (c *Config) PasswordHashIterations() int {
- if c == nil || c.S2KCount == 0 {
- return 0
- }
- return c.S2KCount
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go b/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go
deleted file mode 100644
index 02b372cf..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "crypto/rsa"
- "encoding/binary"
- "io"
- "math/big"
- "strconv"
-
- "golang.org/x/crypto/openpgp/elgamal"
- "golang.org/x/crypto/openpgp/errors"
-)
-
-const encryptedKeyVersion = 3
-
-// EncryptedKey represents a public-key encrypted session key. See RFC 4880,
-// section 5.1.
-type EncryptedKey struct {
- KeyId uint64
- Algo PublicKeyAlgorithm
- CipherFunc CipherFunction // only valid after a successful Decrypt
- Key []byte // only valid after a successful Decrypt
-
- encryptedMPI1, encryptedMPI2 parsedMPI
-}
-
-func (e *EncryptedKey) parse(r io.Reader) (err error) {
- var buf [10]byte
- _, err = readFull(r, buf[:])
- if err != nil {
- return
- }
- if buf[0] != encryptedKeyVersion {
- return errors.UnsupportedError("unknown EncryptedKey version " + strconv.Itoa(int(buf[0])))
- }
- e.KeyId = binary.BigEndian.Uint64(buf[1:9])
- e.Algo = PublicKeyAlgorithm(buf[9])
- switch e.Algo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
- e.encryptedMPI1.bytes, e.encryptedMPI1.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- case PubKeyAlgoElGamal:
- e.encryptedMPI1.bytes, e.encryptedMPI1.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- e.encryptedMPI2.bytes, e.encryptedMPI2.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- }
- _, err = consumeAll(r)
- return
-}
-
-func checksumKeyMaterial(key []byte) uint16 {
- var checksum uint16
- for _, v := range key {
- checksum += uint16(v)
- }
- return checksum
-}
-
-// Decrypt decrypts an encrypted session key with the given private key. The
-// private key must have been decrypted first.
-// If config is nil, sensible defaults will be used.
-func (e *EncryptedKey) Decrypt(priv *PrivateKey, config *Config) error {
- var err error
- var b []byte
-
- // TODO(agl): use session key decryption routines here to avoid
- // padding oracle attacks.
- switch priv.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
- k := priv.PrivateKey.(*rsa.PrivateKey)
- b, err = rsa.DecryptPKCS1v15(config.Random(), k, padToKeySize(&k.PublicKey, e.encryptedMPI1.bytes))
- case PubKeyAlgoElGamal:
- c1 := new(big.Int).SetBytes(e.encryptedMPI1.bytes)
- c2 := new(big.Int).SetBytes(e.encryptedMPI2.bytes)
- b, err = elgamal.Decrypt(priv.PrivateKey.(*elgamal.PrivateKey), c1, c2)
- default:
- err = errors.InvalidArgumentError("cannot decrypted encrypted session key with private key of type " + strconv.Itoa(int(priv.PubKeyAlgo)))
- }
-
- if err != nil {
- return err
- }
-
- e.CipherFunc = CipherFunction(b[0])
- e.Key = b[1 : len(b)-2]
- expectedChecksum := uint16(b[len(b)-2])<<8 | uint16(b[len(b)-1])
- checksum := checksumKeyMaterial(e.Key)
- if checksum != expectedChecksum {
- return errors.StructuralError("EncryptedKey checksum incorrect")
- }
-
- return nil
-}
-
-// Serialize writes the encrypted key packet, e, to w.
-func (e *EncryptedKey) Serialize(w io.Writer) error {
- var mpiLen int
- switch e.Algo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
- mpiLen = 2 + len(e.encryptedMPI1.bytes)
- case PubKeyAlgoElGamal:
- mpiLen = 2 + len(e.encryptedMPI1.bytes) + 2 + len(e.encryptedMPI2.bytes)
- default:
- return errors.InvalidArgumentError("don't know how to serialize encrypted key type " + strconv.Itoa(int(e.Algo)))
- }
-
- serializeHeader(w, packetTypeEncryptedKey, 1 /* version */ +8 /* key id */ +1 /* algo */ +mpiLen)
-
- w.Write([]byte{encryptedKeyVersion})
- binary.Write(w, binary.BigEndian, e.KeyId)
- w.Write([]byte{byte(e.Algo)})
-
- switch e.Algo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
- writeMPIs(w, e.encryptedMPI1)
- case PubKeyAlgoElGamal:
- writeMPIs(w, e.encryptedMPI1, e.encryptedMPI2)
- default:
- panic("internal error")
- }
-
- return nil
-}
-
-// SerializeEncryptedKey serializes an encrypted key packet to w that contains
-// key, encrypted to pub.
-// If config is nil, sensible defaults will be used.
-func SerializeEncryptedKey(w io.Writer, pub *PublicKey, cipherFunc CipherFunction, key []byte, config *Config) error {
- var buf [10]byte
- buf[0] = encryptedKeyVersion
- binary.BigEndian.PutUint64(buf[1:9], pub.KeyId)
- buf[9] = byte(pub.PubKeyAlgo)
-
- keyBlock := make([]byte, 1 /* cipher type */ +len(key)+2 /* checksum */)
- keyBlock[0] = byte(cipherFunc)
- copy(keyBlock[1:], key)
- checksum := checksumKeyMaterial(key)
- keyBlock[1+len(key)] = byte(checksum >> 8)
- keyBlock[1+len(key)+1] = byte(checksum)
-
- switch pub.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
- return serializeEncryptedKeyRSA(w, config.Random(), buf, pub.PublicKey.(*rsa.PublicKey), keyBlock)
- case PubKeyAlgoElGamal:
- return serializeEncryptedKeyElGamal(w, config.Random(), buf, pub.PublicKey.(*elgamal.PublicKey), keyBlock)
- case PubKeyAlgoDSA, PubKeyAlgoRSASignOnly:
- return errors.InvalidArgumentError("cannot encrypt to public key of type " + strconv.Itoa(int(pub.PubKeyAlgo)))
- }
-
- return errors.UnsupportedError("encrypting a key to public key of type " + strconv.Itoa(int(pub.PubKeyAlgo)))
-}
-
-func serializeEncryptedKeyRSA(w io.Writer, rand io.Reader, header [10]byte, pub *rsa.PublicKey, keyBlock []byte) error {
- cipherText, err := rsa.EncryptPKCS1v15(rand, pub, keyBlock)
- if err != nil {
- return errors.InvalidArgumentError("RSA encryption failed: " + err.Error())
- }
-
- packetLen := 10 /* header length */ + 2 /* mpi size */ + len(cipherText)
-
- err = serializeHeader(w, packetTypeEncryptedKey, packetLen)
- if err != nil {
- return err
- }
- _, err = w.Write(header[:])
- if err != nil {
- return err
- }
- return writeMPI(w, 8*uint16(len(cipherText)), cipherText)
-}
-
-func serializeEncryptedKeyElGamal(w io.Writer, rand io.Reader, header [10]byte, pub *elgamal.PublicKey, keyBlock []byte) error {
- c1, c2, err := elgamal.Encrypt(rand, pub, keyBlock)
- if err != nil {
- return errors.InvalidArgumentError("ElGamal encryption failed: " + err.Error())
- }
-
- packetLen := 10 /* header length */
- packetLen += 2 /* mpi size */ + (c1.BitLen()+7)/8
- packetLen += 2 /* mpi size */ + (c2.BitLen()+7)/8
-
- err = serializeHeader(w, packetTypeEncryptedKey, packetLen)
- if err != nil {
- return err
- }
- _, err = w.Write(header[:])
- if err != nil {
- return err
- }
- err = writeBig(w, c1)
- if err != nil {
- return err
- }
- return writeBig(w, c2)
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/literal.go b/vendor/golang.org/x/crypto/openpgp/packet/literal.go
deleted file mode 100644
index 1a9ec6e5..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/literal.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "encoding/binary"
- "io"
-)
-
-// LiteralData represents an encrypted file. See RFC 4880, section 5.9.
-type LiteralData struct {
- IsBinary bool
- FileName string
- Time uint32 // Unix epoch time. Either creation time or modification time. 0 means undefined.
- Body io.Reader
-}
-
-// ForEyesOnly returns whether the contents of the LiteralData have been marked
-// as especially sensitive.
-func (l *LiteralData) ForEyesOnly() bool {
- return l.FileName == "_CONSOLE"
-}
-
-func (l *LiteralData) parse(r io.Reader) (err error) {
- var buf [256]byte
-
- _, err = readFull(r, buf[:2])
- if err != nil {
- return
- }
-
- l.IsBinary = buf[0] == 'b'
- fileNameLen := int(buf[1])
-
- _, err = readFull(r, buf[:fileNameLen])
- if err != nil {
- return
- }
-
- l.FileName = string(buf[:fileNameLen])
-
- _, err = readFull(r, buf[:4])
- if err != nil {
- return
- }
-
- l.Time = binary.BigEndian.Uint32(buf[:4])
- l.Body = r
- return
-}
-
-// SerializeLiteral serializes a literal data packet to w and returns a
-// WriteCloser to which the data itself can be written and which MUST be closed
-// on completion. The fileName is truncated to 255 bytes.
-func SerializeLiteral(w io.WriteCloser, isBinary bool, fileName string, time uint32) (plaintext io.WriteCloser, err error) {
- var buf [4]byte
- buf[0] = 't'
- if isBinary {
- buf[0] = 'b'
- }
- if len(fileName) > 255 {
- fileName = fileName[:255]
- }
- buf[1] = byte(len(fileName))
-
- inner, err := serializeStreamHeader(w, packetTypeLiteralData)
- if err != nil {
- return
- }
-
- _, err = inner.Write(buf[:2])
- if err != nil {
- return
- }
- _, err = inner.Write([]byte(fileName))
- if err != nil {
- return
- }
- binary.BigEndian.PutUint32(buf[:], time)
- _, err = inner.Write(buf[:])
- if err != nil {
- return
- }
-
- plaintext = inner
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/ocfb.go b/vendor/golang.org/x/crypto/openpgp/packet/ocfb.go
deleted file mode 100644
index ce2a33a5..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/ocfb.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// OpenPGP CFB Mode. http://tools.ietf.org/html/rfc4880#section-13.9
-
-package packet
-
-import (
- "crypto/cipher"
-)
-
-type ocfbEncrypter struct {
- b cipher.Block
- fre []byte
- outUsed int
-}
-
-// An OCFBResyncOption determines if the "resynchronization step" of OCFB is
-// performed.
-type OCFBResyncOption bool
-
-const (
- OCFBResync OCFBResyncOption = true
- OCFBNoResync OCFBResyncOption = false
-)
-
-// NewOCFBEncrypter returns a cipher.Stream which encrypts data with OpenPGP's
-// cipher feedback mode using the given cipher.Block, and an initial amount of
-// ciphertext. randData must be random bytes and be the same length as the
-// cipher.Block's block size. Resync determines if the "resynchronization step"
-// from RFC 4880, 13.9 step 7 is performed. Different parts of OpenPGP vary on
-// this point.
-func NewOCFBEncrypter(block cipher.Block, randData []byte, resync OCFBResyncOption) (cipher.Stream, []byte) {
- blockSize := block.BlockSize()
- if len(randData) != blockSize {
- return nil, nil
- }
-
- x := &ocfbEncrypter{
- b: block,
- fre: make([]byte, blockSize),
- outUsed: 0,
- }
- prefix := make([]byte, blockSize+2)
-
- block.Encrypt(x.fre, x.fre)
- for i := 0; i < blockSize; i++ {
- prefix[i] = randData[i] ^ x.fre[i]
- }
-
- block.Encrypt(x.fre, prefix[:blockSize])
- prefix[blockSize] = x.fre[0] ^ randData[blockSize-2]
- prefix[blockSize+1] = x.fre[1] ^ randData[blockSize-1]
-
- if resync {
- block.Encrypt(x.fre, prefix[2:])
- } else {
- x.fre[0] = prefix[blockSize]
- x.fre[1] = prefix[blockSize+1]
- x.outUsed = 2
- }
- return x, prefix
-}
-
-func (x *ocfbEncrypter) XORKeyStream(dst, src []byte) {
- for i := 0; i < len(src); i++ {
- if x.outUsed == len(x.fre) {
- x.b.Encrypt(x.fre, x.fre)
- x.outUsed = 0
- }
-
- x.fre[x.outUsed] ^= src[i]
- dst[i] = x.fre[x.outUsed]
- x.outUsed++
- }
-}
-
-type ocfbDecrypter struct {
- b cipher.Block
- fre []byte
- outUsed int
-}
-
-// NewOCFBDecrypter returns a cipher.Stream which decrypts data with OpenPGP's
-// cipher feedback mode using the given cipher.Block. Prefix must be the first
-// blockSize + 2 bytes of the ciphertext, where blockSize is the cipher.Block's
-// block size. If an incorrect key is detected then nil is returned. On
-// successful exit, blockSize+2 bytes of decrypted data are written into
-// prefix. Resync determines if the "resynchronization step" from RFC 4880,
-// 13.9 step 7 is performed. Different parts of OpenPGP vary on this point.
-func NewOCFBDecrypter(block cipher.Block, prefix []byte, resync OCFBResyncOption) cipher.Stream {
- blockSize := block.BlockSize()
- if len(prefix) != blockSize+2 {
- return nil
- }
-
- x := &ocfbDecrypter{
- b: block,
- fre: make([]byte, blockSize),
- outUsed: 0,
- }
- prefixCopy := make([]byte, len(prefix))
- copy(prefixCopy, prefix)
-
- block.Encrypt(x.fre, x.fre)
- for i := 0; i < blockSize; i++ {
- prefixCopy[i] ^= x.fre[i]
- }
-
- block.Encrypt(x.fre, prefix[:blockSize])
- prefixCopy[blockSize] ^= x.fre[0]
- prefixCopy[blockSize+1] ^= x.fre[1]
-
- if prefixCopy[blockSize-2] != prefixCopy[blockSize] ||
- prefixCopy[blockSize-1] != prefixCopy[blockSize+1] {
- return nil
- }
-
- if resync {
- block.Encrypt(x.fre, prefix[2:])
- } else {
- x.fre[0] = prefix[blockSize]
- x.fre[1] = prefix[blockSize+1]
- x.outUsed = 2
- }
- copy(prefix, prefixCopy)
- return x
-}
-
-func (x *ocfbDecrypter) XORKeyStream(dst, src []byte) {
- for i := 0; i < len(src); i++ {
- if x.outUsed == len(x.fre) {
- x.b.Encrypt(x.fre, x.fre)
- x.outUsed = 0
- }
-
- c := src[i]
- dst[i] = x.fre[x.outUsed] ^ src[i]
- x.fre[x.outUsed] = c
- x.outUsed++
- }
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go b/vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go
deleted file mode 100644
index 17135033..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "crypto"
- "encoding/binary"
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/s2k"
- "io"
- "strconv"
-)
-
-// OnePassSignature represents a one-pass signature packet. See RFC 4880,
-// section 5.4.
-type OnePassSignature struct {
- SigType SignatureType
- Hash crypto.Hash
- PubKeyAlgo PublicKeyAlgorithm
- KeyId uint64
- IsLast bool
-}
-
-const onePassSignatureVersion = 3
-
-func (ops *OnePassSignature) parse(r io.Reader) (err error) {
- var buf [13]byte
-
- _, err = readFull(r, buf[:])
- if err != nil {
- return
- }
- if buf[0] != onePassSignatureVersion {
- err = errors.UnsupportedError("one-pass-signature packet version " + strconv.Itoa(int(buf[0])))
- }
-
- var ok bool
- ops.Hash, ok = s2k.HashIdToHash(buf[2])
- if !ok {
- return errors.UnsupportedError("hash function: " + strconv.Itoa(int(buf[2])))
- }
-
- ops.SigType = SignatureType(buf[1])
- ops.PubKeyAlgo = PublicKeyAlgorithm(buf[3])
- ops.KeyId = binary.BigEndian.Uint64(buf[4:12])
- ops.IsLast = buf[12] != 0
- return
-}
-
-// Serialize marshals the given OnePassSignature to w.
-func (ops *OnePassSignature) Serialize(w io.Writer) error {
- var buf [13]byte
- buf[0] = onePassSignatureVersion
- buf[1] = uint8(ops.SigType)
- var ok bool
- buf[2], ok = s2k.HashToHashId(ops.Hash)
- if !ok {
- return errors.UnsupportedError("hash type: " + strconv.Itoa(int(ops.Hash)))
- }
- buf[3] = uint8(ops.PubKeyAlgo)
- binary.BigEndian.PutUint64(buf[4:12], ops.KeyId)
- if ops.IsLast {
- buf[12] = 1
- }
-
- if err := serializeHeader(w, packetTypeOnePassSignature, len(buf)); err != nil {
- return err
- }
- _, err := w.Write(buf[:])
- return err
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/opaque.go b/vendor/golang.org/x/crypto/openpgp/packet/opaque.go
deleted file mode 100644
index 456d807f..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/opaque.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "io"
- "io/ioutil"
-
- "golang.org/x/crypto/openpgp/errors"
-)
-
-// OpaquePacket represents an OpenPGP packet as raw, unparsed data. This is
-// useful for splitting and storing the original packet contents separately,
-// handling unsupported packet types or accessing parts of the packet not yet
-// implemented by this package.
-type OpaquePacket struct {
- // Packet type
- Tag uint8
- // Reason why the packet was parsed opaquely
- Reason error
- // Binary contents of the packet data
- Contents []byte
-}
-
-func (op *OpaquePacket) parse(r io.Reader) (err error) {
- op.Contents, err = ioutil.ReadAll(r)
- return
-}
-
-// Serialize marshals the packet to a writer in its original form, including
-// the packet header.
-func (op *OpaquePacket) Serialize(w io.Writer) (err error) {
- err = serializeHeader(w, packetType(op.Tag), len(op.Contents))
- if err == nil {
- _, err = w.Write(op.Contents)
- }
- return
-}
-
-// Parse attempts to parse the opaque contents into a structure supported by
-// this package. If the packet is not known then the result will be another
-// OpaquePacket.
-func (op *OpaquePacket) Parse() (p Packet, err error) {
- hdr := bytes.NewBuffer(nil)
- err = serializeHeader(hdr, packetType(op.Tag), len(op.Contents))
- if err != nil {
- op.Reason = err
- return op, err
- }
- p, err = Read(io.MultiReader(hdr, bytes.NewBuffer(op.Contents)))
- if err != nil {
- op.Reason = err
- p = op
- }
- return
-}
-
-// OpaqueReader reads OpaquePackets from an io.Reader.
-type OpaqueReader struct {
- r io.Reader
-}
-
-func NewOpaqueReader(r io.Reader) *OpaqueReader {
- return &OpaqueReader{r: r}
-}
-
-// Read the next OpaquePacket.
-func (or *OpaqueReader) Next() (op *OpaquePacket, err error) {
- tag, _, contents, err := readHeader(or.r)
- if err != nil {
- return
- }
- op = &OpaquePacket{Tag: uint8(tag), Reason: err}
- err = op.parse(contents)
- if err != nil {
- consumeAll(contents)
- }
- return
-}
-
-// OpaqueSubpacket represents an unparsed OpenPGP subpacket,
-// as found in signature and user attribute packets.
-type OpaqueSubpacket struct {
- SubType uint8
- Contents []byte
-}
-
-// OpaqueSubpackets extracts opaque, unparsed OpenPGP subpackets from
-// their byte representation.
-func OpaqueSubpackets(contents []byte) (result []*OpaqueSubpacket, err error) {
- var (
- subHeaderLen int
- subPacket *OpaqueSubpacket
- )
- for len(contents) > 0 {
- subHeaderLen, subPacket, err = nextSubpacket(contents)
- if err != nil {
- break
- }
- result = append(result, subPacket)
- contents = contents[subHeaderLen+len(subPacket.Contents):]
- }
- return
-}
-
-func nextSubpacket(contents []byte) (subHeaderLen int, subPacket *OpaqueSubpacket, err error) {
- // RFC 4880, section 5.2.3.1
- var subLen uint32
- if len(contents) < 1 {
- goto Truncated
- }
- subPacket = &OpaqueSubpacket{}
- switch {
- case contents[0] < 192:
- subHeaderLen = 2 // 1 length byte, 1 subtype byte
- if len(contents) < subHeaderLen {
- goto Truncated
- }
- subLen = uint32(contents[0])
- contents = contents[1:]
- case contents[0] < 255:
- subHeaderLen = 3 // 2 length bytes, 1 subtype
- if len(contents) < subHeaderLen {
- goto Truncated
- }
- subLen = uint32(contents[0]-192)<<8 + uint32(contents[1]) + 192
- contents = contents[2:]
- default:
- subHeaderLen = 6 // 5 length bytes, 1 subtype
- if len(contents) < subHeaderLen {
- goto Truncated
- }
- subLen = uint32(contents[1])<<24 |
- uint32(contents[2])<<16 |
- uint32(contents[3])<<8 |
- uint32(contents[4])
- contents = contents[5:]
- }
- if subLen > uint32(len(contents)) || subLen == 0 {
- goto Truncated
- }
- subPacket.SubType = contents[0]
- subPacket.Contents = contents[1:subLen]
- return
-Truncated:
- err = errors.StructuralError("subpacket truncated")
- return
-}
-
-func (osp *OpaqueSubpacket) Serialize(w io.Writer) (err error) {
- buf := make([]byte, 6)
- n := serializeSubpacketLength(buf, len(osp.Contents)+1)
- buf[n] = osp.SubType
- if _, err = w.Write(buf[:n+1]); err != nil {
- return
- }
- _, err = w.Write(osp.Contents)
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/packet.go b/vendor/golang.org/x/crypto/openpgp/packet/packet.go
deleted file mode 100644
index 625bb5ac..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/packet.go
+++ /dev/null
@@ -1,549 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package packet implements parsing and serialization of OpenPGP packets, as
-// specified in RFC 4880.
-package packet // import "golang.org/x/crypto/openpgp/packet"
-
-import (
- "bufio"
- "crypto/aes"
- "crypto/cipher"
- "crypto/des"
- "crypto/rsa"
- "io"
- "math/big"
-
- "golang.org/x/crypto/cast5"
- "golang.org/x/crypto/openpgp/errors"
-)
-
-// readFull is the same as io.ReadFull except that reading zero bytes returns
-// ErrUnexpectedEOF rather than EOF.
-func readFull(r io.Reader, buf []byte) (n int, err error) {
- n, err = io.ReadFull(r, buf)
- if err == io.EOF {
- err = io.ErrUnexpectedEOF
- }
- return
-}
-
-// readLength reads an OpenPGP length from r. See RFC 4880, section 4.2.2.
-func readLength(r io.Reader) (length int64, isPartial bool, err error) {
- var buf [4]byte
- _, err = readFull(r, buf[:1])
- if err != nil {
- return
- }
- switch {
- case buf[0] < 192:
- length = int64(buf[0])
- case buf[0] < 224:
- length = int64(buf[0]-192) << 8
- _, err = readFull(r, buf[0:1])
- if err != nil {
- return
- }
- length += int64(buf[0]) + 192
- case buf[0] < 255:
- length = int64(1) << (buf[0] & 0x1f)
- isPartial = true
- default:
- _, err = readFull(r, buf[0:4])
- if err != nil {
- return
- }
- length = int64(buf[0])<<24 |
- int64(buf[1])<<16 |
- int64(buf[2])<<8 |
- int64(buf[3])
- }
- return
-}
-
-// partialLengthReader wraps an io.Reader and handles OpenPGP partial lengths.
-// The continuation lengths are parsed and removed from the stream and EOF is
-// returned at the end of the packet. See RFC 4880, section 4.2.2.4.
-type partialLengthReader struct {
- r io.Reader
- remaining int64
- isPartial bool
-}
-
-func (r *partialLengthReader) Read(p []byte) (n int, err error) {
- for r.remaining == 0 {
- if !r.isPartial {
- return 0, io.EOF
- }
- r.remaining, r.isPartial, err = readLength(r.r)
- if err != nil {
- return 0, err
- }
- }
-
- toRead := int64(len(p))
- if toRead > r.remaining {
- toRead = r.remaining
- }
-
- n, err = r.r.Read(p[:int(toRead)])
- r.remaining -= int64(n)
- if n < int(toRead) && err == io.EOF {
- err = io.ErrUnexpectedEOF
- }
- return
-}
-
-// partialLengthWriter writes a stream of data using OpenPGP partial lengths.
-// See RFC 4880, section 4.2.2.4.
-type partialLengthWriter struct {
- w io.WriteCloser
- lengthByte [1]byte
-}
-
-func (w *partialLengthWriter) Write(p []byte) (n int, err error) {
- for len(p) > 0 {
- for power := uint(14); power < 32; power-- {
- l := 1 << power
- if len(p) >= l {
- w.lengthByte[0] = 224 + uint8(power)
- _, err = w.w.Write(w.lengthByte[:])
- if err != nil {
- return
- }
- var m int
- m, err = w.w.Write(p[:l])
- n += m
- if err != nil {
- return
- }
- p = p[l:]
- break
- }
- }
- }
- return
-}
-
-func (w *partialLengthWriter) Close() error {
- w.lengthByte[0] = 0
- _, err := w.w.Write(w.lengthByte[:])
- if err != nil {
- return err
- }
- return w.w.Close()
-}
-
-// A spanReader is an io.LimitReader, but it returns ErrUnexpectedEOF if the
-// underlying Reader returns EOF before the limit has been reached.
-type spanReader struct {
- r io.Reader
- n int64
-}
-
-func (l *spanReader) Read(p []byte) (n int, err error) {
- if l.n <= 0 {
- return 0, io.EOF
- }
- if int64(len(p)) > l.n {
- p = p[0:l.n]
- }
- n, err = l.r.Read(p)
- l.n -= int64(n)
- if l.n > 0 && err == io.EOF {
- err = io.ErrUnexpectedEOF
- }
- return
-}
-
-// readHeader parses a packet header and returns an io.Reader which will return
-// the contents of the packet. See RFC 4880, section 4.2.
-func readHeader(r io.Reader) (tag packetType, length int64, contents io.Reader, err error) {
- var buf [4]byte
- _, err = io.ReadFull(r, buf[:1])
- if err != nil {
- return
- }
- if buf[0]&0x80 == 0 {
- err = errors.StructuralError("tag byte does not have MSB set")
- return
- }
- if buf[0]&0x40 == 0 {
- // Old format packet
- tag = packetType((buf[0] & 0x3f) >> 2)
- lengthType := buf[0] & 3
- if lengthType == 3 {
- length = -1
- contents = r
- return
- }
- lengthBytes := 1 << lengthType
- _, err = readFull(r, buf[0:lengthBytes])
- if err != nil {
- return
- }
- for i := 0; i < lengthBytes; i++ {
- length <<= 8
- length |= int64(buf[i])
- }
- contents = &spanReader{r, length}
- return
- }
-
- // New format packet
- tag = packetType(buf[0] & 0x3f)
- length, isPartial, err := readLength(r)
- if err != nil {
- return
- }
- if isPartial {
- contents = &partialLengthReader{
- remaining: length,
- isPartial: true,
- r: r,
- }
- length = -1
- } else {
- contents = &spanReader{r, length}
- }
- return
-}
-
-// serializeHeader writes an OpenPGP packet header to w. See RFC 4880, section
-// 4.2.
-func serializeHeader(w io.Writer, ptype packetType, length int) (err error) {
- var buf [6]byte
- var n int
-
- buf[0] = 0x80 | 0x40 | byte(ptype)
- if length < 192 {
- buf[1] = byte(length)
- n = 2
- } else if length < 8384 {
- length -= 192
- buf[1] = 192 + byte(length>>8)
- buf[2] = byte(length)
- n = 3
- } else {
- buf[1] = 255
- buf[2] = byte(length >> 24)
- buf[3] = byte(length >> 16)
- buf[4] = byte(length >> 8)
- buf[5] = byte(length)
- n = 6
- }
-
- _, err = w.Write(buf[:n])
- return
-}
-
-// serializeStreamHeader writes an OpenPGP packet header to w where the
-// length of the packet is unknown. It returns a io.WriteCloser which can be
-// used to write the contents of the packet. See RFC 4880, section 4.2.
-func serializeStreamHeader(w io.WriteCloser, ptype packetType) (out io.WriteCloser, err error) {
- var buf [1]byte
- buf[0] = 0x80 | 0x40 | byte(ptype)
- _, err = w.Write(buf[:])
- if err != nil {
- return
- }
- out = &partialLengthWriter{w: w}
- return
-}
-
-// Packet represents an OpenPGP packet. Users are expected to try casting
-// instances of this interface to specific packet types.
-type Packet interface {
- parse(io.Reader) error
-}
-
-// consumeAll reads from the given Reader until error, returning the number of
-// bytes read.
-func consumeAll(r io.Reader) (n int64, err error) {
- var m int
- var buf [1024]byte
-
- for {
- m, err = r.Read(buf[:])
- n += int64(m)
- if err == io.EOF {
- err = nil
- return
- }
- if err != nil {
- return
- }
- }
-}
-
-// packetType represents the numeric ids of the different OpenPGP packet types. See
-// http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-2
-type packetType uint8
-
-const (
- packetTypeEncryptedKey packetType = 1
- packetTypeSignature packetType = 2
- packetTypeSymmetricKeyEncrypted packetType = 3
- packetTypeOnePassSignature packetType = 4
- packetTypePrivateKey packetType = 5
- packetTypePublicKey packetType = 6
- packetTypePrivateSubkey packetType = 7
- packetTypeCompressed packetType = 8
- packetTypeSymmetricallyEncrypted packetType = 9
- packetTypeLiteralData packetType = 11
- packetTypeUserId packetType = 13
- packetTypePublicSubkey packetType = 14
- packetTypeUserAttribute packetType = 17
- packetTypeSymmetricallyEncryptedMDC packetType = 18
-)
-
-// peekVersion detects the version of a public key packet about to
-// be read. A bufio.Reader at the original position of the io.Reader
-// is returned.
-func peekVersion(r io.Reader) (bufr *bufio.Reader, ver byte, err error) {
- bufr = bufio.NewReader(r)
- var verBuf []byte
- if verBuf, err = bufr.Peek(1); err != nil {
- return
- }
- ver = verBuf[0]
- return
-}
-
-// Read reads a single OpenPGP packet from the given io.Reader. If there is an
-// error parsing a packet, the whole packet is consumed from the input.
-func Read(r io.Reader) (p Packet, err error) {
- tag, _, contents, err := readHeader(r)
- if err != nil {
- return
- }
-
- switch tag {
- case packetTypeEncryptedKey:
- p = new(EncryptedKey)
- case packetTypeSignature:
- var version byte
- // Detect signature version
- if contents, version, err = peekVersion(contents); err != nil {
- return
- }
- if version < 4 {
- p = new(SignatureV3)
- } else {
- p = new(Signature)
- }
- case packetTypeSymmetricKeyEncrypted:
- p = new(SymmetricKeyEncrypted)
- case packetTypeOnePassSignature:
- p = new(OnePassSignature)
- case packetTypePrivateKey, packetTypePrivateSubkey:
- pk := new(PrivateKey)
- if tag == packetTypePrivateSubkey {
- pk.IsSubkey = true
- }
- p = pk
- case packetTypePublicKey, packetTypePublicSubkey:
- var version byte
- if contents, version, err = peekVersion(contents); err != nil {
- return
- }
- isSubkey := tag == packetTypePublicSubkey
- if version < 4 {
- p = &PublicKeyV3{IsSubkey: isSubkey}
- } else {
- p = &PublicKey{IsSubkey: isSubkey}
- }
- case packetTypeCompressed:
- p = new(Compressed)
- case packetTypeSymmetricallyEncrypted:
- p = new(SymmetricallyEncrypted)
- case packetTypeLiteralData:
- p = new(LiteralData)
- case packetTypeUserId:
- p = new(UserId)
- case packetTypeUserAttribute:
- p = new(UserAttribute)
- case packetTypeSymmetricallyEncryptedMDC:
- se := new(SymmetricallyEncrypted)
- se.MDC = true
- p = se
- default:
- err = errors.UnknownPacketTypeError(tag)
- }
- if p != nil {
- err = p.parse(contents)
- }
- if err != nil {
- consumeAll(contents)
- }
- return
-}
-
-// SignatureType represents the different semantic meanings of an OpenPGP
-// signature. See RFC 4880, section 5.2.1.
-type SignatureType uint8
-
-const (
- SigTypeBinary SignatureType = 0
- SigTypeText = 1
- SigTypeGenericCert = 0x10
- SigTypePersonaCert = 0x11
- SigTypeCasualCert = 0x12
- SigTypePositiveCert = 0x13
- SigTypeSubkeyBinding = 0x18
- SigTypePrimaryKeyBinding = 0x19
- SigTypeDirectSignature = 0x1F
- SigTypeKeyRevocation = 0x20
- SigTypeSubkeyRevocation = 0x28
-)
-
-// PublicKeyAlgorithm represents the different public key system specified for
-// OpenPGP. See
-// http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-12
-type PublicKeyAlgorithm uint8
-
-const (
- PubKeyAlgoRSA PublicKeyAlgorithm = 1
- PubKeyAlgoRSAEncryptOnly PublicKeyAlgorithm = 2
- PubKeyAlgoRSASignOnly PublicKeyAlgorithm = 3
- PubKeyAlgoElGamal PublicKeyAlgorithm = 16
- PubKeyAlgoDSA PublicKeyAlgorithm = 17
- // RFC 6637, Section 5.
- PubKeyAlgoECDH PublicKeyAlgorithm = 18
- PubKeyAlgoECDSA PublicKeyAlgorithm = 19
-)
-
-// CanEncrypt returns true if it's possible to encrypt a message to a public
-// key of the given type.
-func (pka PublicKeyAlgorithm) CanEncrypt() bool {
- switch pka {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoElGamal:
- return true
- }
- return false
-}
-
-// CanSign returns true if it's possible for a public key of the given type to
-// sign a message.
-func (pka PublicKeyAlgorithm) CanSign() bool {
- switch pka {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoDSA, PubKeyAlgoECDSA:
- return true
- }
- return false
-}
-
-// CipherFunction represents the different block ciphers specified for OpenPGP. See
-// http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-13
-type CipherFunction uint8
-
-const (
- Cipher3DES CipherFunction = 2
- CipherCAST5 CipherFunction = 3
- CipherAES128 CipherFunction = 7
- CipherAES192 CipherFunction = 8
- CipherAES256 CipherFunction = 9
-)
-
-// KeySize returns the key size, in bytes, of cipher.
-func (cipher CipherFunction) KeySize() int {
- switch cipher {
- case Cipher3DES:
- return 24
- case CipherCAST5:
- return cast5.KeySize
- case CipherAES128:
- return 16
- case CipherAES192:
- return 24
- case CipherAES256:
- return 32
- }
- return 0
-}
-
-// blockSize returns the block size, in bytes, of cipher.
-func (cipher CipherFunction) blockSize() int {
- switch cipher {
- case Cipher3DES:
- return des.BlockSize
- case CipherCAST5:
- return 8
- case CipherAES128, CipherAES192, CipherAES256:
- return 16
- }
- return 0
-}
-
-// new returns a fresh instance of the given cipher.
-func (cipher CipherFunction) new(key []byte) (block cipher.Block) {
- switch cipher {
- case Cipher3DES:
- block, _ = des.NewTripleDESCipher(key)
- case CipherCAST5:
- block, _ = cast5.NewCipher(key)
- case CipherAES128, CipherAES192, CipherAES256:
- block, _ = aes.NewCipher(key)
- }
- return
-}
-
-// readMPI reads a big integer from r. The bit length returned is the bit
-// length that was specified in r. This is preserved so that the integer can be
-// reserialized exactly.
-func readMPI(r io.Reader) (mpi []byte, bitLength uint16, err error) {
- var buf [2]byte
- _, err = readFull(r, buf[0:])
- if err != nil {
- return
- }
- bitLength = uint16(buf[0])<<8 | uint16(buf[1])
- numBytes := (int(bitLength) + 7) / 8
- mpi = make([]byte, numBytes)
- _, err = readFull(r, mpi)
- // According to RFC 4880 3.2. we should check that the MPI has no leading
- // zeroes (at least when not an encrypted MPI?), but this implementation
- // does generate leading zeroes, so we keep accepting them.
- return
-}
-
-// writeMPI serializes a big integer to w.
-func writeMPI(w io.Writer, bitLength uint16, mpiBytes []byte) (err error) {
- // Note that we can produce leading zeroes, in violation of RFC 4880 3.2.
- // Implementations seem to be tolerant of them, and stripping them would
- // make it complex to guarantee matching re-serialization.
- _, err = w.Write([]byte{byte(bitLength >> 8), byte(bitLength)})
- if err == nil {
- _, err = w.Write(mpiBytes)
- }
- return
-}
-
-// writeBig serializes a *big.Int to w.
-func writeBig(w io.Writer, i *big.Int) error {
- return writeMPI(w, uint16(i.BitLen()), i.Bytes())
-}
-
-// padToKeySize left-pads a MPI with zeroes to match the length of the
-// specified RSA public.
-func padToKeySize(pub *rsa.PublicKey, b []byte) []byte {
- k := (pub.N.BitLen() + 7) / 8
- if len(b) >= k {
- return b
- }
- bb := make([]byte, k)
- copy(bb[len(bb)-len(b):], b)
- return bb
-}
-
-// CompressionAlgo Represents the different compression algorithms
-// supported by OpenPGP (except for BZIP2, which is not currently
-// supported). See Section 9.3 of RFC 4880.
-type CompressionAlgo uint8
-
-const (
- CompressionNone CompressionAlgo = 0
- CompressionZIP CompressionAlgo = 1
- CompressionZLIB CompressionAlgo = 2
-)
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/private_key.go b/vendor/golang.org/x/crypto/openpgp/packet/private_key.go
deleted file mode 100644
index 34734cc6..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/private_key.go
+++ /dev/null
@@ -1,380 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto"
- "crypto/cipher"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/rsa"
- "crypto/sha1"
- "io"
- "io/ioutil"
- "math/big"
- "strconv"
- "time"
-
- "golang.org/x/crypto/openpgp/elgamal"
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/s2k"
-)
-
-// PrivateKey represents a possibly encrypted private key. See RFC 4880,
-// section 5.5.3.
-type PrivateKey struct {
- PublicKey
- Encrypted bool // if true then the private key is unavailable until Decrypt has been called.
- encryptedData []byte
- cipher CipherFunction
- s2k func(out, in []byte)
- PrivateKey interface{} // An *{rsa|dsa|ecdsa}.PrivateKey or a crypto.Signer.
- sha1Checksum bool
- iv []byte
-}
-
-func NewRSAPrivateKey(currentTime time.Time, priv *rsa.PrivateKey) *PrivateKey {
- pk := new(PrivateKey)
- pk.PublicKey = *NewRSAPublicKey(currentTime, &priv.PublicKey)
- pk.PrivateKey = priv
- return pk
-}
-
-func NewDSAPrivateKey(currentTime time.Time, priv *dsa.PrivateKey) *PrivateKey {
- pk := new(PrivateKey)
- pk.PublicKey = *NewDSAPublicKey(currentTime, &priv.PublicKey)
- pk.PrivateKey = priv
- return pk
-}
-
-func NewElGamalPrivateKey(currentTime time.Time, priv *elgamal.PrivateKey) *PrivateKey {
- pk := new(PrivateKey)
- pk.PublicKey = *NewElGamalPublicKey(currentTime, &priv.PublicKey)
- pk.PrivateKey = priv
- return pk
-}
-
-func NewECDSAPrivateKey(currentTime time.Time, priv *ecdsa.PrivateKey) *PrivateKey {
- pk := new(PrivateKey)
- pk.PublicKey = *NewECDSAPublicKey(currentTime, &priv.PublicKey)
- pk.PrivateKey = priv
- return pk
-}
-
-// NewSignerPrivateKey creates a sign-only PrivateKey from a crypto.Signer that
-// implements RSA or ECDSA.
-func NewSignerPrivateKey(currentTime time.Time, signer crypto.Signer) *PrivateKey {
- pk := new(PrivateKey)
- switch pubkey := signer.Public().(type) {
- case rsa.PublicKey:
- pk.PublicKey = *NewRSAPublicKey(currentTime, &pubkey)
- pk.PubKeyAlgo = PubKeyAlgoRSASignOnly
- case ecdsa.PublicKey:
- pk.PublicKey = *NewECDSAPublicKey(currentTime, &pubkey)
- default:
- panic("openpgp: unknown crypto.Signer type in NewSignerPrivateKey")
- }
- pk.PrivateKey = signer
- return pk
-}
-
-func (pk *PrivateKey) parse(r io.Reader) (err error) {
- err = (&pk.PublicKey).parse(r)
- if err != nil {
- return
- }
- var buf [1]byte
- _, err = readFull(r, buf[:])
- if err != nil {
- return
- }
-
- s2kType := buf[0]
-
- switch s2kType {
- case 0:
- pk.s2k = nil
- pk.Encrypted = false
- case 254, 255:
- _, err = readFull(r, buf[:])
- if err != nil {
- return
- }
- pk.cipher = CipherFunction(buf[0])
- pk.Encrypted = true
- pk.s2k, err = s2k.Parse(r)
- if err != nil {
- return
- }
- if s2kType == 254 {
- pk.sha1Checksum = true
- }
- default:
- return errors.UnsupportedError("deprecated s2k function in private key")
- }
-
- if pk.Encrypted {
- blockSize := pk.cipher.blockSize()
- if blockSize == 0 {
- return errors.UnsupportedError("unsupported cipher in private key: " + strconv.Itoa(int(pk.cipher)))
- }
- pk.iv = make([]byte, blockSize)
- _, err = readFull(r, pk.iv)
- if err != nil {
- return
- }
- }
-
- pk.encryptedData, err = ioutil.ReadAll(r)
- if err != nil {
- return
- }
-
- if !pk.Encrypted {
- return pk.parsePrivateKey(pk.encryptedData)
- }
-
- return
-}
-
-func mod64kHash(d []byte) uint16 {
- var h uint16
- for _, b := range d {
- h += uint16(b)
- }
- return h
-}
-
-func (pk *PrivateKey) Serialize(w io.Writer) (err error) {
- // TODO(agl): support encrypted private keys
- buf := bytes.NewBuffer(nil)
- err = pk.PublicKey.serializeWithoutHeaders(buf)
- if err != nil {
- return
- }
- buf.WriteByte(0 /* no encryption */)
-
- privateKeyBuf := bytes.NewBuffer(nil)
-
- switch priv := pk.PrivateKey.(type) {
- case *rsa.PrivateKey:
- err = serializeRSAPrivateKey(privateKeyBuf, priv)
- case *dsa.PrivateKey:
- err = serializeDSAPrivateKey(privateKeyBuf, priv)
- case *elgamal.PrivateKey:
- err = serializeElGamalPrivateKey(privateKeyBuf, priv)
- case *ecdsa.PrivateKey:
- err = serializeECDSAPrivateKey(privateKeyBuf, priv)
- default:
- err = errors.InvalidArgumentError("unknown private key type")
- }
- if err != nil {
- return
- }
-
- ptype := packetTypePrivateKey
- contents := buf.Bytes()
- privateKeyBytes := privateKeyBuf.Bytes()
- if pk.IsSubkey {
- ptype = packetTypePrivateSubkey
- }
- err = serializeHeader(w, ptype, len(contents)+len(privateKeyBytes)+2)
- if err != nil {
- return
- }
- _, err = w.Write(contents)
- if err != nil {
- return
- }
- _, err = w.Write(privateKeyBytes)
- if err != nil {
- return
- }
-
- checksum := mod64kHash(privateKeyBytes)
- var checksumBytes [2]byte
- checksumBytes[0] = byte(checksum >> 8)
- checksumBytes[1] = byte(checksum)
- _, err = w.Write(checksumBytes[:])
-
- return
-}
-
-func serializeRSAPrivateKey(w io.Writer, priv *rsa.PrivateKey) error {
- err := writeBig(w, priv.D)
- if err != nil {
- return err
- }
- err = writeBig(w, priv.Primes[1])
- if err != nil {
- return err
- }
- err = writeBig(w, priv.Primes[0])
- if err != nil {
- return err
- }
- return writeBig(w, priv.Precomputed.Qinv)
-}
-
-func serializeDSAPrivateKey(w io.Writer, priv *dsa.PrivateKey) error {
- return writeBig(w, priv.X)
-}
-
-func serializeElGamalPrivateKey(w io.Writer, priv *elgamal.PrivateKey) error {
- return writeBig(w, priv.X)
-}
-
-func serializeECDSAPrivateKey(w io.Writer, priv *ecdsa.PrivateKey) error {
- return writeBig(w, priv.D)
-}
-
-// Decrypt decrypts an encrypted private key using a passphrase.
-func (pk *PrivateKey) Decrypt(passphrase []byte) error {
- if !pk.Encrypted {
- return nil
- }
-
- key := make([]byte, pk.cipher.KeySize())
- pk.s2k(key, passphrase)
- block := pk.cipher.new(key)
- cfb := cipher.NewCFBDecrypter(block, pk.iv)
-
- data := make([]byte, len(pk.encryptedData))
- cfb.XORKeyStream(data, pk.encryptedData)
-
- if pk.sha1Checksum {
- if len(data) < sha1.Size {
- return errors.StructuralError("truncated private key data")
- }
- h := sha1.New()
- h.Write(data[:len(data)-sha1.Size])
- sum := h.Sum(nil)
- if !bytes.Equal(sum, data[len(data)-sha1.Size:]) {
- return errors.StructuralError("private key checksum failure")
- }
- data = data[:len(data)-sha1.Size]
- } else {
- if len(data) < 2 {
- return errors.StructuralError("truncated private key data")
- }
- var sum uint16
- for i := 0; i < len(data)-2; i++ {
- sum += uint16(data[i])
- }
- if data[len(data)-2] != uint8(sum>>8) ||
- data[len(data)-1] != uint8(sum) {
- return errors.StructuralError("private key checksum failure")
- }
- data = data[:len(data)-2]
- }
-
- return pk.parsePrivateKey(data)
-}
-
-func (pk *PrivateKey) parsePrivateKey(data []byte) (err error) {
- switch pk.PublicKey.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoRSAEncryptOnly:
- return pk.parseRSAPrivateKey(data)
- case PubKeyAlgoDSA:
- return pk.parseDSAPrivateKey(data)
- case PubKeyAlgoElGamal:
- return pk.parseElGamalPrivateKey(data)
- case PubKeyAlgoECDSA:
- return pk.parseECDSAPrivateKey(data)
- }
- panic("impossible")
-}
-
-func (pk *PrivateKey) parseRSAPrivateKey(data []byte) (err error) {
- rsaPub := pk.PublicKey.PublicKey.(*rsa.PublicKey)
- rsaPriv := new(rsa.PrivateKey)
- rsaPriv.PublicKey = *rsaPub
-
- buf := bytes.NewBuffer(data)
- d, _, err := readMPI(buf)
- if err != nil {
- return
- }
- p, _, err := readMPI(buf)
- if err != nil {
- return
- }
- q, _, err := readMPI(buf)
- if err != nil {
- return
- }
-
- rsaPriv.D = new(big.Int).SetBytes(d)
- rsaPriv.Primes = make([]*big.Int, 2)
- rsaPriv.Primes[0] = new(big.Int).SetBytes(p)
- rsaPriv.Primes[1] = new(big.Int).SetBytes(q)
- if err := rsaPriv.Validate(); err != nil {
- return err
- }
- rsaPriv.Precompute()
- pk.PrivateKey = rsaPriv
- pk.Encrypted = false
- pk.encryptedData = nil
-
- return nil
-}
-
-func (pk *PrivateKey) parseDSAPrivateKey(data []byte) (err error) {
- dsaPub := pk.PublicKey.PublicKey.(*dsa.PublicKey)
- dsaPriv := new(dsa.PrivateKey)
- dsaPriv.PublicKey = *dsaPub
-
- buf := bytes.NewBuffer(data)
- x, _, err := readMPI(buf)
- if err != nil {
- return
- }
-
- dsaPriv.X = new(big.Int).SetBytes(x)
- pk.PrivateKey = dsaPriv
- pk.Encrypted = false
- pk.encryptedData = nil
-
- return nil
-}
-
-func (pk *PrivateKey) parseElGamalPrivateKey(data []byte) (err error) {
- pub := pk.PublicKey.PublicKey.(*elgamal.PublicKey)
- priv := new(elgamal.PrivateKey)
- priv.PublicKey = *pub
-
- buf := bytes.NewBuffer(data)
- x, _, err := readMPI(buf)
- if err != nil {
- return
- }
-
- priv.X = new(big.Int).SetBytes(x)
- pk.PrivateKey = priv
- pk.Encrypted = false
- pk.encryptedData = nil
-
- return nil
-}
-
-func (pk *PrivateKey) parseECDSAPrivateKey(data []byte) (err error) {
- ecdsaPub := pk.PublicKey.PublicKey.(*ecdsa.PublicKey)
-
- buf := bytes.NewBuffer(data)
- d, _, err := readMPI(buf)
- if err != nil {
- return
- }
-
- pk.PrivateKey = &ecdsa.PrivateKey{
- PublicKey: *ecdsaPub,
- D: new(big.Int).SetBytes(d),
- }
- pk.Encrypted = false
- pk.encryptedData = nil
-
- return nil
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/public_key.go b/vendor/golang.org/x/crypto/openpgp/packet/public_key.go
deleted file mode 100644
index fcd5f525..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/public_key.go
+++ /dev/null
@@ -1,753 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rsa"
- "crypto/sha1"
- _ "crypto/sha256"
- _ "crypto/sha512"
- "encoding/binary"
- "fmt"
- "hash"
- "io"
- "math/big"
- "strconv"
- "time"
-
- "golang.org/x/crypto/openpgp/elgamal"
- "golang.org/x/crypto/openpgp/errors"
-)
-
-var (
- // NIST curve P-256
- oidCurveP256 []byte = []byte{0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07}
- // NIST curve P-384
- oidCurveP384 []byte = []byte{0x2B, 0x81, 0x04, 0x00, 0x22}
- // NIST curve P-521
- oidCurveP521 []byte = []byte{0x2B, 0x81, 0x04, 0x00, 0x23}
-)
-
-const maxOIDLength = 8
-
-// ecdsaKey stores the algorithm-specific fields for ECDSA keys.
-// as defined in RFC 6637, Section 9.
-type ecdsaKey struct {
- // oid contains the OID byte sequence identifying the elliptic curve used
- oid []byte
- // p contains the elliptic curve point that represents the public key
- p parsedMPI
-}
-
-// parseOID reads the OID for the curve as defined in RFC 6637, Section 9.
-func parseOID(r io.Reader) (oid []byte, err error) {
- buf := make([]byte, maxOIDLength)
- if _, err = readFull(r, buf[:1]); err != nil {
- return
- }
- oidLen := buf[0]
- if int(oidLen) > len(buf) {
- err = errors.UnsupportedError("invalid oid length: " + strconv.Itoa(int(oidLen)))
- return
- }
- oid = buf[:oidLen]
- _, err = readFull(r, oid)
- return
-}
-
-func (f *ecdsaKey) parse(r io.Reader) (err error) {
- if f.oid, err = parseOID(r); err != nil {
- return err
- }
- f.p.bytes, f.p.bitLength, err = readMPI(r)
- return
-}
-
-func (f *ecdsaKey) serialize(w io.Writer) (err error) {
- buf := make([]byte, maxOIDLength+1)
- buf[0] = byte(len(f.oid))
- copy(buf[1:], f.oid)
- if _, err = w.Write(buf[:len(f.oid)+1]); err != nil {
- return
- }
- return writeMPIs(w, f.p)
-}
-
-func (f *ecdsaKey) newECDSA() (*ecdsa.PublicKey, error) {
- var c elliptic.Curve
- if bytes.Equal(f.oid, oidCurveP256) {
- c = elliptic.P256()
- } else if bytes.Equal(f.oid, oidCurveP384) {
- c = elliptic.P384()
- } else if bytes.Equal(f.oid, oidCurveP521) {
- c = elliptic.P521()
- } else {
- return nil, errors.UnsupportedError(fmt.Sprintf("unsupported oid: %x", f.oid))
- }
- x, y := elliptic.Unmarshal(c, f.p.bytes)
- if x == nil {
- return nil, errors.UnsupportedError("failed to parse EC point")
- }
- return &ecdsa.PublicKey{Curve: c, X: x, Y: y}, nil
-}
-
-func (f *ecdsaKey) byteLen() int {
- return 1 + len(f.oid) + 2 + len(f.p.bytes)
-}
-
-type kdfHashFunction byte
-type kdfAlgorithm byte
-
-// ecdhKdf stores key derivation function parameters
-// used for ECDH encryption. See RFC 6637, Section 9.
-type ecdhKdf struct {
- KdfHash kdfHashFunction
- KdfAlgo kdfAlgorithm
-}
-
-func (f *ecdhKdf) parse(r io.Reader) (err error) {
- buf := make([]byte, 1)
- if _, err = readFull(r, buf); err != nil {
- return
- }
- kdfLen := int(buf[0])
- if kdfLen < 3 {
- return errors.UnsupportedError("Unsupported ECDH KDF length: " + strconv.Itoa(kdfLen))
- }
- buf = make([]byte, kdfLen)
- if _, err = readFull(r, buf); err != nil {
- return
- }
- reserved := int(buf[0])
- f.KdfHash = kdfHashFunction(buf[1])
- f.KdfAlgo = kdfAlgorithm(buf[2])
- if reserved != 0x01 {
- return errors.UnsupportedError("Unsupported KDF reserved field: " + strconv.Itoa(reserved))
- }
- return
-}
-
-func (f *ecdhKdf) serialize(w io.Writer) (err error) {
- buf := make([]byte, 4)
- // See RFC 6637, Section 9, Algorithm-Specific Fields for ECDH keys.
- buf[0] = byte(0x03) // Length of the following fields
- buf[1] = byte(0x01) // Reserved for future extensions, must be 1 for now
- buf[2] = byte(f.KdfHash)
- buf[3] = byte(f.KdfAlgo)
- _, err = w.Write(buf[:])
- return
-}
-
-func (f *ecdhKdf) byteLen() int {
- return 4
-}
-
-// PublicKey represents an OpenPGP public key. See RFC 4880, section 5.5.2.
-type PublicKey struct {
- CreationTime time.Time
- PubKeyAlgo PublicKeyAlgorithm
- PublicKey interface{} // *rsa.PublicKey, *dsa.PublicKey or *ecdsa.PublicKey
- Fingerprint [20]byte
- KeyId uint64
- IsSubkey bool
-
- n, e, p, q, g, y parsedMPI
-
- // RFC 6637 fields
- ec *ecdsaKey
- ecdh *ecdhKdf
-}
-
-// signingKey provides a convenient abstraction over signature verification
-// for v3 and v4 public keys.
-type signingKey interface {
- SerializeSignaturePrefix(io.Writer)
- serializeWithoutHeaders(io.Writer) error
-}
-
-func fromBig(n *big.Int) parsedMPI {
- return parsedMPI{
- bytes: n.Bytes(),
- bitLength: uint16(n.BitLen()),
- }
-}
-
-// NewRSAPublicKey returns a PublicKey that wraps the given rsa.PublicKey.
-func NewRSAPublicKey(creationTime time.Time, pub *rsa.PublicKey) *PublicKey {
- pk := &PublicKey{
- CreationTime: creationTime,
- PubKeyAlgo: PubKeyAlgoRSA,
- PublicKey: pub,
- n: fromBig(pub.N),
- e: fromBig(big.NewInt(int64(pub.E))),
- }
-
- pk.setFingerPrintAndKeyId()
- return pk
-}
-
-// NewDSAPublicKey returns a PublicKey that wraps the given dsa.PublicKey.
-func NewDSAPublicKey(creationTime time.Time, pub *dsa.PublicKey) *PublicKey {
- pk := &PublicKey{
- CreationTime: creationTime,
- PubKeyAlgo: PubKeyAlgoDSA,
- PublicKey: pub,
- p: fromBig(pub.P),
- q: fromBig(pub.Q),
- g: fromBig(pub.G),
- y: fromBig(pub.Y),
- }
-
- pk.setFingerPrintAndKeyId()
- return pk
-}
-
-// NewElGamalPublicKey returns a PublicKey that wraps the given elgamal.PublicKey.
-func NewElGamalPublicKey(creationTime time.Time, pub *elgamal.PublicKey) *PublicKey {
- pk := &PublicKey{
- CreationTime: creationTime,
- PubKeyAlgo: PubKeyAlgoElGamal,
- PublicKey: pub,
- p: fromBig(pub.P),
- g: fromBig(pub.G),
- y: fromBig(pub.Y),
- }
-
- pk.setFingerPrintAndKeyId()
- return pk
-}
-
-func NewECDSAPublicKey(creationTime time.Time, pub *ecdsa.PublicKey) *PublicKey {
- pk := &PublicKey{
- CreationTime: creationTime,
- PubKeyAlgo: PubKeyAlgoECDSA,
- PublicKey: pub,
- ec: new(ecdsaKey),
- }
-
- switch pub.Curve {
- case elliptic.P256():
- pk.ec.oid = oidCurveP256
- case elliptic.P384():
- pk.ec.oid = oidCurveP384
- case elliptic.P521():
- pk.ec.oid = oidCurveP521
- default:
- panic("unknown elliptic curve")
- }
-
- pk.ec.p.bytes = elliptic.Marshal(pub.Curve, pub.X, pub.Y)
-
- // The bit length is 3 (for the 0x04 specifying an uncompressed key)
- // plus two field elements (for x and y), which are rounded up to the
- // nearest byte. See https://tools.ietf.org/html/rfc6637#section-6
- fieldBytes := (pub.Curve.Params().BitSize + 7) & ^7
- pk.ec.p.bitLength = uint16(3 + fieldBytes + fieldBytes)
-
- pk.setFingerPrintAndKeyId()
- return pk
-}
-
-func (pk *PublicKey) parse(r io.Reader) (err error) {
- // RFC 4880, section 5.5.2
- var buf [6]byte
- _, err = readFull(r, buf[:])
- if err != nil {
- return
- }
- if buf[0] != 4 {
- return errors.UnsupportedError("public key version")
- }
- pk.CreationTime = time.Unix(int64(uint32(buf[1])<<24|uint32(buf[2])<<16|uint32(buf[3])<<8|uint32(buf[4])), 0)
- pk.PubKeyAlgo = PublicKeyAlgorithm(buf[5])
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- err = pk.parseRSA(r)
- case PubKeyAlgoDSA:
- err = pk.parseDSA(r)
- case PubKeyAlgoElGamal:
- err = pk.parseElGamal(r)
- case PubKeyAlgoECDSA:
- pk.ec = new(ecdsaKey)
- if err = pk.ec.parse(r); err != nil {
- return err
- }
- pk.PublicKey, err = pk.ec.newECDSA()
- case PubKeyAlgoECDH:
- pk.ec = new(ecdsaKey)
- if err = pk.ec.parse(r); err != nil {
- return
- }
- pk.ecdh = new(ecdhKdf)
- if err = pk.ecdh.parse(r); err != nil {
- return
- }
- // The ECDH key is stored in an ecdsa.PublicKey for convenience.
- pk.PublicKey, err = pk.ec.newECDSA()
- default:
- err = errors.UnsupportedError("public key type: " + strconv.Itoa(int(pk.PubKeyAlgo)))
- }
- if err != nil {
- return
- }
-
- pk.setFingerPrintAndKeyId()
- return
-}
-
-func (pk *PublicKey) setFingerPrintAndKeyId() {
- // RFC 4880, section 12.2
- fingerPrint := sha1.New()
- pk.SerializeSignaturePrefix(fingerPrint)
- pk.serializeWithoutHeaders(fingerPrint)
- copy(pk.Fingerprint[:], fingerPrint.Sum(nil))
- pk.KeyId = binary.BigEndian.Uint64(pk.Fingerprint[12:20])
-}
-
-// parseRSA parses RSA public key material from the given Reader. See RFC 4880,
-// section 5.5.2.
-func (pk *PublicKey) parseRSA(r io.Reader) (err error) {
- pk.n.bytes, pk.n.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- pk.e.bytes, pk.e.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
-
- if len(pk.e.bytes) > 3 {
- err = errors.UnsupportedError("large public exponent")
- return
- }
- rsa := &rsa.PublicKey{
- N: new(big.Int).SetBytes(pk.n.bytes),
- E: 0,
- }
- for i := 0; i < len(pk.e.bytes); i++ {
- rsa.E <<= 8
- rsa.E |= int(pk.e.bytes[i])
- }
- pk.PublicKey = rsa
- return
-}
-
-// parseDSA parses DSA public key material from the given Reader. See RFC 4880,
-// section 5.5.2.
-func (pk *PublicKey) parseDSA(r io.Reader) (err error) {
- pk.p.bytes, pk.p.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- pk.q.bytes, pk.q.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- pk.g.bytes, pk.g.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- pk.y.bytes, pk.y.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
-
- dsa := new(dsa.PublicKey)
- dsa.P = new(big.Int).SetBytes(pk.p.bytes)
- dsa.Q = new(big.Int).SetBytes(pk.q.bytes)
- dsa.G = new(big.Int).SetBytes(pk.g.bytes)
- dsa.Y = new(big.Int).SetBytes(pk.y.bytes)
- pk.PublicKey = dsa
- return
-}
-
-// parseElGamal parses ElGamal public key material from the given Reader. See
-// RFC 4880, section 5.5.2.
-func (pk *PublicKey) parseElGamal(r io.Reader) (err error) {
- pk.p.bytes, pk.p.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- pk.g.bytes, pk.g.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
- pk.y.bytes, pk.y.bitLength, err = readMPI(r)
- if err != nil {
- return
- }
-
- elgamal := new(elgamal.PublicKey)
- elgamal.P = new(big.Int).SetBytes(pk.p.bytes)
- elgamal.G = new(big.Int).SetBytes(pk.g.bytes)
- elgamal.Y = new(big.Int).SetBytes(pk.y.bytes)
- pk.PublicKey = elgamal
- return
-}
-
-// SerializeSignaturePrefix writes the prefix for this public key to the given Writer.
-// The prefix is used when calculating a signature over this public key. See
-// RFC 4880, section 5.2.4.
-func (pk *PublicKey) SerializeSignaturePrefix(h io.Writer) {
- var pLength uint16
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- pLength += 2 + uint16(len(pk.n.bytes))
- pLength += 2 + uint16(len(pk.e.bytes))
- case PubKeyAlgoDSA:
- pLength += 2 + uint16(len(pk.p.bytes))
- pLength += 2 + uint16(len(pk.q.bytes))
- pLength += 2 + uint16(len(pk.g.bytes))
- pLength += 2 + uint16(len(pk.y.bytes))
- case PubKeyAlgoElGamal:
- pLength += 2 + uint16(len(pk.p.bytes))
- pLength += 2 + uint16(len(pk.g.bytes))
- pLength += 2 + uint16(len(pk.y.bytes))
- case PubKeyAlgoECDSA:
- pLength += uint16(pk.ec.byteLen())
- case PubKeyAlgoECDH:
- pLength += uint16(pk.ec.byteLen())
- pLength += uint16(pk.ecdh.byteLen())
- default:
- panic("unknown public key algorithm")
- }
- pLength += 6
- h.Write([]byte{0x99, byte(pLength >> 8), byte(pLength)})
- return
-}
-
-func (pk *PublicKey) Serialize(w io.Writer) (err error) {
- length := 6 // 6 byte header
-
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- length += 2 + len(pk.n.bytes)
- length += 2 + len(pk.e.bytes)
- case PubKeyAlgoDSA:
- length += 2 + len(pk.p.bytes)
- length += 2 + len(pk.q.bytes)
- length += 2 + len(pk.g.bytes)
- length += 2 + len(pk.y.bytes)
- case PubKeyAlgoElGamal:
- length += 2 + len(pk.p.bytes)
- length += 2 + len(pk.g.bytes)
- length += 2 + len(pk.y.bytes)
- case PubKeyAlgoECDSA:
- length += pk.ec.byteLen()
- case PubKeyAlgoECDH:
- length += pk.ec.byteLen()
- length += pk.ecdh.byteLen()
- default:
- panic("unknown public key algorithm")
- }
-
- packetType := packetTypePublicKey
- if pk.IsSubkey {
- packetType = packetTypePublicSubkey
- }
- err = serializeHeader(w, packetType, length)
- if err != nil {
- return
- }
- return pk.serializeWithoutHeaders(w)
-}
-
-// serializeWithoutHeaders marshals the PublicKey to w in the form of an
-// OpenPGP public key packet, not including the packet header.
-func (pk *PublicKey) serializeWithoutHeaders(w io.Writer) (err error) {
- var buf [6]byte
- buf[0] = 4
- t := uint32(pk.CreationTime.Unix())
- buf[1] = byte(t >> 24)
- buf[2] = byte(t >> 16)
- buf[3] = byte(t >> 8)
- buf[4] = byte(t)
- buf[5] = byte(pk.PubKeyAlgo)
-
- _, err = w.Write(buf[:])
- if err != nil {
- return
- }
-
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- return writeMPIs(w, pk.n, pk.e)
- case PubKeyAlgoDSA:
- return writeMPIs(w, pk.p, pk.q, pk.g, pk.y)
- case PubKeyAlgoElGamal:
- return writeMPIs(w, pk.p, pk.g, pk.y)
- case PubKeyAlgoECDSA:
- return pk.ec.serialize(w)
- case PubKeyAlgoECDH:
- if err = pk.ec.serialize(w); err != nil {
- return
- }
- return pk.ecdh.serialize(w)
- }
- return errors.InvalidArgumentError("bad public-key algorithm")
-}
-
-// CanSign returns true iff this public key can generate signatures
-func (pk *PublicKey) CanSign() bool {
- return pk.PubKeyAlgo != PubKeyAlgoRSAEncryptOnly && pk.PubKeyAlgo != PubKeyAlgoElGamal
-}
-
-// VerifySignature returns nil iff sig is a valid signature, made by this
-// public key, of the data hashed into signed. signed is mutated by this call.
-func (pk *PublicKey) VerifySignature(signed hash.Hash, sig *Signature) (err error) {
- if !pk.CanSign() {
- return errors.InvalidArgumentError("public key cannot generate signatures")
- }
-
- signed.Write(sig.HashSuffix)
- hashBytes := signed.Sum(nil)
-
- if hashBytes[0] != sig.HashTag[0] || hashBytes[1] != sig.HashTag[1] {
- return errors.SignatureError("hash tag doesn't match")
- }
-
- if pk.PubKeyAlgo != sig.PubKeyAlgo {
- return errors.InvalidArgumentError("public key and signature use different algorithms")
- }
-
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- rsaPublicKey, _ := pk.PublicKey.(*rsa.PublicKey)
- err = rsa.VerifyPKCS1v15(rsaPublicKey, sig.Hash, hashBytes, padToKeySize(rsaPublicKey, sig.RSASignature.bytes))
- if err != nil {
- return errors.SignatureError("RSA verification failure")
- }
- return nil
- case PubKeyAlgoDSA:
- dsaPublicKey, _ := pk.PublicKey.(*dsa.PublicKey)
- // Need to truncate hashBytes to match FIPS 186-3 section 4.6.
- subgroupSize := (dsaPublicKey.Q.BitLen() + 7) / 8
- if len(hashBytes) > subgroupSize {
- hashBytes = hashBytes[:subgroupSize]
- }
- if !dsa.Verify(dsaPublicKey, hashBytes, new(big.Int).SetBytes(sig.DSASigR.bytes), new(big.Int).SetBytes(sig.DSASigS.bytes)) {
- return errors.SignatureError("DSA verification failure")
- }
- return nil
- case PubKeyAlgoECDSA:
- ecdsaPublicKey := pk.PublicKey.(*ecdsa.PublicKey)
- if !ecdsa.Verify(ecdsaPublicKey, hashBytes, new(big.Int).SetBytes(sig.ECDSASigR.bytes), new(big.Int).SetBytes(sig.ECDSASigS.bytes)) {
- return errors.SignatureError("ECDSA verification failure")
- }
- return nil
- default:
- return errors.SignatureError("Unsupported public key algorithm used in signature")
- }
-}
-
-// VerifySignatureV3 returns nil iff sig is a valid signature, made by this
-// public key, of the data hashed into signed. signed is mutated by this call.
-func (pk *PublicKey) VerifySignatureV3(signed hash.Hash, sig *SignatureV3) (err error) {
- if !pk.CanSign() {
- return errors.InvalidArgumentError("public key cannot generate signatures")
- }
-
- suffix := make([]byte, 5)
- suffix[0] = byte(sig.SigType)
- binary.BigEndian.PutUint32(suffix[1:], uint32(sig.CreationTime.Unix()))
- signed.Write(suffix)
- hashBytes := signed.Sum(nil)
-
- if hashBytes[0] != sig.HashTag[0] || hashBytes[1] != sig.HashTag[1] {
- return errors.SignatureError("hash tag doesn't match")
- }
-
- if pk.PubKeyAlgo != sig.PubKeyAlgo {
- return errors.InvalidArgumentError("public key and signature use different algorithms")
- }
-
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- rsaPublicKey := pk.PublicKey.(*rsa.PublicKey)
- if err = rsa.VerifyPKCS1v15(rsaPublicKey, sig.Hash, hashBytes, padToKeySize(rsaPublicKey, sig.RSASignature.bytes)); err != nil {
- return errors.SignatureError("RSA verification failure")
- }
- return
- case PubKeyAlgoDSA:
- dsaPublicKey := pk.PublicKey.(*dsa.PublicKey)
- // Need to truncate hashBytes to match FIPS 186-3 section 4.6.
- subgroupSize := (dsaPublicKey.Q.BitLen() + 7) / 8
- if len(hashBytes) > subgroupSize {
- hashBytes = hashBytes[:subgroupSize]
- }
- if !dsa.Verify(dsaPublicKey, hashBytes, new(big.Int).SetBytes(sig.DSASigR.bytes), new(big.Int).SetBytes(sig.DSASigS.bytes)) {
- return errors.SignatureError("DSA verification failure")
- }
- return nil
- default:
- panic("shouldn't happen")
- }
-}
-
-// keySignatureHash returns a Hash of the message that needs to be signed for
-// pk to assert a subkey relationship to signed.
-func keySignatureHash(pk, signed signingKey, hashFunc crypto.Hash) (h hash.Hash, err error) {
- if !hashFunc.Available() {
- return nil, errors.UnsupportedError("hash function")
- }
- h = hashFunc.New()
-
- // RFC 4880, section 5.2.4
- pk.SerializeSignaturePrefix(h)
- pk.serializeWithoutHeaders(h)
- signed.SerializeSignaturePrefix(h)
- signed.serializeWithoutHeaders(h)
- return
-}
-
-// VerifyKeySignature returns nil iff sig is a valid signature, made by this
-// public key, of signed.
-func (pk *PublicKey) VerifyKeySignature(signed *PublicKey, sig *Signature) error {
- h, err := keySignatureHash(pk, signed, sig.Hash)
- if err != nil {
- return err
- }
- if err = pk.VerifySignature(h, sig); err != nil {
- return err
- }
-
- if sig.FlagSign {
- // Signing subkeys must be cross-signed. See
- // https://www.gnupg.org/faq/subkey-cross-certify.html.
- if sig.EmbeddedSignature == nil {
- return errors.StructuralError("signing subkey is missing cross-signature")
- }
- // Verify the cross-signature. This is calculated over the same
- // data as the main signature, so we cannot just recursively
- // call signed.VerifyKeySignature(...)
- if h, err = keySignatureHash(pk, signed, sig.EmbeddedSignature.Hash); err != nil {
- return errors.StructuralError("error while hashing for cross-signature: " + err.Error())
- }
- if err := signed.VerifySignature(h, sig.EmbeddedSignature); err != nil {
- return errors.StructuralError("error while verifying cross-signature: " + err.Error())
- }
- }
-
- return nil
-}
-
-func keyRevocationHash(pk signingKey, hashFunc crypto.Hash) (h hash.Hash, err error) {
- if !hashFunc.Available() {
- return nil, errors.UnsupportedError("hash function")
- }
- h = hashFunc.New()
-
- // RFC 4880, section 5.2.4
- pk.SerializeSignaturePrefix(h)
- pk.serializeWithoutHeaders(h)
-
- return
-}
-
-// VerifyRevocationSignature returns nil iff sig is a valid signature, made by this
-// public key.
-func (pk *PublicKey) VerifyRevocationSignature(sig *Signature) (err error) {
- h, err := keyRevocationHash(pk, sig.Hash)
- if err != nil {
- return err
- }
- return pk.VerifySignature(h, sig)
-}
-
-// userIdSignatureHash returns a Hash of the message that needs to be signed
-// to assert that pk is a valid key for id.
-func userIdSignatureHash(id string, pk *PublicKey, hashFunc crypto.Hash) (h hash.Hash, err error) {
- if !hashFunc.Available() {
- return nil, errors.UnsupportedError("hash function")
- }
- h = hashFunc.New()
-
- // RFC 4880, section 5.2.4
- pk.SerializeSignaturePrefix(h)
- pk.serializeWithoutHeaders(h)
-
- var buf [5]byte
- buf[0] = 0xb4
- buf[1] = byte(len(id) >> 24)
- buf[2] = byte(len(id) >> 16)
- buf[3] = byte(len(id) >> 8)
- buf[4] = byte(len(id))
- h.Write(buf[:])
- h.Write([]byte(id))
-
- return
-}
-
-// VerifyUserIdSignature returns nil iff sig is a valid signature, made by this
-// public key, that id is the identity of pub.
-func (pk *PublicKey) VerifyUserIdSignature(id string, pub *PublicKey, sig *Signature) (err error) {
- h, err := userIdSignatureHash(id, pub, sig.Hash)
- if err != nil {
- return err
- }
- return pk.VerifySignature(h, sig)
-}
-
-// VerifyUserIdSignatureV3 returns nil iff sig is a valid signature, made by this
-// public key, that id is the identity of pub.
-func (pk *PublicKey) VerifyUserIdSignatureV3(id string, pub *PublicKey, sig *SignatureV3) (err error) {
- h, err := userIdSignatureV3Hash(id, pub, sig.Hash)
- if err != nil {
- return err
- }
- return pk.VerifySignatureV3(h, sig)
-}
-
-// KeyIdString returns the public key's fingerprint in capital hex
-// (e.g. "6C7EE1B8621CC013").
-func (pk *PublicKey) KeyIdString() string {
- return fmt.Sprintf("%X", pk.Fingerprint[12:20])
-}
-
-// KeyIdShortString returns the short form of public key's fingerprint
-// in capital hex, as shown by gpg --list-keys (e.g. "621CC013").
-func (pk *PublicKey) KeyIdShortString() string {
- return fmt.Sprintf("%X", pk.Fingerprint[16:20])
-}
-
-// A parsedMPI is used to store the contents of a big integer, along with the
-// bit length that was specified in the original input. This allows the MPI to
-// be reserialized exactly.
-type parsedMPI struct {
- bytes []byte
- bitLength uint16
-}
-
-// writeMPIs is a utility function for serializing several big integers to the
-// given Writer.
-func writeMPIs(w io.Writer, mpis ...parsedMPI) (err error) {
- for _, mpi := range mpis {
- err = writeMPI(w, mpi.bitLength, mpi.bytes)
- if err != nil {
- return
- }
- }
- return
-}
-
-// BitLength returns the bit length for the given public key.
-func (pk *PublicKey) BitLength() (bitLength uint16, err error) {
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- bitLength = pk.n.bitLength
- case PubKeyAlgoDSA:
- bitLength = pk.p.bitLength
- case PubKeyAlgoElGamal:
- bitLength = pk.p.bitLength
- default:
- err = errors.InvalidArgumentError("bad public-key algorithm")
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go b/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go
deleted file mode 100644
index 5daf7b6c..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go
+++ /dev/null
@@ -1,279 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "crypto"
- "crypto/md5"
- "crypto/rsa"
- "encoding/binary"
- "fmt"
- "hash"
- "io"
- "math/big"
- "strconv"
- "time"
-
- "golang.org/x/crypto/openpgp/errors"
-)
-
-// PublicKeyV3 represents older, version 3 public keys. These keys are less secure and
-// should not be used for signing or encrypting. They are supported here only for
-// parsing version 3 key material and validating signatures.
-// See RFC 4880, section 5.5.2.
-type PublicKeyV3 struct {
- CreationTime time.Time
- DaysToExpire uint16
- PubKeyAlgo PublicKeyAlgorithm
- PublicKey *rsa.PublicKey
- Fingerprint [16]byte
- KeyId uint64
- IsSubkey bool
-
- n, e parsedMPI
-}
-
-// newRSAPublicKeyV3 returns a PublicKey that wraps the given rsa.PublicKey.
-// Included here for testing purposes only. RFC 4880, section 5.5.2:
-// "an implementation MUST NOT generate a V3 key, but MAY accept it."
-func newRSAPublicKeyV3(creationTime time.Time, pub *rsa.PublicKey) *PublicKeyV3 {
- pk := &PublicKeyV3{
- CreationTime: creationTime,
- PublicKey: pub,
- n: fromBig(pub.N),
- e: fromBig(big.NewInt(int64(pub.E))),
- }
-
- pk.setFingerPrintAndKeyId()
- return pk
-}
-
-func (pk *PublicKeyV3) parse(r io.Reader) (err error) {
- // RFC 4880, section 5.5.2
- var buf [8]byte
- if _, err = readFull(r, buf[:]); err != nil {
- return
- }
- if buf[0] < 2 || buf[0] > 3 {
- return errors.UnsupportedError("public key version")
- }
- pk.CreationTime = time.Unix(int64(uint32(buf[1])<<24|uint32(buf[2])<<16|uint32(buf[3])<<8|uint32(buf[4])), 0)
- pk.DaysToExpire = binary.BigEndian.Uint16(buf[5:7])
- pk.PubKeyAlgo = PublicKeyAlgorithm(buf[7])
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- err = pk.parseRSA(r)
- default:
- err = errors.UnsupportedError("public key type: " + strconv.Itoa(int(pk.PubKeyAlgo)))
- }
- if err != nil {
- return
- }
-
- pk.setFingerPrintAndKeyId()
- return
-}
-
-func (pk *PublicKeyV3) setFingerPrintAndKeyId() {
- // RFC 4880, section 12.2
- fingerPrint := md5.New()
- fingerPrint.Write(pk.n.bytes)
- fingerPrint.Write(pk.e.bytes)
- fingerPrint.Sum(pk.Fingerprint[:0])
- pk.KeyId = binary.BigEndian.Uint64(pk.n.bytes[len(pk.n.bytes)-8:])
-}
-
-// parseRSA parses RSA public key material from the given Reader. See RFC 4880,
-// section 5.5.2.
-func (pk *PublicKeyV3) parseRSA(r io.Reader) (err error) {
- if pk.n.bytes, pk.n.bitLength, err = readMPI(r); err != nil {
- return
- }
- if pk.e.bytes, pk.e.bitLength, err = readMPI(r); err != nil {
- return
- }
-
- // RFC 4880 Section 12.2 requires the low 8 bytes of the
- // modulus to form the key id.
- if len(pk.n.bytes) < 8 {
- return errors.StructuralError("v3 public key modulus is too short")
- }
- if len(pk.e.bytes) > 3 {
- err = errors.UnsupportedError("large public exponent")
- return
- }
- rsa := &rsa.PublicKey{N: new(big.Int).SetBytes(pk.n.bytes)}
- for i := 0; i < len(pk.e.bytes); i++ {
- rsa.E <<= 8
- rsa.E |= int(pk.e.bytes[i])
- }
- pk.PublicKey = rsa
- return
-}
-
-// SerializeSignaturePrefix writes the prefix for this public key to the given Writer.
-// The prefix is used when calculating a signature over this public key. See
-// RFC 4880, section 5.2.4.
-func (pk *PublicKeyV3) SerializeSignaturePrefix(w io.Writer) {
- var pLength uint16
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- pLength += 2 + uint16(len(pk.n.bytes))
- pLength += 2 + uint16(len(pk.e.bytes))
- default:
- panic("unknown public key algorithm")
- }
- pLength += 6
- w.Write([]byte{0x99, byte(pLength >> 8), byte(pLength)})
- return
-}
-
-func (pk *PublicKeyV3) Serialize(w io.Writer) (err error) {
- length := 8 // 8 byte header
-
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- length += 2 + len(pk.n.bytes)
- length += 2 + len(pk.e.bytes)
- default:
- panic("unknown public key algorithm")
- }
-
- packetType := packetTypePublicKey
- if pk.IsSubkey {
- packetType = packetTypePublicSubkey
- }
- if err = serializeHeader(w, packetType, length); err != nil {
- return
- }
- return pk.serializeWithoutHeaders(w)
-}
-
-// serializeWithoutHeaders marshals the PublicKey to w in the form of an
-// OpenPGP public key packet, not including the packet header.
-func (pk *PublicKeyV3) serializeWithoutHeaders(w io.Writer) (err error) {
- var buf [8]byte
- // Version 3
- buf[0] = 3
- // Creation time
- t := uint32(pk.CreationTime.Unix())
- buf[1] = byte(t >> 24)
- buf[2] = byte(t >> 16)
- buf[3] = byte(t >> 8)
- buf[4] = byte(t)
- // Days to expire
- buf[5] = byte(pk.DaysToExpire >> 8)
- buf[6] = byte(pk.DaysToExpire)
- // Public key algorithm
- buf[7] = byte(pk.PubKeyAlgo)
-
- if _, err = w.Write(buf[:]); err != nil {
- return
- }
-
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- return writeMPIs(w, pk.n, pk.e)
- }
- return errors.InvalidArgumentError("bad public-key algorithm")
-}
-
-// CanSign returns true iff this public key can generate signatures
-func (pk *PublicKeyV3) CanSign() bool {
- return pk.PubKeyAlgo != PubKeyAlgoRSAEncryptOnly
-}
-
-// VerifySignatureV3 returns nil iff sig is a valid signature, made by this
-// public key, of the data hashed into signed. signed is mutated by this call.
-func (pk *PublicKeyV3) VerifySignatureV3(signed hash.Hash, sig *SignatureV3) (err error) {
- if !pk.CanSign() {
- return errors.InvalidArgumentError("public key cannot generate signatures")
- }
-
- suffix := make([]byte, 5)
- suffix[0] = byte(sig.SigType)
- binary.BigEndian.PutUint32(suffix[1:], uint32(sig.CreationTime.Unix()))
- signed.Write(suffix)
- hashBytes := signed.Sum(nil)
-
- if hashBytes[0] != sig.HashTag[0] || hashBytes[1] != sig.HashTag[1] {
- return errors.SignatureError("hash tag doesn't match")
- }
-
- if pk.PubKeyAlgo != sig.PubKeyAlgo {
- return errors.InvalidArgumentError("public key and signature use different algorithms")
- }
-
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- if err = rsa.VerifyPKCS1v15(pk.PublicKey, sig.Hash, hashBytes, sig.RSASignature.bytes); err != nil {
- return errors.SignatureError("RSA verification failure")
- }
- return
- default:
- // V3 public keys only support RSA.
- panic("shouldn't happen")
- }
-}
-
-// VerifyUserIdSignatureV3 returns nil iff sig is a valid signature, made by this
-// public key, that id is the identity of pub.
-func (pk *PublicKeyV3) VerifyUserIdSignatureV3(id string, pub *PublicKeyV3, sig *SignatureV3) (err error) {
- h, err := userIdSignatureV3Hash(id, pk, sig.Hash)
- if err != nil {
- return err
- }
- return pk.VerifySignatureV3(h, sig)
-}
-
-// VerifyKeySignatureV3 returns nil iff sig is a valid signature, made by this
-// public key, of signed.
-func (pk *PublicKeyV3) VerifyKeySignatureV3(signed *PublicKeyV3, sig *SignatureV3) (err error) {
- h, err := keySignatureHash(pk, signed, sig.Hash)
- if err != nil {
- return err
- }
- return pk.VerifySignatureV3(h, sig)
-}
-
-// userIdSignatureV3Hash returns a Hash of the message that needs to be signed
-// to assert that pk is a valid key for id.
-func userIdSignatureV3Hash(id string, pk signingKey, hfn crypto.Hash) (h hash.Hash, err error) {
- if !hfn.Available() {
- return nil, errors.UnsupportedError("hash function")
- }
- h = hfn.New()
-
- // RFC 4880, section 5.2.4
- pk.SerializeSignaturePrefix(h)
- pk.serializeWithoutHeaders(h)
-
- h.Write([]byte(id))
-
- return
-}
-
-// KeyIdString returns the public key's fingerprint in capital hex
-// (e.g. "6C7EE1B8621CC013").
-func (pk *PublicKeyV3) KeyIdString() string {
- return fmt.Sprintf("%X", pk.KeyId)
-}
-
-// KeyIdShortString returns the short form of public key's fingerprint
-// in capital hex, as shown by gpg --list-keys (e.g. "621CC013").
-func (pk *PublicKeyV3) KeyIdShortString() string {
- return fmt.Sprintf("%X", pk.KeyId&0xFFFFFFFF)
-}
-
-// BitLength returns the bit length for the given public key.
-func (pk *PublicKeyV3) BitLength() (bitLength uint16, err error) {
- switch pk.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
- bitLength = pk.n.bitLength
- default:
- err = errors.InvalidArgumentError("bad public-key algorithm")
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/reader.go b/vendor/golang.org/x/crypto/openpgp/packet/reader.go
deleted file mode 100644
index 34bc7c61..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/reader.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "golang.org/x/crypto/openpgp/errors"
- "io"
-)
-
-// Reader reads packets from an io.Reader and allows packets to be 'unread' so
-// that they result from the next call to Next.
-type Reader struct {
- q []Packet
- readers []io.Reader
-}
-
-// New io.Readers are pushed when a compressed or encrypted packet is processed
-// and recursively treated as a new source of packets. However, a carefully
-// crafted packet can trigger an infinite recursive sequence of packets. See
-// http://mumble.net/~campbell/misc/pgp-quine
-// https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-4402
-// This constant limits the number of recursive packets that may be pushed.
-const maxReaders = 32
-
-// Next returns the most recently unread Packet, or reads another packet from
-// the top-most io.Reader. Unknown packet types are skipped.
-func (r *Reader) Next() (p Packet, err error) {
- if len(r.q) > 0 {
- p = r.q[len(r.q)-1]
- r.q = r.q[:len(r.q)-1]
- return
- }
-
- for len(r.readers) > 0 {
- p, err = Read(r.readers[len(r.readers)-1])
- if err == nil {
- return
- }
- if err == io.EOF {
- r.readers = r.readers[:len(r.readers)-1]
- continue
- }
- if _, ok := err.(errors.UnknownPacketTypeError); !ok {
- return nil, err
- }
- }
-
- return nil, io.EOF
-}
-
-// Push causes the Reader to start reading from a new io.Reader. When an EOF
-// error is seen from the new io.Reader, it is popped and the Reader continues
-// to read from the next most recent io.Reader. Push returns a StructuralError
-// if pushing the reader would exceed the maximum recursion level, otherwise it
-// returns nil.
-func (r *Reader) Push(reader io.Reader) (err error) {
- if len(r.readers) >= maxReaders {
- return errors.StructuralError("too many layers of packets")
- }
- r.readers = append(r.readers, reader)
- return nil
-}
-
-// Unread causes the given Packet to be returned from the next call to Next.
-func (r *Reader) Unread(p Packet) {
- r.q = append(r.q, p)
-}
-
-func NewReader(r io.Reader) *Reader {
- return &Reader{
- q: nil,
- readers: []io.Reader{r},
- }
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/signature.go b/vendor/golang.org/x/crypto/openpgp/packet/signature.go
deleted file mode 100644
index 6ce0cbed..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/signature.go
+++ /dev/null
@@ -1,731 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto"
- "crypto/dsa"
- "crypto/ecdsa"
- "encoding/asn1"
- "encoding/binary"
- "hash"
- "io"
- "math/big"
- "strconv"
- "time"
-
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/s2k"
-)
-
-const (
- // See RFC 4880, section 5.2.3.21 for details.
- KeyFlagCertify = 1 << iota
- KeyFlagSign
- KeyFlagEncryptCommunications
- KeyFlagEncryptStorage
-)
-
-// Signature represents a signature. See RFC 4880, section 5.2.
-type Signature struct {
- SigType SignatureType
- PubKeyAlgo PublicKeyAlgorithm
- Hash crypto.Hash
-
- // HashSuffix is extra data that is hashed in after the signed data.
- HashSuffix []byte
- // HashTag contains the first two bytes of the hash for fast rejection
- // of bad signed data.
- HashTag [2]byte
- CreationTime time.Time
-
- RSASignature parsedMPI
- DSASigR, DSASigS parsedMPI
- ECDSASigR, ECDSASigS parsedMPI
-
- // rawSubpackets contains the unparsed subpackets, in order.
- rawSubpackets []outputSubpacket
-
- // The following are optional so are nil when not included in the
- // signature.
-
- SigLifetimeSecs, KeyLifetimeSecs *uint32
- PreferredSymmetric, PreferredHash, PreferredCompression []uint8
- IssuerKeyId *uint64
- IsPrimaryId *bool
-
- // FlagsValid is set if any flags were given. See RFC 4880, section
- // 5.2.3.21 for details.
- FlagsValid bool
- FlagCertify, FlagSign, FlagEncryptCommunications, FlagEncryptStorage bool
-
- // RevocationReason is set if this signature has been revoked.
- // See RFC 4880, section 5.2.3.23 for details.
- RevocationReason *uint8
- RevocationReasonText string
-
- // MDC is set if this signature has a feature packet that indicates
- // support for MDC subpackets.
- MDC bool
-
- // EmbeddedSignature, if non-nil, is a signature of the parent key, by
- // this key. This prevents an attacker from claiming another's signing
- // subkey as their own.
- EmbeddedSignature *Signature
-
- outSubpackets []outputSubpacket
-}
-
-func (sig *Signature) parse(r io.Reader) (err error) {
- // RFC 4880, section 5.2.3
- var buf [5]byte
- _, err = readFull(r, buf[:1])
- if err != nil {
- return
- }
- if buf[0] != 4 {
- err = errors.UnsupportedError("signature packet version " + strconv.Itoa(int(buf[0])))
- return
- }
-
- _, err = readFull(r, buf[:5])
- if err != nil {
- return
- }
- sig.SigType = SignatureType(buf[0])
- sig.PubKeyAlgo = PublicKeyAlgorithm(buf[1])
- switch sig.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoDSA, PubKeyAlgoECDSA:
- default:
- err = errors.UnsupportedError("public key algorithm " + strconv.Itoa(int(sig.PubKeyAlgo)))
- return
- }
-
- var ok bool
- sig.Hash, ok = s2k.HashIdToHash(buf[2])
- if !ok {
- return errors.UnsupportedError("hash function " + strconv.Itoa(int(buf[2])))
- }
-
- hashedSubpacketsLength := int(buf[3])<<8 | int(buf[4])
- l := 6 + hashedSubpacketsLength
- sig.HashSuffix = make([]byte, l+6)
- sig.HashSuffix[0] = 4
- copy(sig.HashSuffix[1:], buf[:5])
- hashedSubpackets := sig.HashSuffix[6:l]
- _, err = readFull(r, hashedSubpackets)
- if err != nil {
- return
- }
- // See RFC 4880, section 5.2.4
- trailer := sig.HashSuffix[l:]
- trailer[0] = 4
- trailer[1] = 0xff
- trailer[2] = uint8(l >> 24)
- trailer[3] = uint8(l >> 16)
- trailer[4] = uint8(l >> 8)
- trailer[5] = uint8(l)
-
- err = parseSignatureSubpackets(sig, hashedSubpackets, true)
- if err != nil {
- return
- }
-
- _, err = readFull(r, buf[:2])
- if err != nil {
- return
- }
- unhashedSubpacketsLength := int(buf[0])<<8 | int(buf[1])
- unhashedSubpackets := make([]byte, unhashedSubpacketsLength)
- _, err = readFull(r, unhashedSubpackets)
- if err != nil {
- return
- }
- err = parseSignatureSubpackets(sig, unhashedSubpackets, false)
- if err != nil {
- return
- }
-
- _, err = readFull(r, sig.HashTag[:2])
- if err != nil {
- return
- }
-
- switch sig.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- sig.RSASignature.bytes, sig.RSASignature.bitLength, err = readMPI(r)
- case PubKeyAlgoDSA:
- sig.DSASigR.bytes, sig.DSASigR.bitLength, err = readMPI(r)
- if err == nil {
- sig.DSASigS.bytes, sig.DSASigS.bitLength, err = readMPI(r)
- }
- case PubKeyAlgoECDSA:
- sig.ECDSASigR.bytes, sig.ECDSASigR.bitLength, err = readMPI(r)
- if err == nil {
- sig.ECDSASigS.bytes, sig.ECDSASigS.bitLength, err = readMPI(r)
- }
- default:
- panic("unreachable")
- }
- return
-}
-
-// parseSignatureSubpackets parses subpackets of the main signature packet. See
-// RFC 4880, section 5.2.3.1.
-func parseSignatureSubpackets(sig *Signature, subpackets []byte, isHashed bool) (err error) {
- for len(subpackets) > 0 {
- subpackets, err = parseSignatureSubpacket(sig, subpackets, isHashed)
- if err != nil {
- return
- }
- }
-
- if sig.CreationTime.IsZero() {
- err = errors.StructuralError("no creation time in signature")
- }
-
- return
-}
-
-type signatureSubpacketType uint8
-
-const (
- creationTimeSubpacket signatureSubpacketType = 2
- signatureExpirationSubpacket signatureSubpacketType = 3
- keyExpirationSubpacket signatureSubpacketType = 9
- prefSymmetricAlgosSubpacket signatureSubpacketType = 11
- issuerSubpacket signatureSubpacketType = 16
- prefHashAlgosSubpacket signatureSubpacketType = 21
- prefCompressionSubpacket signatureSubpacketType = 22
- primaryUserIdSubpacket signatureSubpacketType = 25
- keyFlagsSubpacket signatureSubpacketType = 27
- reasonForRevocationSubpacket signatureSubpacketType = 29
- featuresSubpacket signatureSubpacketType = 30
- embeddedSignatureSubpacket signatureSubpacketType = 32
-)
-
-// parseSignatureSubpacket parses a single subpacket. len(subpacket) is >= 1.
-func parseSignatureSubpacket(sig *Signature, subpacket []byte, isHashed bool) (rest []byte, err error) {
- // RFC 4880, section 5.2.3.1
- var (
- length uint32
- packetType signatureSubpacketType
- isCritical bool
- )
- switch {
- case subpacket[0] < 192:
- length = uint32(subpacket[0])
- subpacket = subpacket[1:]
- case subpacket[0] < 255:
- if len(subpacket) < 2 {
- goto Truncated
- }
- length = uint32(subpacket[0]-192)<<8 + uint32(subpacket[1]) + 192
- subpacket = subpacket[2:]
- default:
- if len(subpacket) < 5 {
- goto Truncated
- }
- length = uint32(subpacket[1])<<24 |
- uint32(subpacket[2])<<16 |
- uint32(subpacket[3])<<8 |
- uint32(subpacket[4])
- subpacket = subpacket[5:]
- }
- if length > uint32(len(subpacket)) {
- goto Truncated
- }
- rest = subpacket[length:]
- subpacket = subpacket[:length]
- if len(subpacket) == 0 {
- err = errors.StructuralError("zero length signature subpacket")
- return
- }
- packetType = signatureSubpacketType(subpacket[0] & 0x7f)
- isCritical = subpacket[0]&0x80 == 0x80
- subpacket = subpacket[1:]
- sig.rawSubpackets = append(sig.rawSubpackets, outputSubpacket{isHashed, packetType, isCritical, subpacket})
- switch packetType {
- case creationTimeSubpacket:
- if !isHashed {
- err = errors.StructuralError("signature creation time in non-hashed area")
- return
- }
- if len(subpacket) != 4 {
- err = errors.StructuralError("signature creation time not four bytes")
- return
- }
- t := binary.BigEndian.Uint32(subpacket)
- sig.CreationTime = time.Unix(int64(t), 0)
- case signatureExpirationSubpacket:
- // Signature expiration time, section 5.2.3.10
- if !isHashed {
- return
- }
- if len(subpacket) != 4 {
- err = errors.StructuralError("expiration subpacket with bad length")
- return
- }
- sig.SigLifetimeSecs = new(uint32)
- *sig.SigLifetimeSecs = binary.BigEndian.Uint32(subpacket)
- case keyExpirationSubpacket:
- // Key expiration time, section 5.2.3.6
- if !isHashed {
- return
- }
- if len(subpacket) != 4 {
- err = errors.StructuralError("key expiration subpacket with bad length")
- return
- }
- sig.KeyLifetimeSecs = new(uint32)
- *sig.KeyLifetimeSecs = binary.BigEndian.Uint32(subpacket)
- case prefSymmetricAlgosSubpacket:
- // Preferred symmetric algorithms, section 5.2.3.7
- if !isHashed {
- return
- }
- sig.PreferredSymmetric = make([]byte, len(subpacket))
- copy(sig.PreferredSymmetric, subpacket)
- case issuerSubpacket:
- // Issuer, section 5.2.3.5
- if len(subpacket) != 8 {
- err = errors.StructuralError("issuer subpacket with bad length")
- return
- }
- sig.IssuerKeyId = new(uint64)
- *sig.IssuerKeyId = binary.BigEndian.Uint64(subpacket)
- case prefHashAlgosSubpacket:
- // Preferred hash algorithms, section 5.2.3.8
- if !isHashed {
- return
- }
- sig.PreferredHash = make([]byte, len(subpacket))
- copy(sig.PreferredHash, subpacket)
- case prefCompressionSubpacket:
- // Preferred compression algorithms, section 5.2.3.9
- if !isHashed {
- return
- }
- sig.PreferredCompression = make([]byte, len(subpacket))
- copy(sig.PreferredCompression, subpacket)
- case primaryUserIdSubpacket:
- // Primary User ID, section 5.2.3.19
- if !isHashed {
- return
- }
- if len(subpacket) != 1 {
- err = errors.StructuralError("primary user id subpacket with bad length")
- return
- }
- sig.IsPrimaryId = new(bool)
- if subpacket[0] > 0 {
- *sig.IsPrimaryId = true
- }
- case keyFlagsSubpacket:
- // Key flags, section 5.2.3.21
- if !isHashed {
- return
- }
- if len(subpacket) == 0 {
- err = errors.StructuralError("empty key flags subpacket")
- return
- }
- sig.FlagsValid = true
- if subpacket[0]&KeyFlagCertify != 0 {
- sig.FlagCertify = true
- }
- if subpacket[0]&KeyFlagSign != 0 {
- sig.FlagSign = true
- }
- if subpacket[0]&KeyFlagEncryptCommunications != 0 {
- sig.FlagEncryptCommunications = true
- }
- if subpacket[0]&KeyFlagEncryptStorage != 0 {
- sig.FlagEncryptStorage = true
- }
- case reasonForRevocationSubpacket:
- // Reason For Revocation, section 5.2.3.23
- if !isHashed {
- return
- }
- if len(subpacket) == 0 {
- err = errors.StructuralError("empty revocation reason subpacket")
- return
- }
- sig.RevocationReason = new(uint8)
- *sig.RevocationReason = subpacket[0]
- sig.RevocationReasonText = string(subpacket[1:])
- case featuresSubpacket:
- // Features subpacket, section 5.2.3.24 specifies a very general
- // mechanism for OpenPGP implementations to signal support for new
- // features. In practice, the subpacket is used exclusively to
- // indicate support for MDC-protected encryption.
- sig.MDC = len(subpacket) >= 1 && subpacket[0]&1 == 1
- case embeddedSignatureSubpacket:
- // Only usage is in signatures that cross-certify
- // signing subkeys. section 5.2.3.26 describes the
- // format, with its usage described in section 11.1
- if sig.EmbeddedSignature != nil {
- err = errors.StructuralError("Cannot have multiple embedded signatures")
- return
- }
- sig.EmbeddedSignature = new(Signature)
- // Embedded signatures are required to be v4 signatures see
- // section 12.1. However, we only parse v4 signatures in this
- // file anyway.
- if err := sig.EmbeddedSignature.parse(bytes.NewBuffer(subpacket)); err != nil {
- return nil, err
- }
- if sigType := sig.EmbeddedSignature.SigType; sigType != SigTypePrimaryKeyBinding {
- return nil, errors.StructuralError("cross-signature has unexpected type " + strconv.Itoa(int(sigType)))
- }
- default:
- if isCritical {
- err = errors.UnsupportedError("unknown critical signature subpacket type " + strconv.Itoa(int(packetType)))
- return
- }
- }
- return
-
-Truncated:
- err = errors.StructuralError("signature subpacket truncated")
- return
-}
-
-// subpacketLengthLength returns the length, in bytes, of an encoded length value.
-func subpacketLengthLength(length int) int {
- if length < 192 {
- return 1
- }
- if length < 16320 {
- return 2
- }
- return 5
-}
-
-// serializeSubpacketLength marshals the given length into to.
-func serializeSubpacketLength(to []byte, length int) int {
- // RFC 4880, Section 4.2.2.
- if length < 192 {
- to[0] = byte(length)
- return 1
- }
- if length < 16320 {
- length -= 192
- to[0] = byte((length >> 8) + 192)
- to[1] = byte(length)
- return 2
- }
- to[0] = 255
- to[1] = byte(length >> 24)
- to[2] = byte(length >> 16)
- to[3] = byte(length >> 8)
- to[4] = byte(length)
- return 5
-}
-
-// subpacketsLength returns the serialized length, in bytes, of the given
-// subpackets.
-func subpacketsLength(subpackets []outputSubpacket, hashed bool) (length int) {
- for _, subpacket := range subpackets {
- if subpacket.hashed == hashed {
- length += subpacketLengthLength(len(subpacket.contents) + 1)
- length += 1 // type byte
- length += len(subpacket.contents)
- }
- }
- return
-}
-
-// serializeSubpackets marshals the given subpackets into to.
-func serializeSubpackets(to []byte, subpackets []outputSubpacket, hashed bool) {
- for _, subpacket := range subpackets {
- if subpacket.hashed == hashed {
- n := serializeSubpacketLength(to, len(subpacket.contents)+1)
- to[n] = byte(subpacket.subpacketType)
- to = to[1+n:]
- n = copy(to, subpacket.contents)
- to = to[n:]
- }
- }
- return
-}
-
-// KeyExpired returns whether sig is a self-signature of a key that has
-// expired.
-func (sig *Signature) KeyExpired(currentTime time.Time) bool {
- if sig.KeyLifetimeSecs == nil {
- return false
- }
- expiry := sig.CreationTime.Add(time.Duration(*sig.KeyLifetimeSecs) * time.Second)
- return currentTime.After(expiry)
-}
-
-// buildHashSuffix constructs the HashSuffix member of sig in preparation for signing.
-func (sig *Signature) buildHashSuffix() (err error) {
- hashedSubpacketsLen := subpacketsLength(sig.outSubpackets, true)
-
- var ok bool
- l := 6 + hashedSubpacketsLen
- sig.HashSuffix = make([]byte, l+6)
- sig.HashSuffix[0] = 4
- sig.HashSuffix[1] = uint8(sig.SigType)
- sig.HashSuffix[2] = uint8(sig.PubKeyAlgo)
- sig.HashSuffix[3], ok = s2k.HashToHashId(sig.Hash)
- if !ok {
- sig.HashSuffix = nil
- return errors.InvalidArgumentError("hash cannot be represented in OpenPGP: " + strconv.Itoa(int(sig.Hash)))
- }
- sig.HashSuffix[4] = byte(hashedSubpacketsLen >> 8)
- sig.HashSuffix[5] = byte(hashedSubpacketsLen)
- serializeSubpackets(sig.HashSuffix[6:l], sig.outSubpackets, true)
- trailer := sig.HashSuffix[l:]
- trailer[0] = 4
- trailer[1] = 0xff
- trailer[2] = byte(l >> 24)
- trailer[3] = byte(l >> 16)
- trailer[4] = byte(l >> 8)
- trailer[5] = byte(l)
- return
-}
-
-func (sig *Signature) signPrepareHash(h hash.Hash) (digest []byte, err error) {
- err = sig.buildHashSuffix()
- if err != nil {
- return
- }
-
- h.Write(sig.HashSuffix)
- digest = h.Sum(nil)
- copy(sig.HashTag[:], digest)
- return
-}
-
-// Sign signs a message with a private key. The hash, h, must contain
-// the hash of the message to be signed and will be mutated by this function.
-// On success, the signature is stored in sig. Call Serialize to write it out.
-// If config is nil, sensible defaults will be used.
-func (sig *Signature) Sign(h hash.Hash, priv *PrivateKey, config *Config) (err error) {
- sig.outSubpackets = sig.buildSubpackets()
- digest, err := sig.signPrepareHash(h)
- if err != nil {
- return
- }
-
- switch priv.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- // supports both *rsa.PrivateKey and crypto.Signer
- sig.RSASignature.bytes, err = priv.PrivateKey.(crypto.Signer).Sign(config.Random(), digest, sig.Hash)
- sig.RSASignature.bitLength = uint16(8 * len(sig.RSASignature.bytes))
- case PubKeyAlgoDSA:
- dsaPriv := priv.PrivateKey.(*dsa.PrivateKey)
-
- // Need to truncate hashBytes to match FIPS 186-3 section 4.6.
- subgroupSize := (dsaPriv.Q.BitLen() + 7) / 8
- if len(digest) > subgroupSize {
- digest = digest[:subgroupSize]
- }
- r, s, err := dsa.Sign(config.Random(), dsaPriv, digest)
- if err == nil {
- sig.DSASigR.bytes = r.Bytes()
- sig.DSASigR.bitLength = uint16(8 * len(sig.DSASigR.bytes))
- sig.DSASigS.bytes = s.Bytes()
- sig.DSASigS.bitLength = uint16(8 * len(sig.DSASigS.bytes))
- }
- case PubKeyAlgoECDSA:
- var r, s *big.Int
- if pk, ok := priv.PrivateKey.(*ecdsa.PrivateKey); ok {
- // direct support, avoid asn1 wrapping/unwrapping
- r, s, err = ecdsa.Sign(config.Random(), pk, digest)
- } else {
- var b []byte
- b, err = priv.PrivateKey.(crypto.Signer).Sign(config.Random(), digest, nil)
- if err == nil {
- r, s, err = unwrapECDSASig(b)
- }
- }
- if err == nil {
- sig.ECDSASigR = fromBig(r)
- sig.ECDSASigS = fromBig(s)
- }
- default:
- err = errors.UnsupportedError("public key algorithm: " + strconv.Itoa(int(sig.PubKeyAlgo)))
- }
-
- return
-}
-
-// unwrapECDSASig parses the two integer components of an ASN.1-encoded ECDSA
-// signature.
-func unwrapECDSASig(b []byte) (r, s *big.Int, err error) {
- var ecsdaSig struct {
- R, S *big.Int
- }
- _, err = asn1.Unmarshal(b, &ecsdaSig)
- if err != nil {
- return
- }
- return ecsdaSig.R, ecsdaSig.S, nil
-}
-
-// SignUserId computes a signature from priv, asserting that pub is a valid
-// key for the identity id. On success, the signature is stored in sig. Call
-// Serialize to write it out.
-// If config is nil, sensible defaults will be used.
-func (sig *Signature) SignUserId(id string, pub *PublicKey, priv *PrivateKey, config *Config) error {
- h, err := userIdSignatureHash(id, pub, sig.Hash)
- if err != nil {
- return err
- }
- return sig.Sign(h, priv, config)
-}
-
-// SignKey computes a signature from priv, asserting that pub is a subkey. On
-// success, the signature is stored in sig. Call Serialize to write it out.
-// If config is nil, sensible defaults will be used.
-func (sig *Signature) SignKey(pub *PublicKey, priv *PrivateKey, config *Config) error {
- h, err := keySignatureHash(&priv.PublicKey, pub, sig.Hash)
- if err != nil {
- return err
- }
- return sig.Sign(h, priv, config)
-}
-
-// Serialize marshals sig to w. Sign, SignUserId or SignKey must have been
-// called first.
-func (sig *Signature) Serialize(w io.Writer) (err error) {
- if len(sig.outSubpackets) == 0 {
- sig.outSubpackets = sig.rawSubpackets
- }
- if sig.RSASignature.bytes == nil && sig.DSASigR.bytes == nil && sig.ECDSASigR.bytes == nil {
- return errors.InvalidArgumentError("Signature: need to call Sign, SignUserId or SignKey before Serialize")
- }
-
- sigLength := 0
- switch sig.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- sigLength = 2 + len(sig.RSASignature.bytes)
- case PubKeyAlgoDSA:
- sigLength = 2 + len(sig.DSASigR.bytes)
- sigLength += 2 + len(sig.DSASigS.bytes)
- case PubKeyAlgoECDSA:
- sigLength = 2 + len(sig.ECDSASigR.bytes)
- sigLength += 2 + len(sig.ECDSASigS.bytes)
- default:
- panic("impossible")
- }
-
- unhashedSubpacketsLen := subpacketsLength(sig.outSubpackets, false)
- length := len(sig.HashSuffix) - 6 /* trailer not included */ +
- 2 /* length of unhashed subpackets */ + unhashedSubpacketsLen +
- 2 /* hash tag */ + sigLength
- err = serializeHeader(w, packetTypeSignature, length)
- if err != nil {
- return
- }
-
- _, err = w.Write(sig.HashSuffix[:len(sig.HashSuffix)-6])
- if err != nil {
- return
- }
-
- unhashedSubpackets := make([]byte, 2+unhashedSubpacketsLen)
- unhashedSubpackets[0] = byte(unhashedSubpacketsLen >> 8)
- unhashedSubpackets[1] = byte(unhashedSubpacketsLen)
- serializeSubpackets(unhashedSubpackets[2:], sig.outSubpackets, false)
-
- _, err = w.Write(unhashedSubpackets)
- if err != nil {
- return
- }
- _, err = w.Write(sig.HashTag[:])
- if err != nil {
- return
- }
-
- switch sig.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- err = writeMPIs(w, sig.RSASignature)
- case PubKeyAlgoDSA:
- err = writeMPIs(w, sig.DSASigR, sig.DSASigS)
- case PubKeyAlgoECDSA:
- err = writeMPIs(w, sig.ECDSASigR, sig.ECDSASigS)
- default:
- panic("impossible")
- }
- return
-}
-
-// outputSubpacket represents a subpacket to be marshaled.
-type outputSubpacket struct {
- hashed bool // true if this subpacket is in the hashed area.
- subpacketType signatureSubpacketType
- isCritical bool
- contents []byte
-}
-
-func (sig *Signature) buildSubpackets() (subpackets []outputSubpacket) {
- creationTime := make([]byte, 4)
- binary.BigEndian.PutUint32(creationTime, uint32(sig.CreationTime.Unix()))
- subpackets = append(subpackets, outputSubpacket{true, creationTimeSubpacket, false, creationTime})
-
- if sig.IssuerKeyId != nil {
- keyId := make([]byte, 8)
- binary.BigEndian.PutUint64(keyId, *sig.IssuerKeyId)
- subpackets = append(subpackets, outputSubpacket{true, issuerSubpacket, false, keyId})
- }
-
- if sig.SigLifetimeSecs != nil && *sig.SigLifetimeSecs != 0 {
- sigLifetime := make([]byte, 4)
- binary.BigEndian.PutUint32(sigLifetime, *sig.SigLifetimeSecs)
- subpackets = append(subpackets, outputSubpacket{true, signatureExpirationSubpacket, true, sigLifetime})
- }
-
- // Key flags may only appear in self-signatures or certification signatures.
-
- if sig.FlagsValid {
- var flags byte
- if sig.FlagCertify {
- flags |= KeyFlagCertify
- }
- if sig.FlagSign {
- flags |= KeyFlagSign
- }
- if sig.FlagEncryptCommunications {
- flags |= KeyFlagEncryptCommunications
- }
- if sig.FlagEncryptStorage {
- flags |= KeyFlagEncryptStorage
- }
- subpackets = append(subpackets, outputSubpacket{true, keyFlagsSubpacket, false, []byte{flags}})
- }
-
- // The following subpackets may only appear in self-signatures
-
- if sig.KeyLifetimeSecs != nil && *sig.KeyLifetimeSecs != 0 {
- keyLifetime := make([]byte, 4)
- binary.BigEndian.PutUint32(keyLifetime, *sig.KeyLifetimeSecs)
- subpackets = append(subpackets, outputSubpacket{true, keyExpirationSubpacket, true, keyLifetime})
- }
-
- if sig.IsPrimaryId != nil && *sig.IsPrimaryId {
- subpackets = append(subpackets, outputSubpacket{true, primaryUserIdSubpacket, false, []byte{1}})
- }
-
- if len(sig.PreferredSymmetric) > 0 {
- subpackets = append(subpackets, outputSubpacket{true, prefSymmetricAlgosSubpacket, false, sig.PreferredSymmetric})
- }
-
- if len(sig.PreferredHash) > 0 {
- subpackets = append(subpackets, outputSubpacket{true, prefHashAlgosSubpacket, false, sig.PreferredHash})
- }
-
- if len(sig.PreferredCompression) > 0 {
- subpackets = append(subpackets, outputSubpacket{true, prefCompressionSubpacket, false, sig.PreferredCompression})
- }
-
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go b/vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go
deleted file mode 100644
index 6edff889..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "crypto"
- "encoding/binary"
- "fmt"
- "io"
- "strconv"
- "time"
-
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/s2k"
-)
-
-// SignatureV3 represents older version 3 signatures. These signatures are less secure
-// than version 4 and should not be used to create new signatures. They are included
-// here for backwards compatibility to read and validate with older key material.
-// See RFC 4880, section 5.2.2.
-type SignatureV3 struct {
- SigType SignatureType
- CreationTime time.Time
- IssuerKeyId uint64
- PubKeyAlgo PublicKeyAlgorithm
- Hash crypto.Hash
- HashTag [2]byte
-
- RSASignature parsedMPI
- DSASigR, DSASigS parsedMPI
-}
-
-func (sig *SignatureV3) parse(r io.Reader) (err error) {
- // RFC 4880, section 5.2.2
- var buf [8]byte
- if _, err = readFull(r, buf[:1]); err != nil {
- return
- }
- if buf[0] < 2 || buf[0] > 3 {
- err = errors.UnsupportedError("signature packet version " + strconv.Itoa(int(buf[0])))
- return
- }
- if _, err = readFull(r, buf[:1]); err != nil {
- return
- }
- if buf[0] != 5 {
- err = errors.UnsupportedError(
- "invalid hashed material length " + strconv.Itoa(int(buf[0])))
- return
- }
-
- // Read hashed material: signature type + creation time
- if _, err = readFull(r, buf[:5]); err != nil {
- return
- }
- sig.SigType = SignatureType(buf[0])
- t := binary.BigEndian.Uint32(buf[1:5])
- sig.CreationTime = time.Unix(int64(t), 0)
-
- // Eight-octet Key ID of signer.
- if _, err = readFull(r, buf[:8]); err != nil {
- return
- }
- sig.IssuerKeyId = binary.BigEndian.Uint64(buf[:])
-
- // Public-key and hash algorithm
- if _, err = readFull(r, buf[:2]); err != nil {
- return
- }
- sig.PubKeyAlgo = PublicKeyAlgorithm(buf[0])
- switch sig.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoDSA:
- default:
- err = errors.UnsupportedError("public key algorithm " + strconv.Itoa(int(sig.PubKeyAlgo)))
- return
- }
- var ok bool
- if sig.Hash, ok = s2k.HashIdToHash(buf[1]); !ok {
- return errors.UnsupportedError("hash function " + strconv.Itoa(int(buf[2])))
- }
-
- // Two-octet field holding left 16 bits of signed hash value.
- if _, err = readFull(r, sig.HashTag[:2]); err != nil {
- return
- }
-
- switch sig.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- sig.RSASignature.bytes, sig.RSASignature.bitLength, err = readMPI(r)
- case PubKeyAlgoDSA:
- if sig.DSASigR.bytes, sig.DSASigR.bitLength, err = readMPI(r); err != nil {
- return
- }
- sig.DSASigS.bytes, sig.DSASigS.bitLength, err = readMPI(r)
- default:
- panic("unreachable")
- }
- return
-}
-
-// Serialize marshals sig to w. Sign, SignUserId or SignKey must have been
-// called first.
-func (sig *SignatureV3) Serialize(w io.Writer) (err error) {
- buf := make([]byte, 8)
-
- // Write the sig type and creation time
- buf[0] = byte(sig.SigType)
- binary.BigEndian.PutUint32(buf[1:5], uint32(sig.CreationTime.Unix()))
- if _, err = w.Write(buf[:5]); err != nil {
- return
- }
-
- // Write the issuer long key ID
- binary.BigEndian.PutUint64(buf[:8], sig.IssuerKeyId)
- if _, err = w.Write(buf[:8]); err != nil {
- return
- }
-
- // Write public key algorithm, hash ID, and hash value
- buf[0] = byte(sig.PubKeyAlgo)
- hashId, ok := s2k.HashToHashId(sig.Hash)
- if !ok {
- return errors.UnsupportedError(fmt.Sprintf("hash function %v", sig.Hash))
- }
- buf[1] = hashId
- copy(buf[2:4], sig.HashTag[:])
- if _, err = w.Write(buf[:4]); err != nil {
- return
- }
-
- if sig.RSASignature.bytes == nil && sig.DSASigR.bytes == nil {
- return errors.InvalidArgumentError("Signature: need to call Sign, SignUserId or SignKey before Serialize")
- }
-
- switch sig.PubKeyAlgo {
- case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
- err = writeMPIs(w, sig.RSASignature)
- case PubKeyAlgoDSA:
- err = writeMPIs(w, sig.DSASigR, sig.DSASigS)
- default:
- panic("impossible")
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go b/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go
deleted file mode 100644
index 744c2d2c..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto/cipher"
- "io"
- "strconv"
-
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/s2k"
-)
-
-// This is the largest session key that we'll support. Since no 512-bit cipher
-// has even been seriously used, this is comfortably large.
-const maxSessionKeySizeInBytes = 64
-
-// SymmetricKeyEncrypted represents a passphrase protected session key. See RFC
-// 4880, section 5.3.
-type SymmetricKeyEncrypted struct {
- CipherFunc CipherFunction
- s2k func(out, in []byte)
- encryptedKey []byte
-}
-
-const symmetricKeyEncryptedVersion = 4
-
-func (ske *SymmetricKeyEncrypted) parse(r io.Reader) error {
- // RFC 4880, section 5.3.
- var buf [2]byte
- if _, err := readFull(r, buf[:]); err != nil {
- return err
- }
- if buf[0] != symmetricKeyEncryptedVersion {
- return errors.UnsupportedError("SymmetricKeyEncrypted version")
- }
- ske.CipherFunc = CipherFunction(buf[1])
-
- if ske.CipherFunc.KeySize() == 0 {
- return errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(buf[1])))
- }
-
- var err error
- ske.s2k, err = s2k.Parse(r)
- if err != nil {
- return err
- }
-
- encryptedKey := make([]byte, maxSessionKeySizeInBytes)
- // The session key may follow. We just have to try and read to find
- // out. If it exists then we limit it to maxSessionKeySizeInBytes.
- n, err := readFull(r, encryptedKey)
- if err != nil && err != io.ErrUnexpectedEOF {
- return err
- }
-
- if n != 0 {
- if n == maxSessionKeySizeInBytes {
- return errors.UnsupportedError("oversized encrypted session key")
- }
- ske.encryptedKey = encryptedKey[:n]
- }
-
- return nil
-}
-
-// Decrypt attempts to decrypt an encrypted session key and returns the key and
-// the cipher to use when decrypting a subsequent Symmetrically Encrypted Data
-// packet.
-func (ske *SymmetricKeyEncrypted) Decrypt(passphrase []byte) ([]byte, CipherFunction, error) {
- key := make([]byte, ske.CipherFunc.KeySize())
- ske.s2k(key, passphrase)
-
- if len(ske.encryptedKey) == 0 {
- return key, ske.CipherFunc, nil
- }
-
- // the IV is all zeros
- iv := make([]byte, ske.CipherFunc.blockSize())
- c := cipher.NewCFBDecrypter(ske.CipherFunc.new(key), iv)
- plaintextKey := make([]byte, len(ske.encryptedKey))
- c.XORKeyStream(plaintextKey, ske.encryptedKey)
- cipherFunc := CipherFunction(plaintextKey[0])
- if cipherFunc.blockSize() == 0 {
- return nil, ske.CipherFunc, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(cipherFunc)))
- }
- plaintextKey = plaintextKey[1:]
- if l, cipherKeySize := len(plaintextKey), cipherFunc.KeySize(); l != cipherFunc.KeySize() {
- return nil, cipherFunc, errors.StructuralError("length of decrypted key (" + strconv.Itoa(l) + ") " +
- "not equal to cipher keysize (" + strconv.Itoa(cipherKeySize) + ")")
- }
- return plaintextKey, cipherFunc, nil
-}
-
-// SerializeSymmetricKeyEncrypted serializes a symmetric key packet to w. The
-// packet contains a random session key, encrypted by a key derived from the
-// given passphrase. The session key is returned and must be passed to
-// SerializeSymmetricallyEncrypted.
-// If config is nil, sensible defaults will be used.
-func SerializeSymmetricKeyEncrypted(w io.Writer, passphrase []byte, config *Config) (key []byte, err error) {
- cipherFunc := config.Cipher()
- keySize := cipherFunc.KeySize()
- if keySize == 0 {
- return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(cipherFunc)))
- }
-
- s2kBuf := new(bytes.Buffer)
- keyEncryptingKey := make([]byte, keySize)
- // s2k.Serialize salts and stretches the passphrase, and writes the
- // resulting key to keyEncryptingKey and the s2k descriptor to s2kBuf.
- err = s2k.Serialize(s2kBuf, keyEncryptingKey, config.Random(), passphrase, &s2k.Config{Hash: config.Hash(), S2KCount: config.PasswordHashIterations()})
- if err != nil {
- return
- }
- s2kBytes := s2kBuf.Bytes()
-
- packetLength := 2 /* header */ + len(s2kBytes) + 1 /* cipher type */ + keySize
- err = serializeHeader(w, packetTypeSymmetricKeyEncrypted, packetLength)
- if err != nil {
- return
- }
-
- var buf [2]byte
- buf[0] = symmetricKeyEncryptedVersion
- buf[1] = byte(cipherFunc)
- _, err = w.Write(buf[:])
- if err != nil {
- return
- }
- _, err = w.Write(s2kBytes)
- if err != nil {
- return
- }
-
- sessionKey := make([]byte, keySize)
- _, err = io.ReadFull(config.Random(), sessionKey)
- if err != nil {
- return
- }
- iv := make([]byte, cipherFunc.blockSize())
- c := cipher.NewCFBEncrypter(cipherFunc.new(keyEncryptingKey), iv)
- encryptedCipherAndKey := make([]byte, keySize+1)
- c.XORKeyStream(encryptedCipherAndKey, buf[1:])
- c.XORKeyStream(encryptedCipherAndKey[1:], sessionKey)
- _, err = w.Write(encryptedCipherAndKey)
- if err != nil {
- return
- }
-
- key = sessionKey
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go b/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go
deleted file mode 100644
index 6126030e..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "crypto/cipher"
- "crypto/sha1"
- "crypto/subtle"
- "golang.org/x/crypto/openpgp/errors"
- "hash"
- "io"
- "strconv"
-)
-
-// SymmetricallyEncrypted represents a symmetrically encrypted byte string. The
-// encrypted contents will consist of more OpenPGP packets. See RFC 4880,
-// sections 5.7 and 5.13.
-type SymmetricallyEncrypted struct {
- MDC bool // true iff this is a type 18 packet and thus has an embedded MAC.
- contents io.Reader
- prefix []byte
-}
-
-const symmetricallyEncryptedVersion = 1
-
-func (se *SymmetricallyEncrypted) parse(r io.Reader) error {
- if se.MDC {
- // See RFC 4880, section 5.13.
- var buf [1]byte
- _, err := readFull(r, buf[:])
- if err != nil {
- return err
- }
- if buf[0] != symmetricallyEncryptedVersion {
- return errors.UnsupportedError("unknown SymmetricallyEncrypted version")
- }
- }
- se.contents = r
- return nil
-}
-
-// Decrypt returns a ReadCloser, from which the decrypted contents of the
-// packet can be read. An incorrect key can, with high probability, be detected
-// immediately and this will result in a KeyIncorrect error being returned.
-func (se *SymmetricallyEncrypted) Decrypt(c CipherFunction, key []byte) (io.ReadCloser, error) {
- keySize := c.KeySize()
- if keySize == 0 {
- return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(c)))
- }
- if len(key) != keySize {
- return nil, errors.InvalidArgumentError("SymmetricallyEncrypted: incorrect key length")
- }
-
- if se.prefix == nil {
- se.prefix = make([]byte, c.blockSize()+2)
- _, err := readFull(se.contents, se.prefix)
- if err != nil {
- return nil, err
- }
- } else if len(se.prefix) != c.blockSize()+2 {
- return nil, errors.InvalidArgumentError("can't try ciphers with different block lengths")
- }
-
- ocfbResync := OCFBResync
- if se.MDC {
- // MDC packets use a different form of OCFB mode.
- ocfbResync = OCFBNoResync
- }
-
- s := NewOCFBDecrypter(c.new(key), se.prefix, ocfbResync)
- if s == nil {
- return nil, errors.ErrKeyIncorrect
- }
-
- plaintext := cipher.StreamReader{S: s, R: se.contents}
-
- if se.MDC {
- // MDC packets have an embedded hash that we need to check.
- h := sha1.New()
- h.Write(se.prefix)
- return &seMDCReader{in: plaintext, h: h}, nil
- }
-
- // Otherwise, we just need to wrap plaintext so that it's a valid ReadCloser.
- return seReader{plaintext}, nil
-}
-
-// seReader wraps an io.Reader with a no-op Close method.
-type seReader struct {
- in io.Reader
-}
-
-func (ser seReader) Read(buf []byte) (int, error) {
- return ser.in.Read(buf)
-}
-
-func (ser seReader) Close() error {
- return nil
-}
-
-const mdcTrailerSize = 1 /* tag byte */ + 1 /* length byte */ + sha1.Size
-
-// An seMDCReader wraps an io.Reader, maintains a running hash and keeps hold
-// of the most recent 22 bytes (mdcTrailerSize). Upon EOF, those bytes form an
-// MDC packet containing a hash of the previous contents which is checked
-// against the running hash. See RFC 4880, section 5.13.
-type seMDCReader struct {
- in io.Reader
- h hash.Hash
- trailer [mdcTrailerSize]byte
- scratch [mdcTrailerSize]byte
- trailerUsed int
- error bool
- eof bool
-}
-
-func (ser *seMDCReader) Read(buf []byte) (n int, err error) {
- if ser.error {
- err = io.ErrUnexpectedEOF
- return
- }
- if ser.eof {
- err = io.EOF
- return
- }
-
- // If we haven't yet filled the trailer buffer then we must do that
- // first.
- for ser.trailerUsed < mdcTrailerSize {
- n, err = ser.in.Read(ser.trailer[ser.trailerUsed:])
- ser.trailerUsed += n
- if err == io.EOF {
- if ser.trailerUsed != mdcTrailerSize {
- n = 0
- err = io.ErrUnexpectedEOF
- ser.error = true
- return
- }
- ser.eof = true
- n = 0
- return
- }
-
- if err != nil {
- n = 0
- return
- }
- }
-
- // If it's a short read then we read into a temporary buffer and shift
- // the data into the caller's buffer.
- if len(buf) <= mdcTrailerSize {
- n, err = readFull(ser.in, ser.scratch[:len(buf)])
- copy(buf, ser.trailer[:n])
- ser.h.Write(buf[:n])
- copy(ser.trailer[:], ser.trailer[n:])
- copy(ser.trailer[mdcTrailerSize-n:], ser.scratch[:])
- if n < len(buf) {
- ser.eof = true
- err = io.EOF
- }
- return
- }
-
- n, err = ser.in.Read(buf[mdcTrailerSize:])
- copy(buf, ser.trailer[:])
- ser.h.Write(buf[:n])
- copy(ser.trailer[:], buf[n:])
-
- if err == io.EOF {
- ser.eof = true
- }
- return
-}
-
-// This is a new-format packet tag byte for a type 19 (MDC) packet.
-const mdcPacketTagByte = byte(0x80) | 0x40 | 19
-
-func (ser *seMDCReader) Close() error {
- if ser.error {
- return errors.SignatureError("error during reading")
- }
-
- for !ser.eof {
- // We haven't seen EOF so we need to read to the end
- var buf [1024]byte
- _, err := ser.Read(buf[:])
- if err == io.EOF {
- break
- }
- if err != nil {
- return errors.SignatureError("error during reading")
- }
- }
-
- if ser.trailer[0] != mdcPacketTagByte || ser.trailer[1] != sha1.Size {
- return errors.SignatureError("MDC packet not found")
- }
- ser.h.Write(ser.trailer[:2])
-
- final := ser.h.Sum(nil)
- if subtle.ConstantTimeCompare(final, ser.trailer[2:]) != 1 {
- return errors.SignatureError("hash mismatch")
- }
- return nil
-}
-
-// An seMDCWriter writes through to an io.WriteCloser while maintains a running
-// hash of the data written. On close, it emits an MDC packet containing the
-// running hash.
-type seMDCWriter struct {
- w io.WriteCloser
- h hash.Hash
-}
-
-func (w *seMDCWriter) Write(buf []byte) (n int, err error) {
- w.h.Write(buf)
- return w.w.Write(buf)
-}
-
-func (w *seMDCWriter) Close() (err error) {
- var buf [mdcTrailerSize]byte
-
- buf[0] = mdcPacketTagByte
- buf[1] = sha1.Size
- w.h.Write(buf[:2])
- digest := w.h.Sum(nil)
- copy(buf[2:], digest)
-
- _, err = w.w.Write(buf[:])
- if err != nil {
- return
- }
- return w.w.Close()
-}
-
-// noOpCloser is like an ioutil.NopCloser, but for an io.Writer.
-type noOpCloser struct {
- w io.Writer
-}
-
-func (c noOpCloser) Write(data []byte) (n int, err error) {
- return c.w.Write(data)
-}
-
-func (c noOpCloser) Close() error {
- return nil
-}
-
-// SerializeSymmetricallyEncrypted serializes a symmetrically encrypted packet
-// to w and returns a WriteCloser to which the to-be-encrypted packets can be
-// written.
-// If config is nil, sensible defaults will be used.
-func SerializeSymmetricallyEncrypted(w io.Writer, c CipherFunction, key []byte, config *Config) (contents io.WriteCloser, err error) {
- if c.KeySize() != len(key) {
- return nil, errors.InvalidArgumentError("SymmetricallyEncrypted.Serialize: bad key length")
- }
- writeCloser := noOpCloser{w}
- ciphertext, err := serializeStreamHeader(writeCloser, packetTypeSymmetricallyEncryptedMDC)
- if err != nil {
- return
- }
-
- _, err = ciphertext.Write([]byte{symmetricallyEncryptedVersion})
- if err != nil {
- return
- }
-
- block := c.new(key)
- blockSize := block.BlockSize()
- iv := make([]byte, blockSize)
- _, err = config.Random().Read(iv)
- if err != nil {
- return
- }
- s, prefix := NewOCFBEncrypter(block, iv, OCFBNoResync)
- _, err = ciphertext.Write(prefix)
- if err != nil {
- return
- }
- plaintext := cipher.StreamWriter{S: s, W: ciphertext}
-
- h := sha1.New()
- h.Write(iv)
- h.Write(iv[blockSize-2:])
- contents = &seMDCWriter{w: plaintext, h: h}
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go b/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go
deleted file mode 100644
index 96a2b382..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "image"
- "image/jpeg"
- "io"
- "io/ioutil"
-)
-
-const UserAttrImageSubpacket = 1
-
-// UserAttribute is capable of storing other types of data about a user
-// beyond name, email and a text comment. In practice, user attributes are typically used
-// to store a signed thumbnail photo JPEG image of the user.
-// See RFC 4880, section 5.12.
-type UserAttribute struct {
- Contents []*OpaqueSubpacket
-}
-
-// NewUserAttributePhoto creates a user attribute packet
-// containing the given images.
-func NewUserAttributePhoto(photos ...image.Image) (uat *UserAttribute, err error) {
- uat = new(UserAttribute)
- for _, photo := range photos {
- var buf bytes.Buffer
- // RFC 4880, Section 5.12.1.
- data := []byte{
- 0x10, 0x00, // Little-endian image header length (16 bytes)
- 0x01, // Image header version 1
- 0x01, // JPEG
- 0, 0, 0, 0, // 12 reserved octets, must be all zero.
- 0, 0, 0, 0,
- 0, 0, 0, 0}
- if _, err = buf.Write(data); err != nil {
- return
- }
- if err = jpeg.Encode(&buf, photo, nil); err != nil {
- return
- }
- uat.Contents = append(uat.Contents, &OpaqueSubpacket{
- SubType: UserAttrImageSubpacket,
- Contents: buf.Bytes()})
- }
- return
-}
-
-// NewUserAttribute creates a new user attribute packet containing the given subpackets.
-func NewUserAttribute(contents ...*OpaqueSubpacket) *UserAttribute {
- return &UserAttribute{Contents: contents}
-}
-
-func (uat *UserAttribute) parse(r io.Reader) (err error) {
- // RFC 4880, section 5.13
- b, err := ioutil.ReadAll(r)
- if err != nil {
- return
- }
- uat.Contents, err = OpaqueSubpackets(b)
- return
-}
-
-// Serialize marshals the user attribute to w in the form of an OpenPGP packet, including
-// header.
-func (uat *UserAttribute) Serialize(w io.Writer) (err error) {
- var buf bytes.Buffer
- for _, sp := range uat.Contents {
- sp.Serialize(&buf)
- }
- if err = serializeHeader(w, packetTypeUserAttribute, buf.Len()); err != nil {
- return err
- }
- _, err = w.Write(buf.Bytes())
- return
-}
-
-// ImageData returns zero or more byte slices, each containing
-// JPEG File Interchange Format (JFIF), for each photo in the
-// the user attribute packet.
-func (uat *UserAttribute) ImageData() (imageData [][]byte) {
- for _, sp := range uat.Contents {
- if sp.SubType == UserAttrImageSubpacket && len(sp.Contents) > 16 {
- imageData = append(imageData, sp.Contents[16:])
- }
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/userid.go b/vendor/golang.org/x/crypto/openpgp/packet/userid.go
deleted file mode 100644
index d6bea7d4..00000000
--- a/vendor/golang.org/x/crypto/openpgp/packet/userid.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "io"
- "io/ioutil"
- "strings"
-)
-
-// UserId contains text that is intended to represent the name and email
-// address of the key holder. See RFC 4880, section 5.11. By convention, this
-// takes the form "Full Name (Comment) "
-type UserId struct {
- Id string // By convention, this takes the form "Full Name (Comment) " which is split out in the fields below.
-
- Name, Comment, Email string
-}
-
-func hasInvalidCharacters(s string) bool {
- for _, c := range s {
- switch c {
- case '(', ')', '<', '>', 0:
- return true
- }
- }
- return false
-}
-
-// NewUserId returns a UserId or nil if any of the arguments contain invalid
-// characters. The invalid characters are '\x00', '(', ')', '<' and '>'
-func NewUserId(name, comment, email string) *UserId {
- // RFC 4880 doesn't deal with the structure of userid strings; the
- // name, comment and email form is just a convention. However, there's
- // no convention about escaping the metacharacters and GPG just refuses
- // to create user ids where, say, the name contains a '('. We mirror
- // this behaviour.
-
- if hasInvalidCharacters(name) || hasInvalidCharacters(comment) || hasInvalidCharacters(email) {
- return nil
- }
-
- uid := new(UserId)
- uid.Name, uid.Comment, uid.Email = name, comment, email
- uid.Id = name
- if len(comment) > 0 {
- if len(uid.Id) > 0 {
- uid.Id += " "
- }
- uid.Id += "("
- uid.Id += comment
- uid.Id += ")"
- }
- if len(email) > 0 {
- if len(uid.Id) > 0 {
- uid.Id += " "
- }
- uid.Id += "<"
- uid.Id += email
- uid.Id += ">"
- }
- return uid
-}
-
-func (uid *UserId) parse(r io.Reader) (err error) {
- // RFC 4880, section 5.11
- b, err := ioutil.ReadAll(r)
- if err != nil {
- return
- }
- uid.Id = string(b)
- uid.Name, uid.Comment, uid.Email = parseUserId(uid.Id)
- return
-}
-
-// Serialize marshals uid to w in the form of an OpenPGP packet, including
-// header.
-func (uid *UserId) Serialize(w io.Writer) error {
- err := serializeHeader(w, packetTypeUserId, len(uid.Id))
- if err != nil {
- return err
- }
- _, err = w.Write([]byte(uid.Id))
- return err
-}
-
-// parseUserId extracts the name, comment and email from a user id string that
-// is formatted as "Full Name (Comment) ".
-func parseUserId(id string) (name, comment, email string) {
- var n, c, e struct {
- start, end int
- }
- var state int
-
- for offset, rune := range id {
- switch state {
- case 0:
- // Entering name
- n.start = offset
- state = 1
- fallthrough
- case 1:
- // In name
- if rune == '(' {
- state = 2
- n.end = offset
- } else if rune == '<' {
- state = 5
- n.end = offset
- }
- case 2:
- // Entering comment
- c.start = offset
- state = 3
- fallthrough
- case 3:
- // In comment
- if rune == ')' {
- state = 4
- c.end = offset
- }
- case 4:
- // Between comment and email
- if rune == '<' {
- state = 5
- }
- case 5:
- // Entering email
- e.start = offset
- state = 6
- fallthrough
- case 6:
- // In email
- if rune == '>' {
- state = 7
- e.end = offset
- }
- default:
- // After email
- }
- }
- switch state {
- case 1:
- // ended in the name
- n.end = len(id)
- case 3:
- // ended in comment
- c.end = len(id)
- case 6:
- // ended in email
- e.end = len(id)
- }
-
- name = strings.TrimSpace(id[n.start:n.end])
- comment = strings.TrimSpace(id[c.start:c.end])
- email = strings.TrimSpace(id[e.start:e.end])
- return
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/read.go b/vendor/golang.org/x/crypto/openpgp/read.go
deleted file mode 100644
index 6ec664f4..00000000
--- a/vendor/golang.org/x/crypto/openpgp/read.go
+++ /dev/null
@@ -1,442 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package openpgp implements high level operations on OpenPGP messages.
-package openpgp // import "golang.org/x/crypto/openpgp"
-
-import (
- "crypto"
- _ "crypto/sha256"
- "hash"
- "io"
- "strconv"
-
- "golang.org/x/crypto/openpgp/armor"
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/packet"
-)
-
-// SignatureType is the armor type for a PGP signature.
-var SignatureType = "PGP SIGNATURE"
-
-// readArmored reads an armored block with the given type.
-func readArmored(r io.Reader, expectedType string) (body io.Reader, err error) {
- block, err := armor.Decode(r)
- if err != nil {
- return
- }
-
- if block.Type != expectedType {
- return nil, errors.InvalidArgumentError("expected '" + expectedType + "', got: " + block.Type)
- }
-
- return block.Body, nil
-}
-
-// MessageDetails contains the result of parsing an OpenPGP encrypted and/or
-// signed message.
-type MessageDetails struct {
- IsEncrypted bool // true if the message was encrypted.
- EncryptedToKeyIds []uint64 // the list of recipient key ids.
- IsSymmetricallyEncrypted bool // true if a passphrase could have decrypted the message.
- DecryptedWith Key // the private key used to decrypt the message, if any.
- IsSigned bool // true if the message is signed.
- SignedByKeyId uint64 // the key id of the signer, if any.
- SignedBy *Key // the key of the signer, if available.
- LiteralData *packet.LiteralData // the metadata of the contents
- UnverifiedBody io.Reader // the contents of the message.
-
- // If IsSigned is true and SignedBy is non-zero then the signature will
- // be verified as UnverifiedBody is read. The signature cannot be
- // checked until the whole of UnverifiedBody is read so UnverifiedBody
- // must be consumed until EOF before the data can be trusted. Even if a
- // message isn't signed (or the signer is unknown) the data may contain
- // an authentication code that is only checked once UnverifiedBody has
- // been consumed. Once EOF has been seen, the following fields are
- // valid. (An authentication code failure is reported as a
- // SignatureError error when reading from UnverifiedBody.)
- SignatureError error // nil if the signature is good.
- Signature *packet.Signature // the signature packet itself, if v4 (default)
- SignatureV3 *packet.SignatureV3 // the signature packet if it is a v2 or v3 signature
-
- decrypted io.ReadCloser
-}
-
-// A PromptFunction is used as a callback by functions that may need to decrypt
-// a private key, or prompt for a passphrase. It is called with a list of
-// acceptable, encrypted private keys and a boolean that indicates whether a
-// passphrase is usable. It should either decrypt a private key or return a
-// passphrase to try. If the decrypted private key or given passphrase isn't
-// correct, the function will be called again, forever. Any error returned will
-// be passed up.
-type PromptFunction func(keys []Key, symmetric bool) ([]byte, error)
-
-// A keyEnvelopePair is used to store a private key with the envelope that
-// contains a symmetric key, encrypted with that key.
-type keyEnvelopePair struct {
- key Key
- encryptedKey *packet.EncryptedKey
-}
-
-// ReadMessage parses an OpenPGP message that may be signed and/or encrypted.
-// The given KeyRing should contain both public keys (for signature
-// verification) and, possibly encrypted, private keys for decrypting.
-// If config is nil, sensible defaults will be used.
-func ReadMessage(r io.Reader, keyring KeyRing, prompt PromptFunction, config *packet.Config) (md *MessageDetails, err error) {
- var p packet.Packet
-
- var symKeys []*packet.SymmetricKeyEncrypted
- var pubKeys []keyEnvelopePair
- var se *packet.SymmetricallyEncrypted
-
- packets := packet.NewReader(r)
- md = new(MessageDetails)
- md.IsEncrypted = true
-
- // The message, if encrypted, starts with a number of packets
- // containing an encrypted decryption key. The decryption key is either
- // encrypted to a public key, or with a passphrase. This loop
- // collects these packets.
-ParsePackets:
- for {
- p, err = packets.Next()
- if err != nil {
- return nil, err
- }
- switch p := p.(type) {
- case *packet.SymmetricKeyEncrypted:
- // This packet contains the decryption key encrypted with a passphrase.
- md.IsSymmetricallyEncrypted = true
- symKeys = append(symKeys, p)
- case *packet.EncryptedKey:
- // This packet contains the decryption key encrypted to a public key.
- md.EncryptedToKeyIds = append(md.EncryptedToKeyIds, p.KeyId)
- switch p.Algo {
- case packet.PubKeyAlgoRSA, packet.PubKeyAlgoRSAEncryptOnly, packet.PubKeyAlgoElGamal:
- break
- default:
- continue
- }
- var keys []Key
- if p.KeyId == 0 {
- keys = keyring.DecryptionKeys()
- } else {
- keys = keyring.KeysById(p.KeyId)
- }
- for _, k := range keys {
- pubKeys = append(pubKeys, keyEnvelopePair{k, p})
- }
- case *packet.SymmetricallyEncrypted:
- se = p
- break ParsePackets
- case *packet.Compressed, *packet.LiteralData, *packet.OnePassSignature:
- // This message isn't encrypted.
- if len(symKeys) != 0 || len(pubKeys) != 0 {
- return nil, errors.StructuralError("key material not followed by encrypted message")
- }
- packets.Unread(p)
- return readSignedMessage(packets, nil, keyring)
- }
- }
-
- var candidates []Key
- var decrypted io.ReadCloser
-
- // Now that we have the list of encrypted keys we need to decrypt at
- // least one of them or, if we cannot, we need to call the prompt
- // function so that it can decrypt a key or give us a passphrase.
-FindKey:
- for {
- // See if any of the keys already have a private key available
- candidates = candidates[:0]
- candidateFingerprints := make(map[string]bool)
-
- for _, pk := range pubKeys {
- if pk.key.PrivateKey == nil {
- continue
- }
- if !pk.key.PrivateKey.Encrypted {
- if len(pk.encryptedKey.Key) == 0 {
- pk.encryptedKey.Decrypt(pk.key.PrivateKey, config)
- }
- if len(pk.encryptedKey.Key) == 0 {
- continue
- }
- decrypted, err = se.Decrypt(pk.encryptedKey.CipherFunc, pk.encryptedKey.Key)
- if err != nil && err != errors.ErrKeyIncorrect {
- return nil, err
- }
- if decrypted != nil {
- md.DecryptedWith = pk.key
- break FindKey
- }
- } else {
- fpr := string(pk.key.PublicKey.Fingerprint[:])
- if v := candidateFingerprints[fpr]; v {
- continue
- }
- candidates = append(candidates, pk.key)
- candidateFingerprints[fpr] = true
- }
- }
-
- if len(candidates) == 0 && len(symKeys) == 0 {
- return nil, errors.ErrKeyIncorrect
- }
-
- if prompt == nil {
- return nil, errors.ErrKeyIncorrect
- }
-
- passphrase, err := prompt(candidates, len(symKeys) != 0)
- if err != nil {
- return nil, err
- }
-
- // Try the symmetric passphrase first
- if len(symKeys) != 0 && passphrase != nil {
- for _, s := range symKeys {
- key, cipherFunc, err := s.Decrypt(passphrase)
- if err == nil {
- decrypted, err = se.Decrypt(cipherFunc, key)
- if err != nil && err != errors.ErrKeyIncorrect {
- return nil, err
- }
- if decrypted != nil {
- break FindKey
- }
- }
-
- }
- }
- }
-
- md.decrypted = decrypted
- if err := packets.Push(decrypted); err != nil {
- return nil, err
- }
- return readSignedMessage(packets, md, keyring)
-}
-
-// readSignedMessage reads a possibly signed message if mdin is non-zero then
-// that structure is updated and returned. Otherwise a fresh MessageDetails is
-// used.
-func readSignedMessage(packets *packet.Reader, mdin *MessageDetails, keyring KeyRing) (md *MessageDetails, err error) {
- if mdin == nil {
- mdin = new(MessageDetails)
- }
- md = mdin
-
- var p packet.Packet
- var h hash.Hash
- var wrappedHash hash.Hash
-FindLiteralData:
- for {
- p, err = packets.Next()
- if err != nil {
- return nil, err
- }
- switch p := p.(type) {
- case *packet.Compressed:
- if err := packets.Push(p.Body); err != nil {
- return nil, err
- }
- case *packet.OnePassSignature:
- if !p.IsLast {
- return nil, errors.UnsupportedError("nested signatures")
- }
-
- h, wrappedHash, err = hashForSignature(p.Hash, p.SigType)
- if err != nil {
- md = nil
- return
- }
-
- md.IsSigned = true
- md.SignedByKeyId = p.KeyId
- keys := keyring.KeysByIdUsage(p.KeyId, packet.KeyFlagSign)
- if len(keys) > 0 {
- md.SignedBy = &keys[0]
- }
- case *packet.LiteralData:
- md.LiteralData = p
- break FindLiteralData
- }
- }
-
- if md.SignedBy != nil {
- md.UnverifiedBody = &signatureCheckReader{packets, h, wrappedHash, md}
- } else if md.decrypted != nil {
- md.UnverifiedBody = checkReader{md}
- } else {
- md.UnverifiedBody = md.LiteralData.Body
- }
-
- return md, nil
-}
-
-// hashForSignature returns a pair of hashes that can be used to verify a
-// signature. The signature may specify that the contents of the signed message
-// should be preprocessed (i.e. to normalize line endings). Thus this function
-// returns two hashes. The second should be used to hash the message itself and
-// performs any needed preprocessing.
-func hashForSignature(hashId crypto.Hash, sigType packet.SignatureType) (hash.Hash, hash.Hash, error) {
- if !hashId.Available() {
- return nil, nil, errors.UnsupportedError("hash not available: " + strconv.Itoa(int(hashId)))
- }
- h := hashId.New()
-
- switch sigType {
- case packet.SigTypeBinary:
- return h, h, nil
- case packet.SigTypeText:
- return h, NewCanonicalTextHash(h), nil
- }
-
- return nil, nil, errors.UnsupportedError("unsupported signature type: " + strconv.Itoa(int(sigType)))
-}
-
-// checkReader wraps an io.Reader from a LiteralData packet. When it sees EOF
-// it closes the ReadCloser from any SymmetricallyEncrypted packet to trigger
-// MDC checks.
-type checkReader struct {
- md *MessageDetails
-}
-
-func (cr checkReader) Read(buf []byte) (n int, err error) {
- n, err = cr.md.LiteralData.Body.Read(buf)
- if err == io.EOF {
- mdcErr := cr.md.decrypted.Close()
- if mdcErr != nil {
- err = mdcErr
- }
- }
- return
-}
-
-// signatureCheckReader wraps an io.Reader from a LiteralData packet and hashes
-// the data as it is read. When it sees an EOF from the underlying io.Reader
-// it parses and checks a trailing Signature packet and triggers any MDC checks.
-type signatureCheckReader struct {
- packets *packet.Reader
- h, wrappedHash hash.Hash
- md *MessageDetails
-}
-
-func (scr *signatureCheckReader) Read(buf []byte) (n int, err error) {
- n, err = scr.md.LiteralData.Body.Read(buf)
- scr.wrappedHash.Write(buf[:n])
- if err == io.EOF {
- var p packet.Packet
- p, scr.md.SignatureError = scr.packets.Next()
- if scr.md.SignatureError != nil {
- return
- }
-
- var ok bool
- if scr.md.Signature, ok = p.(*packet.Signature); ok {
- scr.md.SignatureError = scr.md.SignedBy.PublicKey.VerifySignature(scr.h, scr.md.Signature)
- } else if scr.md.SignatureV3, ok = p.(*packet.SignatureV3); ok {
- scr.md.SignatureError = scr.md.SignedBy.PublicKey.VerifySignatureV3(scr.h, scr.md.SignatureV3)
- } else {
- scr.md.SignatureError = errors.StructuralError("LiteralData not followed by Signature")
- return
- }
-
- // The SymmetricallyEncrypted packet, if any, might have an
- // unsigned hash of its own. In order to check this we need to
- // close that Reader.
- if scr.md.decrypted != nil {
- mdcErr := scr.md.decrypted.Close()
- if mdcErr != nil {
- err = mdcErr
- }
- }
- }
- return
-}
-
-// CheckDetachedSignature takes a signed file and a detached signature and
-// returns the signer if the signature is valid. If the signer isn't known,
-// ErrUnknownIssuer is returned.
-func CheckDetachedSignature(keyring KeyRing, signed, signature io.Reader) (signer *Entity, err error) {
- var issuerKeyId uint64
- var hashFunc crypto.Hash
- var sigType packet.SignatureType
- var keys []Key
- var p packet.Packet
-
- packets := packet.NewReader(signature)
- for {
- p, err = packets.Next()
- if err == io.EOF {
- return nil, errors.ErrUnknownIssuer
- }
- if err != nil {
- return nil, err
- }
-
- switch sig := p.(type) {
- case *packet.Signature:
- if sig.IssuerKeyId == nil {
- return nil, errors.StructuralError("signature doesn't have an issuer")
- }
- issuerKeyId = *sig.IssuerKeyId
- hashFunc = sig.Hash
- sigType = sig.SigType
- case *packet.SignatureV3:
- issuerKeyId = sig.IssuerKeyId
- hashFunc = sig.Hash
- sigType = sig.SigType
- default:
- return nil, errors.StructuralError("non signature packet found")
- }
-
- keys = keyring.KeysByIdUsage(issuerKeyId, packet.KeyFlagSign)
- if len(keys) > 0 {
- break
- }
- }
-
- if len(keys) == 0 {
- panic("unreachable")
- }
-
- h, wrappedHash, err := hashForSignature(hashFunc, sigType)
- if err != nil {
- return nil, err
- }
-
- if _, err := io.Copy(wrappedHash, signed); err != nil && err != io.EOF {
- return nil, err
- }
-
- for _, key := range keys {
- switch sig := p.(type) {
- case *packet.Signature:
- err = key.PublicKey.VerifySignature(h, sig)
- case *packet.SignatureV3:
- err = key.PublicKey.VerifySignatureV3(h, sig)
- default:
- panic("unreachable")
- }
-
- if err == nil {
- return key.Entity, nil
- }
- }
-
- return nil, err
-}
-
-// CheckArmoredDetachedSignature performs the same actions as
-// CheckDetachedSignature but expects the signature to be armored.
-func CheckArmoredDetachedSignature(keyring KeyRing, signed, signature io.Reader) (signer *Entity, err error) {
- body, err := readArmored(signature, SignatureType)
- if err != nil {
- return
- }
-
- return CheckDetachedSignature(keyring, signed, body)
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go b/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go
deleted file mode 100644
index 4b9a44ca..00000000
--- a/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go
+++ /dev/null
@@ -1,273 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package s2k implements the various OpenPGP string-to-key transforms as
-// specified in RFC 4800 section 3.7.1.
-package s2k // import "golang.org/x/crypto/openpgp/s2k"
-
-import (
- "crypto"
- "hash"
- "io"
- "strconv"
-
- "golang.org/x/crypto/openpgp/errors"
-)
-
-// Config collects configuration parameters for s2k key-stretching
-// transformatioms. A nil *Config is valid and results in all default
-// values. Currently, Config is used only by the Serialize function in
-// this package.
-type Config struct {
- // Hash is the default hash function to be used. If
- // nil, SHA1 is used.
- Hash crypto.Hash
- // S2KCount is only used for symmetric encryption. It
- // determines the strength of the passphrase stretching when
- // the said passphrase is hashed to produce a key. S2KCount
- // should be between 1024 and 65011712, inclusive. If Config
- // is nil or S2KCount is 0, the value 65536 used. Not all
- // values in the above range can be represented. S2KCount will
- // be rounded up to the next representable value if it cannot
- // be encoded exactly. When set, it is strongly encrouraged to
- // use a value that is at least 65536. See RFC 4880 Section
- // 3.7.1.3.
- S2KCount int
-}
-
-func (c *Config) hash() crypto.Hash {
- if c == nil || uint(c.Hash) == 0 {
- // SHA1 is the historical default in this package.
- return crypto.SHA1
- }
-
- return c.Hash
-}
-
-func (c *Config) encodedCount() uint8 {
- if c == nil || c.S2KCount == 0 {
- return 96 // The common case. Correspoding to 65536
- }
-
- i := c.S2KCount
- switch {
- // Behave like GPG. Should we make 65536 the lowest value used?
- case i < 1024:
- i = 1024
- case i > 65011712:
- i = 65011712
- }
-
- return encodeCount(i)
-}
-
-// encodeCount converts an iterative "count" in the range 1024 to
-// 65011712, inclusive, to an encoded count. The return value is the
-// octet that is actually stored in the GPG file. encodeCount panics
-// if i is not in the above range (encodedCount above takes care to
-// pass i in the correct range). See RFC 4880 Section 3.7.7.1.
-func encodeCount(i int) uint8 {
- if i < 1024 || i > 65011712 {
- panic("count arg i outside the required range")
- }
-
- for encoded := 0; encoded < 256; encoded++ {
- count := decodeCount(uint8(encoded))
- if count >= i {
- return uint8(encoded)
- }
- }
-
- return 255
-}
-
-// decodeCount returns the s2k mode 3 iterative "count" corresponding to
-// the encoded octet c.
-func decodeCount(c uint8) int {
- return (16 + int(c&15)) << (uint32(c>>4) + 6)
-}
-
-// Simple writes to out the result of computing the Simple S2K function (RFC
-// 4880, section 3.7.1.1) using the given hash and input passphrase.
-func Simple(out []byte, h hash.Hash, in []byte) {
- Salted(out, h, in, nil)
-}
-
-var zero [1]byte
-
-// Salted writes to out the result of computing the Salted S2K function (RFC
-// 4880, section 3.7.1.2) using the given hash, input passphrase and salt.
-func Salted(out []byte, h hash.Hash, in []byte, salt []byte) {
- done := 0
- var digest []byte
-
- for i := 0; done < len(out); i++ {
- h.Reset()
- for j := 0; j < i; j++ {
- h.Write(zero[:])
- }
- h.Write(salt)
- h.Write(in)
- digest = h.Sum(digest[:0])
- n := copy(out[done:], digest)
- done += n
- }
-}
-
-// Iterated writes to out the result of computing the Iterated and Salted S2K
-// function (RFC 4880, section 3.7.1.3) using the given hash, input passphrase,
-// salt and iteration count.
-func Iterated(out []byte, h hash.Hash, in []byte, salt []byte, count int) {
- combined := make([]byte, len(in)+len(salt))
- copy(combined, salt)
- copy(combined[len(salt):], in)
-
- if count < len(combined) {
- count = len(combined)
- }
-
- done := 0
- var digest []byte
- for i := 0; done < len(out); i++ {
- h.Reset()
- for j := 0; j < i; j++ {
- h.Write(zero[:])
- }
- written := 0
- for written < count {
- if written+len(combined) > count {
- todo := count - written
- h.Write(combined[:todo])
- written = count
- } else {
- h.Write(combined)
- written += len(combined)
- }
- }
- digest = h.Sum(digest[:0])
- n := copy(out[done:], digest)
- done += n
- }
-}
-
-// Parse reads a binary specification for a string-to-key transformation from r
-// and returns a function which performs that transform.
-func Parse(r io.Reader) (f func(out, in []byte), err error) {
- var buf [9]byte
-
- _, err = io.ReadFull(r, buf[:2])
- if err != nil {
- return
- }
-
- hash, ok := HashIdToHash(buf[1])
- if !ok {
- return nil, errors.UnsupportedError("hash for S2K function: " + strconv.Itoa(int(buf[1])))
- }
- if !hash.Available() {
- return nil, errors.UnsupportedError("hash not available: " + strconv.Itoa(int(hash)))
- }
- h := hash.New()
-
- switch buf[0] {
- case 0:
- f := func(out, in []byte) {
- Simple(out, h, in)
- }
- return f, nil
- case 1:
- _, err = io.ReadFull(r, buf[:8])
- if err != nil {
- return
- }
- f := func(out, in []byte) {
- Salted(out, h, in, buf[:8])
- }
- return f, nil
- case 3:
- _, err = io.ReadFull(r, buf[:9])
- if err != nil {
- return
- }
- count := decodeCount(buf[8])
- f := func(out, in []byte) {
- Iterated(out, h, in, buf[:8], count)
- }
- return f, nil
- }
-
- return nil, errors.UnsupportedError("S2K function")
-}
-
-// Serialize salts and stretches the given passphrase and writes the
-// resulting key into key. It also serializes an S2K descriptor to
-// w. The key stretching can be configured with c, which may be
-// nil. In that case, sensible defaults will be used.
-func Serialize(w io.Writer, key []byte, rand io.Reader, passphrase []byte, c *Config) error {
- var buf [11]byte
- buf[0] = 3 /* iterated and salted */
- buf[1], _ = HashToHashId(c.hash())
- salt := buf[2:10]
- if _, err := io.ReadFull(rand, salt); err != nil {
- return err
- }
- encodedCount := c.encodedCount()
- count := decodeCount(encodedCount)
- buf[10] = encodedCount
- if _, err := w.Write(buf[:]); err != nil {
- return err
- }
-
- Iterated(key, c.hash().New(), passphrase, salt, count)
- return nil
-}
-
-// hashToHashIdMapping contains pairs relating OpenPGP's hash identifier with
-// Go's crypto.Hash type. See RFC 4880, section 9.4.
-var hashToHashIdMapping = []struct {
- id byte
- hash crypto.Hash
- name string
-}{
- {1, crypto.MD5, "MD5"},
- {2, crypto.SHA1, "SHA1"},
- {3, crypto.RIPEMD160, "RIPEMD160"},
- {8, crypto.SHA256, "SHA256"},
- {9, crypto.SHA384, "SHA384"},
- {10, crypto.SHA512, "SHA512"},
- {11, crypto.SHA224, "SHA224"},
-}
-
-// HashIdToHash returns a crypto.Hash which corresponds to the given OpenPGP
-// hash id.
-func HashIdToHash(id byte) (h crypto.Hash, ok bool) {
- for _, m := range hashToHashIdMapping {
- if m.id == id {
- return m.hash, true
- }
- }
- return 0, false
-}
-
-// HashIdToString returns the name of the hash function corresponding to the
-// given OpenPGP hash id.
-func HashIdToString(id byte) (name string, ok bool) {
- for _, m := range hashToHashIdMapping {
- if m.id == id {
- return m.name, true
- }
- }
-
- return "", false
-}
-
-// HashIdToHash returns an OpenPGP hash id which corresponds the given Hash.
-func HashToHashId(h crypto.Hash) (id byte, ok bool) {
- for _, m := range hashToHashIdMapping {
- if m.hash == h {
- return m.id, true
- }
- }
- return 0, false
-}
diff --git a/vendor/golang.org/x/crypto/openpgp/write.go b/vendor/golang.org/x/crypto/openpgp/write.go
deleted file mode 100644
index d6dede74..00000000
--- a/vendor/golang.org/x/crypto/openpgp/write.go
+++ /dev/null
@@ -1,416 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package openpgp
-
-import (
- "crypto"
- "hash"
- "io"
- "strconv"
- "time"
-
- "golang.org/x/crypto/openpgp/armor"
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/packet"
- "golang.org/x/crypto/openpgp/s2k"
-)
-
-// DetachSign signs message with the private key from signer (which must
-// already have been decrypted) and writes the signature to w.
-// If config is nil, sensible defaults will be used.
-func DetachSign(w io.Writer, signer *Entity, message io.Reader, config *packet.Config) error {
- return detachSign(w, signer, message, packet.SigTypeBinary, config)
-}
-
-// ArmoredDetachSign signs message with the private key from signer (which
-// must already have been decrypted) and writes an armored signature to w.
-// If config is nil, sensible defaults will be used.
-func ArmoredDetachSign(w io.Writer, signer *Entity, message io.Reader, config *packet.Config) (err error) {
- return armoredDetachSign(w, signer, message, packet.SigTypeBinary, config)
-}
-
-// DetachSignText signs message (after canonicalising the line endings) with
-// the private key from signer (which must already have been decrypted) and
-// writes the signature to w.
-// If config is nil, sensible defaults will be used.
-func DetachSignText(w io.Writer, signer *Entity, message io.Reader, config *packet.Config) error {
- return detachSign(w, signer, message, packet.SigTypeText, config)
-}
-
-// ArmoredDetachSignText signs message (after canonicalising the line endings)
-// with the private key from signer (which must already have been decrypted)
-// and writes an armored signature to w.
-// If config is nil, sensible defaults will be used.
-func ArmoredDetachSignText(w io.Writer, signer *Entity, message io.Reader, config *packet.Config) error {
- return armoredDetachSign(w, signer, message, packet.SigTypeText, config)
-}
-
-func armoredDetachSign(w io.Writer, signer *Entity, message io.Reader, sigType packet.SignatureType, config *packet.Config) (err error) {
- out, err := armor.Encode(w, SignatureType, nil)
- if err != nil {
- return
- }
- err = detachSign(out, signer, message, sigType, config)
- if err != nil {
- return
- }
- return out.Close()
-}
-
-func detachSign(w io.Writer, signer *Entity, message io.Reader, sigType packet.SignatureType, config *packet.Config) (err error) {
- if signer.PrivateKey == nil {
- return errors.InvalidArgumentError("signing key doesn't have a private key")
- }
- if signer.PrivateKey.Encrypted {
- return errors.InvalidArgumentError("signing key is encrypted")
- }
-
- sig := new(packet.Signature)
- sig.SigType = sigType
- sig.PubKeyAlgo = signer.PrivateKey.PubKeyAlgo
- sig.Hash = config.Hash()
- sig.CreationTime = config.Now()
- sig.IssuerKeyId = &signer.PrivateKey.KeyId
-
- h, wrappedHash, err := hashForSignature(sig.Hash, sig.SigType)
- if err != nil {
- return
- }
- io.Copy(wrappedHash, message)
-
- err = sig.Sign(h, signer.PrivateKey, config)
- if err != nil {
- return
- }
-
- return sig.Serialize(w)
-}
-
-// FileHints contains metadata about encrypted files. This metadata is, itself,
-// encrypted.
-type FileHints struct {
- // IsBinary can be set to hint that the contents are binary data.
- IsBinary bool
- // FileName hints at the name of the file that should be written. It's
- // truncated to 255 bytes if longer. It may be empty to suggest that the
- // file should not be written to disk. It may be equal to "_CONSOLE" to
- // suggest the data should not be written to disk.
- FileName string
- // ModTime contains the modification time of the file, or the zero time if not applicable.
- ModTime time.Time
-}
-
-// SymmetricallyEncrypt acts like gpg -c: it encrypts a file with a passphrase.
-// The resulting WriteCloser must be closed after the contents of the file have
-// been written.
-// If config is nil, sensible defaults will be used.
-func SymmetricallyEncrypt(ciphertext io.Writer, passphrase []byte, hints *FileHints, config *packet.Config) (plaintext io.WriteCloser, err error) {
- if hints == nil {
- hints = &FileHints{}
- }
-
- key, err := packet.SerializeSymmetricKeyEncrypted(ciphertext, passphrase, config)
- if err != nil {
- return
- }
- w, err := packet.SerializeSymmetricallyEncrypted(ciphertext, config.Cipher(), key, config)
- if err != nil {
- return
- }
-
- literaldata := w
- if algo := config.Compression(); algo != packet.CompressionNone {
- var compConfig *packet.CompressionConfig
- if config != nil {
- compConfig = config.CompressionConfig
- }
- literaldata, err = packet.SerializeCompressed(w, algo, compConfig)
- if err != nil {
- return
- }
- }
-
- var epochSeconds uint32
- if !hints.ModTime.IsZero() {
- epochSeconds = uint32(hints.ModTime.Unix())
- }
- return packet.SerializeLiteral(literaldata, hints.IsBinary, hints.FileName, epochSeconds)
-}
-
-// intersectPreferences mutates and returns a prefix of a that contains only
-// the values in the intersection of a and b. The order of a is preserved.
-func intersectPreferences(a []uint8, b []uint8) (intersection []uint8) {
- var j int
- for _, v := range a {
- for _, v2 := range b {
- if v == v2 {
- a[j] = v
- j++
- break
- }
- }
- }
-
- return a[:j]
-}
-
-func hashToHashId(h crypto.Hash) uint8 {
- v, ok := s2k.HashToHashId(h)
- if !ok {
- panic("tried to convert unknown hash")
- }
- return v
-}
-
-// writeAndSign writes the data as a payload package and, optionally, signs
-// it. hints contains optional information, that is also encrypted,
-// that aids the recipients in processing the message. The resulting
-// WriteCloser must be closed after the contents of the file have been
-// written. If config is nil, sensible defaults will be used.
-func writeAndSign(payload io.WriteCloser, candidateHashes []uint8, signed *Entity, hints *FileHints, config *packet.Config) (plaintext io.WriteCloser, err error) {
- var signer *packet.PrivateKey
- if signed != nil {
- signKey, ok := signed.signingKey(config.Now())
- if !ok {
- return nil, errors.InvalidArgumentError("no valid signing keys")
- }
- signer = signKey.PrivateKey
- if signer == nil {
- return nil, errors.InvalidArgumentError("no private key in signing key")
- }
- if signer.Encrypted {
- return nil, errors.InvalidArgumentError("signing key must be decrypted")
- }
- }
-
- var hash crypto.Hash
- for _, hashId := range candidateHashes {
- if h, ok := s2k.HashIdToHash(hashId); ok && h.Available() {
- hash = h
- break
- }
- }
-
- // If the hash specified by config is a candidate, we'll use that.
- if configuredHash := config.Hash(); configuredHash.Available() {
- for _, hashId := range candidateHashes {
- if h, ok := s2k.HashIdToHash(hashId); ok && h == configuredHash {
- hash = h
- break
- }
- }
- }
-
- if hash == 0 {
- hashId := candidateHashes[0]
- name, ok := s2k.HashIdToString(hashId)
- if !ok {
- name = "#" + strconv.Itoa(int(hashId))
- }
- return nil, errors.InvalidArgumentError("cannot encrypt because no candidate hash functions are compiled in. (Wanted " + name + " in this case.)")
- }
-
- if signer != nil {
- ops := &packet.OnePassSignature{
- SigType: packet.SigTypeBinary,
- Hash: hash,
- PubKeyAlgo: signer.PubKeyAlgo,
- KeyId: signer.KeyId,
- IsLast: true,
- }
- if err := ops.Serialize(payload); err != nil {
- return nil, err
- }
- }
-
- if hints == nil {
- hints = &FileHints{}
- }
-
- w := payload
- if signer != nil {
- // If we need to write a signature packet after the literal
- // data then we need to stop literalData from closing
- // encryptedData.
- w = noOpCloser{w}
-
- }
- var epochSeconds uint32
- if !hints.ModTime.IsZero() {
- epochSeconds = uint32(hints.ModTime.Unix())
- }
- literalData, err := packet.SerializeLiteral(w, hints.IsBinary, hints.FileName, epochSeconds)
- if err != nil {
- return nil, err
- }
-
- if signer != nil {
- return signatureWriter{payload, literalData, hash, hash.New(), signer, config}, nil
- }
- return literalData, nil
-}
-
-// Encrypt encrypts a message to a number of recipients and, optionally, signs
-// it. hints contains optional information, that is also encrypted, that aids
-// the recipients in processing the message. The resulting WriteCloser must
-// be closed after the contents of the file have been written.
-// If config is nil, sensible defaults will be used.
-func Encrypt(ciphertext io.Writer, to []*Entity, signed *Entity, hints *FileHints, config *packet.Config) (plaintext io.WriteCloser, err error) {
- if len(to) == 0 {
- return nil, errors.InvalidArgumentError("no encryption recipient provided")
- }
-
- // These are the possible ciphers that we'll use for the message.
- candidateCiphers := []uint8{
- uint8(packet.CipherAES128),
- uint8(packet.CipherAES256),
- uint8(packet.CipherCAST5),
- }
- // These are the possible hash functions that we'll use for the signature.
- candidateHashes := []uint8{
- hashToHashId(crypto.SHA256),
- hashToHashId(crypto.SHA512),
- hashToHashId(crypto.SHA1),
- hashToHashId(crypto.RIPEMD160),
- }
- // In the event that a recipient doesn't specify any supported ciphers
- // or hash functions, these are the ones that we assume that every
- // implementation supports.
- defaultCiphers := candidateCiphers[len(candidateCiphers)-1:]
- defaultHashes := candidateHashes[len(candidateHashes)-1:]
-
- encryptKeys := make([]Key, len(to))
- for i := range to {
- var ok bool
- encryptKeys[i], ok = to[i].encryptionKey(config.Now())
- if !ok {
- return nil, errors.InvalidArgumentError("cannot encrypt a message to key id " + strconv.FormatUint(to[i].PrimaryKey.KeyId, 16) + " because it has no encryption keys")
- }
-
- sig := to[i].primaryIdentity().SelfSignature
-
- preferredSymmetric := sig.PreferredSymmetric
- if len(preferredSymmetric) == 0 {
- preferredSymmetric = defaultCiphers
- }
- preferredHashes := sig.PreferredHash
- if len(preferredHashes) == 0 {
- preferredHashes = defaultHashes
- }
- candidateCiphers = intersectPreferences(candidateCiphers, preferredSymmetric)
- candidateHashes = intersectPreferences(candidateHashes, preferredHashes)
- }
-
- if len(candidateCiphers) == 0 || len(candidateHashes) == 0 {
- return nil, errors.InvalidArgumentError("cannot encrypt because recipient set shares no common algorithms")
- }
-
- cipher := packet.CipherFunction(candidateCiphers[0])
- // If the cipher specified by config is a candidate, we'll use that.
- configuredCipher := config.Cipher()
- for _, c := range candidateCiphers {
- cipherFunc := packet.CipherFunction(c)
- if cipherFunc == configuredCipher {
- cipher = cipherFunc
- break
- }
- }
-
- symKey := make([]byte, cipher.KeySize())
- if _, err := io.ReadFull(config.Random(), symKey); err != nil {
- return nil, err
- }
-
- for _, key := range encryptKeys {
- if err := packet.SerializeEncryptedKey(ciphertext, key.PublicKey, cipher, symKey, config); err != nil {
- return nil, err
- }
- }
-
- payload, err := packet.SerializeSymmetricallyEncrypted(ciphertext, cipher, symKey, config)
- if err != nil {
- return
- }
-
- return writeAndSign(payload, candidateHashes, signed, hints, config)
-}
-
-// Sign signs a message. The resulting WriteCloser must be closed after the
-// contents of the file have been written. hints contains optional information
-// that aids the recipients in processing the message.
-// If config is nil, sensible defaults will be used.
-func Sign(output io.Writer, signed *Entity, hints *FileHints, config *packet.Config) (input io.WriteCloser, err error) {
- if signed == nil {
- return nil, errors.InvalidArgumentError("no signer provided")
- }
-
- // These are the possible hash functions that we'll use for the signature.
- candidateHashes := []uint8{
- hashToHashId(crypto.SHA256),
- hashToHashId(crypto.SHA512),
- hashToHashId(crypto.SHA1),
- hashToHashId(crypto.RIPEMD160),
- }
- defaultHashes := candidateHashes[len(candidateHashes)-1:]
- preferredHashes := signed.primaryIdentity().SelfSignature.PreferredHash
- if len(preferredHashes) == 0 {
- preferredHashes = defaultHashes
- }
- candidateHashes = intersectPreferences(candidateHashes, preferredHashes)
- return writeAndSign(noOpCloser{output}, candidateHashes, signed, hints, config)
-}
-
-// signatureWriter hashes the contents of a message while passing it along to
-// literalData. When closed, it closes literalData, writes a signature packet
-// to encryptedData and then also closes encryptedData.
-type signatureWriter struct {
- encryptedData io.WriteCloser
- literalData io.WriteCloser
- hashType crypto.Hash
- h hash.Hash
- signer *packet.PrivateKey
- config *packet.Config
-}
-
-func (s signatureWriter) Write(data []byte) (int, error) {
- s.h.Write(data)
- return s.literalData.Write(data)
-}
-
-func (s signatureWriter) Close() error {
- sig := &packet.Signature{
- SigType: packet.SigTypeBinary,
- PubKeyAlgo: s.signer.PubKeyAlgo,
- Hash: s.hashType,
- CreationTime: s.config.Now(),
- IssuerKeyId: &s.signer.KeyId,
- }
-
- if err := sig.Sign(s.h, s.signer, s.config); err != nil {
- return err
- }
- if err := s.literalData.Close(); err != nil {
- return err
- }
- if err := sig.Serialize(s.encryptedData); err != nil {
- return err
- }
- return s.encryptedData.Close()
-}
-
-// noOpCloser is like an ioutil.NopCloser, but for an io.Writer.
-// TODO: we have two of these in OpenPGP packages alone. This probably needs
-// to be promoted somewhere more common.
-type noOpCloser struct {
- w io.Writer
-}
-
-func (c noOpCloser) Write(data []byte) (n int, err error) {
- return c.w.Write(data)
-}
-
-func (c noOpCloser) Close() error {
- return nil
-}
diff --git a/vendor/golang.org/x/crypto/poly1305/poly1305.go b/vendor/golang.org/x/crypto/poly1305/poly1305.go
deleted file mode 100644
index f562fa57..00000000
--- a/vendor/golang.org/x/crypto/poly1305/poly1305.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package poly1305 implements Poly1305 one-time message authentication code as
-specified in https://cr.yp.to/mac/poly1305-20050329.pdf.
-
-Poly1305 is a fast, one-time authentication function. It is infeasible for an
-attacker to generate an authenticator for a message without the key. However, a
-key must only be used for a single message. Authenticating two different
-messages with the same key allows an attacker to forge authenticators for other
-messages with the same key.
-
-Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was
-used with a fixed key in order to generate one-time keys from an nonce.
-However, in this package AES isn't used and the one-time key is specified
-directly.
-*/
-package poly1305 // import "golang.org/x/crypto/poly1305"
-
-import "crypto/subtle"
-
-// TagSize is the size, in bytes, of a poly1305 authenticator.
-const TagSize = 16
-
-// Verify returns true if mac is a valid authenticator for m with the given
-// key.
-func Verify(mac *[16]byte, m []byte, key *[32]byte) bool {
- var tmp [16]byte
- Sum(&tmp, m, key)
- return subtle.ConstantTimeCompare(tmp[:], mac[:]) == 1
-}
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_amd64.go b/vendor/golang.org/x/crypto/poly1305/sum_amd64.go
deleted file mode 100644
index 4dd72fe7..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_amd64.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,!gccgo,!appengine
-
-package poly1305
-
-// This function is implemented in sum_amd64.s
-//go:noescape
-func poly1305(out *[16]byte, m *byte, mlen uint64, key *[32]byte)
-
-// Sum generates an authenticator for m using a one-time key and puts the
-// 16-byte result into out. Authenticating two different messages with the same
-// key allows an attacker to forge messages at will.
-func Sum(out *[16]byte, m []byte, key *[32]byte) {
- var mPtr *byte
- if len(m) > 0 {
- mPtr = &m[0]
- }
- poly1305(out, mPtr, uint64(len(m)), key)
-}
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_amd64.s b/vendor/golang.org/x/crypto/poly1305/sum_amd64.s
deleted file mode 100644
index 2edae638..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_amd64.s
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,!gccgo,!appengine
-
-#include "textflag.h"
-
-#define POLY1305_ADD(msg, h0, h1, h2) \
- ADDQ 0(msg), h0; \
- ADCQ 8(msg), h1; \
- ADCQ $1, h2; \
- LEAQ 16(msg), msg
-
-#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3) \
- MOVQ r0, AX; \
- MULQ h0; \
- MOVQ AX, t0; \
- MOVQ DX, t1; \
- MOVQ r0, AX; \
- MULQ h1; \
- ADDQ AX, t1; \
- ADCQ $0, DX; \
- MOVQ r0, t2; \
- IMULQ h2, t2; \
- ADDQ DX, t2; \
- \
- MOVQ r1, AX; \
- MULQ h0; \
- ADDQ AX, t1; \
- ADCQ $0, DX; \
- MOVQ DX, h0; \
- MOVQ r1, t3; \
- IMULQ h2, t3; \
- MOVQ r1, AX; \
- MULQ h1; \
- ADDQ AX, t2; \
- ADCQ DX, t3; \
- ADDQ h0, t2; \
- ADCQ $0, t3; \
- \
- MOVQ t0, h0; \
- MOVQ t1, h1; \
- MOVQ t2, h2; \
- ANDQ $3, h2; \
- MOVQ t2, t0; \
- ANDQ $0xFFFFFFFFFFFFFFFC, t0; \
- ADDQ t0, h0; \
- ADCQ t3, h1; \
- ADCQ $0, h2; \
- SHRQ $2, t3, t2; \
- SHRQ $2, t3; \
- ADDQ t2, h0; \
- ADCQ t3, h1; \
- ADCQ $0, h2
-
-DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF
-DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC
-GLOBL ·poly1305Mask<>(SB), RODATA, $16
-
-// func poly1305(out *[16]byte, m *byte, mlen uint64, key *[32]key)
-TEXT ·poly1305(SB), $0-32
- MOVQ out+0(FP), DI
- MOVQ m+8(FP), SI
- MOVQ mlen+16(FP), R15
- MOVQ key+24(FP), AX
-
- MOVQ 0(AX), R11
- MOVQ 8(AX), R12
- ANDQ ·poly1305Mask<>(SB), R11 // r0
- ANDQ ·poly1305Mask<>+8(SB), R12 // r1
- XORQ R8, R8 // h0
- XORQ R9, R9 // h1
- XORQ R10, R10 // h2
-
- CMPQ R15, $16
- JB bytes_between_0_and_15
-
-loop:
- POLY1305_ADD(SI, R8, R9, R10)
-
-multiply:
- POLY1305_MUL(R8, R9, R10, R11, R12, BX, CX, R13, R14)
- SUBQ $16, R15
- CMPQ R15, $16
- JAE loop
-
-bytes_between_0_and_15:
- TESTQ R15, R15
- JZ done
- MOVQ $1, BX
- XORQ CX, CX
- XORQ R13, R13
- ADDQ R15, SI
-
-flush_buffer:
- SHLQ $8, BX, CX
- SHLQ $8, BX
- MOVB -1(SI), R13
- XORQ R13, BX
- DECQ SI
- DECQ R15
- JNZ flush_buffer
-
- ADDQ BX, R8
- ADCQ CX, R9
- ADCQ $0, R10
- MOVQ $16, R15
- JMP multiply
-
-done:
- MOVQ R8, AX
- MOVQ R9, BX
- SUBQ $0xFFFFFFFFFFFFFFFB, AX
- SBBQ $0xFFFFFFFFFFFFFFFF, BX
- SBBQ $3, R10
- CMOVQCS R8, AX
- CMOVQCS R9, BX
- MOVQ key+24(FP), R8
- ADDQ 16(R8), AX
- ADCQ 24(R8), BX
-
- MOVQ AX, 0(DI)
- MOVQ BX, 8(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_arm.go b/vendor/golang.org/x/crypto/poly1305/sum_arm.go
deleted file mode 100644
index 5dc321c2..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_arm.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build arm,!gccgo,!appengine,!nacl
-
-package poly1305
-
-// This function is implemented in sum_arm.s
-//go:noescape
-func poly1305_auth_armv6(out *[16]byte, m *byte, mlen uint32, key *[32]byte)
-
-// Sum generates an authenticator for m using a one-time key and puts the
-// 16-byte result into out. Authenticating two different messages with the same
-// key allows an attacker to forge messages at will.
-func Sum(out *[16]byte, m []byte, key *[32]byte) {
- var mPtr *byte
- if len(m) > 0 {
- mPtr = &m[0]
- }
- poly1305_auth_armv6(out, mPtr, uint32(len(m)), key)
-}
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_arm.s b/vendor/golang.org/x/crypto/poly1305/sum_arm.s
deleted file mode 100644
index f70b4ac4..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_arm.s
+++ /dev/null
@@ -1,427 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build arm,!gccgo,!appengine,!nacl
-
-#include "textflag.h"
-
-// This code was translated into a form compatible with 5a from the public
-// domain source by Andrew Moon: github.com/floodyberry/poly1305-opt/blob/master/app/extensions/poly1305.
-
-DATA ·poly1305_init_constants_armv6<>+0x00(SB)/4, $0x3ffffff
-DATA ·poly1305_init_constants_armv6<>+0x04(SB)/4, $0x3ffff03
-DATA ·poly1305_init_constants_armv6<>+0x08(SB)/4, $0x3ffc0ff
-DATA ·poly1305_init_constants_armv6<>+0x0c(SB)/4, $0x3f03fff
-DATA ·poly1305_init_constants_armv6<>+0x10(SB)/4, $0x00fffff
-GLOBL ·poly1305_init_constants_armv6<>(SB), 8, $20
-
-// Warning: the linker may use R11 to synthesize certain instructions. Please
-// take care and verify that no synthetic instructions use it.
-
-TEXT poly1305_init_ext_armv6<>(SB), NOSPLIT, $0
- // Needs 16 bytes of stack and 64 bytes of space pointed to by R0. (It
- // might look like it's only 60 bytes of space but the final four bytes
- // will be written by another function.) We need to skip over four
- // bytes of stack because that's saving the value of 'g'.
- ADD $4, R13, R8
- MOVM.IB [R4-R7], (R8)
- MOVM.IA.W (R1), [R2-R5]
- MOVW $·poly1305_init_constants_armv6<>(SB), R7
- MOVW R2, R8
- MOVW R2>>26, R9
- MOVW R3>>20, g
- MOVW R4>>14, R11
- MOVW R5>>8, R12
- ORR R3<<6, R9, R9
- ORR R4<<12, g, g
- ORR R5<<18, R11, R11
- MOVM.IA (R7), [R2-R6]
- AND R8, R2, R2
- AND R9, R3, R3
- AND g, R4, R4
- AND R11, R5, R5
- AND R12, R6, R6
- MOVM.IA.W [R2-R6], (R0)
- EOR R2, R2, R2
- EOR R3, R3, R3
- EOR R4, R4, R4
- EOR R5, R5, R5
- EOR R6, R6, R6
- MOVM.IA.W [R2-R6], (R0)
- MOVM.IA.W (R1), [R2-R5]
- MOVM.IA [R2-R6], (R0)
- ADD $20, R13, R0
- MOVM.DA (R0), [R4-R7]
- RET
-
-#define MOVW_UNALIGNED(Rsrc, Rdst, Rtmp, offset) \
- MOVBU (offset+0)(Rsrc), Rtmp; \
- MOVBU Rtmp, (offset+0)(Rdst); \
- MOVBU (offset+1)(Rsrc), Rtmp; \
- MOVBU Rtmp, (offset+1)(Rdst); \
- MOVBU (offset+2)(Rsrc), Rtmp; \
- MOVBU Rtmp, (offset+2)(Rdst); \
- MOVBU (offset+3)(Rsrc), Rtmp; \
- MOVBU Rtmp, (offset+3)(Rdst)
-
-TEXT poly1305_blocks_armv6<>(SB), NOSPLIT, $0
- // Needs 24 bytes of stack for saved registers and then 88 bytes of
- // scratch space after that. We assume that 24 bytes at (R13) have
- // already been used: four bytes for the link register saved in the
- // prelude of poly1305_auth_armv6, four bytes for saving the value of g
- // in that function and 16 bytes of scratch space used around
- // poly1305_finish_ext_armv6_skip1.
- ADD $24, R13, R12
- MOVM.IB [R4-R8, R14], (R12)
- MOVW R0, 88(R13)
- MOVW R1, 92(R13)
- MOVW R2, 96(R13)
- MOVW R1, R14
- MOVW R2, R12
- MOVW 56(R0), R8
- WORD $0xe1180008 // TST R8, R8 not working see issue 5921
- EOR R6, R6, R6
- MOVW.EQ $(1<<24), R6
- MOVW R6, 84(R13)
- ADD $116, R13, g
- MOVM.IA (R0), [R0-R9]
- MOVM.IA [R0-R4], (g)
- CMP $16, R12
- BLO poly1305_blocks_armv6_done
-
-poly1305_blocks_armv6_mainloop:
- WORD $0xe31e0003 // TST R14, #3 not working see issue 5921
- BEQ poly1305_blocks_armv6_mainloop_aligned
- ADD $100, R13, g
- MOVW_UNALIGNED(R14, g, R0, 0)
- MOVW_UNALIGNED(R14, g, R0, 4)
- MOVW_UNALIGNED(R14, g, R0, 8)
- MOVW_UNALIGNED(R14, g, R0, 12)
- MOVM.IA (g), [R0-R3]
- ADD $16, R14
- B poly1305_blocks_armv6_mainloop_loaded
-
-poly1305_blocks_armv6_mainloop_aligned:
- MOVM.IA.W (R14), [R0-R3]
-
-poly1305_blocks_armv6_mainloop_loaded:
- MOVW R0>>26, g
- MOVW R1>>20, R11
- MOVW R2>>14, R12
- MOVW R14, 92(R13)
- MOVW R3>>8, R4
- ORR R1<<6, g, g
- ORR R2<<12, R11, R11
- ORR R3<<18, R12, R12
- BIC $0xfc000000, R0, R0
- BIC $0xfc000000, g, g
- MOVW 84(R13), R3
- BIC $0xfc000000, R11, R11
- BIC $0xfc000000, R12, R12
- ADD R0, R5, R5
- ADD g, R6, R6
- ORR R3, R4, R4
- ADD R11, R7, R7
- ADD $116, R13, R14
- ADD R12, R8, R8
- ADD R4, R9, R9
- MOVM.IA (R14), [R0-R4]
- MULLU R4, R5, (R11, g)
- MULLU R3, R5, (R14, R12)
- MULALU R3, R6, (R11, g)
- MULALU R2, R6, (R14, R12)
- MULALU R2, R7, (R11, g)
- MULALU R1, R7, (R14, R12)
- ADD R4<<2, R4, R4
- ADD R3<<2, R3, R3
- MULALU R1, R8, (R11, g)
- MULALU R0, R8, (R14, R12)
- MULALU R0, R9, (R11, g)
- MULALU R4, R9, (R14, R12)
- MOVW g, 76(R13)
- MOVW R11, 80(R13)
- MOVW R12, 68(R13)
- MOVW R14, 72(R13)
- MULLU R2, R5, (R11, g)
- MULLU R1, R5, (R14, R12)
- MULALU R1, R6, (R11, g)
- MULALU R0, R6, (R14, R12)
- MULALU R0, R7, (R11, g)
- MULALU R4, R7, (R14, R12)
- ADD R2<<2, R2, R2
- ADD R1<<2, R1, R1
- MULALU R4, R8, (R11, g)
- MULALU R3, R8, (R14, R12)
- MULALU R3, R9, (R11, g)
- MULALU R2, R9, (R14, R12)
- MOVW g, 60(R13)
- MOVW R11, 64(R13)
- MOVW R12, 52(R13)
- MOVW R14, 56(R13)
- MULLU R0, R5, (R11, g)
- MULALU R4, R6, (R11, g)
- MULALU R3, R7, (R11, g)
- MULALU R2, R8, (R11, g)
- MULALU R1, R9, (R11, g)
- ADD $52, R13, R0
- MOVM.IA (R0), [R0-R7]
- MOVW g>>26, R12
- MOVW R4>>26, R14
- ORR R11<<6, R12, R12
- ORR R5<<6, R14, R14
- BIC $0xfc000000, g, g
- BIC $0xfc000000, R4, R4
- ADD.S R12, R0, R0
- ADC $0, R1, R1
- ADD.S R14, R6, R6
- ADC $0, R7, R7
- MOVW R0>>26, R12
- MOVW R6>>26, R14
- ORR R1<<6, R12, R12
- ORR R7<<6, R14, R14
- BIC $0xfc000000, R0, R0
- BIC $0xfc000000, R6, R6
- ADD R14<<2, R14, R14
- ADD.S R12, R2, R2
- ADC $0, R3, R3
- ADD R14, g, g
- MOVW R2>>26, R12
- MOVW g>>26, R14
- ORR R3<<6, R12, R12
- BIC $0xfc000000, g, R5
- BIC $0xfc000000, R2, R7
- ADD R12, R4, R4
- ADD R14, R0, R0
- MOVW R4>>26, R12
- BIC $0xfc000000, R4, R8
- ADD R12, R6, R9
- MOVW 96(R13), R12
- MOVW 92(R13), R14
- MOVW R0, R6
- CMP $32, R12
- SUB $16, R12, R12
- MOVW R12, 96(R13)
- BHS poly1305_blocks_armv6_mainloop
-
-poly1305_blocks_armv6_done:
- MOVW 88(R13), R12
- MOVW R5, 20(R12)
- MOVW R6, 24(R12)
- MOVW R7, 28(R12)
- MOVW R8, 32(R12)
- MOVW R9, 36(R12)
- ADD $48, R13, R0
- MOVM.DA (R0), [R4-R8, R14]
- RET
-
-#define MOVHUP_UNALIGNED(Rsrc, Rdst, Rtmp) \
- MOVBU.P 1(Rsrc), Rtmp; \
- MOVBU.P Rtmp, 1(Rdst); \
- MOVBU.P 1(Rsrc), Rtmp; \
- MOVBU.P Rtmp, 1(Rdst)
-
-#define MOVWP_UNALIGNED(Rsrc, Rdst, Rtmp) \
- MOVHUP_UNALIGNED(Rsrc, Rdst, Rtmp); \
- MOVHUP_UNALIGNED(Rsrc, Rdst, Rtmp)
-
-// func poly1305_auth_armv6(out *[16]byte, m *byte, mlen uint32, key *[32]key)
-TEXT ·poly1305_auth_armv6(SB), $196-16
- // The value 196, just above, is the sum of 64 (the size of the context
- // structure) and 132 (the amount of stack needed).
- //
- // At this point, the stack pointer (R13) has been moved down. It
- // points to the saved link register and there's 196 bytes of free
- // space above it.
- //
- // The stack for this function looks like:
- //
- // +---------------------
- // |
- // | 64 bytes of context structure
- // |
- // +---------------------
- // |
- // | 112 bytes for poly1305_blocks_armv6
- // |
- // +---------------------
- // | 16 bytes of final block, constructed at
- // | poly1305_finish_ext_armv6_skip8
- // +---------------------
- // | four bytes of saved 'g'
- // +---------------------
- // | lr, saved by prelude <- R13 points here
- // +---------------------
- MOVW g, 4(R13)
-
- MOVW out+0(FP), R4
- MOVW m+4(FP), R5
- MOVW mlen+8(FP), R6
- MOVW key+12(FP), R7
-
- ADD $136, R13, R0 // 136 = 4 + 4 + 16 + 112
- MOVW R7, R1
-
- // poly1305_init_ext_armv6 will write to the stack from R13+4, but
- // that's ok because none of the other values have been written yet.
- BL poly1305_init_ext_armv6<>(SB)
- BIC.S $15, R6, R2
- BEQ poly1305_auth_armv6_noblocks
- ADD $136, R13, R0
- MOVW R5, R1
- ADD R2, R5, R5
- SUB R2, R6, R6
- BL poly1305_blocks_armv6<>(SB)
-
-poly1305_auth_armv6_noblocks:
- ADD $136, R13, R0
- MOVW R5, R1
- MOVW R6, R2
- MOVW R4, R3
-
- MOVW R0, R5
- MOVW R1, R6
- MOVW R2, R7
- MOVW R3, R8
- AND.S R2, R2, R2
- BEQ poly1305_finish_ext_armv6_noremaining
- EOR R0, R0
- ADD $8, R13, R9 // 8 = offset to 16 byte scratch space
- MOVW R0, (R9)
- MOVW R0, 4(R9)
- MOVW R0, 8(R9)
- MOVW R0, 12(R9)
- WORD $0xe3110003 // TST R1, #3 not working see issue 5921
- BEQ poly1305_finish_ext_armv6_aligned
- WORD $0xe3120008 // TST R2, #8 not working see issue 5921
- BEQ poly1305_finish_ext_armv6_skip8
- MOVWP_UNALIGNED(R1, R9, g)
- MOVWP_UNALIGNED(R1, R9, g)
-
-poly1305_finish_ext_armv6_skip8:
- WORD $0xe3120004 // TST $4, R2 not working see issue 5921
- BEQ poly1305_finish_ext_armv6_skip4
- MOVWP_UNALIGNED(R1, R9, g)
-
-poly1305_finish_ext_armv6_skip4:
- WORD $0xe3120002 // TST $2, R2 not working see issue 5921
- BEQ poly1305_finish_ext_armv6_skip2
- MOVHUP_UNALIGNED(R1, R9, g)
- B poly1305_finish_ext_armv6_skip2
-
-poly1305_finish_ext_armv6_aligned:
- WORD $0xe3120008 // TST R2, #8 not working see issue 5921
- BEQ poly1305_finish_ext_armv6_skip8_aligned
- MOVM.IA.W (R1), [g-R11]
- MOVM.IA.W [g-R11], (R9)
-
-poly1305_finish_ext_armv6_skip8_aligned:
- WORD $0xe3120004 // TST $4, R2 not working see issue 5921
- BEQ poly1305_finish_ext_armv6_skip4_aligned
- MOVW.P 4(R1), g
- MOVW.P g, 4(R9)
-
-poly1305_finish_ext_armv6_skip4_aligned:
- WORD $0xe3120002 // TST $2, R2 not working see issue 5921
- BEQ poly1305_finish_ext_armv6_skip2
- MOVHU.P 2(R1), g
- MOVH.P g, 2(R9)
-
-poly1305_finish_ext_armv6_skip2:
- WORD $0xe3120001 // TST $1, R2 not working see issue 5921
- BEQ poly1305_finish_ext_armv6_skip1
- MOVBU.P 1(R1), g
- MOVBU.P g, 1(R9)
-
-poly1305_finish_ext_armv6_skip1:
- MOVW $1, R11
- MOVBU R11, 0(R9)
- MOVW R11, 56(R5)
- MOVW R5, R0
- ADD $8, R13, R1
- MOVW $16, R2
- BL poly1305_blocks_armv6<>(SB)
-
-poly1305_finish_ext_armv6_noremaining:
- MOVW 20(R5), R0
- MOVW 24(R5), R1
- MOVW 28(R5), R2
- MOVW 32(R5), R3
- MOVW 36(R5), R4
- MOVW R4>>26, R12
- BIC $0xfc000000, R4, R4
- ADD R12<<2, R12, R12
- ADD R12, R0, R0
- MOVW R0>>26, R12
- BIC $0xfc000000, R0, R0
- ADD R12, R1, R1
- MOVW R1>>26, R12
- BIC $0xfc000000, R1, R1
- ADD R12, R2, R2
- MOVW R2>>26, R12
- BIC $0xfc000000, R2, R2
- ADD R12, R3, R3
- MOVW R3>>26, R12
- BIC $0xfc000000, R3, R3
- ADD R12, R4, R4
- ADD $5, R0, R6
- MOVW R6>>26, R12
- BIC $0xfc000000, R6, R6
- ADD R12, R1, R7
- MOVW R7>>26, R12
- BIC $0xfc000000, R7, R7
- ADD R12, R2, g
- MOVW g>>26, R12
- BIC $0xfc000000, g, g
- ADD R12, R3, R11
- MOVW $-(1<<26), R12
- ADD R11>>26, R12, R12
- BIC $0xfc000000, R11, R11
- ADD R12, R4, R9
- MOVW R9>>31, R12
- SUB $1, R12
- AND R12, R6, R6
- AND R12, R7, R7
- AND R12, g, g
- AND R12, R11, R11
- AND R12, R9, R9
- MVN R12, R12
- AND R12, R0, R0
- AND R12, R1, R1
- AND R12, R2, R2
- AND R12, R3, R3
- AND R12, R4, R4
- ORR R6, R0, R0
- ORR R7, R1, R1
- ORR g, R2, R2
- ORR R11, R3, R3
- ORR R9, R4, R4
- ORR R1<<26, R0, R0
- MOVW R1>>6, R1
- ORR R2<<20, R1, R1
- MOVW R2>>12, R2
- ORR R3<<14, R2, R2
- MOVW R3>>18, R3
- ORR R4<<8, R3, R3
- MOVW 40(R5), R6
- MOVW 44(R5), R7
- MOVW 48(R5), g
- MOVW 52(R5), R11
- ADD.S R6, R0, R0
- ADC.S R7, R1, R1
- ADC.S g, R2, R2
- ADC.S R11, R3, R3
- MOVM.IA [R0-R3], (R8)
- MOVW R5, R12
- EOR R0, R0, R0
- EOR R1, R1, R1
- EOR R2, R2, R2
- EOR R3, R3, R3
- EOR R4, R4, R4
- EOR R5, R5, R5
- EOR R6, R6, R6
- EOR R7, R7, R7
- MOVM.IA.W [R0-R7], (R12)
- MOVM.IA [R0-R7], (R12)
- MOVW 4(R13), g
- RET
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go b/vendor/golang.org/x/crypto/poly1305/sum_noasm.go
deleted file mode 100644
index 751eec52..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build s390x,!go1.11 !arm,!amd64,!s390x gccgo appengine nacl
-
-package poly1305
-
-// Sum generates an authenticator for msg using a one-time key and puts the
-// 16-byte result into out. Authenticating two different messages with the same
-// key allows an attacker to forge messages at will.
-func Sum(out *[TagSize]byte, msg []byte, key *[32]byte) {
- sumGeneric(out, msg, key)
-}
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ref.go b/vendor/golang.org/x/crypto/poly1305/sum_ref.go
deleted file mode 100644
index c4d59bd0..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_ref.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package poly1305
-
-import "encoding/binary"
-
-// sumGeneric generates an authenticator for msg using a one-time key and
-// puts the 16-byte result into out. This is the generic implementation of
-// Sum and should be called if no assembly implementation is available.
-func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) {
- var (
- h0, h1, h2, h3, h4 uint32 // the hash accumulators
- r0, r1, r2, r3, r4 uint64 // the r part of the key
- )
-
- r0 = uint64(binary.LittleEndian.Uint32(key[0:]) & 0x3ffffff)
- r1 = uint64((binary.LittleEndian.Uint32(key[3:]) >> 2) & 0x3ffff03)
- r2 = uint64((binary.LittleEndian.Uint32(key[6:]) >> 4) & 0x3ffc0ff)
- r3 = uint64((binary.LittleEndian.Uint32(key[9:]) >> 6) & 0x3f03fff)
- r4 = uint64((binary.LittleEndian.Uint32(key[12:]) >> 8) & 0x00fffff)
-
- R1, R2, R3, R4 := r1*5, r2*5, r3*5, r4*5
-
- for len(msg) >= TagSize {
- // h += msg
- h0 += binary.LittleEndian.Uint32(msg[0:]) & 0x3ffffff
- h1 += (binary.LittleEndian.Uint32(msg[3:]) >> 2) & 0x3ffffff
- h2 += (binary.LittleEndian.Uint32(msg[6:]) >> 4) & 0x3ffffff
- h3 += (binary.LittleEndian.Uint32(msg[9:]) >> 6) & 0x3ffffff
- h4 += (binary.LittleEndian.Uint32(msg[12:]) >> 8) | (1 << 24)
-
- // h *= r
- d0 := (uint64(h0) * r0) + (uint64(h1) * R4) + (uint64(h2) * R3) + (uint64(h3) * R2) + (uint64(h4) * R1)
- d1 := (d0 >> 26) + (uint64(h0) * r1) + (uint64(h1) * r0) + (uint64(h2) * R4) + (uint64(h3) * R3) + (uint64(h4) * R2)
- d2 := (d1 >> 26) + (uint64(h0) * r2) + (uint64(h1) * r1) + (uint64(h2) * r0) + (uint64(h3) * R4) + (uint64(h4) * R3)
- d3 := (d2 >> 26) + (uint64(h0) * r3) + (uint64(h1) * r2) + (uint64(h2) * r1) + (uint64(h3) * r0) + (uint64(h4) * R4)
- d4 := (d3 >> 26) + (uint64(h0) * r4) + (uint64(h1) * r3) + (uint64(h2) * r2) + (uint64(h3) * r1) + (uint64(h4) * r0)
-
- // h %= p
- h0 = uint32(d0) & 0x3ffffff
- h1 = uint32(d1) & 0x3ffffff
- h2 = uint32(d2) & 0x3ffffff
- h3 = uint32(d3) & 0x3ffffff
- h4 = uint32(d4) & 0x3ffffff
-
- h0 += uint32(d4>>26) * 5
- h1 += h0 >> 26
- h0 = h0 & 0x3ffffff
-
- msg = msg[TagSize:]
- }
-
- if len(msg) > 0 {
- var block [TagSize]byte
- off := copy(block[:], msg)
- block[off] = 0x01
-
- // h += msg
- h0 += binary.LittleEndian.Uint32(block[0:]) & 0x3ffffff
- h1 += (binary.LittleEndian.Uint32(block[3:]) >> 2) & 0x3ffffff
- h2 += (binary.LittleEndian.Uint32(block[6:]) >> 4) & 0x3ffffff
- h3 += (binary.LittleEndian.Uint32(block[9:]) >> 6) & 0x3ffffff
- h4 += (binary.LittleEndian.Uint32(block[12:]) >> 8)
-
- // h *= r
- d0 := (uint64(h0) * r0) + (uint64(h1) * R4) + (uint64(h2) * R3) + (uint64(h3) * R2) + (uint64(h4) * R1)
- d1 := (d0 >> 26) + (uint64(h0) * r1) + (uint64(h1) * r0) + (uint64(h2) * R4) + (uint64(h3) * R3) + (uint64(h4) * R2)
- d2 := (d1 >> 26) + (uint64(h0) * r2) + (uint64(h1) * r1) + (uint64(h2) * r0) + (uint64(h3) * R4) + (uint64(h4) * R3)
- d3 := (d2 >> 26) + (uint64(h0) * r3) + (uint64(h1) * r2) + (uint64(h2) * r1) + (uint64(h3) * r0) + (uint64(h4) * R4)
- d4 := (d3 >> 26) + (uint64(h0) * r4) + (uint64(h1) * r3) + (uint64(h2) * r2) + (uint64(h3) * r1) + (uint64(h4) * r0)
-
- // h %= p
- h0 = uint32(d0) & 0x3ffffff
- h1 = uint32(d1) & 0x3ffffff
- h2 = uint32(d2) & 0x3ffffff
- h3 = uint32(d3) & 0x3ffffff
- h4 = uint32(d4) & 0x3ffffff
-
- h0 += uint32(d4>>26) * 5
- h1 += h0 >> 26
- h0 = h0 & 0x3ffffff
- }
-
- // h %= p reduction
- h2 += h1 >> 26
- h1 &= 0x3ffffff
- h3 += h2 >> 26
- h2 &= 0x3ffffff
- h4 += h3 >> 26
- h3 &= 0x3ffffff
- h0 += 5 * (h4 >> 26)
- h4 &= 0x3ffffff
- h1 += h0 >> 26
- h0 &= 0x3ffffff
-
- // h - p
- t0 := h0 + 5
- t1 := h1 + (t0 >> 26)
- t2 := h2 + (t1 >> 26)
- t3 := h3 + (t2 >> 26)
- t4 := h4 + (t3 >> 26) - (1 << 26)
- t0 &= 0x3ffffff
- t1 &= 0x3ffffff
- t2 &= 0x3ffffff
- t3 &= 0x3ffffff
-
- // select h if h < p else h - p
- t_mask := (t4 >> 31) - 1
- h_mask := ^t_mask
- h0 = (h0 & h_mask) | (t0 & t_mask)
- h1 = (h1 & h_mask) | (t1 & t_mask)
- h2 = (h2 & h_mask) | (t2 & t_mask)
- h3 = (h3 & h_mask) | (t3 & t_mask)
- h4 = (h4 & h_mask) | (t4 & t_mask)
-
- // h %= 2^128
- h0 |= h1 << 26
- h1 = ((h1 >> 6) | (h2 << 20))
- h2 = ((h2 >> 12) | (h3 << 14))
- h3 = ((h3 >> 18) | (h4 << 8))
-
- // s: the s part of the key
- // tag = (h + s) % (2^128)
- t := uint64(h0) + uint64(binary.LittleEndian.Uint32(key[16:]))
- h0 = uint32(t)
- t = uint64(h1) + uint64(binary.LittleEndian.Uint32(key[20:])) + (t >> 32)
- h1 = uint32(t)
- t = uint64(h2) + uint64(binary.LittleEndian.Uint32(key[24:])) + (t >> 32)
- h2 = uint32(t)
- t = uint64(h3) + uint64(binary.LittleEndian.Uint32(key[28:])) + (t >> 32)
- h3 = uint32(t)
-
- binary.LittleEndian.PutUint32(out[0:], h0)
- binary.LittleEndian.PutUint32(out[4:], h1)
- binary.LittleEndian.PutUint32(out[8:], h2)
- binary.LittleEndian.PutUint32(out[12:], h3)
-}
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_s390x.go b/vendor/golang.org/x/crypto/poly1305/sum_s390x.go
deleted file mode 100644
index 7a266cec..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_s390x.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build s390x,go1.11,!gccgo,!appengine
-
-package poly1305
-
-// hasVectorFacility reports whether the machine supports
-// the vector facility (vx).
-func hasVectorFacility() bool
-
-// hasVMSLFacility reports whether the machine supports
-// Vector Multiply Sum Logical (VMSL).
-func hasVMSLFacility() bool
-
-var hasVX = hasVectorFacility()
-var hasVMSL = hasVMSLFacility()
-
-// poly1305vx is an assembly implementation of Poly1305 that uses vector
-// instructions. It must only be called if the vector facility (vx) is
-// available.
-//go:noescape
-func poly1305vx(out *[16]byte, m *byte, mlen uint64, key *[32]byte)
-
-// poly1305vmsl is an assembly implementation of Poly1305 that uses vector
-// instructions, including VMSL. It must only be called if the vector facility (vx) is
-// available and if VMSL is supported.
-//go:noescape
-func poly1305vmsl(out *[16]byte, m *byte, mlen uint64, key *[32]byte)
-
-// Sum generates an authenticator for m using a one-time key and puts the
-// 16-byte result into out. Authenticating two different messages with the same
-// key allows an attacker to forge messages at will.
-func Sum(out *[16]byte, m []byte, key *[32]byte) {
- if hasVX {
- var mPtr *byte
- if len(m) > 0 {
- mPtr = &m[0]
- }
- if hasVMSL && len(m) > 256 {
- poly1305vmsl(out, mPtr, uint64(len(m)), key)
- } else {
- poly1305vx(out, mPtr, uint64(len(m)), key)
- }
- } else {
- sumGeneric(out, m, key)
- }
-}
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_s390x.s b/vendor/golang.org/x/crypto/poly1305/sum_s390x.s
deleted file mode 100644
index 356c07a6..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_s390x.s
+++ /dev/null
@@ -1,400 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build s390x,go1.11,!gccgo,!appengine
-
-#include "textflag.h"
-
-// Implementation of Poly1305 using the vector facility (vx).
-
-// constants
-#define MOD26 V0
-#define EX0 V1
-#define EX1 V2
-#define EX2 V3
-
-// temporaries
-#define T_0 V4
-#define T_1 V5
-#define T_2 V6
-#define T_3 V7
-#define T_4 V8
-
-// key (r)
-#define R_0 V9
-#define R_1 V10
-#define R_2 V11
-#define R_3 V12
-#define R_4 V13
-#define R5_1 V14
-#define R5_2 V15
-#define R5_3 V16
-#define R5_4 V17
-#define RSAVE_0 R5
-#define RSAVE_1 R6
-#define RSAVE_2 R7
-#define RSAVE_3 R8
-#define RSAVE_4 R9
-#define R5SAVE_1 V28
-#define R5SAVE_2 V29
-#define R5SAVE_3 V30
-#define R5SAVE_4 V31
-
-// message block
-#define F_0 V18
-#define F_1 V19
-#define F_2 V20
-#define F_3 V21
-#define F_4 V22
-
-// accumulator
-#define H_0 V23
-#define H_1 V24
-#define H_2 V25
-#define H_3 V26
-#define H_4 V27
-
-GLOBL ·keyMask<>(SB), RODATA, $16
-DATA ·keyMask<>+0(SB)/8, $0xffffff0ffcffff0f
-DATA ·keyMask<>+8(SB)/8, $0xfcffff0ffcffff0f
-
-GLOBL ·bswapMask<>(SB), RODATA, $16
-DATA ·bswapMask<>+0(SB)/8, $0x0f0e0d0c0b0a0908
-DATA ·bswapMask<>+8(SB)/8, $0x0706050403020100
-
-GLOBL ·constants<>(SB), RODATA, $64
-// MOD26
-DATA ·constants<>+0(SB)/8, $0x3ffffff
-DATA ·constants<>+8(SB)/8, $0x3ffffff
-// EX0
-DATA ·constants<>+16(SB)/8, $0x0006050403020100
-DATA ·constants<>+24(SB)/8, $0x1016151413121110
-// EX1
-DATA ·constants<>+32(SB)/8, $0x060c0b0a09080706
-DATA ·constants<>+40(SB)/8, $0x161c1b1a19181716
-// EX2
-DATA ·constants<>+48(SB)/8, $0x0d0d0d0d0d0f0e0d
-DATA ·constants<>+56(SB)/8, $0x1d1d1d1d1d1f1e1d
-
-// h = (f*g) % (2**130-5) [partial reduction]
-#define MULTIPLY(f0, f1, f2, f3, f4, g0, g1, g2, g3, g4, g51, g52, g53, g54, h0, h1, h2, h3, h4) \
- VMLOF f0, g0, h0 \
- VMLOF f0, g1, h1 \
- VMLOF f0, g2, h2 \
- VMLOF f0, g3, h3 \
- VMLOF f0, g4, h4 \
- VMLOF f1, g54, T_0 \
- VMLOF f1, g0, T_1 \
- VMLOF f1, g1, T_2 \
- VMLOF f1, g2, T_3 \
- VMLOF f1, g3, T_4 \
- VMALOF f2, g53, h0, h0 \
- VMALOF f2, g54, h1, h1 \
- VMALOF f2, g0, h2, h2 \
- VMALOF f2, g1, h3, h3 \
- VMALOF f2, g2, h4, h4 \
- VMALOF f3, g52, T_0, T_0 \
- VMALOF f3, g53, T_1, T_1 \
- VMALOF f3, g54, T_2, T_2 \
- VMALOF f3, g0, T_3, T_3 \
- VMALOF f3, g1, T_4, T_4 \
- VMALOF f4, g51, h0, h0 \
- VMALOF f4, g52, h1, h1 \
- VMALOF f4, g53, h2, h2 \
- VMALOF f4, g54, h3, h3 \
- VMALOF f4, g0, h4, h4 \
- VAG T_0, h0, h0 \
- VAG T_1, h1, h1 \
- VAG T_2, h2, h2 \
- VAG T_3, h3, h3 \
- VAG T_4, h4, h4
-
-// carry h0->h1 h3->h4, h1->h2 h4->h0, h0->h1 h2->h3, h3->h4
-#define REDUCE(h0, h1, h2, h3, h4) \
- VESRLG $26, h0, T_0 \
- VESRLG $26, h3, T_1 \
- VN MOD26, h0, h0 \
- VN MOD26, h3, h3 \
- VAG T_0, h1, h1 \
- VAG T_1, h4, h4 \
- VESRLG $26, h1, T_2 \
- VESRLG $26, h4, T_3 \
- VN MOD26, h1, h1 \
- VN MOD26, h4, h4 \
- VESLG $2, T_3, T_4 \
- VAG T_3, T_4, T_4 \
- VAG T_2, h2, h2 \
- VAG T_4, h0, h0 \
- VESRLG $26, h2, T_0 \
- VESRLG $26, h0, T_1 \
- VN MOD26, h2, h2 \
- VN MOD26, h0, h0 \
- VAG T_0, h3, h3 \
- VAG T_1, h1, h1 \
- VESRLG $26, h3, T_2 \
- VN MOD26, h3, h3 \
- VAG T_2, h4, h4
-
-// expand in0 into d[0] and in1 into d[1]
-#define EXPAND(in0, in1, d0, d1, d2, d3, d4) \
- VGBM $0x0707, d1 \ // d1=tmp
- VPERM in0, in1, EX2, d4 \
- VPERM in0, in1, EX0, d0 \
- VPERM in0, in1, EX1, d2 \
- VN d1, d4, d4 \
- VESRLG $26, d0, d1 \
- VESRLG $30, d2, d3 \
- VESRLG $4, d2, d2 \
- VN MOD26, d0, d0 \
- VN MOD26, d1, d1 \
- VN MOD26, d2, d2 \
- VN MOD26, d3, d3
-
-// pack h4:h0 into h1:h0 (no carry)
-#define PACK(h0, h1, h2, h3, h4) \
- VESLG $26, h1, h1 \
- VESLG $26, h3, h3 \
- VO h0, h1, h0 \
- VO h2, h3, h2 \
- VESLG $4, h2, h2 \
- VLEIB $7, $48, h1 \
- VSLB h1, h2, h2 \
- VO h0, h2, h0 \
- VLEIB $7, $104, h1 \
- VSLB h1, h4, h3 \
- VO h3, h0, h0 \
- VLEIB $7, $24, h1 \
- VSRLB h1, h4, h1
-
-// if h > 2**130-5 then h -= 2**130-5
-#define MOD(h0, h1, t0, t1, t2) \
- VZERO t0 \
- VLEIG $1, $5, t0 \
- VACCQ h0, t0, t1 \
- VAQ h0, t0, t0 \
- VONE t2 \
- VLEIG $1, $-4, t2 \
- VAQ t2, t1, t1 \
- VACCQ h1, t1, t1 \
- VONE t2 \
- VAQ t2, t1, t1 \
- VN h0, t1, t2 \
- VNC t0, t1, t1 \
- VO t1, t2, h0
-
-// func poly1305vx(out *[16]byte, m *byte, mlen uint64, key *[32]key)
-TEXT ·poly1305vx(SB), $0-32
- // This code processes up to 2 blocks (32 bytes) per iteration
- // using the algorithm described in:
- // NEON crypto, Daniel J. Bernstein & Peter Schwabe
- // https://cryptojedi.org/papers/neoncrypto-20120320.pdf
- LMG out+0(FP), R1, R4 // R1=out, R2=m, R3=mlen, R4=key
-
- // load MOD26, EX0, EX1 and EX2
- MOVD $·constants<>(SB), R5
- VLM (R5), MOD26, EX2
-
- // setup r
- VL (R4), T_0
- MOVD $·keyMask<>(SB), R6
- VL (R6), T_1
- VN T_0, T_1, T_0
- EXPAND(T_0, T_0, R_0, R_1, R_2, R_3, R_4)
-
- // setup r*5
- VLEIG $0, $5, T_0
- VLEIG $1, $5, T_0
-
- // store r (for final block)
- VMLOF T_0, R_1, R5SAVE_1
- VMLOF T_0, R_2, R5SAVE_2
- VMLOF T_0, R_3, R5SAVE_3
- VMLOF T_0, R_4, R5SAVE_4
- VLGVG $0, R_0, RSAVE_0
- VLGVG $0, R_1, RSAVE_1
- VLGVG $0, R_2, RSAVE_2
- VLGVG $0, R_3, RSAVE_3
- VLGVG $0, R_4, RSAVE_4
-
- // skip r**2 calculation
- CMPBLE R3, $16, skip
-
- // calculate r**2
- MULTIPLY(R_0, R_1, R_2, R_3, R_4, R_0, R_1, R_2, R_3, R_4, R5SAVE_1, R5SAVE_2, R5SAVE_3, R5SAVE_4, H_0, H_1, H_2, H_3, H_4)
- REDUCE(H_0, H_1, H_2, H_3, H_4)
- VLEIG $0, $5, T_0
- VLEIG $1, $5, T_0
- VMLOF T_0, H_1, R5_1
- VMLOF T_0, H_2, R5_2
- VMLOF T_0, H_3, R5_3
- VMLOF T_0, H_4, R5_4
- VLR H_0, R_0
- VLR H_1, R_1
- VLR H_2, R_2
- VLR H_3, R_3
- VLR H_4, R_4
-
- // initialize h
- VZERO H_0
- VZERO H_1
- VZERO H_2
- VZERO H_3
- VZERO H_4
-
-loop:
- CMPBLE R3, $32, b2
- VLM (R2), T_0, T_1
- SUB $32, R3
- MOVD $32(R2), R2
- EXPAND(T_0, T_1, F_0, F_1, F_2, F_3, F_4)
- VLEIB $4, $1, F_4
- VLEIB $12, $1, F_4
-
-multiply:
- VAG H_0, F_0, F_0
- VAG H_1, F_1, F_1
- VAG H_2, F_2, F_2
- VAG H_3, F_3, F_3
- VAG H_4, F_4, F_4
- MULTIPLY(F_0, F_1, F_2, F_3, F_4, R_0, R_1, R_2, R_3, R_4, R5_1, R5_2, R5_3, R5_4, H_0, H_1, H_2, H_3, H_4)
- REDUCE(H_0, H_1, H_2, H_3, H_4)
- CMPBNE R3, $0, loop
-
-finish:
- // sum vectors
- VZERO T_0
- VSUMQG H_0, T_0, H_0
- VSUMQG H_1, T_0, H_1
- VSUMQG H_2, T_0, H_2
- VSUMQG H_3, T_0, H_3
- VSUMQG H_4, T_0, H_4
-
- // h may be >= 2*(2**130-5) so we need to reduce it again
- REDUCE(H_0, H_1, H_2, H_3, H_4)
-
- // carry h1->h4
- VESRLG $26, H_1, T_1
- VN MOD26, H_1, H_1
- VAQ T_1, H_2, H_2
- VESRLG $26, H_2, T_2
- VN MOD26, H_2, H_2
- VAQ T_2, H_3, H_3
- VESRLG $26, H_3, T_3
- VN MOD26, H_3, H_3
- VAQ T_3, H_4, H_4
-
- // h is now < 2*(2**130-5)
- // pack h into h1 (hi) and h0 (lo)
- PACK(H_0, H_1, H_2, H_3, H_4)
-
- // if h > 2**130-5 then h -= 2**130-5
- MOD(H_0, H_1, T_0, T_1, T_2)
-
- // h += s
- MOVD $·bswapMask<>(SB), R5
- VL (R5), T_1
- VL 16(R4), T_0
- VPERM T_0, T_0, T_1, T_0 // reverse bytes (to big)
- VAQ T_0, H_0, H_0
- VPERM H_0, H_0, T_1, H_0 // reverse bytes (to little)
- VST H_0, (R1)
-
- RET
-
-b2:
- CMPBLE R3, $16, b1
-
- // 2 blocks remaining
- SUB $17, R3
- VL (R2), T_0
- VLL R3, 16(R2), T_1
- ADD $1, R3
- MOVBZ $1, R0
- CMPBEQ R3, $16, 2(PC)
- VLVGB R3, R0, T_1
- EXPAND(T_0, T_1, F_0, F_1, F_2, F_3, F_4)
- CMPBNE R3, $16, 2(PC)
- VLEIB $12, $1, F_4
- VLEIB $4, $1, F_4
-
- // setup [r²,r]
- VLVGG $1, RSAVE_0, R_0
- VLVGG $1, RSAVE_1, R_1
- VLVGG $1, RSAVE_2, R_2
- VLVGG $1, RSAVE_3, R_3
- VLVGG $1, RSAVE_4, R_4
- VPDI $0, R5_1, R5SAVE_1, R5_1
- VPDI $0, R5_2, R5SAVE_2, R5_2
- VPDI $0, R5_3, R5SAVE_3, R5_3
- VPDI $0, R5_4, R5SAVE_4, R5_4
-
- MOVD $0, R3
- BR multiply
-
-skip:
- VZERO H_0
- VZERO H_1
- VZERO H_2
- VZERO H_3
- VZERO H_4
-
- CMPBEQ R3, $0, finish
-
-b1:
- // 1 block remaining
- SUB $1, R3
- VLL R3, (R2), T_0
- ADD $1, R3
- MOVBZ $1, R0
- CMPBEQ R3, $16, 2(PC)
- VLVGB R3, R0, T_0
- VZERO T_1
- EXPAND(T_0, T_1, F_0, F_1, F_2, F_3, F_4)
- CMPBNE R3, $16, 2(PC)
- VLEIB $4, $1, F_4
- VLEIG $1, $1, R_0
- VZERO R_1
- VZERO R_2
- VZERO R_3
- VZERO R_4
- VZERO R5_1
- VZERO R5_2
- VZERO R5_3
- VZERO R5_4
-
- // setup [r, 1]
- VLVGG $0, RSAVE_0, R_0
- VLVGG $0, RSAVE_1, R_1
- VLVGG $0, RSAVE_2, R_2
- VLVGG $0, RSAVE_3, R_3
- VLVGG $0, RSAVE_4, R_4
- VPDI $0, R5SAVE_1, R5_1, R5_1
- VPDI $0, R5SAVE_2, R5_2, R5_2
- VPDI $0, R5SAVE_3, R5_3, R5_3
- VPDI $0, R5SAVE_4, R5_4, R5_4
-
- MOVD $0, R3
- BR multiply
-
-TEXT ·hasVectorFacility(SB), NOSPLIT, $24-1
- MOVD $x-24(SP), R1
- XC $24, 0(R1), 0(R1) // clear the storage
- MOVD $2, R0 // R0 is the number of double words stored -1
- WORD $0xB2B01000 // STFLE 0(R1)
- XOR R0, R0 // reset the value of R0
- MOVBZ z-8(SP), R1
- AND $0x40, R1
- BEQ novector
-
-vectorinstalled:
- // check if the vector instruction has been enabled
- VLEIB $0, $0xF, V16
- VLGVB $0, V16, R1
- CMPBNE R1, $0xF, novector
- MOVB $1, ret+0(FP) // have vx
- RET
-
-novector:
- MOVB $0, ret+0(FP) // no vx
- RET
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s b/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s
deleted file mode 100644
index e548020b..00000000
--- a/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s
+++ /dev/null
@@ -1,931 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build s390x,go1.11,!gccgo,!appengine
-
-#include "textflag.h"
-
-// Implementation of Poly1305 using the vector facility (vx) and the VMSL instruction.
-
-// constants
-#define EX0 V1
-#define EX1 V2
-#define EX2 V3
-
-// temporaries
-#define T_0 V4
-#define T_1 V5
-#define T_2 V6
-#define T_3 V7
-#define T_4 V8
-#define T_5 V9
-#define T_6 V10
-#define T_7 V11
-#define T_8 V12
-#define T_9 V13
-#define T_10 V14
-
-// r**2 & r**4
-#define R_0 V15
-#define R_1 V16
-#define R_2 V17
-#define R5_1 V18
-#define R5_2 V19
-// key (r)
-#define RSAVE_0 R7
-#define RSAVE_1 R8
-#define RSAVE_2 R9
-#define R5SAVE_1 R10
-#define R5SAVE_2 R11
-
-// message block
-#define M0 V20
-#define M1 V21
-#define M2 V22
-#define M3 V23
-#define M4 V24
-#define M5 V25
-
-// accumulator
-#define H0_0 V26
-#define H1_0 V27
-#define H2_0 V28
-#define H0_1 V29
-#define H1_1 V30
-#define H2_1 V31
-
-GLOBL ·keyMask<>(SB), RODATA, $16
-DATA ·keyMask<>+0(SB)/8, $0xffffff0ffcffff0f
-DATA ·keyMask<>+8(SB)/8, $0xfcffff0ffcffff0f
-
-GLOBL ·bswapMask<>(SB), RODATA, $16
-DATA ·bswapMask<>+0(SB)/8, $0x0f0e0d0c0b0a0908
-DATA ·bswapMask<>+8(SB)/8, $0x0706050403020100
-
-GLOBL ·constants<>(SB), RODATA, $48
-// EX0
-DATA ·constants<>+0(SB)/8, $0x18191a1b1c1d1e1f
-DATA ·constants<>+8(SB)/8, $0x0000050403020100
-// EX1
-DATA ·constants<>+16(SB)/8, $0x18191a1b1c1d1e1f
-DATA ·constants<>+24(SB)/8, $0x00000a0908070605
-// EX2
-DATA ·constants<>+32(SB)/8, $0x18191a1b1c1d1e1f
-DATA ·constants<>+40(SB)/8, $0x0000000f0e0d0c0b
-
-GLOBL ·c<>(SB), RODATA, $48
-// EX0
-DATA ·c<>+0(SB)/8, $0x0000050403020100
-DATA ·c<>+8(SB)/8, $0x0000151413121110
-// EX1
-DATA ·c<>+16(SB)/8, $0x00000a0908070605
-DATA ·c<>+24(SB)/8, $0x00001a1918171615
-// EX2
-DATA ·c<>+32(SB)/8, $0x0000000f0e0d0c0b
-DATA ·c<>+40(SB)/8, $0x0000001f1e1d1c1b
-
-GLOBL ·reduce<>(SB), RODATA, $32
-// 44 bit
-DATA ·reduce<>+0(SB)/8, $0x0
-DATA ·reduce<>+8(SB)/8, $0xfffffffffff
-// 42 bit
-DATA ·reduce<>+16(SB)/8, $0x0
-DATA ·reduce<>+24(SB)/8, $0x3ffffffffff
-
-// h = (f*g) % (2**130-5) [partial reduction]
-// uses T_0...T_9 temporary registers
-// input: m02_0, m02_1, m02_2, m13_0, m13_1, m13_2, r_0, r_1, r_2, r5_1, r5_2, m4_0, m4_1, m4_2, m5_0, m5_1, m5_2
-// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8, t9
-// output: m02_0, m02_1, m02_2, m13_0, m13_1, m13_2
-#define MULTIPLY(m02_0, m02_1, m02_2, m13_0, m13_1, m13_2, r_0, r_1, r_2, r5_1, r5_2, m4_0, m4_1, m4_2, m5_0, m5_1, m5_2, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9) \
- \ // Eliminate the dependency for the last 2 VMSLs
- VMSLG m02_0, r_2, m4_2, m4_2 \
- VMSLG m13_0, r_2, m5_2, m5_2 \ // 8 VMSLs pipelined
- VMSLG m02_0, r_0, m4_0, m4_0 \
- VMSLG m02_1, r5_2, V0, T_0 \
- VMSLG m02_0, r_1, m4_1, m4_1 \
- VMSLG m02_1, r_0, V0, T_1 \
- VMSLG m02_1, r_1, V0, T_2 \
- VMSLG m02_2, r5_1, V0, T_3 \
- VMSLG m02_2, r5_2, V0, T_4 \
- VMSLG m13_0, r_0, m5_0, m5_0 \
- VMSLG m13_1, r5_2, V0, T_5 \
- VMSLG m13_0, r_1, m5_1, m5_1 \
- VMSLG m13_1, r_0, V0, T_6 \
- VMSLG m13_1, r_1, V0, T_7 \
- VMSLG m13_2, r5_1, V0, T_8 \
- VMSLG m13_2, r5_2, V0, T_9 \
- VMSLG m02_2, r_0, m4_2, m4_2 \
- VMSLG m13_2, r_0, m5_2, m5_2 \
- VAQ m4_0, T_0, m02_0 \
- VAQ m4_1, T_1, m02_1 \
- VAQ m5_0, T_5, m13_0 \
- VAQ m5_1, T_6, m13_1 \
- VAQ m02_0, T_3, m02_0 \
- VAQ m02_1, T_4, m02_1 \
- VAQ m13_0, T_8, m13_0 \
- VAQ m13_1, T_9, m13_1 \
- VAQ m4_2, T_2, m02_2 \
- VAQ m5_2, T_7, m13_2 \
-
-// SQUARE uses three limbs of r and r_2*5 to output square of r
-// uses T_1, T_5 and T_7 temporary registers
-// input: r_0, r_1, r_2, r5_2
-// temp: TEMP0, TEMP1, TEMP2
-// output: p0, p1, p2
-#define SQUARE(r_0, r_1, r_2, r5_2, p0, p1, p2, TEMP0, TEMP1, TEMP2) \
- VMSLG r_0, r_0, p0, p0 \
- VMSLG r_1, r5_2, V0, TEMP0 \
- VMSLG r_2, r5_2, p1, p1 \
- VMSLG r_0, r_1, V0, TEMP1 \
- VMSLG r_1, r_1, p2, p2 \
- VMSLG r_0, r_2, V0, TEMP2 \
- VAQ TEMP0, p0, p0 \
- VAQ TEMP1, p1, p1 \
- VAQ TEMP2, p2, p2 \
- VAQ TEMP0, p0, p0 \
- VAQ TEMP1, p1, p1 \
- VAQ TEMP2, p2, p2 \
-
-// carry h0->h1->h2->h0 || h3->h4->h5->h3
-// uses T_2, T_4, T_5, T_7, T_8, T_9
-// t6, t7, t8, t9, t10, t11
-// input: h0, h1, h2, h3, h4, h5
-// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11
-// output: h0, h1, h2, h3, h4, h5
-#define REDUCE(h0, h1, h2, h3, h4, h5, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) \
- VLM (R12), t6, t7 \ // 44 and 42 bit clear mask
- VLEIB $7, $0x28, t10 \ // 5 byte shift mask
- VREPIB $4, t8 \ // 4 bit shift mask
- VREPIB $2, t11 \ // 2 bit shift mask
- VSRLB t10, h0, t0 \ // h0 byte shift
- VSRLB t10, h1, t1 \ // h1 byte shift
- VSRLB t10, h2, t2 \ // h2 byte shift
- VSRLB t10, h3, t3 \ // h3 byte shift
- VSRLB t10, h4, t4 \ // h4 byte shift
- VSRLB t10, h5, t5 \ // h5 byte shift
- VSRL t8, t0, t0 \ // h0 bit shift
- VSRL t8, t1, t1 \ // h2 bit shift
- VSRL t11, t2, t2 \ // h2 bit shift
- VSRL t8, t3, t3 \ // h3 bit shift
- VSRL t8, t4, t4 \ // h4 bit shift
- VESLG $2, t2, t9 \ // h2 carry x5
- VSRL t11, t5, t5 \ // h5 bit shift
- VN t6, h0, h0 \ // h0 clear carry
- VAQ t2, t9, t2 \ // h2 carry x5
- VESLG $2, t5, t9 \ // h5 carry x5
- VN t6, h1, h1 \ // h1 clear carry
- VN t7, h2, h2 \ // h2 clear carry
- VAQ t5, t9, t5 \ // h5 carry x5
- VN t6, h3, h3 \ // h3 clear carry
- VN t6, h4, h4 \ // h4 clear carry
- VN t7, h5, h5 \ // h5 clear carry
- VAQ t0, h1, h1 \ // h0->h1
- VAQ t3, h4, h4 \ // h3->h4
- VAQ t1, h2, h2 \ // h1->h2
- VAQ t4, h5, h5 \ // h4->h5
- VAQ t2, h0, h0 \ // h2->h0
- VAQ t5, h3, h3 \ // h5->h3
- VREPG $1, t6, t6 \ // 44 and 42 bit masks across both halves
- VREPG $1, t7, t7 \
- VSLDB $8, h0, h0, h0 \ // set up [h0/1/2, h3/4/5]
- VSLDB $8, h1, h1, h1 \
- VSLDB $8, h2, h2, h2 \
- VO h0, h3, h3 \
- VO h1, h4, h4 \
- VO h2, h5, h5 \
- VESRLG $44, h3, t0 \ // 44 bit shift right
- VESRLG $44, h4, t1 \
- VESRLG $42, h5, t2 \
- VN t6, h3, h3 \ // clear carry bits
- VN t6, h4, h4 \
- VN t7, h5, h5 \
- VESLG $2, t2, t9 \ // multiply carry by 5
- VAQ t9, t2, t2 \
- VAQ t0, h4, h4 \
- VAQ t1, h5, h5 \
- VAQ t2, h3, h3 \
-
-// carry h0->h1->h2->h0
-// input: h0, h1, h2
-// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8
-// output: h0, h1, h2
-#define REDUCE2(h0, h1, h2, t0, t1, t2, t3, t4, t5, t6, t7, t8) \
- VLEIB $7, $0x28, t3 \ // 5 byte shift mask
- VREPIB $4, t4 \ // 4 bit shift mask
- VREPIB $2, t7 \ // 2 bit shift mask
- VGBM $0x003F, t5 \ // mask to clear carry bits
- VSRLB t3, h0, t0 \
- VSRLB t3, h1, t1 \
- VSRLB t3, h2, t2 \
- VESRLG $4, t5, t5 \ // 44 bit clear mask
- VSRL t4, t0, t0 \
- VSRL t4, t1, t1 \
- VSRL t7, t2, t2 \
- VESRLG $2, t5, t6 \ // 42 bit clear mask
- VESLG $2, t2, t8 \
- VAQ t8, t2, t2 \
- VN t5, h0, h0 \
- VN t5, h1, h1 \
- VN t6, h2, h2 \
- VAQ t0, h1, h1 \
- VAQ t1, h2, h2 \
- VAQ t2, h0, h0 \
- VSRLB t3, h0, t0 \
- VSRLB t3, h1, t1 \
- VSRLB t3, h2, t2 \
- VSRL t4, t0, t0 \
- VSRL t4, t1, t1 \
- VSRL t7, t2, t2 \
- VN t5, h0, h0 \
- VN t5, h1, h1 \
- VESLG $2, t2, t8 \
- VN t6, h2, h2 \
- VAQ t0, h1, h1 \
- VAQ t8, t2, t2 \
- VAQ t1, h2, h2 \
- VAQ t2, h0, h0 \
-
-// expands two message blocks into the lower halfs of the d registers
-// moves the contents of the d registers into upper halfs
-// input: in1, in2, d0, d1, d2, d3, d4, d5
-// temp: TEMP0, TEMP1, TEMP2, TEMP3
-// output: d0, d1, d2, d3, d4, d5
-#define EXPACC(in1, in2, d0, d1, d2, d3, d4, d5, TEMP0, TEMP1, TEMP2, TEMP3) \
- VGBM $0xff3f, TEMP0 \
- VGBM $0xff1f, TEMP1 \
- VESLG $4, d1, TEMP2 \
- VESLG $4, d4, TEMP3 \
- VESRLG $4, TEMP0, TEMP0 \
- VPERM in1, d0, EX0, d0 \
- VPERM in2, d3, EX0, d3 \
- VPERM in1, d2, EX2, d2 \
- VPERM in2, d5, EX2, d5 \
- VPERM in1, TEMP2, EX1, d1 \
- VPERM in2, TEMP3, EX1, d4 \
- VN TEMP0, d0, d0 \
- VN TEMP0, d3, d3 \
- VESRLG $4, d1, d1 \
- VESRLG $4, d4, d4 \
- VN TEMP1, d2, d2 \
- VN TEMP1, d5, d5 \
- VN TEMP0, d1, d1 \
- VN TEMP0, d4, d4 \
-
-// expands one message block into the lower halfs of the d registers
-// moves the contents of the d registers into upper halfs
-// input: in, d0, d1, d2
-// temp: TEMP0, TEMP1, TEMP2
-// output: d0, d1, d2
-#define EXPACC2(in, d0, d1, d2, TEMP0, TEMP1, TEMP2) \
- VGBM $0xff3f, TEMP0 \
- VESLG $4, d1, TEMP2 \
- VGBM $0xff1f, TEMP1 \
- VPERM in, d0, EX0, d0 \
- VESRLG $4, TEMP0, TEMP0 \
- VPERM in, d2, EX2, d2 \
- VPERM in, TEMP2, EX1, d1 \
- VN TEMP0, d0, d0 \
- VN TEMP1, d2, d2 \
- VESRLG $4, d1, d1 \
- VN TEMP0, d1, d1 \
-
-// pack h2:h0 into h1:h0 (no carry)
-// input: h0, h1, h2
-// output: h0, h1, h2
-#define PACK(h0, h1, h2) \
- VMRLG h1, h2, h2 \ // copy h1 to upper half h2
- VESLG $44, h1, h1 \ // shift limb 1 44 bits, leaving 20
- VO h0, h1, h0 \ // combine h0 with 20 bits from limb 1
- VESRLG $20, h2, h1 \ // put top 24 bits of limb 1 into h1
- VLEIG $1, $0, h1 \ // clear h2 stuff from lower half of h1
- VO h0, h1, h0 \ // h0 now has 88 bits (limb 0 and 1)
- VLEIG $0, $0, h2 \ // clear upper half of h2
- VESRLG $40, h2, h1 \ // h1 now has upper two bits of result
- VLEIB $7, $88, h1 \ // for byte shift (11 bytes)
- VSLB h1, h2, h2 \ // shift h2 11 bytes to the left
- VO h0, h2, h0 \ // combine h0 with 20 bits from limb 1
- VLEIG $0, $0, h1 \ // clear upper half of h1
-
-// if h > 2**130-5 then h -= 2**130-5
-// input: h0, h1
-// temp: t0, t1, t2
-// output: h0
-#define MOD(h0, h1, t0, t1, t2) \
- VZERO t0 \
- VLEIG $1, $5, t0 \
- VACCQ h0, t0, t1 \
- VAQ h0, t0, t0 \
- VONE t2 \
- VLEIG $1, $-4, t2 \
- VAQ t2, t1, t1 \
- VACCQ h1, t1, t1 \
- VONE t2 \
- VAQ t2, t1, t1 \
- VN h0, t1, t2 \
- VNC t0, t1, t1 \
- VO t1, t2, h0 \
-
-// func poly1305vmsl(out *[16]byte, m *byte, mlen uint64, key *[32]key)
-TEXT ·poly1305vmsl(SB), $0-32
- // This code processes 6 + up to 4 blocks (32 bytes) per iteration
- // using the algorithm described in:
- // NEON crypto, Daniel J. Bernstein & Peter Schwabe
- // https://cryptojedi.org/papers/neoncrypto-20120320.pdf
- // And as moddified for VMSL as described in
- // Accelerating Poly1305 Cryptographic Message Authentication on the z14
- // O'Farrell et al, CASCON 2017, p48-55
- // https://ibm.ent.box.com/s/jf9gedj0e9d2vjctfyh186shaztavnht
-
- LMG out+0(FP), R1, R4 // R1=out, R2=m, R3=mlen, R4=key
- VZERO V0 // c
-
- // load EX0, EX1 and EX2
- MOVD $·constants<>(SB), R5
- VLM (R5), EX0, EX2 // c
-
- // setup r
- VL (R4), T_0
- MOVD $·keyMask<>(SB), R6
- VL (R6), T_1
- VN T_0, T_1, T_0
- VZERO T_2 // limbs for r
- VZERO T_3
- VZERO T_4
- EXPACC2(T_0, T_2, T_3, T_4, T_1, T_5, T_7)
-
- // T_2, T_3, T_4: [0, r]
-
- // setup r*20
- VLEIG $0, $0, T_0
- VLEIG $1, $20, T_0 // T_0: [0, 20]
- VZERO T_5
- VZERO T_6
- VMSLG T_0, T_3, T_5, T_5
- VMSLG T_0, T_4, T_6, T_6
-
- // store r for final block in GR
- VLGVG $1, T_2, RSAVE_0 // c
- VLGVG $1, T_3, RSAVE_1 // c
- VLGVG $1, T_4, RSAVE_2 // c
- VLGVG $1, T_5, R5SAVE_1 // c
- VLGVG $1, T_6, R5SAVE_2 // c
-
- // initialize h
- VZERO H0_0
- VZERO H1_0
- VZERO H2_0
- VZERO H0_1
- VZERO H1_1
- VZERO H2_1
-
- // initialize pointer for reduce constants
- MOVD $·reduce<>(SB), R12
-
- // calculate r**2 and 20*(r**2)
- VZERO R_0
- VZERO R_1
- VZERO R_2
- SQUARE(T_2, T_3, T_4, T_6, R_0, R_1, R_2, T_1, T_5, T_7)
- REDUCE2(R_0, R_1, R_2, M0, M1, M2, M3, M4, R5_1, R5_2, M5, T_1)
- VZERO R5_1
- VZERO R5_2
- VMSLG T_0, R_1, R5_1, R5_1
- VMSLG T_0, R_2, R5_2, R5_2
-
- // skip r**4 calculation if 3 blocks or less
- CMPBLE R3, $48, b4
-
- // calculate r**4 and 20*(r**4)
- VZERO T_8
- VZERO T_9
- VZERO T_10
- SQUARE(R_0, R_1, R_2, R5_2, T_8, T_9, T_10, T_1, T_5, T_7)
- REDUCE2(T_8, T_9, T_10, M0, M1, M2, M3, M4, T_2, T_3, M5, T_1)
- VZERO T_2
- VZERO T_3
- VMSLG T_0, T_9, T_2, T_2
- VMSLG T_0, T_10, T_3, T_3
-
- // put r**2 to the right and r**4 to the left of R_0, R_1, R_2
- VSLDB $8, T_8, T_8, T_8
- VSLDB $8, T_9, T_9, T_9
- VSLDB $8, T_10, T_10, T_10
- VSLDB $8, T_2, T_2, T_2
- VSLDB $8, T_3, T_3, T_3
-
- VO T_8, R_0, R_0
- VO T_9, R_1, R_1
- VO T_10, R_2, R_2
- VO T_2, R5_1, R5_1
- VO T_3, R5_2, R5_2
-
- CMPBLE R3, $80, load // less than or equal to 5 blocks in message
-
- // 6(or 5+1) blocks
- SUB $81, R3
- VLM (R2), M0, M4
- VLL R3, 80(R2), M5
- ADD $1, R3
- MOVBZ $1, R0
- CMPBGE R3, $16, 2(PC)
- VLVGB R3, R0, M5
- MOVD $96(R2), R2
- EXPACC(M0, M1, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3)
- EXPACC(M2, M3, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3)
- VLEIB $2, $1, H2_0
- VLEIB $2, $1, H2_1
- VLEIB $10, $1, H2_0
- VLEIB $10, $1, H2_1
-
- VZERO M0
- VZERO M1
- VZERO M2
- VZERO M3
- VZERO T_4
- VZERO T_10
- EXPACC(M4, M5, M0, M1, M2, M3, T_4, T_10, T_0, T_1, T_2, T_3)
- VLR T_4, M4
- VLEIB $10, $1, M2
- CMPBLT R3, $16, 2(PC)
- VLEIB $10, $1, T_10
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M2, M3, M4, T_4, T_5, T_2, T_7, T_8, T_9)
- VMRHG V0, H0_1, H0_0
- VMRHG V0, H1_1, H1_0
- VMRHG V0, H2_1, H2_0
- VMRLG V0, H0_1, H0_1
- VMRLG V0, H1_1, H1_1
- VMRLG V0, H2_1, H2_1
-
- SUB $16, R3
- CMPBLE R3, $0, square
-
-load:
- // load EX0, EX1 and EX2
- MOVD $·c<>(SB), R5
- VLM (R5), EX0, EX2
-
-loop:
- CMPBLE R3, $64, add // b4 // last 4 or less blocks left
-
- // next 4 full blocks
- VLM (R2), M2, M5
- SUB $64, R3
- MOVD $64(R2), R2
- REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, T_0, T_1, T_3, T_4, T_5, T_2, T_7, T_8, T_9)
-
- // expacc in-lined to create [m2, m3] limbs
- VGBM $0x3f3f, T_0 // 44 bit clear mask
- VGBM $0x1f1f, T_1 // 40 bit clear mask
- VPERM M2, M3, EX0, T_3
- VESRLG $4, T_0, T_0 // 44 bit clear mask ready
- VPERM M2, M3, EX1, T_4
- VPERM M2, M3, EX2, T_5
- VN T_0, T_3, T_3
- VESRLG $4, T_4, T_4
- VN T_1, T_5, T_5
- VN T_0, T_4, T_4
- VMRHG H0_1, T_3, H0_0
- VMRHG H1_1, T_4, H1_0
- VMRHG H2_1, T_5, H2_0
- VMRLG H0_1, T_3, H0_1
- VMRLG H1_1, T_4, H1_1
- VMRLG H2_1, T_5, H2_1
- VLEIB $10, $1, H2_0
- VLEIB $10, $1, H2_1
- VPERM M4, M5, EX0, T_3
- VPERM M4, M5, EX1, T_4
- VPERM M4, M5, EX2, T_5
- VN T_0, T_3, T_3
- VESRLG $4, T_4, T_4
- VN T_1, T_5, T_5
- VN T_0, T_4, T_4
- VMRHG V0, T_3, M0
- VMRHG V0, T_4, M1
- VMRHG V0, T_5, M2
- VMRLG V0, T_3, M3
- VMRLG V0, T_4, M4
- VMRLG V0, T_5, M5
- VLEIB $10, $1, M2
- VLEIB $10, $1, M5
-
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- CMPBNE R3, $0, loop
- REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9)
- VMRHG V0, H0_1, H0_0
- VMRHG V0, H1_1, H1_0
- VMRHG V0, H2_1, H2_0
- VMRLG V0, H0_1, H0_1
- VMRLG V0, H1_1, H1_1
- VMRLG V0, H2_1, H2_1
-
- // load EX0, EX1, EX2
- MOVD $·constants<>(SB), R5
- VLM (R5), EX0, EX2
-
- // sum vectors
- VAQ H0_0, H0_1, H0_0
- VAQ H1_0, H1_1, H1_0
- VAQ H2_0, H2_1, H2_0
-
- // h may be >= 2*(2**130-5) so we need to reduce it again
- // M0...M4 are used as temps here
- REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5)
-
-next: // carry h1->h2
- VLEIB $7, $0x28, T_1
- VREPIB $4, T_2
- VGBM $0x003F, T_3
- VESRLG $4, T_3
-
- // byte shift
- VSRLB T_1, H1_0, T_4
-
- // bit shift
- VSRL T_2, T_4, T_4
-
- // clear h1 carry bits
- VN T_3, H1_0, H1_0
-
- // add carry
- VAQ T_4, H2_0, H2_0
-
- // h is now < 2*(2**130-5)
- // pack h into h1 (hi) and h0 (lo)
- PACK(H0_0, H1_0, H2_0)
-
- // if h > 2**130-5 then h -= 2**130-5
- MOD(H0_0, H1_0, T_0, T_1, T_2)
-
- // h += s
- MOVD $·bswapMask<>(SB), R5
- VL (R5), T_1
- VL 16(R4), T_0
- VPERM T_0, T_0, T_1, T_0 // reverse bytes (to big)
- VAQ T_0, H0_0, H0_0
- VPERM H0_0, H0_0, T_1, H0_0 // reverse bytes (to little)
- VST H0_0, (R1)
- RET
-
-add:
- // load EX0, EX1, EX2
- MOVD $·constants<>(SB), R5
- VLM (R5), EX0, EX2
-
- REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9)
- VMRHG V0, H0_1, H0_0
- VMRHG V0, H1_1, H1_0
- VMRHG V0, H2_1, H2_0
- VMRLG V0, H0_1, H0_1
- VMRLG V0, H1_1, H1_1
- VMRLG V0, H2_1, H2_1
- CMPBLE R3, $64, b4
-
-b4:
- CMPBLE R3, $48, b3 // 3 blocks or less
-
- // 4(3+1) blocks remaining
- SUB $49, R3
- VLM (R2), M0, M2
- VLL R3, 48(R2), M3
- ADD $1, R3
- MOVBZ $1, R0
- CMPBEQ R3, $16, 2(PC)
- VLVGB R3, R0, M3
- MOVD $64(R2), R2
- EXPACC(M0, M1, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3)
- VLEIB $10, $1, H2_0
- VLEIB $10, $1, H2_1
- VZERO M0
- VZERO M1
- VZERO M4
- VZERO M5
- VZERO T_4
- VZERO T_10
- EXPACC(M2, M3, M0, M1, M4, M5, T_4, T_10, T_0, T_1, T_2, T_3)
- VLR T_4, M2
- VLEIB $10, $1, M4
- CMPBNE R3, $16, 2(PC)
- VLEIB $10, $1, T_10
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M4, M5, M2, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9)
- VMRHG V0, H0_1, H0_0
- VMRHG V0, H1_1, H1_0
- VMRHG V0, H2_1, H2_0
- VMRLG V0, H0_1, H0_1
- VMRLG V0, H1_1, H1_1
- VMRLG V0, H2_1, H2_1
- SUB $16, R3
- CMPBLE R3, $0, square // this condition must always hold true!
-
-b3:
- CMPBLE R3, $32, b2
-
- // 3 blocks remaining
-
- // setup [r²,r]
- VSLDB $8, R_0, R_0, R_0
- VSLDB $8, R_1, R_1, R_1
- VSLDB $8, R_2, R_2, R_2
- VSLDB $8, R5_1, R5_1, R5_1
- VSLDB $8, R5_2, R5_2, R5_2
-
- VLVGG $1, RSAVE_0, R_0
- VLVGG $1, RSAVE_1, R_1
- VLVGG $1, RSAVE_2, R_2
- VLVGG $1, R5SAVE_1, R5_1
- VLVGG $1, R5SAVE_2, R5_2
-
- // setup [h0, h1]
- VSLDB $8, H0_0, H0_0, H0_0
- VSLDB $8, H1_0, H1_0, H1_0
- VSLDB $8, H2_0, H2_0, H2_0
- VO H0_1, H0_0, H0_0
- VO H1_1, H1_0, H1_0
- VO H2_1, H2_0, H2_0
- VZERO H0_1
- VZERO H1_1
- VZERO H2_1
-
- VZERO M0
- VZERO M1
- VZERO M2
- VZERO M3
- VZERO M4
- VZERO M5
-
- // H*[r**2, r]
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, H0_1, H1_1, T_10, M5)
-
- SUB $33, R3
- VLM (R2), M0, M1
- VLL R3, 32(R2), M2
- ADD $1, R3
- MOVBZ $1, R0
- CMPBEQ R3, $16, 2(PC)
- VLVGB R3, R0, M2
-
- // H += m0
- VZERO T_1
- VZERO T_2
- VZERO T_3
- EXPACC2(M0, T_1, T_2, T_3, T_4, T_5, T_6)
- VLEIB $10, $1, T_3
- VAG H0_0, T_1, H0_0
- VAG H1_0, T_2, H1_0
- VAG H2_0, T_3, H2_0
-
- VZERO M0
- VZERO M3
- VZERO M4
- VZERO M5
- VZERO T_10
-
- // (H+m0)*r
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M3, M4, M5, V0, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE2(H0_0, H1_0, H2_0, M0, M3, M4, M5, T_10, H0_1, H1_1, H2_1, T_9)
-
- // H += m1
- VZERO V0
- VZERO T_1
- VZERO T_2
- VZERO T_3
- EXPACC2(M1, T_1, T_2, T_3, T_4, T_5, T_6)
- VLEIB $10, $1, T_3
- VAQ H0_0, T_1, H0_0
- VAQ H1_0, T_2, H1_0
- VAQ H2_0, T_3, H2_0
- REDUCE2(H0_0, H1_0, H2_0, M0, M3, M4, M5, T_9, H0_1, H1_1, H2_1, T_10)
-
- // [H, m2] * [r**2, r]
- EXPACC2(M2, H0_0, H1_0, H2_0, T_1, T_2, T_3)
- CMPBNE R3, $16, 2(PC)
- VLEIB $10, $1, H2_0
- VZERO M0
- VZERO M1
- VZERO M2
- VZERO M3
- VZERO M4
- VZERO M5
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, H0_1, H1_1, M5, T_10)
- SUB $16, R3
- CMPBLE R3, $0, next // this condition must always hold true!
-
-b2:
- CMPBLE R3, $16, b1
-
- // 2 blocks remaining
-
- // setup [r²,r]
- VSLDB $8, R_0, R_0, R_0
- VSLDB $8, R_1, R_1, R_1
- VSLDB $8, R_2, R_2, R_2
- VSLDB $8, R5_1, R5_1, R5_1
- VSLDB $8, R5_2, R5_2, R5_2
-
- VLVGG $1, RSAVE_0, R_0
- VLVGG $1, RSAVE_1, R_1
- VLVGG $1, RSAVE_2, R_2
- VLVGG $1, R5SAVE_1, R5_1
- VLVGG $1, R5SAVE_2, R5_2
-
- // setup [h0, h1]
- VSLDB $8, H0_0, H0_0, H0_0
- VSLDB $8, H1_0, H1_0, H1_0
- VSLDB $8, H2_0, H2_0, H2_0
- VO H0_1, H0_0, H0_0
- VO H1_1, H1_0, H1_0
- VO H2_1, H2_0, H2_0
- VZERO H0_1
- VZERO H1_1
- VZERO H2_1
-
- VZERO M0
- VZERO M1
- VZERO M2
- VZERO M3
- VZERO M4
- VZERO M5
-
- // H*[r**2, r]
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M2, M3, M4, T_4, T_5, T_2, T_7, T_8, T_9)
- VMRHG V0, H0_1, H0_0
- VMRHG V0, H1_1, H1_0
- VMRHG V0, H2_1, H2_0
- VMRLG V0, H0_1, H0_1
- VMRLG V0, H1_1, H1_1
- VMRLG V0, H2_1, H2_1
-
- // move h to the left and 0s at the right
- VSLDB $8, H0_0, H0_0, H0_0
- VSLDB $8, H1_0, H1_0, H1_0
- VSLDB $8, H2_0, H2_0, H2_0
-
- // get message blocks and append 1 to start
- SUB $17, R3
- VL (R2), M0
- VLL R3, 16(R2), M1
- ADD $1, R3
- MOVBZ $1, R0
- CMPBEQ R3, $16, 2(PC)
- VLVGB R3, R0, M1
- VZERO T_6
- VZERO T_7
- VZERO T_8
- EXPACC2(M0, T_6, T_7, T_8, T_1, T_2, T_3)
- EXPACC2(M1, T_6, T_7, T_8, T_1, T_2, T_3)
- VLEIB $2, $1, T_8
- CMPBNE R3, $16, 2(PC)
- VLEIB $10, $1, T_8
-
- // add [m0, m1] to h
- VAG H0_0, T_6, H0_0
- VAG H1_0, T_7, H1_0
- VAG H2_0, T_8, H2_0
-
- VZERO M2
- VZERO M3
- VZERO M4
- VZERO M5
- VZERO T_10
- VZERO M0
-
- // at this point R_0 .. R5_2 look like [r**2, r]
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M2, M3, M4, M5, T_10, M0, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE2(H0_0, H1_0, H2_0, M2, M3, M4, M5, T_9, H0_1, H1_1, H2_1, T_10)
- SUB $16, R3, R3
- CMPBLE R3, $0, next
-
-b1:
- CMPBLE R3, $0, next
-
- // 1 block remaining
-
- // setup [r²,r]
- VSLDB $8, R_0, R_0, R_0
- VSLDB $8, R_1, R_1, R_1
- VSLDB $8, R_2, R_2, R_2
- VSLDB $8, R5_1, R5_1, R5_1
- VSLDB $8, R5_2, R5_2, R5_2
-
- VLVGG $1, RSAVE_0, R_0
- VLVGG $1, RSAVE_1, R_1
- VLVGG $1, RSAVE_2, R_2
- VLVGG $1, R5SAVE_1, R5_1
- VLVGG $1, R5SAVE_2, R5_2
-
- // setup [h0, h1]
- VSLDB $8, H0_0, H0_0, H0_0
- VSLDB $8, H1_0, H1_0, H1_0
- VSLDB $8, H2_0, H2_0, H2_0
- VO H0_1, H0_0, H0_0
- VO H1_1, H1_0, H1_0
- VO H2_1, H2_0, H2_0
- VZERO H0_1
- VZERO H1_1
- VZERO H2_1
-
- VZERO M0
- VZERO M1
- VZERO M2
- VZERO M3
- VZERO M4
- VZERO M5
-
- // H*[r**2, r]
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5)
-
- // set up [0, m0] limbs
- SUB $1, R3
- VLL R3, (R2), M0
- ADD $1, R3
- MOVBZ $1, R0
- CMPBEQ R3, $16, 2(PC)
- VLVGB R3, R0, M0
- VZERO T_1
- VZERO T_2
- VZERO T_3
- EXPACC2(M0, T_1, T_2, T_3, T_4, T_5, T_6)// limbs: [0, m]
- CMPBNE R3, $16, 2(PC)
- VLEIB $10, $1, T_3
-
- // h+m0
- VAQ H0_0, T_1, H0_0
- VAQ H1_0, T_2, H1_0
- VAQ H2_0, T_3, H2_0
-
- VZERO M0
- VZERO M1
- VZERO M2
- VZERO M3
- VZERO M4
- VZERO M5
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5)
-
- BR next
-
-square:
- // setup [r²,r]
- VSLDB $8, R_0, R_0, R_0
- VSLDB $8, R_1, R_1, R_1
- VSLDB $8, R_2, R_2, R_2
- VSLDB $8, R5_1, R5_1, R5_1
- VSLDB $8, R5_2, R5_2, R5_2
-
- VLVGG $1, RSAVE_0, R_0
- VLVGG $1, RSAVE_1, R_1
- VLVGG $1, RSAVE_2, R_2
- VLVGG $1, R5SAVE_1, R5_1
- VLVGG $1, R5SAVE_2, R5_2
-
- // setup [h0, h1]
- VSLDB $8, H0_0, H0_0, H0_0
- VSLDB $8, H1_0, H1_0, H1_0
- VSLDB $8, H2_0, H2_0, H2_0
- VO H0_1, H0_0, H0_0
- VO H1_1, H1_0, H1_0
- VO H2_1, H2_0, H2_0
- VZERO H0_1
- VZERO H1_1
- VZERO H2_1
-
- VZERO M0
- VZERO M1
- VZERO M2
- VZERO M3
- VZERO M4
- VZERO M5
-
- // (h0*r**2) + (h1*r)
- MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9)
- REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5)
- BR next
-
-TEXT ·hasVMSLFacility(SB), NOSPLIT, $24-1
- MOVD $x-24(SP), R1
- XC $24, 0(R1), 0(R1) // clear the storage
- MOVD $2, R0 // R0 is the number of double words stored -1
- WORD $0xB2B01000 // STFLE 0(R1)
- XOR R0, R0 // reset the value of R0
- MOVBZ z-8(SP), R1
- AND $0x01, R1
- BEQ novmsl
-
-vectorinstalled:
- // check if the vector instruction has been enabled
- VLEIB $0, $0xF, V16
- VLGVB $0, V16, R1
- CMPBNE R1, $0xF, novmsl
- MOVB $1, ret+0(FP) // have vx
- RET
-
-novmsl:
- MOVB $0, ret+0(FP) // no vx
- RET
diff --git a/vendor/golang.org/x/crypto/ssh/agent/client.go b/vendor/golang.org/x/crypto/ssh/agent/client.go
deleted file mode 100644
index b1808dd2..00000000
--- a/vendor/golang.org/x/crypto/ssh/agent/client.go
+++ /dev/null
@@ -1,683 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package agent implements the ssh-agent protocol, and provides both
-// a client and a server. The client can talk to a standard ssh-agent
-// that uses UNIX sockets, and one could implement an alternative
-// ssh-agent process using the sample server.
-//
-// References:
-// [PROTOCOL.agent]: https://tools.ietf.org/html/draft-miller-ssh-agent-00
-package agent // import "golang.org/x/crypto/ssh/agent"
-
-import (
- "bytes"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rsa"
- "encoding/base64"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "math/big"
- "sync"
-
- "golang.org/x/crypto/ed25519"
- "golang.org/x/crypto/ssh"
-)
-
-// Agent represents the capabilities of an ssh-agent.
-type Agent interface {
- // List returns the identities known to the agent.
- List() ([]*Key, error)
-
- // Sign has the agent sign the data using a protocol 2 key as defined
- // in [PROTOCOL.agent] section 2.6.2.
- Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error)
-
- // Add adds a private key to the agent.
- Add(key AddedKey) error
-
- // Remove removes all identities with the given public key.
- Remove(key ssh.PublicKey) error
-
- // RemoveAll removes all identities.
- RemoveAll() error
-
- // Lock locks the agent. Sign and Remove will fail, and List will empty an empty list.
- Lock(passphrase []byte) error
-
- // Unlock undoes the effect of Lock
- Unlock(passphrase []byte) error
-
- // Signers returns signers for all the known keys.
- Signers() ([]ssh.Signer, error)
-}
-
-// ConstraintExtension describes an optional constraint defined by users.
-type ConstraintExtension struct {
- // ExtensionName consist of a UTF-8 string suffixed by the
- // implementation domain following the naming scheme defined
- // in Section 4.2 of [RFC4251], e.g. "foo@example.com".
- ExtensionName string
- // ExtensionDetails contains the actual content of the extended
- // constraint.
- ExtensionDetails []byte
-}
-
-// AddedKey describes an SSH key to be added to an Agent.
-type AddedKey struct {
- // PrivateKey must be a *rsa.PrivateKey, *dsa.PrivateKey or
- // *ecdsa.PrivateKey, which will be inserted into the agent.
- PrivateKey interface{}
- // Certificate, if not nil, is communicated to the agent and will be
- // stored with the key.
- Certificate *ssh.Certificate
- // Comment is an optional, free-form string.
- Comment string
- // LifetimeSecs, if not zero, is the number of seconds that the
- // agent will store the key for.
- LifetimeSecs uint32
- // ConfirmBeforeUse, if true, requests that the agent confirm with the
- // user before each use of this key.
- ConfirmBeforeUse bool
- // ConstraintExtensions are the experimental or private-use constraints
- // defined by users.
- ConstraintExtensions []ConstraintExtension
-}
-
-// See [PROTOCOL.agent], section 3.
-const (
- agentRequestV1Identities = 1
- agentRemoveAllV1Identities = 9
-
- // 3.2 Requests from client to agent for protocol 2 key operations
- agentAddIdentity = 17
- agentRemoveIdentity = 18
- agentRemoveAllIdentities = 19
- agentAddIDConstrained = 25
-
- // 3.3 Key-type independent requests from client to agent
- agentAddSmartcardKey = 20
- agentRemoveSmartcardKey = 21
- agentLock = 22
- agentUnlock = 23
- agentAddSmartcardKeyConstrained = 26
-
- // 3.7 Key constraint identifiers
- agentConstrainLifetime = 1
- agentConstrainConfirm = 2
- agentConstrainExtension = 3
-)
-
-// maxAgentResponseBytes is the maximum agent reply size that is accepted. This
-// is a sanity check, not a limit in the spec.
-const maxAgentResponseBytes = 16 << 20
-
-// Agent messages:
-// These structures mirror the wire format of the corresponding ssh agent
-// messages found in [PROTOCOL.agent].
-
-// 3.4 Generic replies from agent to client
-const agentFailure = 5
-
-type failureAgentMsg struct{}
-
-const agentSuccess = 6
-
-type successAgentMsg struct{}
-
-// See [PROTOCOL.agent], section 2.5.2.
-const agentRequestIdentities = 11
-
-type requestIdentitiesAgentMsg struct{}
-
-// See [PROTOCOL.agent], section 2.5.2.
-const agentIdentitiesAnswer = 12
-
-type identitiesAnswerAgentMsg struct {
- NumKeys uint32 `sshtype:"12"`
- Keys []byte `ssh:"rest"`
-}
-
-// See [PROTOCOL.agent], section 2.6.2.
-const agentSignRequest = 13
-
-type signRequestAgentMsg struct {
- KeyBlob []byte `sshtype:"13"`
- Data []byte
- Flags uint32
-}
-
-// See [PROTOCOL.agent], section 2.6.2.
-
-// 3.6 Replies from agent to client for protocol 2 key operations
-const agentSignResponse = 14
-
-type signResponseAgentMsg struct {
- SigBlob []byte `sshtype:"14"`
-}
-
-type publicKey struct {
- Format string
- Rest []byte `ssh:"rest"`
-}
-
-// 3.7 Key constraint identifiers
-type constrainLifetimeAgentMsg struct {
- LifetimeSecs uint32 `sshtype:"1"`
-}
-
-type constrainExtensionAgentMsg struct {
- ExtensionName string `sshtype:"3"`
- ExtensionDetails []byte
-
- // Rest is a field used for parsing, not part of message
- Rest []byte `ssh:"rest"`
-}
-
-// Key represents a protocol 2 public key as defined in
-// [PROTOCOL.agent], section 2.5.2.
-type Key struct {
- Format string
- Blob []byte
- Comment string
-}
-
-func clientErr(err error) error {
- return fmt.Errorf("agent: client error: %v", err)
-}
-
-// String returns the storage form of an agent key with the format, base64
-// encoded serialized key, and the comment if it is not empty.
-func (k *Key) String() string {
- s := string(k.Format) + " " + base64.StdEncoding.EncodeToString(k.Blob)
-
- if k.Comment != "" {
- s += " " + k.Comment
- }
-
- return s
-}
-
-// Type returns the public key type.
-func (k *Key) Type() string {
- return k.Format
-}
-
-// Marshal returns key blob to satisfy the ssh.PublicKey interface.
-func (k *Key) Marshal() []byte {
- return k.Blob
-}
-
-// Verify satisfies the ssh.PublicKey interface.
-func (k *Key) Verify(data []byte, sig *ssh.Signature) error {
- pubKey, err := ssh.ParsePublicKey(k.Blob)
- if err != nil {
- return fmt.Errorf("agent: bad public key: %v", err)
- }
- return pubKey.Verify(data, sig)
-}
-
-type wireKey struct {
- Format string
- Rest []byte `ssh:"rest"`
-}
-
-func parseKey(in []byte) (out *Key, rest []byte, err error) {
- var record struct {
- Blob []byte
- Comment string
- Rest []byte `ssh:"rest"`
- }
-
- if err := ssh.Unmarshal(in, &record); err != nil {
- return nil, nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(record.Blob, &wk); err != nil {
- return nil, nil, err
- }
-
- return &Key{
- Format: wk.Format,
- Blob: record.Blob,
- Comment: record.Comment,
- }, record.Rest, nil
-}
-
-// client is a client for an ssh-agent process.
-type client struct {
- // conn is typically a *net.UnixConn
- conn io.ReadWriter
- // mu is used to prevent concurrent access to the agent
- mu sync.Mutex
-}
-
-// NewClient returns an Agent that talks to an ssh-agent process over
-// the given connection.
-func NewClient(rw io.ReadWriter) Agent {
- return &client{conn: rw}
-}
-
-// call sends an RPC to the agent. On success, the reply is
-// unmarshaled into reply and replyType is set to the first byte of
-// the reply, which contains the type of the message.
-func (c *client) call(req []byte) (reply interface{}, err error) {
- c.mu.Lock()
- defer c.mu.Unlock()
-
- msg := make([]byte, 4+len(req))
- binary.BigEndian.PutUint32(msg, uint32(len(req)))
- copy(msg[4:], req)
- if _, err = c.conn.Write(msg); err != nil {
- return nil, clientErr(err)
- }
-
- var respSizeBuf [4]byte
- if _, err = io.ReadFull(c.conn, respSizeBuf[:]); err != nil {
- return nil, clientErr(err)
- }
- respSize := binary.BigEndian.Uint32(respSizeBuf[:])
- if respSize > maxAgentResponseBytes {
- return nil, clientErr(err)
- }
-
- buf := make([]byte, respSize)
- if _, err = io.ReadFull(c.conn, buf); err != nil {
- return nil, clientErr(err)
- }
- reply, err = unmarshal(buf)
- if err != nil {
- return nil, clientErr(err)
- }
- return reply, err
-}
-
-func (c *client) simpleCall(req []byte) error {
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-func (c *client) RemoveAll() error {
- return c.simpleCall([]byte{agentRemoveAllIdentities})
-}
-
-func (c *client) Remove(key ssh.PublicKey) error {
- req := ssh.Marshal(&agentRemoveIdentityMsg{
- KeyBlob: key.Marshal(),
- })
- return c.simpleCall(req)
-}
-
-func (c *client) Lock(passphrase []byte) error {
- req := ssh.Marshal(&agentLockMsg{
- Passphrase: passphrase,
- })
- return c.simpleCall(req)
-}
-
-func (c *client) Unlock(passphrase []byte) error {
- req := ssh.Marshal(&agentUnlockMsg{
- Passphrase: passphrase,
- })
- return c.simpleCall(req)
-}
-
-// List returns the identities known to the agent.
-func (c *client) List() ([]*Key, error) {
- // see [PROTOCOL.agent] section 2.5.2.
- req := []byte{agentRequestIdentities}
-
- msg, err := c.call(req)
- if err != nil {
- return nil, err
- }
-
- switch msg := msg.(type) {
- case *identitiesAnswerAgentMsg:
- if msg.NumKeys > maxAgentResponseBytes/8 {
- return nil, errors.New("agent: too many keys in agent reply")
- }
- keys := make([]*Key, msg.NumKeys)
- data := msg.Keys
- for i := uint32(0); i < msg.NumKeys; i++ {
- var key *Key
- var err error
- if key, data, err = parseKey(data); err != nil {
- return nil, err
- }
- keys[i] = key
- }
- return keys, nil
- case *failureAgentMsg:
- return nil, errors.New("agent: failed to list keys")
- }
- panic("unreachable")
-}
-
-// Sign has the agent sign the data using a protocol 2 key as defined
-// in [PROTOCOL.agent] section 2.6.2.
-func (c *client) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error) {
- req := ssh.Marshal(signRequestAgentMsg{
- KeyBlob: key.Marshal(),
- Data: data,
- })
-
- msg, err := c.call(req)
- if err != nil {
- return nil, err
- }
-
- switch msg := msg.(type) {
- case *signResponseAgentMsg:
- var sig ssh.Signature
- if err := ssh.Unmarshal(msg.SigBlob, &sig); err != nil {
- return nil, err
- }
-
- return &sig, nil
- case *failureAgentMsg:
- return nil, errors.New("agent: failed to sign challenge")
- }
- panic("unreachable")
-}
-
-// unmarshal parses an agent message in packet, returning the parsed
-// form and the message type of packet.
-func unmarshal(packet []byte) (interface{}, error) {
- if len(packet) < 1 {
- return nil, errors.New("agent: empty packet")
- }
- var msg interface{}
- switch packet[0] {
- case agentFailure:
- return new(failureAgentMsg), nil
- case agentSuccess:
- return new(successAgentMsg), nil
- case agentIdentitiesAnswer:
- msg = new(identitiesAnswerAgentMsg)
- case agentSignResponse:
- msg = new(signResponseAgentMsg)
- case agentV1IdentitiesAnswer:
- msg = new(agentV1IdentityMsg)
- default:
- return nil, fmt.Errorf("agent: unknown type tag %d", packet[0])
- }
- if err := ssh.Unmarshal(packet, msg); err != nil {
- return nil, err
- }
- return msg, nil
-}
-
-type rsaKeyMsg struct {
- Type string `sshtype:"17|25"`
- N *big.Int
- E *big.Int
- D *big.Int
- Iqmp *big.Int // IQMP = Inverse Q Mod P
- P *big.Int
- Q *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type dsaKeyMsg struct {
- Type string `sshtype:"17|25"`
- P *big.Int
- Q *big.Int
- G *big.Int
- Y *big.Int
- X *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ecdsaKeyMsg struct {
- Type string `sshtype:"17|25"`
- Curve string
- KeyBytes []byte
- D *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ed25519KeyMsg struct {
- Type string `sshtype:"17|25"`
- Pub []byte
- Priv []byte
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-// Insert adds a private key to the agent.
-func (c *client) insertKey(s interface{}, comment string, constraints []byte) error {
- var req []byte
- switch k := s.(type) {
- case *rsa.PrivateKey:
- if len(k.Primes) != 2 {
- return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
- }
- k.Precompute()
- req = ssh.Marshal(rsaKeyMsg{
- Type: ssh.KeyAlgoRSA,
- N: k.N,
- E: big.NewInt(int64(k.E)),
- D: k.D,
- Iqmp: k.Precomputed.Qinv,
- P: k.Primes[0],
- Q: k.Primes[1],
- Comments: comment,
- Constraints: constraints,
- })
- case *dsa.PrivateKey:
- req = ssh.Marshal(dsaKeyMsg{
- Type: ssh.KeyAlgoDSA,
- P: k.P,
- Q: k.Q,
- G: k.G,
- Y: k.Y,
- X: k.X,
- Comments: comment,
- Constraints: constraints,
- })
- case *ecdsa.PrivateKey:
- nistID := fmt.Sprintf("nistp%d", k.Params().BitSize)
- req = ssh.Marshal(ecdsaKeyMsg{
- Type: "ecdsa-sha2-" + nistID,
- Curve: nistID,
- KeyBytes: elliptic.Marshal(k.Curve, k.X, k.Y),
- D: k.D,
- Comments: comment,
- Constraints: constraints,
- })
- case *ed25519.PrivateKey:
- req = ssh.Marshal(ed25519KeyMsg{
- Type: ssh.KeyAlgoED25519,
- Pub: []byte(*k)[32:],
- Priv: []byte(*k),
- Comments: comment,
- Constraints: constraints,
- })
- default:
- return fmt.Errorf("agent: unsupported key type %T", s)
- }
-
- // if constraints are present then the message type needs to be changed.
- if len(constraints) != 0 {
- req[0] = agentAddIDConstrained
- }
-
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-type rsaCertMsg struct {
- Type string `sshtype:"17|25"`
- CertBytes []byte
- D *big.Int
- Iqmp *big.Int // IQMP = Inverse Q Mod P
- P *big.Int
- Q *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type dsaCertMsg struct {
- Type string `sshtype:"17|25"`
- CertBytes []byte
- X *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ecdsaCertMsg struct {
- Type string `sshtype:"17|25"`
- CertBytes []byte
- D *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ed25519CertMsg struct {
- Type string `sshtype:"17|25"`
- CertBytes []byte
- Pub []byte
- Priv []byte
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-// Add adds a private key to the agent. If a certificate is given,
-// that certificate is added instead as public key.
-func (c *client) Add(key AddedKey) error {
- var constraints []byte
-
- if secs := key.LifetimeSecs; secs != 0 {
- constraints = append(constraints, ssh.Marshal(constrainLifetimeAgentMsg{secs})...)
- }
-
- if key.ConfirmBeforeUse {
- constraints = append(constraints, agentConstrainConfirm)
- }
-
- cert := key.Certificate
- if cert == nil {
- return c.insertKey(key.PrivateKey, key.Comment, constraints)
- }
- return c.insertCert(key.PrivateKey, cert, key.Comment, constraints)
-}
-
-func (c *client) insertCert(s interface{}, cert *ssh.Certificate, comment string, constraints []byte) error {
- var req []byte
- switch k := s.(type) {
- case *rsa.PrivateKey:
- if len(k.Primes) != 2 {
- return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
- }
- k.Precompute()
- req = ssh.Marshal(rsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- D: k.D,
- Iqmp: k.Precomputed.Qinv,
- P: k.Primes[0],
- Q: k.Primes[1],
- Comments: comment,
- Constraints: constraints,
- })
- case *dsa.PrivateKey:
- req = ssh.Marshal(dsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- X: k.X,
- Comments: comment,
- Constraints: constraints,
- })
- case *ecdsa.PrivateKey:
- req = ssh.Marshal(ecdsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- D: k.D,
- Comments: comment,
- Constraints: constraints,
- })
- case *ed25519.PrivateKey:
- req = ssh.Marshal(ed25519CertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- Pub: []byte(*k)[32:],
- Priv: []byte(*k),
- Comments: comment,
- Constraints: constraints,
- })
- default:
- return fmt.Errorf("agent: unsupported key type %T", s)
- }
-
- // if constraints are present then the message type needs to be changed.
- if len(constraints) != 0 {
- req[0] = agentAddIDConstrained
- }
-
- signer, err := ssh.NewSignerFromKey(s)
- if err != nil {
- return err
- }
- if bytes.Compare(cert.Key.Marshal(), signer.PublicKey().Marshal()) != 0 {
- return errors.New("agent: signer and cert have different public key")
- }
-
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-// Signers provides a callback for client authentication.
-func (c *client) Signers() ([]ssh.Signer, error) {
- keys, err := c.List()
- if err != nil {
- return nil, err
- }
-
- var result []ssh.Signer
- for _, k := range keys {
- result = append(result, &agentKeyringSigner{c, k})
- }
- return result, nil
-}
-
-type agentKeyringSigner struct {
- agent *client
- pub ssh.PublicKey
-}
-
-func (s *agentKeyringSigner) PublicKey() ssh.PublicKey {
- return s.pub
-}
-
-func (s *agentKeyringSigner) Sign(rand io.Reader, data []byte) (*ssh.Signature, error) {
- // The agent has its own entropy source, so the rand argument is ignored.
- return s.agent.Sign(s.pub, data)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/forward.go b/vendor/golang.org/x/crypto/ssh/agent/forward.go
deleted file mode 100644
index fd24ba90..00000000
--- a/vendor/golang.org/x/crypto/ssh/agent/forward.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "errors"
- "io"
- "net"
- "sync"
-
- "golang.org/x/crypto/ssh"
-)
-
-// RequestAgentForwarding sets up agent forwarding for the session.
-// ForwardToAgent or ForwardToRemote should be called to route
-// the authentication requests.
-func RequestAgentForwarding(session *ssh.Session) error {
- ok, err := session.SendRequest("auth-agent-req@openssh.com", true, nil)
- if err != nil {
- return err
- }
- if !ok {
- return errors.New("forwarding request denied")
- }
- return nil
-}
-
-// ForwardToAgent routes authentication requests to the given keyring.
-func ForwardToAgent(client *ssh.Client, keyring Agent) error {
- channels := client.HandleChannelOpen(channelType)
- if channels == nil {
- return errors.New("agent: already have handler for " + channelType)
- }
-
- go func() {
- for ch := range channels {
- channel, reqs, err := ch.Accept()
- if err != nil {
- continue
- }
- go ssh.DiscardRequests(reqs)
- go func() {
- ServeAgent(keyring, channel)
- channel.Close()
- }()
- }
- }()
- return nil
-}
-
-const channelType = "auth-agent@openssh.com"
-
-// ForwardToRemote routes authentication requests to the ssh-agent
-// process serving on the given unix socket.
-func ForwardToRemote(client *ssh.Client, addr string) error {
- channels := client.HandleChannelOpen(channelType)
- if channels == nil {
- return errors.New("agent: already have handler for " + channelType)
- }
- conn, err := net.Dial("unix", addr)
- if err != nil {
- return err
- }
- conn.Close()
-
- go func() {
- for ch := range channels {
- channel, reqs, err := ch.Accept()
- if err != nil {
- continue
- }
- go ssh.DiscardRequests(reqs)
- go forwardUnixSocket(channel, addr)
- }
- }()
- return nil
-}
-
-func forwardUnixSocket(channel ssh.Channel, addr string) {
- conn, err := net.Dial("unix", addr)
- if err != nil {
- return
- }
-
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- io.Copy(conn, channel)
- conn.(*net.UnixConn).CloseWrite()
- wg.Done()
- }()
- go func() {
- io.Copy(channel, conn)
- channel.CloseWrite()
- wg.Done()
- }()
-
- wg.Wait()
- conn.Close()
- channel.Close()
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/keyring.go b/vendor/golang.org/x/crypto/ssh/agent/keyring.go
deleted file mode 100644
index 1a516327..00000000
--- a/vendor/golang.org/x/crypto/ssh/agent/keyring.go
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "bytes"
- "crypto/rand"
- "crypto/subtle"
- "errors"
- "fmt"
- "sync"
- "time"
-
- "golang.org/x/crypto/ssh"
-)
-
-type privKey struct {
- signer ssh.Signer
- comment string
- expire *time.Time
-}
-
-type keyring struct {
- mu sync.Mutex
- keys []privKey
-
- locked bool
- passphrase []byte
-}
-
-var errLocked = errors.New("agent: locked")
-
-// NewKeyring returns an Agent that holds keys in memory. It is safe
-// for concurrent use by multiple goroutines.
-func NewKeyring() Agent {
- return &keyring{}
-}
-
-// RemoveAll removes all identities.
-func (r *keyring) RemoveAll() error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- r.keys = nil
- return nil
-}
-
-// removeLocked does the actual key removal. The caller must already be holding the
-// keyring mutex.
-func (r *keyring) removeLocked(want []byte) error {
- found := false
- for i := 0; i < len(r.keys); {
- if bytes.Equal(r.keys[i].signer.PublicKey().Marshal(), want) {
- found = true
- r.keys[i] = r.keys[len(r.keys)-1]
- r.keys = r.keys[:len(r.keys)-1]
- continue
- } else {
- i++
- }
- }
-
- if !found {
- return errors.New("agent: key not found")
- }
- return nil
-}
-
-// Remove removes all identities with the given public key.
-func (r *keyring) Remove(key ssh.PublicKey) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- return r.removeLocked(key.Marshal())
-}
-
-// Lock locks the agent. Sign and Remove will fail, and List will return an empty list.
-func (r *keyring) Lock(passphrase []byte) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- r.locked = true
- r.passphrase = passphrase
- return nil
-}
-
-// Unlock undoes the effect of Lock
-func (r *keyring) Unlock(passphrase []byte) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if !r.locked {
- return errors.New("agent: not locked")
- }
- if 1 != subtle.ConstantTimeCompare(passphrase, r.passphrase) {
- return fmt.Errorf("agent: incorrect passphrase")
- }
-
- r.locked = false
- r.passphrase = nil
- return nil
-}
-
-// expireKeysLocked removes expired keys from the keyring. If a key was added
-// with a lifetimesecs contraint and seconds >= lifetimesecs seconds have
-// ellapsed, it is removed. The caller *must* be holding the keyring mutex.
-func (r *keyring) expireKeysLocked() {
- for _, k := range r.keys {
- if k.expire != nil && time.Now().After(*k.expire) {
- r.removeLocked(k.signer.PublicKey().Marshal())
- }
- }
-}
-
-// List returns the identities known to the agent.
-func (r *keyring) List() ([]*Key, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- // section 2.7: locked agents return empty.
- return nil, nil
- }
-
- r.expireKeysLocked()
- var ids []*Key
- for _, k := range r.keys {
- pub := k.signer.PublicKey()
- ids = append(ids, &Key{
- Format: pub.Type(),
- Blob: pub.Marshal(),
- Comment: k.comment})
- }
- return ids, nil
-}
-
-// Insert adds a private key to the keyring. If a certificate
-// is given, that certificate is added as public key. Note that
-// any constraints given are ignored.
-func (r *keyring) Add(key AddedKey) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
- signer, err := ssh.NewSignerFromKey(key.PrivateKey)
-
- if err != nil {
- return err
- }
-
- if cert := key.Certificate; cert != nil {
- signer, err = ssh.NewCertSigner(cert, signer)
- if err != nil {
- return err
- }
- }
-
- p := privKey{
- signer: signer,
- comment: key.Comment,
- }
-
- if key.LifetimeSecs > 0 {
- t := time.Now().Add(time.Duration(key.LifetimeSecs) * time.Second)
- p.expire = &t
- }
-
- r.keys = append(r.keys, p)
-
- return nil
-}
-
-// Sign returns a signature for the data.
-func (r *keyring) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return nil, errLocked
- }
-
- r.expireKeysLocked()
- wanted := key.Marshal()
- for _, k := range r.keys {
- if bytes.Equal(k.signer.PublicKey().Marshal(), wanted) {
- return k.signer.Sign(rand.Reader, data)
- }
- }
- return nil, errors.New("not found")
-}
-
-// Signers returns signers for all the known keys.
-func (r *keyring) Signers() ([]ssh.Signer, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return nil, errLocked
- }
-
- r.expireKeysLocked()
- s := make([]ssh.Signer, 0, len(r.keys))
- for _, k := range r.keys {
- s = append(s, k.signer)
- }
- return s, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/server.go b/vendor/golang.org/x/crypto/ssh/agent/server.go
deleted file mode 100644
index 2e4692cb..00000000
--- a/vendor/golang.org/x/crypto/ssh/agent/server.go
+++ /dev/null
@@ -1,523 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rsa"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "log"
- "math/big"
-
- "golang.org/x/crypto/ed25519"
- "golang.org/x/crypto/ssh"
-)
-
-// Server wraps an Agent and uses it to implement the agent side of
-// the SSH-agent, wire protocol.
-type server struct {
- agent Agent
-}
-
-func (s *server) processRequestBytes(reqData []byte) []byte {
- rep, err := s.processRequest(reqData)
- if err != nil {
- if err != errLocked {
- // TODO(hanwen): provide better logging interface?
- log.Printf("agent %d: %v", reqData[0], err)
- }
- return []byte{agentFailure}
- }
-
- if err == nil && rep == nil {
- return []byte{agentSuccess}
- }
-
- return ssh.Marshal(rep)
-}
-
-func marshalKey(k *Key) []byte {
- var record struct {
- Blob []byte
- Comment string
- }
- record.Blob = k.Marshal()
- record.Comment = k.Comment
-
- return ssh.Marshal(&record)
-}
-
-// See [PROTOCOL.agent], section 2.5.1.
-const agentV1IdentitiesAnswer = 2
-
-type agentV1IdentityMsg struct {
- Numkeys uint32 `sshtype:"2"`
-}
-
-type agentRemoveIdentityMsg struct {
- KeyBlob []byte `sshtype:"18"`
-}
-
-type agentLockMsg struct {
- Passphrase []byte `sshtype:"22"`
-}
-
-type agentUnlockMsg struct {
- Passphrase []byte `sshtype:"23"`
-}
-
-func (s *server) processRequest(data []byte) (interface{}, error) {
- switch data[0] {
- case agentRequestV1Identities:
- return &agentV1IdentityMsg{0}, nil
-
- case agentRemoveAllV1Identities:
- return nil, nil
-
- case agentRemoveIdentity:
- var req agentRemoveIdentityMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(req.KeyBlob, &wk); err != nil {
- return nil, err
- }
-
- return nil, s.agent.Remove(&Key{Format: wk.Format, Blob: req.KeyBlob})
-
- case agentRemoveAllIdentities:
- return nil, s.agent.RemoveAll()
-
- case agentLock:
- var req agentLockMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- return nil, s.agent.Lock(req.Passphrase)
-
- case agentUnlock:
- var req agentUnlockMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
- return nil, s.agent.Unlock(req.Passphrase)
-
- case agentSignRequest:
- var req signRequestAgentMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(req.KeyBlob, &wk); err != nil {
- return nil, err
- }
-
- k := &Key{
- Format: wk.Format,
- Blob: req.KeyBlob,
- }
-
- sig, err := s.agent.Sign(k, req.Data) // TODO(hanwen): flags.
- if err != nil {
- return nil, err
- }
- return &signResponseAgentMsg{SigBlob: ssh.Marshal(sig)}, nil
-
- case agentRequestIdentities:
- keys, err := s.agent.List()
- if err != nil {
- return nil, err
- }
-
- rep := identitiesAnswerAgentMsg{
- NumKeys: uint32(len(keys)),
- }
- for _, k := range keys {
- rep.Keys = append(rep.Keys, marshalKey(k)...)
- }
- return rep, nil
-
- case agentAddIDConstrained, agentAddIdentity:
- return nil, s.insertIdentity(data)
- }
-
- return nil, fmt.Errorf("unknown opcode %d", data[0])
-}
-
-func parseConstraints(constraints []byte) (lifetimeSecs uint32, confirmBeforeUse bool, extensions []ConstraintExtension, err error) {
- for len(constraints) != 0 {
- switch constraints[0] {
- case agentConstrainLifetime:
- lifetimeSecs = binary.BigEndian.Uint32(constraints[1:5])
- constraints = constraints[5:]
- case agentConstrainConfirm:
- confirmBeforeUse = true
- constraints = constraints[1:]
- case agentConstrainExtension:
- var msg constrainExtensionAgentMsg
- if err = ssh.Unmarshal(constraints, &msg); err != nil {
- return 0, false, nil, err
- }
- extensions = append(extensions, ConstraintExtension{
- ExtensionName: msg.ExtensionName,
- ExtensionDetails: msg.ExtensionDetails,
- })
- constraints = msg.Rest
- default:
- return 0, false, nil, fmt.Errorf("unknown constraint type: %d", constraints[0])
- }
- }
- return
-}
-
-func setConstraints(key *AddedKey, constraintBytes []byte) error {
- lifetimeSecs, confirmBeforeUse, constraintExtensions, err := parseConstraints(constraintBytes)
- if err != nil {
- return err
- }
-
- key.LifetimeSecs = lifetimeSecs
- key.ConfirmBeforeUse = confirmBeforeUse
- key.ConstraintExtensions = constraintExtensions
- return nil
-}
-
-func parseRSAKey(req []byte) (*AddedKey, error) {
- var k rsaKeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- if k.E.BitLen() > 30 {
- return nil, errors.New("agent: RSA public exponent too large")
- }
- priv := &rsa.PrivateKey{
- PublicKey: rsa.PublicKey{
- E: int(k.E.Int64()),
- N: k.N,
- },
- D: k.D,
- Primes: []*big.Int{k.P, k.Q},
- }
- priv.Precompute()
-
- addedKey := &AddedKey{PrivateKey: priv, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseEd25519Key(req []byte) (*AddedKey, error) {
- var k ed25519KeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- priv := ed25519.PrivateKey(k.Priv)
-
- addedKey := &AddedKey{PrivateKey: &priv, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseDSAKey(req []byte) (*AddedKey, error) {
- var k dsaKeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- priv := &dsa.PrivateKey{
- PublicKey: dsa.PublicKey{
- Parameters: dsa.Parameters{
- P: k.P,
- Q: k.Q,
- G: k.G,
- },
- Y: k.Y,
- },
- X: k.X,
- }
-
- addedKey := &AddedKey{PrivateKey: priv, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func unmarshalECDSA(curveName string, keyBytes []byte, privScalar *big.Int) (priv *ecdsa.PrivateKey, err error) {
- priv = &ecdsa.PrivateKey{
- D: privScalar,
- }
-
- switch curveName {
- case "nistp256":
- priv.Curve = elliptic.P256()
- case "nistp384":
- priv.Curve = elliptic.P384()
- case "nistp521":
- priv.Curve = elliptic.P521()
- default:
- return nil, fmt.Errorf("agent: unknown curve %q", curveName)
- }
-
- priv.X, priv.Y = elliptic.Unmarshal(priv.Curve, keyBytes)
- if priv.X == nil || priv.Y == nil {
- return nil, errors.New("agent: point not on curve")
- }
-
- return priv, nil
-}
-
-func parseEd25519Cert(req []byte) (*AddedKey, error) {
- var k ed25519CertMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- pubKey, err := ssh.ParsePublicKey(k.CertBytes)
- if err != nil {
- return nil, err
- }
- priv := ed25519.PrivateKey(k.Priv)
- cert, ok := pubKey.(*ssh.Certificate)
- if !ok {
- return nil, errors.New("agent: bad ED25519 certificate")
- }
-
- addedKey := &AddedKey{PrivateKey: &priv, Certificate: cert, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseECDSAKey(req []byte) (*AddedKey, error) {
- var k ecdsaKeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
-
- priv, err := unmarshalECDSA(k.Curve, k.KeyBytes, k.D)
- if err != nil {
- return nil, err
- }
-
- addedKey := &AddedKey{PrivateKey: priv, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseRSACert(req []byte) (*AddedKey, error) {
- var k rsaCertMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
-
- pubKey, err := ssh.ParsePublicKey(k.CertBytes)
- if err != nil {
- return nil, err
- }
-
- cert, ok := pubKey.(*ssh.Certificate)
- if !ok {
- return nil, errors.New("agent: bad RSA certificate")
- }
-
- // An RSA publickey as marshaled by rsaPublicKey.Marshal() in keys.go
- var rsaPub struct {
- Name string
- E *big.Int
- N *big.Int
- }
- if err := ssh.Unmarshal(cert.Key.Marshal(), &rsaPub); err != nil {
- return nil, fmt.Errorf("agent: Unmarshal failed to parse public key: %v", err)
- }
-
- if rsaPub.E.BitLen() > 30 {
- return nil, errors.New("agent: RSA public exponent too large")
- }
-
- priv := rsa.PrivateKey{
- PublicKey: rsa.PublicKey{
- E: int(rsaPub.E.Int64()),
- N: rsaPub.N,
- },
- D: k.D,
- Primes: []*big.Int{k.Q, k.P},
- }
- priv.Precompute()
-
- addedKey := &AddedKey{PrivateKey: &priv, Certificate: cert, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseDSACert(req []byte) (*AddedKey, error) {
- var k dsaCertMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- pubKey, err := ssh.ParsePublicKey(k.CertBytes)
- if err != nil {
- return nil, err
- }
- cert, ok := pubKey.(*ssh.Certificate)
- if !ok {
- return nil, errors.New("agent: bad DSA certificate")
- }
-
- // A DSA publickey as marshaled by dsaPublicKey.Marshal() in keys.go
- var w struct {
- Name string
- P, Q, G, Y *big.Int
- }
- if err := ssh.Unmarshal(cert.Key.Marshal(), &w); err != nil {
- return nil, fmt.Errorf("agent: Unmarshal failed to parse public key: %v", err)
- }
-
- priv := &dsa.PrivateKey{
- PublicKey: dsa.PublicKey{
- Parameters: dsa.Parameters{
- P: w.P,
- Q: w.Q,
- G: w.G,
- },
- Y: w.Y,
- },
- X: k.X,
- }
-
- addedKey := &AddedKey{PrivateKey: priv, Certificate: cert, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseECDSACert(req []byte) (*AddedKey, error) {
- var k ecdsaCertMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
-
- pubKey, err := ssh.ParsePublicKey(k.CertBytes)
- if err != nil {
- return nil, err
- }
- cert, ok := pubKey.(*ssh.Certificate)
- if !ok {
- return nil, errors.New("agent: bad ECDSA certificate")
- }
-
- // An ECDSA publickey as marshaled by ecdsaPublicKey.Marshal() in keys.go
- var ecdsaPub struct {
- Name string
- ID string
- Key []byte
- }
- if err := ssh.Unmarshal(cert.Key.Marshal(), &ecdsaPub); err != nil {
- return nil, err
- }
-
- priv, err := unmarshalECDSA(ecdsaPub.ID, ecdsaPub.Key, k.D)
- if err != nil {
- return nil, err
- }
-
- addedKey := &AddedKey{PrivateKey: priv, Certificate: cert, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func (s *server) insertIdentity(req []byte) error {
- var record struct {
- Type string `sshtype:"17|25"`
- Rest []byte `ssh:"rest"`
- }
-
- if err := ssh.Unmarshal(req, &record); err != nil {
- return err
- }
-
- var addedKey *AddedKey
- var err error
-
- switch record.Type {
- case ssh.KeyAlgoRSA:
- addedKey, err = parseRSAKey(req)
- case ssh.KeyAlgoDSA:
- addedKey, err = parseDSAKey(req)
- case ssh.KeyAlgoECDSA256, ssh.KeyAlgoECDSA384, ssh.KeyAlgoECDSA521:
- addedKey, err = parseECDSAKey(req)
- case ssh.KeyAlgoED25519:
- addedKey, err = parseEd25519Key(req)
- case ssh.CertAlgoRSAv01:
- addedKey, err = parseRSACert(req)
- case ssh.CertAlgoDSAv01:
- addedKey, err = parseDSACert(req)
- case ssh.CertAlgoECDSA256v01, ssh.CertAlgoECDSA384v01, ssh.CertAlgoECDSA521v01:
- addedKey, err = parseECDSACert(req)
- case ssh.CertAlgoED25519v01:
- addedKey, err = parseEd25519Cert(req)
- default:
- return fmt.Errorf("agent: not implemented: %q", record.Type)
- }
-
- if err != nil {
- return err
- }
- return s.agent.Add(*addedKey)
-}
-
-// ServeAgent serves the agent protocol on the given connection. It
-// returns when an I/O error occurs.
-func ServeAgent(agent Agent, c io.ReadWriter) error {
- s := &server{agent}
-
- var length [4]byte
- for {
- if _, err := io.ReadFull(c, length[:]); err != nil {
- return err
- }
- l := binary.BigEndian.Uint32(length[:])
- if l > maxAgentResponseBytes {
- // We also cap requests.
- return fmt.Errorf("agent: request too large: %d", l)
- }
-
- req := make([]byte, l)
- if _, err := io.ReadFull(c, req); err != nil {
- return err
- }
-
- repData := s.processRequestBytes(req)
- if len(repData) > maxAgentResponseBytes {
- return fmt.Errorf("agent: reply too large: %d bytes", len(repData))
- }
-
- binary.BigEndian.PutUint32(length[:], uint32(len(repData)))
- if _, err := c.Write(length[:]); err != nil {
- return err
- }
- if _, err := c.Write(repData); err != nil {
- return err
- }
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/buffer.go b/vendor/golang.org/x/crypto/ssh/buffer.go
deleted file mode 100644
index 1ab07d07..00000000
--- a/vendor/golang.org/x/crypto/ssh/buffer.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "sync"
-)
-
-// buffer provides a linked list buffer for data exchange
-// between producer and consumer. Theoretically the buffer is
-// of unlimited capacity as it does no allocation of its own.
-type buffer struct {
- // protects concurrent access to head, tail and closed
- *sync.Cond
-
- head *element // the buffer that will be read first
- tail *element // the buffer that will be read last
-
- closed bool
-}
-
-// An element represents a single link in a linked list.
-type element struct {
- buf []byte
- next *element
-}
-
-// newBuffer returns an empty buffer that is not closed.
-func newBuffer() *buffer {
- e := new(element)
- b := &buffer{
- Cond: newCond(),
- head: e,
- tail: e,
- }
- return b
-}
-
-// write makes buf available for Read to receive.
-// buf must not be modified after the call to write.
-func (b *buffer) write(buf []byte) {
- b.Cond.L.Lock()
- e := &element{buf: buf}
- b.tail.next = e
- b.tail = e
- b.Cond.Signal()
- b.Cond.L.Unlock()
-}
-
-// eof closes the buffer. Reads from the buffer once all
-// the data has been consumed will receive io.EOF.
-func (b *buffer) eof() {
- b.Cond.L.Lock()
- b.closed = true
- b.Cond.Signal()
- b.Cond.L.Unlock()
-}
-
-// Read reads data from the internal buffer in buf. Reads will block
-// if no data is available, or until the buffer is closed.
-func (b *buffer) Read(buf []byte) (n int, err error) {
- b.Cond.L.Lock()
- defer b.Cond.L.Unlock()
-
- for len(buf) > 0 {
- // if there is data in b.head, copy it
- if len(b.head.buf) > 0 {
- r := copy(buf, b.head.buf)
- buf, b.head.buf = buf[r:], b.head.buf[r:]
- n += r
- continue
- }
- // if there is a next buffer, make it the head
- if len(b.head.buf) == 0 && b.head != b.tail {
- b.head = b.head.next
- continue
- }
-
- // if at least one byte has been copied, return
- if n > 0 {
- break
- }
-
- // if nothing was read, and there is nothing outstanding
- // check to see if the buffer is closed.
- if b.closed {
- err = io.EOF
- break
- }
- // out of buffers, wait for producer
- b.Cond.Wait()
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/ssh/certs.go b/vendor/golang.org/x/crypto/ssh/certs.go
deleted file mode 100644
index 42106f3f..00000000
--- a/vendor/golang.org/x/crypto/ssh/certs.go
+++ /dev/null
@@ -1,521 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "net"
- "sort"
- "time"
-)
-
-// These constants from [PROTOCOL.certkeys] represent the algorithm names
-// for certificate types supported by this package.
-const (
- CertAlgoRSAv01 = "ssh-rsa-cert-v01@openssh.com"
- CertAlgoDSAv01 = "ssh-dss-cert-v01@openssh.com"
- CertAlgoECDSA256v01 = "ecdsa-sha2-nistp256-cert-v01@openssh.com"
- CertAlgoECDSA384v01 = "ecdsa-sha2-nistp384-cert-v01@openssh.com"
- CertAlgoECDSA521v01 = "ecdsa-sha2-nistp521-cert-v01@openssh.com"
- CertAlgoED25519v01 = "ssh-ed25519-cert-v01@openssh.com"
-)
-
-// Certificate types distinguish between host and user
-// certificates. The values can be set in the CertType field of
-// Certificate.
-const (
- UserCert = 1
- HostCert = 2
-)
-
-// Signature represents a cryptographic signature.
-type Signature struct {
- Format string
- Blob []byte
-}
-
-// CertTimeInfinity can be used for OpenSSHCertV01.ValidBefore to indicate that
-// a certificate does not expire.
-const CertTimeInfinity = 1<<64 - 1
-
-// An Certificate represents an OpenSSH certificate as defined in
-// [PROTOCOL.certkeys]?rev=1.8. The Certificate type implements the
-// PublicKey interface, so it can be unmarshaled using
-// ParsePublicKey.
-type Certificate struct {
- Nonce []byte
- Key PublicKey
- Serial uint64
- CertType uint32
- KeyId string
- ValidPrincipals []string
- ValidAfter uint64
- ValidBefore uint64
- Permissions
- Reserved []byte
- SignatureKey PublicKey
- Signature *Signature
-}
-
-// genericCertData holds the key-independent part of the certificate data.
-// Overall, certificates contain an nonce, public key fields and
-// key-independent fields.
-type genericCertData struct {
- Serial uint64
- CertType uint32
- KeyId string
- ValidPrincipals []byte
- ValidAfter uint64
- ValidBefore uint64
- CriticalOptions []byte
- Extensions []byte
- Reserved []byte
- SignatureKey []byte
- Signature []byte
-}
-
-func marshalStringList(namelist []string) []byte {
- var to []byte
- for _, name := range namelist {
- s := struct{ N string }{name}
- to = append(to, Marshal(&s)...)
- }
- return to
-}
-
-type optionsTuple struct {
- Key string
- Value []byte
-}
-
-type optionsTupleValue struct {
- Value string
-}
-
-// serialize a map of critical options or extensions
-// issue #10569 - per [PROTOCOL.certkeys] and SSH implementation,
-// we need two length prefixes for a non-empty string value
-func marshalTuples(tups map[string]string) []byte {
- keys := make([]string, 0, len(tups))
- for key := range tups {
- keys = append(keys, key)
- }
- sort.Strings(keys)
-
- var ret []byte
- for _, key := range keys {
- s := optionsTuple{Key: key}
- if value := tups[key]; len(value) > 0 {
- s.Value = Marshal(&optionsTupleValue{value})
- }
- ret = append(ret, Marshal(&s)...)
- }
- return ret
-}
-
-// issue #10569 - per [PROTOCOL.certkeys] and SSH implementation,
-// we need two length prefixes for a non-empty option value
-func parseTuples(in []byte) (map[string]string, error) {
- tups := map[string]string{}
- var lastKey string
- var haveLastKey bool
-
- for len(in) > 0 {
- var key, val, extra []byte
- var ok bool
-
- if key, in, ok = parseString(in); !ok {
- return nil, errShortRead
- }
- keyStr := string(key)
- // according to [PROTOCOL.certkeys], the names must be in
- // lexical order.
- if haveLastKey && keyStr <= lastKey {
- return nil, fmt.Errorf("ssh: certificate options are not in lexical order")
- }
- lastKey, haveLastKey = keyStr, true
- // the next field is a data field, which if non-empty has a string embedded
- if val, in, ok = parseString(in); !ok {
- return nil, errShortRead
- }
- if len(val) > 0 {
- val, extra, ok = parseString(val)
- if !ok {
- return nil, errShortRead
- }
- if len(extra) > 0 {
- return nil, fmt.Errorf("ssh: unexpected trailing data after certificate option value")
- }
- tups[keyStr] = string(val)
- } else {
- tups[keyStr] = ""
- }
- }
- return tups, nil
-}
-
-func parseCert(in []byte, privAlgo string) (*Certificate, error) {
- nonce, rest, ok := parseString(in)
- if !ok {
- return nil, errShortRead
- }
-
- key, rest, err := parsePubKey(rest, privAlgo)
- if err != nil {
- return nil, err
- }
-
- var g genericCertData
- if err := Unmarshal(rest, &g); err != nil {
- return nil, err
- }
-
- c := &Certificate{
- Nonce: nonce,
- Key: key,
- Serial: g.Serial,
- CertType: g.CertType,
- KeyId: g.KeyId,
- ValidAfter: g.ValidAfter,
- ValidBefore: g.ValidBefore,
- }
-
- for principals := g.ValidPrincipals; len(principals) > 0; {
- principal, rest, ok := parseString(principals)
- if !ok {
- return nil, errShortRead
- }
- c.ValidPrincipals = append(c.ValidPrincipals, string(principal))
- principals = rest
- }
-
- c.CriticalOptions, err = parseTuples(g.CriticalOptions)
- if err != nil {
- return nil, err
- }
- c.Extensions, err = parseTuples(g.Extensions)
- if err != nil {
- return nil, err
- }
- c.Reserved = g.Reserved
- k, err := ParsePublicKey(g.SignatureKey)
- if err != nil {
- return nil, err
- }
-
- c.SignatureKey = k
- c.Signature, rest, ok = parseSignatureBody(g.Signature)
- if !ok || len(rest) > 0 {
- return nil, errors.New("ssh: signature parse error")
- }
-
- return c, nil
-}
-
-type openSSHCertSigner struct {
- pub *Certificate
- signer Signer
-}
-
-// NewCertSigner returns a Signer that signs with the given Certificate, whose
-// private key is held by signer. It returns an error if the public key in cert
-// doesn't match the key used by signer.
-func NewCertSigner(cert *Certificate, signer Signer) (Signer, error) {
- if bytes.Compare(cert.Key.Marshal(), signer.PublicKey().Marshal()) != 0 {
- return nil, errors.New("ssh: signer and cert have different public key")
- }
-
- return &openSSHCertSigner{cert, signer}, nil
-}
-
-func (s *openSSHCertSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
- return s.signer.Sign(rand, data)
-}
-
-func (s *openSSHCertSigner) PublicKey() PublicKey {
- return s.pub
-}
-
-const sourceAddressCriticalOption = "source-address"
-
-// CertChecker does the work of verifying a certificate. Its methods
-// can be plugged into ClientConfig.HostKeyCallback and
-// ServerConfig.PublicKeyCallback. For the CertChecker to work,
-// minimally, the IsAuthority callback should be set.
-type CertChecker struct {
- // SupportedCriticalOptions lists the CriticalOptions that the
- // server application layer understands. These are only used
- // for user certificates.
- SupportedCriticalOptions []string
-
- // IsUserAuthority should return true if the key is recognized as an
- // authority for the given user certificate. This allows for
- // certificates to be signed by other certificates. This must be set
- // if this CertChecker will be checking user certificates.
- IsUserAuthority func(auth PublicKey) bool
-
- // IsHostAuthority should report whether the key is recognized as
- // an authority for this host. This allows for certificates to be
- // signed by other keys, and for those other keys to only be valid
- // signers for particular hostnames. This must be set if this
- // CertChecker will be checking host certificates.
- IsHostAuthority func(auth PublicKey, address string) bool
-
- // Clock is used for verifying time stamps. If nil, time.Now
- // is used.
- Clock func() time.Time
-
- // UserKeyFallback is called when CertChecker.Authenticate encounters a
- // public key that is not a certificate. It must implement validation
- // of user keys or else, if nil, all such keys are rejected.
- UserKeyFallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
-
- // HostKeyFallback is called when CertChecker.CheckHostKey encounters a
- // public key that is not a certificate. It must implement host key
- // validation or else, if nil, all such keys are rejected.
- HostKeyFallback HostKeyCallback
-
- // IsRevoked is called for each certificate so that revocation checking
- // can be implemented. It should return true if the given certificate
- // is revoked and false otherwise. If nil, no certificates are
- // considered to have been revoked.
- IsRevoked func(cert *Certificate) bool
-}
-
-// CheckHostKey checks a host key certificate. This method can be
-// plugged into ClientConfig.HostKeyCallback.
-func (c *CertChecker) CheckHostKey(addr string, remote net.Addr, key PublicKey) error {
- cert, ok := key.(*Certificate)
- if !ok {
- if c.HostKeyFallback != nil {
- return c.HostKeyFallback(addr, remote, key)
- }
- return errors.New("ssh: non-certificate host key")
- }
- if cert.CertType != HostCert {
- return fmt.Errorf("ssh: certificate presented as a host key has type %d", cert.CertType)
- }
- if !c.IsHostAuthority(cert.SignatureKey, addr) {
- return fmt.Errorf("ssh: no authorities for hostname: %v", addr)
- }
-
- hostname, _, err := net.SplitHostPort(addr)
- if err != nil {
- return err
- }
-
- // Pass hostname only as principal for host certificates (consistent with OpenSSH)
- return c.CheckCert(hostname, cert)
-}
-
-// Authenticate checks a user certificate. Authenticate can be used as
-// a value for ServerConfig.PublicKeyCallback.
-func (c *CertChecker) Authenticate(conn ConnMetadata, pubKey PublicKey) (*Permissions, error) {
- cert, ok := pubKey.(*Certificate)
- if !ok {
- if c.UserKeyFallback != nil {
- return c.UserKeyFallback(conn, pubKey)
- }
- return nil, errors.New("ssh: normal key pairs not accepted")
- }
-
- if cert.CertType != UserCert {
- return nil, fmt.Errorf("ssh: cert has type %d", cert.CertType)
- }
- if !c.IsUserAuthority(cert.SignatureKey) {
- return nil, fmt.Errorf("ssh: certificate signed by unrecognized authority")
- }
-
- if err := c.CheckCert(conn.User(), cert); err != nil {
- return nil, err
- }
-
- return &cert.Permissions, nil
-}
-
-// CheckCert checks CriticalOptions, ValidPrincipals, revocation, timestamp and
-// the signature of the certificate.
-func (c *CertChecker) CheckCert(principal string, cert *Certificate) error {
- if c.IsRevoked != nil && c.IsRevoked(cert) {
- return fmt.Errorf("ssh: certificate serial %d revoked", cert.Serial)
- }
-
- for opt := range cert.CriticalOptions {
- // sourceAddressCriticalOption will be enforced by
- // serverAuthenticate
- if opt == sourceAddressCriticalOption {
- continue
- }
-
- found := false
- for _, supp := range c.SupportedCriticalOptions {
- if supp == opt {
- found = true
- break
- }
- }
- if !found {
- return fmt.Errorf("ssh: unsupported critical option %q in certificate", opt)
- }
- }
-
- if len(cert.ValidPrincipals) > 0 {
- // By default, certs are valid for all users/hosts.
- found := false
- for _, p := range cert.ValidPrincipals {
- if p == principal {
- found = true
- break
- }
- }
- if !found {
- return fmt.Errorf("ssh: principal %q not in the set of valid principals for given certificate: %q", principal, cert.ValidPrincipals)
- }
- }
-
- clock := c.Clock
- if clock == nil {
- clock = time.Now
- }
-
- unixNow := clock().Unix()
- if after := int64(cert.ValidAfter); after < 0 || unixNow < int64(cert.ValidAfter) {
- return fmt.Errorf("ssh: cert is not yet valid")
- }
- if before := int64(cert.ValidBefore); cert.ValidBefore != uint64(CertTimeInfinity) && (unixNow >= before || before < 0) {
- return fmt.Errorf("ssh: cert has expired")
- }
- if err := cert.SignatureKey.Verify(cert.bytesForSigning(), cert.Signature); err != nil {
- return fmt.Errorf("ssh: certificate signature does not verify")
- }
-
- return nil
-}
-
-// SignCert sets c.SignatureKey to the authority's public key and stores a
-// Signature, by authority, in the certificate.
-func (c *Certificate) SignCert(rand io.Reader, authority Signer) error {
- c.Nonce = make([]byte, 32)
- if _, err := io.ReadFull(rand, c.Nonce); err != nil {
- return err
- }
- c.SignatureKey = authority.PublicKey()
-
- sig, err := authority.Sign(rand, c.bytesForSigning())
- if err != nil {
- return err
- }
- c.Signature = sig
- return nil
-}
-
-var certAlgoNames = map[string]string{
- KeyAlgoRSA: CertAlgoRSAv01,
- KeyAlgoDSA: CertAlgoDSAv01,
- KeyAlgoECDSA256: CertAlgoECDSA256v01,
- KeyAlgoECDSA384: CertAlgoECDSA384v01,
- KeyAlgoECDSA521: CertAlgoECDSA521v01,
- KeyAlgoED25519: CertAlgoED25519v01,
-}
-
-// certToPrivAlgo returns the underlying algorithm for a certificate algorithm.
-// Panics if a non-certificate algorithm is passed.
-func certToPrivAlgo(algo string) string {
- for privAlgo, pubAlgo := range certAlgoNames {
- if pubAlgo == algo {
- return privAlgo
- }
- }
- panic("unknown cert algorithm")
-}
-
-func (cert *Certificate) bytesForSigning() []byte {
- c2 := *cert
- c2.Signature = nil
- out := c2.Marshal()
- // Drop trailing signature length.
- return out[:len(out)-4]
-}
-
-// Marshal serializes c into OpenSSH's wire format. It is part of the
-// PublicKey interface.
-func (c *Certificate) Marshal() []byte {
- generic := genericCertData{
- Serial: c.Serial,
- CertType: c.CertType,
- KeyId: c.KeyId,
- ValidPrincipals: marshalStringList(c.ValidPrincipals),
- ValidAfter: uint64(c.ValidAfter),
- ValidBefore: uint64(c.ValidBefore),
- CriticalOptions: marshalTuples(c.CriticalOptions),
- Extensions: marshalTuples(c.Extensions),
- Reserved: c.Reserved,
- SignatureKey: c.SignatureKey.Marshal(),
- }
- if c.Signature != nil {
- generic.Signature = Marshal(c.Signature)
- }
- genericBytes := Marshal(&generic)
- keyBytes := c.Key.Marshal()
- _, keyBytes, _ = parseString(keyBytes)
- prefix := Marshal(&struct {
- Name string
- Nonce []byte
- Key []byte `ssh:"rest"`
- }{c.Type(), c.Nonce, keyBytes})
-
- result := make([]byte, 0, len(prefix)+len(genericBytes))
- result = append(result, prefix...)
- result = append(result, genericBytes...)
- return result
-}
-
-// Type returns the key name. It is part of the PublicKey interface.
-func (c *Certificate) Type() string {
- algo, ok := certAlgoNames[c.Key.Type()]
- if !ok {
- panic("unknown cert key type " + c.Key.Type())
- }
- return algo
-}
-
-// Verify verifies a signature against the certificate's public
-// key. It is part of the PublicKey interface.
-func (c *Certificate) Verify(data []byte, sig *Signature) error {
- return c.Key.Verify(data, sig)
-}
-
-func parseSignatureBody(in []byte) (out *Signature, rest []byte, ok bool) {
- format, in, ok := parseString(in)
- if !ok {
- return
- }
-
- out = &Signature{
- Format: string(format),
- }
-
- if out.Blob, in, ok = parseString(in); !ok {
- return
- }
-
- return out, in, ok
-}
-
-func parseSignature(in []byte) (out *Signature, rest []byte, ok bool) {
- sigBytes, rest, ok := parseString(in)
- if !ok {
- return
- }
-
- out, trailing, ok := parseSignatureBody(sigBytes)
- if !ok || len(trailing) > 0 {
- return nil, nil, false
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/ssh/channel.go b/vendor/golang.org/x/crypto/ssh/channel.go
deleted file mode 100644
index c0834c00..00000000
--- a/vendor/golang.org/x/crypto/ssh/channel.go
+++ /dev/null
@@ -1,633 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "log"
- "sync"
-)
-
-const (
- minPacketLength = 9
- // channelMaxPacket contains the maximum number of bytes that will be
- // sent in a single packet. As per RFC 4253, section 6.1, 32k is also
- // the minimum.
- channelMaxPacket = 1 << 15
- // We follow OpenSSH here.
- channelWindowSize = 64 * channelMaxPacket
-)
-
-// NewChannel represents an incoming request to a channel. It must either be
-// accepted for use by calling Accept, or rejected by calling Reject.
-type NewChannel interface {
- // Accept accepts the channel creation request. It returns the Channel
- // and a Go channel containing SSH requests. The Go channel must be
- // serviced otherwise the Channel will hang.
- Accept() (Channel, <-chan *Request, error)
-
- // Reject rejects the channel creation request. After calling
- // this, no other methods on the Channel may be called.
- Reject(reason RejectionReason, message string) error
-
- // ChannelType returns the type of the channel, as supplied by the
- // client.
- ChannelType() string
-
- // ExtraData returns the arbitrary payload for this channel, as supplied
- // by the client. This data is specific to the channel type.
- ExtraData() []byte
-}
-
-// A Channel is an ordered, reliable, flow-controlled, duplex stream
-// that is multiplexed over an SSH connection.
-type Channel interface {
- // Read reads up to len(data) bytes from the channel.
- Read(data []byte) (int, error)
-
- // Write writes len(data) bytes to the channel.
- Write(data []byte) (int, error)
-
- // Close signals end of channel use. No data may be sent after this
- // call.
- Close() error
-
- // CloseWrite signals the end of sending in-band
- // data. Requests may still be sent, and the other side may
- // still send data
- CloseWrite() error
-
- // SendRequest sends a channel request. If wantReply is true,
- // it will wait for a reply and return the result as a
- // boolean, otherwise the return value will be false. Channel
- // requests are out-of-band messages so they may be sent even
- // if the data stream is closed or blocked by flow control.
- // If the channel is closed before a reply is returned, io.EOF
- // is returned.
- SendRequest(name string, wantReply bool, payload []byte) (bool, error)
-
- // Stderr returns an io.ReadWriter that writes to this channel
- // with the extended data type set to stderr. Stderr may
- // safely be read and written from a different goroutine than
- // Read and Write respectively.
- Stderr() io.ReadWriter
-}
-
-// Request is a request sent outside of the normal stream of
-// data. Requests can either be specific to an SSH channel, or they
-// can be global.
-type Request struct {
- Type string
- WantReply bool
- Payload []byte
-
- ch *channel
- mux *mux
-}
-
-// Reply sends a response to a request. It must be called for all requests
-// where WantReply is true and is a no-op otherwise. The payload argument is
-// ignored for replies to channel-specific requests.
-func (r *Request) Reply(ok bool, payload []byte) error {
- if !r.WantReply {
- return nil
- }
-
- if r.ch == nil {
- return r.mux.ackRequest(ok, payload)
- }
-
- return r.ch.ackRequest(ok)
-}
-
-// RejectionReason is an enumeration used when rejecting channel creation
-// requests. See RFC 4254, section 5.1.
-type RejectionReason uint32
-
-const (
- Prohibited RejectionReason = iota + 1
- ConnectionFailed
- UnknownChannelType
- ResourceShortage
-)
-
-// String converts the rejection reason to human readable form.
-func (r RejectionReason) String() string {
- switch r {
- case Prohibited:
- return "administratively prohibited"
- case ConnectionFailed:
- return "connect failed"
- case UnknownChannelType:
- return "unknown channel type"
- case ResourceShortage:
- return "resource shortage"
- }
- return fmt.Sprintf("unknown reason %d", int(r))
-}
-
-func min(a uint32, b int) uint32 {
- if a < uint32(b) {
- return a
- }
- return uint32(b)
-}
-
-type channelDirection uint8
-
-const (
- channelInbound channelDirection = iota
- channelOutbound
-)
-
-// channel is an implementation of the Channel interface that works
-// with the mux class.
-type channel struct {
- // R/O after creation
- chanType string
- extraData []byte
- localId, remoteId uint32
-
- // maxIncomingPayload and maxRemotePayload are the maximum
- // payload sizes of normal and extended data packets for
- // receiving and sending, respectively. The wire packet will
- // be 9 or 13 bytes larger (excluding encryption overhead).
- maxIncomingPayload uint32
- maxRemotePayload uint32
-
- mux *mux
-
- // decided is set to true if an accept or reject message has been sent
- // (for outbound channels) or received (for inbound channels).
- decided bool
-
- // direction contains either channelOutbound, for channels created
- // locally, or channelInbound, for channels created by the peer.
- direction channelDirection
-
- // Pending internal channel messages.
- msg chan interface{}
-
- // Since requests have no ID, there can be only one request
- // with WantReply=true outstanding. This lock is held by a
- // goroutine that has such an outgoing request pending.
- sentRequestMu sync.Mutex
-
- incomingRequests chan *Request
-
- sentEOF bool
-
- // thread-safe data
- remoteWin window
- pending *buffer
- extPending *buffer
-
- // windowMu protects myWindow, the flow-control window.
- windowMu sync.Mutex
- myWindow uint32
-
- // writeMu serializes calls to mux.conn.writePacket() and
- // protects sentClose and packetPool. This mutex must be
- // different from windowMu, as writePacket can block if there
- // is a key exchange pending.
- writeMu sync.Mutex
- sentClose bool
-
- // packetPool has a buffer for each extended channel ID to
- // save allocations during writes.
- packetPool map[uint32][]byte
-}
-
-// writePacket sends a packet. If the packet is a channel close, it updates
-// sentClose. This method takes the lock c.writeMu.
-func (ch *channel) writePacket(packet []byte) error {
- ch.writeMu.Lock()
- if ch.sentClose {
- ch.writeMu.Unlock()
- return io.EOF
- }
- ch.sentClose = (packet[0] == msgChannelClose)
- err := ch.mux.conn.writePacket(packet)
- ch.writeMu.Unlock()
- return err
-}
-
-func (ch *channel) sendMessage(msg interface{}) error {
- if debugMux {
- log.Printf("send(%d): %#v", ch.mux.chanList.offset, msg)
- }
-
- p := Marshal(msg)
- binary.BigEndian.PutUint32(p[1:], ch.remoteId)
- return ch.writePacket(p)
-}
-
-// WriteExtended writes data to a specific extended stream. These streams are
-// used, for example, for stderr.
-func (ch *channel) WriteExtended(data []byte, extendedCode uint32) (n int, err error) {
- if ch.sentEOF {
- return 0, io.EOF
- }
- // 1 byte message type, 4 bytes remoteId, 4 bytes data length
- opCode := byte(msgChannelData)
- headerLength := uint32(9)
- if extendedCode > 0 {
- headerLength += 4
- opCode = msgChannelExtendedData
- }
-
- ch.writeMu.Lock()
- packet := ch.packetPool[extendedCode]
- // We don't remove the buffer from packetPool, so
- // WriteExtended calls from different goroutines will be
- // flagged as errors by the race detector.
- ch.writeMu.Unlock()
-
- for len(data) > 0 {
- space := min(ch.maxRemotePayload, len(data))
- if space, err = ch.remoteWin.reserve(space); err != nil {
- return n, err
- }
- if want := headerLength + space; uint32(cap(packet)) < want {
- packet = make([]byte, want)
- } else {
- packet = packet[:want]
- }
-
- todo := data[:space]
-
- packet[0] = opCode
- binary.BigEndian.PutUint32(packet[1:], ch.remoteId)
- if extendedCode > 0 {
- binary.BigEndian.PutUint32(packet[5:], uint32(extendedCode))
- }
- binary.BigEndian.PutUint32(packet[headerLength-4:], uint32(len(todo)))
- copy(packet[headerLength:], todo)
- if err = ch.writePacket(packet); err != nil {
- return n, err
- }
-
- n += len(todo)
- data = data[len(todo):]
- }
-
- ch.writeMu.Lock()
- ch.packetPool[extendedCode] = packet
- ch.writeMu.Unlock()
-
- return n, err
-}
-
-func (ch *channel) handleData(packet []byte) error {
- headerLen := 9
- isExtendedData := packet[0] == msgChannelExtendedData
- if isExtendedData {
- headerLen = 13
- }
- if len(packet) < headerLen {
- // malformed data packet
- return parseError(packet[0])
- }
-
- var extended uint32
- if isExtendedData {
- extended = binary.BigEndian.Uint32(packet[5:])
- }
-
- length := binary.BigEndian.Uint32(packet[headerLen-4 : headerLen])
- if length == 0 {
- return nil
- }
- if length > ch.maxIncomingPayload {
- // TODO(hanwen): should send Disconnect?
- return errors.New("ssh: incoming packet exceeds maximum payload size")
- }
-
- data := packet[headerLen:]
- if length != uint32(len(data)) {
- return errors.New("ssh: wrong packet length")
- }
-
- ch.windowMu.Lock()
- if ch.myWindow < length {
- ch.windowMu.Unlock()
- // TODO(hanwen): should send Disconnect with reason?
- return errors.New("ssh: remote side wrote too much")
- }
- ch.myWindow -= length
- ch.windowMu.Unlock()
-
- if extended == 1 {
- ch.extPending.write(data)
- } else if extended > 0 {
- // discard other extended data.
- } else {
- ch.pending.write(data)
- }
- return nil
-}
-
-func (c *channel) adjustWindow(n uint32) error {
- c.windowMu.Lock()
- // Since myWindow is managed on our side, and can never exceed
- // the initial window setting, we don't worry about overflow.
- c.myWindow += uint32(n)
- c.windowMu.Unlock()
- return c.sendMessage(windowAdjustMsg{
- AdditionalBytes: uint32(n),
- })
-}
-
-func (c *channel) ReadExtended(data []byte, extended uint32) (n int, err error) {
- switch extended {
- case 1:
- n, err = c.extPending.Read(data)
- case 0:
- n, err = c.pending.Read(data)
- default:
- return 0, fmt.Errorf("ssh: extended code %d unimplemented", extended)
- }
-
- if n > 0 {
- err = c.adjustWindow(uint32(n))
- // sendWindowAdjust can return io.EOF if the remote
- // peer has closed the connection, however we want to
- // defer forwarding io.EOF to the caller of Read until
- // the buffer has been drained.
- if n > 0 && err == io.EOF {
- err = nil
- }
- }
-
- return n, err
-}
-
-func (c *channel) close() {
- c.pending.eof()
- c.extPending.eof()
- close(c.msg)
- close(c.incomingRequests)
- c.writeMu.Lock()
- // This is not necessary for a normal channel teardown, but if
- // there was another error, it is.
- c.sentClose = true
- c.writeMu.Unlock()
- // Unblock writers.
- c.remoteWin.close()
-}
-
-// responseMessageReceived is called when a success or failure message is
-// received on a channel to check that such a message is reasonable for the
-// given channel.
-func (ch *channel) responseMessageReceived() error {
- if ch.direction == channelInbound {
- return errors.New("ssh: channel response message received on inbound channel")
- }
- if ch.decided {
- return errors.New("ssh: duplicate response received for channel")
- }
- ch.decided = true
- return nil
-}
-
-func (ch *channel) handlePacket(packet []byte) error {
- switch packet[0] {
- case msgChannelData, msgChannelExtendedData:
- return ch.handleData(packet)
- case msgChannelClose:
- ch.sendMessage(channelCloseMsg{PeersID: ch.remoteId})
- ch.mux.chanList.remove(ch.localId)
- ch.close()
- return nil
- case msgChannelEOF:
- // RFC 4254 is mute on how EOF affects dataExt messages but
- // it is logical to signal EOF at the same time.
- ch.extPending.eof()
- ch.pending.eof()
- return nil
- }
-
- decoded, err := decode(packet)
- if err != nil {
- return err
- }
-
- switch msg := decoded.(type) {
- case *channelOpenFailureMsg:
- if err := ch.responseMessageReceived(); err != nil {
- return err
- }
- ch.mux.chanList.remove(msg.PeersID)
- ch.msg <- msg
- case *channelOpenConfirmMsg:
- if err := ch.responseMessageReceived(); err != nil {
- return err
- }
- if msg.MaxPacketSize < minPacketLength || msg.MaxPacketSize > 1<<31 {
- return fmt.Errorf("ssh: invalid MaxPacketSize %d from peer", msg.MaxPacketSize)
- }
- ch.remoteId = msg.MyID
- ch.maxRemotePayload = msg.MaxPacketSize
- ch.remoteWin.add(msg.MyWindow)
- ch.msg <- msg
- case *windowAdjustMsg:
- if !ch.remoteWin.add(msg.AdditionalBytes) {
- return fmt.Errorf("ssh: invalid window update for %d bytes", msg.AdditionalBytes)
- }
- case *channelRequestMsg:
- req := Request{
- Type: msg.Request,
- WantReply: msg.WantReply,
- Payload: msg.RequestSpecificData,
- ch: ch,
- }
-
- ch.incomingRequests <- &req
- default:
- ch.msg <- msg
- }
- return nil
-}
-
-func (m *mux) newChannel(chanType string, direction channelDirection, extraData []byte) *channel {
- ch := &channel{
- remoteWin: window{Cond: newCond()},
- myWindow: channelWindowSize,
- pending: newBuffer(),
- extPending: newBuffer(),
- direction: direction,
- incomingRequests: make(chan *Request, chanSize),
- msg: make(chan interface{}, chanSize),
- chanType: chanType,
- extraData: extraData,
- mux: m,
- packetPool: make(map[uint32][]byte),
- }
- ch.localId = m.chanList.add(ch)
- return ch
-}
-
-var errUndecided = errors.New("ssh: must Accept or Reject channel")
-var errDecidedAlready = errors.New("ssh: can call Accept or Reject only once")
-
-type extChannel struct {
- code uint32
- ch *channel
-}
-
-func (e *extChannel) Write(data []byte) (n int, err error) {
- return e.ch.WriteExtended(data, e.code)
-}
-
-func (e *extChannel) Read(data []byte) (n int, err error) {
- return e.ch.ReadExtended(data, e.code)
-}
-
-func (ch *channel) Accept() (Channel, <-chan *Request, error) {
- if ch.decided {
- return nil, nil, errDecidedAlready
- }
- ch.maxIncomingPayload = channelMaxPacket
- confirm := channelOpenConfirmMsg{
- PeersID: ch.remoteId,
- MyID: ch.localId,
- MyWindow: ch.myWindow,
- MaxPacketSize: ch.maxIncomingPayload,
- }
- ch.decided = true
- if err := ch.sendMessage(confirm); err != nil {
- return nil, nil, err
- }
-
- return ch, ch.incomingRequests, nil
-}
-
-func (ch *channel) Reject(reason RejectionReason, message string) error {
- if ch.decided {
- return errDecidedAlready
- }
- reject := channelOpenFailureMsg{
- PeersID: ch.remoteId,
- Reason: reason,
- Message: message,
- Language: "en",
- }
- ch.decided = true
- return ch.sendMessage(reject)
-}
-
-func (ch *channel) Read(data []byte) (int, error) {
- if !ch.decided {
- return 0, errUndecided
- }
- return ch.ReadExtended(data, 0)
-}
-
-func (ch *channel) Write(data []byte) (int, error) {
- if !ch.decided {
- return 0, errUndecided
- }
- return ch.WriteExtended(data, 0)
-}
-
-func (ch *channel) CloseWrite() error {
- if !ch.decided {
- return errUndecided
- }
- ch.sentEOF = true
- return ch.sendMessage(channelEOFMsg{
- PeersID: ch.remoteId})
-}
-
-func (ch *channel) Close() error {
- if !ch.decided {
- return errUndecided
- }
-
- return ch.sendMessage(channelCloseMsg{
- PeersID: ch.remoteId})
-}
-
-// Extended returns an io.ReadWriter that sends and receives data on the given,
-// SSH extended stream. Such streams are used, for example, for stderr.
-func (ch *channel) Extended(code uint32) io.ReadWriter {
- if !ch.decided {
- return nil
- }
- return &extChannel{code, ch}
-}
-
-func (ch *channel) Stderr() io.ReadWriter {
- return ch.Extended(1)
-}
-
-func (ch *channel) SendRequest(name string, wantReply bool, payload []byte) (bool, error) {
- if !ch.decided {
- return false, errUndecided
- }
-
- if wantReply {
- ch.sentRequestMu.Lock()
- defer ch.sentRequestMu.Unlock()
- }
-
- msg := channelRequestMsg{
- PeersID: ch.remoteId,
- Request: name,
- WantReply: wantReply,
- RequestSpecificData: payload,
- }
-
- if err := ch.sendMessage(msg); err != nil {
- return false, err
- }
-
- if wantReply {
- m, ok := (<-ch.msg)
- if !ok {
- return false, io.EOF
- }
- switch m.(type) {
- case *channelRequestFailureMsg:
- return false, nil
- case *channelRequestSuccessMsg:
- return true, nil
- default:
- return false, fmt.Errorf("ssh: unexpected response to channel request: %#v", m)
- }
- }
-
- return false, nil
-}
-
-// ackRequest either sends an ack or nack to the channel request.
-func (ch *channel) ackRequest(ok bool) error {
- if !ch.decided {
- return errUndecided
- }
-
- var msg interface{}
- if !ok {
- msg = channelRequestFailureMsg{
- PeersID: ch.remoteId,
- }
- } else {
- msg = channelRequestSuccessMsg{
- PeersID: ch.remoteId,
- }
- }
- return ch.sendMessage(msg)
-}
-
-func (ch *channel) ChannelType() string {
- return ch.chanType
-}
-
-func (ch *channel) ExtraData() []byte {
- return ch.extraData
-}
diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go
deleted file mode 100644
index 67b01261..00000000
--- a/vendor/golang.org/x/crypto/ssh/cipher.go
+++ /dev/null
@@ -1,770 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto/aes"
- "crypto/cipher"
- "crypto/des"
- "crypto/rc4"
- "crypto/subtle"
- "encoding/binary"
- "errors"
- "fmt"
- "hash"
- "io"
- "io/ioutil"
- "math/bits"
-
- "golang.org/x/crypto/internal/chacha20"
- "golang.org/x/crypto/poly1305"
-)
-
-const (
- packetSizeMultiple = 16 // TODO(huin) this should be determined by the cipher.
-
- // RFC 4253 section 6.1 defines a minimum packet size of 32768 that implementations
- // MUST be able to process (plus a few more kilobytes for padding and mac). The RFC
- // indicates implementations SHOULD be able to handle larger packet sizes, but then
- // waffles on about reasonable limits.
- //
- // OpenSSH caps their maxPacket at 256kB so we choose to do
- // the same. maxPacket is also used to ensure that uint32
- // length fields do not overflow, so it should remain well
- // below 4G.
- maxPacket = 256 * 1024
-)
-
-// noneCipher implements cipher.Stream and provides no encryption. It is used
-// by the transport before the first key-exchange.
-type noneCipher struct{}
-
-func (c noneCipher) XORKeyStream(dst, src []byte) {
- copy(dst, src)
-}
-
-func newAESCTR(key, iv []byte) (cipher.Stream, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
- return cipher.NewCTR(c, iv), nil
-}
-
-func newRC4(key, iv []byte) (cipher.Stream, error) {
- return rc4.NewCipher(key)
-}
-
-type cipherMode struct {
- keySize int
- ivSize int
- create func(key, iv []byte, macKey []byte, algs directionAlgorithms) (packetCipher, error)
-}
-
-func streamCipherMode(skip int, createFunc func(key, iv []byte) (cipher.Stream, error)) func(key, iv []byte, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- return func(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- stream, err := createFunc(key, iv)
- if err != nil {
- return nil, err
- }
-
- var streamDump []byte
- if skip > 0 {
- streamDump = make([]byte, 512)
- }
-
- for remainingToDump := skip; remainingToDump > 0; {
- dumpThisTime := remainingToDump
- if dumpThisTime > len(streamDump) {
- dumpThisTime = len(streamDump)
- }
- stream.XORKeyStream(streamDump[:dumpThisTime], streamDump[:dumpThisTime])
- remainingToDump -= dumpThisTime
- }
-
- mac := macModes[algs.MAC].new(macKey)
- return &streamPacketCipher{
- mac: mac,
- etm: macModes[algs.MAC].etm,
- macResult: make([]byte, mac.Size()),
- cipher: stream,
- }, nil
- }
-}
-
-// cipherModes documents properties of supported ciphers. Ciphers not included
-// are not supported and will not be negotiated, even if explicitly requested in
-// ClientConfig.Crypto.Ciphers.
-var cipherModes = map[string]*cipherMode{
- // Ciphers from RFC4344, which introduced many CTR-based ciphers. Algorithms
- // are defined in the order specified in the RFC.
- "aes128-ctr": {16, aes.BlockSize, streamCipherMode(0, newAESCTR)},
- "aes192-ctr": {24, aes.BlockSize, streamCipherMode(0, newAESCTR)},
- "aes256-ctr": {32, aes.BlockSize, streamCipherMode(0, newAESCTR)},
-
- // Ciphers from RFC4345, which introduces security-improved arcfour ciphers.
- // They are defined in the order specified in the RFC.
- "arcfour128": {16, 0, streamCipherMode(1536, newRC4)},
- "arcfour256": {32, 0, streamCipherMode(1536, newRC4)},
-
- // Cipher defined in RFC 4253, which describes SSH Transport Layer Protocol.
- // Note that this cipher is not safe, as stated in RFC 4253: "Arcfour (and
- // RC4) has problems with weak keys, and should be used with caution."
- // RFC4345 introduces improved versions of Arcfour.
- "arcfour": {16, 0, streamCipherMode(0, newRC4)},
-
- // AEAD ciphers
- gcmCipherID: {16, 12, newGCMCipher},
- chacha20Poly1305ID: {64, 0, newChaCha20Cipher},
-
- // CBC mode is insecure and so is not included in the default config.
- // (See http://www.isg.rhul.ac.uk/~kp/SandPfinal.pdf). If absolutely
- // needed, it's possible to specify a custom Config to enable it.
- // You should expect that an active attacker can recover plaintext if
- // you do.
- aes128cbcID: {16, aes.BlockSize, newAESCBCCipher},
-
- // 3des-cbc is insecure and is not included in the default
- // config.
- tripledescbcID: {24, des.BlockSize, newTripleDESCBCCipher},
-}
-
-// prefixLen is the length of the packet prefix that contains the packet length
-// and number of padding bytes.
-const prefixLen = 5
-
-// streamPacketCipher is a packetCipher using a stream cipher.
-type streamPacketCipher struct {
- mac hash.Hash
- cipher cipher.Stream
- etm bool
-
- // The following members are to avoid per-packet allocations.
- prefix [prefixLen]byte
- seqNumBytes [4]byte
- padding [2 * packetSizeMultiple]byte
- packetData []byte
- macResult []byte
-}
-
-// readPacket reads and decrypt a single packet from the reader argument.
-func (s *streamPacketCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- if _, err := io.ReadFull(r, s.prefix[:]); err != nil {
- return nil, err
- }
-
- var encryptedPaddingLength [1]byte
- if s.mac != nil && s.etm {
- copy(encryptedPaddingLength[:], s.prefix[4:5])
- s.cipher.XORKeyStream(s.prefix[4:5], s.prefix[4:5])
- } else {
- s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
- }
-
- length := binary.BigEndian.Uint32(s.prefix[0:4])
- paddingLength := uint32(s.prefix[4])
-
- var macSize uint32
- if s.mac != nil {
- s.mac.Reset()
- binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
- s.mac.Write(s.seqNumBytes[:])
- if s.etm {
- s.mac.Write(s.prefix[:4])
- s.mac.Write(encryptedPaddingLength[:])
- } else {
- s.mac.Write(s.prefix[:])
- }
- macSize = uint32(s.mac.Size())
- }
-
- if length <= paddingLength+1 {
- return nil, errors.New("ssh: invalid packet length, packet too small")
- }
-
- if length > maxPacket {
- return nil, errors.New("ssh: invalid packet length, packet too large")
- }
-
- // the maxPacket check above ensures that length-1+macSize
- // does not overflow.
- if uint32(cap(s.packetData)) < length-1+macSize {
- s.packetData = make([]byte, length-1+macSize)
- } else {
- s.packetData = s.packetData[:length-1+macSize]
- }
-
- if _, err := io.ReadFull(r, s.packetData); err != nil {
- return nil, err
- }
- mac := s.packetData[length-1:]
- data := s.packetData[:length-1]
-
- if s.mac != nil && s.etm {
- s.mac.Write(data)
- }
-
- s.cipher.XORKeyStream(data, data)
-
- if s.mac != nil {
- if !s.etm {
- s.mac.Write(data)
- }
- s.macResult = s.mac.Sum(s.macResult[:0])
- if subtle.ConstantTimeCompare(s.macResult, mac) != 1 {
- return nil, errors.New("ssh: MAC failure")
- }
- }
-
- return s.packetData[:length-paddingLength-1], nil
-}
-
-// writePacket encrypts and sends a packet of data to the writer argument
-func (s *streamPacketCipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- if len(packet) > maxPacket {
- return errors.New("ssh: packet too large")
- }
-
- aadlen := 0
- if s.mac != nil && s.etm {
- // packet length is not encrypted for EtM modes
- aadlen = 4
- }
-
- paddingLength := packetSizeMultiple - (prefixLen+len(packet)-aadlen)%packetSizeMultiple
- if paddingLength < 4 {
- paddingLength += packetSizeMultiple
- }
-
- length := len(packet) + 1 + paddingLength
- binary.BigEndian.PutUint32(s.prefix[:], uint32(length))
- s.prefix[4] = byte(paddingLength)
- padding := s.padding[:paddingLength]
- if _, err := io.ReadFull(rand, padding); err != nil {
- return err
- }
-
- if s.mac != nil {
- s.mac.Reset()
- binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
- s.mac.Write(s.seqNumBytes[:])
-
- if s.etm {
- // For EtM algorithms, the packet length must stay unencrypted,
- // but the following data (padding length) must be encrypted
- s.cipher.XORKeyStream(s.prefix[4:5], s.prefix[4:5])
- }
-
- s.mac.Write(s.prefix[:])
-
- if !s.etm {
- // For non-EtM algorithms, the algorithm is applied on unencrypted data
- s.mac.Write(packet)
- s.mac.Write(padding)
- }
- }
-
- if !(s.mac != nil && s.etm) {
- // For EtM algorithms, the padding length has already been encrypted
- // and the packet length must remain unencrypted
- s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
- }
-
- s.cipher.XORKeyStream(packet, packet)
- s.cipher.XORKeyStream(padding, padding)
-
- if s.mac != nil && s.etm {
- // For EtM algorithms, packet and padding must be encrypted
- s.mac.Write(packet)
- s.mac.Write(padding)
- }
-
- if _, err := w.Write(s.prefix[:]); err != nil {
- return err
- }
- if _, err := w.Write(packet); err != nil {
- return err
- }
- if _, err := w.Write(padding); err != nil {
- return err
- }
-
- if s.mac != nil {
- s.macResult = s.mac.Sum(s.macResult[:0])
- if _, err := w.Write(s.macResult); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-type gcmCipher struct {
- aead cipher.AEAD
- prefix [4]byte
- iv []byte
- buf []byte
-}
-
-func newGCMCipher(key, iv, unusedMacKey []byte, unusedAlgs directionAlgorithms) (packetCipher, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
-
- aead, err := cipher.NewGCM(c)
- if err != nil {
- return nil, err
- }
-
- return &gcmCipher{
- aead: aead,
- iv: iv,
- }, nil
-}
-
-const gcmTagSize = 16
-
-func (c *gcmCipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- // Pad out to multiple of 16 bytes. This is different from the
- // stream cipher because that encrypts the length too.
- padding := byte(packetSizeMultiple - (1+len(packet))%packetSizeMultiple)
- if padding < 4 {
- padding += packetSizeMultiple
- }
-
- length := uint32(len(packet) + int(padding) + 1)
- binary.BigEndian.PutUint32(c.prefix[:], length)
- if _, err := w.Write(c.prefix[:]); err != nil {
- return err
- }
-
- if cap(c.buf) < int(length) {
- c.buf = make([]byte, length)
- } else {
- c.buf = c.buf[:length]
- }
-
- c.buf[0] = padding
- copy(c.buf[1:], packet)
- if _, err := io.ReadFull(rand, c.buf[1+len(packet):]); err != nil {
- return err
- }
- c.buf = c.aead.Seal(c.buf[:0], c.iv, c.buf, c.prefix[:])
- if _, err := w.Write(c.buf); err != nil {
- return err
- }
- c.incIV()
-
- return nil
-}
-
-func (c *gcmCipher) incIV() {
- for i := 4 + 7; i >= 4; i-- {
- c.iv[i]++
- if c.iv[i] != 0 {
- break
- }
- }
-}
-
-func (c *gcmCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- if _, err := io.ReadFull(r, c.prefix[:]); err != nil {
- return nil, err
- }
- length := binary.BigEndian.Uint32(c.prefix[:])
- if length > maxPacket {
- return nil, errors.New("ssh: max packet length exceeded")
- }
-
- if cap(c.buf) < int(length+gcmTagSize) {
- c.buf = make([]byte, length+gcmTagSize)
- } else {
- c.buf = c.buf[:length+gcmTagSize]
- }
-
- if _, err := io.ReadFull(r, c.buf); err != nil {
- return nil, err
- }
-
- plain, err := c.aead.Open(c.buf[:0], c.iv, c.buf, c.prefix[:])
- if err != nil {
- return nil, err
- }
- c.incIV()
-
- padding := plain[0]
- if padding < 4 {
- // padding is a byte, so it automatically satisfies
- // the maximum size, which is 255.
- return nil, fmt.Errorf("ssh: illegal padding %d", padding)
- }
-
- if int(padding+1) >= len(plain) {
- return nil, fmt.Errorf("ssh: padding %d too large", padding)
- }
- plain = plain[1 : length-uint32(padding)]
- return plain, nil
-}
-
-// cbcCipher implements aes128-cbc cipher defined in RFC 4253 section 6.1
-type cbcCipher struct {
- mac hash.Hash
- macSize uint32
- decrypter cipher.BlockMode
- encrypter cipher.BlockMode
-
- // The following members are to avoid per-packet allocations.
- seqNumBytes [4]byte
- packetData []byte
- macResult []byte
-
- // Amount of data we should still read to hide which
- // verification error triggered.
- oracleCamouflage uint32
-}
-
-func newCBCCipher(c cipher.Block, key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- cbc := &cbcCipher{
- mac: macModes[algs.MAC].new(macKey),
- decrypter: cipher.NewCBCDecrypter(c, iv),
- encrypter: cipher.NewCBCEncrypter(c, iv),
- packetData: make([]byte, 1024),
- }
- if cbc.mac != nil {
- cbc.macSize = uint32(cbc.mac.Size())
- }
-
- return cbc, nil
-}
-
-func newAESCBCCipher(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
-
- cbc, err := newCBCCipher(c, key, iv, macKey, algs)
- if err != nil {
- return nil, err
- }
-
- return cbc, nil
-}
-
-func newTripleDESCBCCipher(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- c, err := des.NewTripleDESCipher(key)
- if err != nil {
- return nil, err
- }
-
- cbc, err := newCBCCipher(c, key, iv, macKey, algs)
- if err != nil {
- return nil, err
- }
-
- return cbc, nil
-}
-
-func maxUInt32(a, b int) uint32 {
- if a > b {
- return uint32(a)
- }
- return uint32(b)
-}
-
-const (
- cbcMinPacketSizeMultiple = 8
- cbcMinPacketSize = 16
- cbcMinPaddingSize = 4
-)
-
-// cbcError represents a verification error that may leak information.
-type cbcError string
-
-func (e cbcError) Error() string { return string(e) }
-
-func (c *cbcCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- p, err := c.readPacketLeaky(seqNum, r)
- if err != nil {
- if _, ok := err.(cbcError); ok {
- // Verification error: read a fixed amount of
- // data, to make distinguishing between
- // failing MAC and failing length check more
- // difficult.
- io.CopyN(ioutil.Discard, r, int64(c.oracleCamouflage))
- }
- }
- return p, err
-}
-
-func (c *cbcCipher) readPacketLeaky(seqNum uint32, r io.Reader) ([]byte, error) {
- blockSize := c.decrypter.BlockSize()
-
- // Read the header, which will include some of the subsequent data in the
- // case of block ciphers - this is copied back to the payload later.
- // How many bytes of payload/padding will be read with this first read.
- firstBlockLength := uint32((prefixLen + blockSize - 1) / blockSize * blockSize)
- firstBlock := c.packetData[:firstBlockLength]
- if _, err := io.ReadFull(r, firstBlock); err != nil {
- return nil, err
- }
-
- c.oracleCamouflage = maxPacket + 4 + c.macSize - firstBlockLength
-
- c.decrypter.CryptBlocks(firstBlock, firstBlock)
- length := binary.BigEndian.Uint32(firstBlock[:4])
- if length > maxPacket {
- return nil, cbcError("ssh: packet too large")
- }
- if length+4 < maxUInt32(cbcMinPacketSize, blockSize) {
- // The minimum size of a packet is 16 (or the cipher block size, whichever
- // is larger) bytes.
- return nil, cbcError("ssh: packet too small")
- }
- // The length of the packet (including the length field but not the MAC) must
- // be a multiple of the block size or 8, whichever is larger.
- if (length+4)%maxUInt32(cbcMinPacketSizeMultiple, blockSize) != 0 {
- return nil, cbcError("ssh: invalid packet length multiple")
- }
-
- paddingLength := uint32(firstBlock[4])
- if paddingLength < cbcMinPaddingSize || length <= paddingLength+1 {
- return nil, cbcError("ssh: invalid packet length")
- }
-
- // Positions within the c.packetData buffer:
- macStart := 4 + length
- paddingStart := macStart - paddingLength
-
- // Entire packet size, starting before length, ending at end of mac.
- entirePacketSize := macStart + c.macSize
-
- // Ensure c.packetData is large enough for the entire packet data.
- if uint32(cap(c.packetData)) < entirePacketSize {
- // Still need to upsize and copy, but this should be rare at runtime, only
- // on upsizing the packetData buffer.
- c.packetData = make([]byte, entirePacketSize)
- copy(c.packetData, firstBlock)
- } else {
- c.packetData = c.packetData[:entirePacketSize]
- }
-
- n, err := io.ReadFull(r, c.packetData[firstBlockLength:])
- if err != nil {
- return nil, err
- }
- c.oracleCamouflage -= uint32(n)
-
- remainingCrypted := c.packetData[firstBlockLength:macStart]
- c.decrypter.CryptBlocks(remainingCrypted, remainingCrypted)
-
- mac := c.packetData[macStart:]
- if c.mac != nil {
- c.mac.Reset()
- binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum)
- c.mac.Write(c.seqNumBytes[:])
- c.mac.Write(c.packetData[:macStart])
- c.macResult = c.mac.Sum(c.macResult[:0])
- if subtle.ConstantTimeCompare(c.macResult, mac) != 1 {
- return nil, cbcError("ssh: MAC failure")
- }
- }
-
- return c.packetData[prefixLen:paddingStart], nil
-}
-
-func (c *cbcCipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- effectiveBlockSize := maxUInt32(cbcMinPacketSizeMultiple, c.encrypter.BlockSize())
-
- // Length of encrypted portion of the packet (header, payload, padding).
- // Enforce minimum padding and packet size.
- encLength := maxUInt32(prefixLen+len(packet)+cbcMinPaddingSize, cbcMinPaddingSize)
- // Enforce block size.
- encLength = (encLength + effectiveBlockSize - 1) / effectiveBlockSize * effectiveBlockSize
-
- length := encLength - 4
- paddingLength := int(length) - (1 + len(packet))
-
- // Overall buffer contains: header, payload, padding, mac.
- // Space for the MAC is reserved in the capacity but not the slice length.
- bufferSize := encLength + c.macSize
- if uint32(cap(c.packetData)) < bufferSize {
- c.packetData = make([]byte, encLength, bufferSize)
- } else {
- c.packetData = c.packetData[:encLength]
- }
-
- p := c.packetData
-
- // Packet header.
- binary.BigEndian.PutUint32(p, length)
- p = p[4:]
- p[0] = byte(paddingLength)
-
- // Payload.
- p = p[1:]
- copy(p, packet)
-
- // Padding.
- p = p[len(packet):]
- if _, err := io.ReadFull(rand, p); err != nil {
- return err
- }
-
- if c.mac != nil {
- c.mac.Reset()
- binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum)
- c.mac.Write(c.seqNumBytes[:])
- c.mac.Write(c.packetData)
- // The MAC is now appended into the capacity reserved for it earlier.
- c.packetData = c.mac.Sum(c.packetData)
- }
-
- c.encrypter.CryptBlocks(c.packetData[:encLength], c.packetData[:encLength])
-
- if _, err := w.Write(c.packetData); err != nil {
- return err
- }
-
- return nil
-}
-
-const chacha20Poly1305ID = "chacha20-poly1305@openssh.com"
-
-// chacha20Poly1305Cipher implements the chacha20-poly1305@openssh.com
-// AEAD, which is described here:
-//
-// https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00
-//
-// the methods here also implement padding, which RFC4253 Section 6
-// also requires of stream ciphers.
-type chacha20Poly1305Cipher struct {
- lengthKey [8]uint32
- contentKey [8]uint32
- buf []byte
-}
-
-func newChaCha20Cipher(key, unusedIV, unusedMACKey []byte, unusedAlgs directionAlgorithms) (packetCipher, error) {
- if len(key) != 64 {
- panic(len(key))
- }
-
- c := &chacha20Poly1305Cipher{
- buf: make([]byte, 256),
- }
-
- for i := range c.contentKey {
- c.contentKey[i] = binary.LittleEndian.Uint32(key[i*4 : (i+1)*4])
- }
- for i := range c.lengthKey {
- c.lengthKey[i] = binary.LittleEndian.Uint32(key[(i+8)*4 : (i+9)*4])
- }
- return c, nil
-}
-
-func (c *chacha20Poly1305Cipher) readPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- nonce := [3]uint32{0, 0, bits.ReverseBytes32(seqNum)}
- s := chacha20.New(c.contentKey, nonce)
- var polyKey [32]byte
- s.XORKeyStream(polyKey[:], polyKey[:])
- s.Advance() // skip next 32 bytes
-
- encryptedLength := c.buf[:4]
- if _, err := io.ReadFull(r, encryptedLength); err != nil {
- return nil, err
- }
-
- var lenBytes [4]byte
- chacha20.New(c.lengthKey, nonce).XORKeyStream(lenBytes[:], encryptedLength)
-
- length := binary.BigEndian.Uint32(lenBytes[:])
- if length > maxPacket {
- return nil, errors.New("ssh: invalid packet length, packet too large")
- }
-
- contentEnd := 4 + length
- packetEnd := contentEnd + poly1305.TagSize
- if uint32(cap(c.buf)) < packetEnd {
- c.buf = make([]byte, packetEnd)
- copy(c.buf[:], encryptedLength)
- } else {
- c.buf = c.buf[:packetEnd]
- }
-
- if _, err := io.ReadFull(r, c.buf[4:packetEnd]); err != nil {
- return nil, err
- }
-
- var mac [poly1305.TagSize]byte
- copy(mac[:], c.buf[contentEnd:packetEnd])
- if !poly1305.Verify(&mac, c.buf[:contentEnd], &polyKey) {
- return nil, errors.New("ssh: MAC failure")
- }
-
- plain := c.buf[4:contentEnd]
- s.XORKeyStream(plain, plain)
-
- padding := plain[0]
- if padding < 4 {
- // padding is a byte, so it automatically satisfies
- // the maximum size, which is 255.
- return nil, fmt.Errorf("ssh: illegal padding %d", padding)
- }
-
- if int(padding)+1 >= len(plain) {
- return nil, fmt.Errorf("ssh: padding %d too large", padding)
- }
-
- plain = plain[1 : len(plain)-int(padding)]
-
- return plain, nil
-}
-
-func (c *chacha20Poly1305Cipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, payload []byte) error {
- nonce := [3]uint32{0, 0, bits.ReverseBytes32(seqNum)}
- s := chacha20.New(c.contentKey, nonce)
- var polyKey [32]byte
- s.XORKeyStream(polyKey[:], polyKey[:])
- s.Advance() // skip next 32 bytes
-
- // There is no blocksize, so fall back to multiple of 8 byte
- // padding, as described in RFC 4253, Sec 6.
- const packetSizeMultiple = 8
-
- padding := packetSizeMultiple - (1+len(payload))%packetSizeMultiple
- if padding < 4 {
- padding += packetSizeMultiple
- }
-
- // size (4 bytes), padding (1), payload, padding, tag.
- totalLength := 4 + 1 + len(payload) + padding + poly1305.TagSize
- if cap(c.buf) < totalLength {
- c.buf = make([]byte, totalLength)
- } else {
- c.buf = c.buf[:totalLength]
- }
-
- binary.BigEndian.PutUint32(c.buf, uint32(1+len(payload)+padding))
- chacha20.New(c.lengthKey, nonce).XORKeyStream(c.buf, c.buf[:4])
- c.buf[4] = byte(padding)
- copy(c.buf[5:], payload)
- packetEnd := 5 + len(payload) + padding
- if _, err := io.ReadFull(rand, c.buf[5+len(payload):packetEnd]); err != nil {
- return err
- }
-
- s.XORKeyStream(c.buf[4:], c.buf[4:packetEnd])
-
- var mac [poly1305.TagSize]byte
- poly1305.Sum(&mac, c.buf[:packetEnd], &polyKey)
-
- copy(c.buf[packetEnd:], mac[:])
-
- if _, err := w.Write(c.buf); err != nil {
- return err
- }
- return nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/client.go b/vendor/golang.org/x/crypto/ssh/client.go
deleted file mode 100644
index ae6ca775..00000000
--- a/vendor/golang.org/x/crypto/ssh/client.go
+++ /dev/null
@@ -1,278 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "net"
- "os"
- "sync"
- "time"
-)
-
-// Client implements a traditional SSH client that supports shells,
-// subprocesses, TCP port/streamlocal forwarding and tunneled dialing.
-type Client struct {
- Conn
-
- handleForwardsOnce sync.Once // guards calling (*Client).handleForwards
-
- forwards forwardList // forwarded tcpip connections from the remote side
- mu sync.Mutex
- channelHandlers map[string]chan NewChannel
-}
-
-// HandleChannelOpen returns a channel on which NewChannel requests
-// for the given type are sent. If the type already is being handled,
-// nil is returned. The channel is closed when the connection is closed.
-func (c *Client) HandleChannelOpen(channelType string) <-chan NewChannel {
- c.mu.Lock()
- defer c.mu.Unlock()
- if c.channelHandlers == nil {
- // The SSH channel has been closed.
- c := make(chan NewChannel)
- close(c)
- return c
- }
-
- ch := c.channelHandlers[channelType]
- if ch != nil {
- return nil
- }
-
- ch = make(chan NewChannel, chanSize)
- c.channelHandlers[channelType] = ch
- return ch
-}
-
-// NewClient creates a Client on top of the given connection.
-func NewClient(c Conn, chans <-chan NewChannel, reqs <-chan *Request) *Client {
- conn := &Client{
- Conn: c,
- channelHandlers: make(map[string]chan NewChannel, 1),
- }
-
- go conn.handleGlobalRequests(reqs)
- go conn.handleChannelOpens(chans)
- go func() {
- conn.Wait()
- conn.forwards.closeAll()
- }()
- return conn
-}
-
-// NewClientConn establishes an authenticated SSH connection using c
-// as the underlying transport. The Request and NewChannel channels
-// must be serviced or the connection will hang.
-func NewClientConn(c net.Conn, addr string, config *ClientConfig) (Conn, <-chan NewChannel, <-chan *Request, error) {
- fullConf := *config
- fullConf.SetDefaults()
- if fullConf.HostKeyCallback == nil {
- c.Close()
- return nil, nil, nil, errors.New("ssh: must specify HostKeyCallback")
- }
-
- conn := &connection{
- sshConn: sshConn{conn: c},
- }
-
- if err := conn.clientHandshake(addr, &fullConf); err != nil {
- c.Close()
- return nil, nil, nil, fmt.Errorf("ssh: handshake failed: %v", err)
- }
- conn.mux = newMux(conn.transport)
- return conn, conn.mux.incomingChannels, conn.mux.incomingRequests, nil
-}
-
-// clientHandshake performs the client side key exchange. See RFC 4253 Section
-// 7.
-func (c *connection) clientHandshake(dialAddress string, config *ClientConfig) error {
- if config.ClientVersion != "" {
- c.clientVersion = []byte(config.ClientVersion)
- } else {
- c.clientVersion = []byte(packageVersion)
- }
- var err error
- c.serverVersion, err = exchangeVersions(c.sshConn.conn, c.clientVersion)
- if err != nil {
- return err
- }
-
- c.transport = newClientTransport(
- newTransport(c.sshConn.conn, config.Rand, true /* is client */),
- c.clientVersion, c.serverVersion, config, dialAddress, c.sshConn.RemoteAddr())
- if err := c.transport.waitSession(); err != nil {
- return err
- }
-
- c.sessionID = c.transport.getSessionID()
- return c.clientAuthenticate(config)
-}
-
-// verifyHostKeySignature verifies the host key obtained in the key
-// exchange.
-func verifyHostKeySignature(hostKey PublicKey, result *kexResult) error {
- sig, rest, ok := parseSignatureBody(result.Signature)
- if len(rest) > 0 || !ok {
- return errors.New("ssh: signature parse error")
- }
-
- return hostKey.Verify(result.H, sig)
-}
-
-// NewSession opens a new Session for this client. (A session is a remote
-// execution of a program.)
-func (c *Client) NewSession() (*Session, error) {
- ch, in, err := c.OpenChannel("session", nil)
- if err != nil {
- return nil, err
- }
- return newSession(ch, in)
-}
-
-func (c *Client) handleGlobalRequests(incoming <-chan *Request) {
- for r := range incoming {
- // This handles keepalive messages and matches
- // the behaviour of OpenSSH.
- r.Reply(false, nil)
- }
-}
-
-// handleChannelOpens channel open messages from the remote side.
-func (c *Client) handleChannelOpens(in <-chan NewChannel) {
- for ch := range in {
- c.mu.Lock()
- handler := c.channelHandlers[ch.ChannelType()]
- c.mu.Unlock()
-
- if handler != nil {
- handler <- ch
- } else {
- ch.Reject(UnknownChannelType, fmt.Sprintf("unknown channel type: %v", ch.ChannelType()))
- }
- }
-
- c.mu.Lock()
- for _, ch := range c.channelHandlers {
- close(ch)
- }
- c.channelHandlers = nil
- c.mu.Unlock()
-}
-
-// Dial starts a client connection to the given SSH server. It is a
-// convenience function that connects to the given network address,
-// initiates the SSH handshake, and then sets up a Client. For access
-// to incoming channels and requests, use net.Dial with NewClientConn
-// instead.
-func Dial(network, addr string, config *ClientConfig) (*Client, error) {
- conn, err := net.DialTimeout(network, addr, config.Timeout)
- if err != nil {
- return nil, err
- }
- c, chans, reqs, err := NewClientConn(conn, addr, config)
- if err != nil {
- return nil, err
- }
- return NewClient(c, chans, reqs), nil
-}
-
-// HostKeyCallback is the function type used for verifying server
-// keys. A HostKeyCallback must return nil if the host key is OK, or
-// an error to reject it. It receives the hostname as passed to Dial
-// or NewClientConn. The remote address is the RemoteAddr of the
-// net.Conn underlying the the SSH connection.
-type HostKeyCallback func(hostname string, remote net.Addr, key PublicKey) error
-
-// BannerCallback is the function type used for treat the banner sent by
-// the server. A BannerCallback receives the message sent by the remote server.
-type BannerCallback func(message string) error
-
-// A ClientConfig structure is used to configure a Client. It must not be
-// modified after having been passed to an SSH function.
-type ClientConfig struct {
- // Config contains configuration that is shared between clients and
- // servers.
- Config
-
- // User contains the username to authenticate as.
- User string
-
- // Auth contains possible authentication methods to use with the
- // server. Only the first instance of a particular RFC 4252 method will
- // be used during authentication.
- Auth []AuthMethod
-
- // HostKeyCallback is called during the cryptographic
- // handshake to validate the server's host key. The client
- // configuration must supply this callback for the connection
- // to succeed. The functions InsecureIgnoreHostKey or
- // FixedHostKey can be used for simplistic host key checks.
- HostKeyCallback HostKeyCallback
-
- // BannerCallback is called during the SSH dance to display a custom
- // server's message. The client configuration can supply this callback to
- // handle it as wished. The function BannerDisplayStderr can be used for
- // simplistic display on Stderr.
- BannerCallback BannerCallback
-
- // ClientVersion contains the version identification string that will
- // be used for the connection. If empty, a reasonable default is used.
- ClientVersion string
-
- // HostKeyAlgorithms lists the key types that the client will
- // accept from the server as host key, in order of
- // preference. If empty, a reasonable default is used. Any
- // string returned from PublicKey.Type method may be used, or
- // any of the CertAlgoXxxx and KeyAlgoXxxx constants.
- HostKeyAlgorithms []string
-
- // Timeout is the maximum amount of time for the TCP connection to establish.
- //
- // A Timeout of zero means no timeout.
- Timeout time.Duration
-}
-
-// InsecureIgnoreHostKey returns a function that can be used for
-// ClientConfig.HostKeyCallback to accept any host key. It should
-// not be used for production code.
-func InsecureIgnoreHostKey() HostKeyCallback {
- return func(hostname string, remote net.Addr, key PublicKey) error {
- return nil
- }
-}
-
-type fixedHostKey struct {
- key PublicKey
-}
-
-func (f *fixedHostKey) check(hostname string, remote net.Addr, key PublicKey) error {
- if f.key == nil {
- return fmt.Errorf("ssh: required host key was nil")
- }
- if !bytes.Equal(key.Marshal(), f.key.Marshal()) {
- return fmt.Errorf("ssh: host key mismatch")
- }
- return nil
-}
-
-// FixedHostKey returns a function for use in
-// ClientConfig.HostKeyCallback to accept only a specific host key.
-func FixedHostKey(key PublicKey) HostKeyCallback {
- hk := &fixedHostKey{key}
- return hk.check
-}
-
-// BannerDisplayStderr returns a function that can be used for
-// ClientConfig.BannerCallback to display banners on os.Stderr.
-func BannerDisplayStderr() BannerCallback {
- return func(banner string) error {
- _, err := os.Stderr.WriteString(banner)
-
- return err
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go
deleted file mode 100644
index 5f44b774..00000000
--- a/vendor/golang.org/x/crypto/ssh/client_auth.go
+++ /dev/null
@@ -1,525 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
-)
-
-type authResult int
-
-const (
- authFailure authResult = iota
- authPartialSuccess
- authSuccess
-)
-
-// clientAuthenticate authenticates with the remote server. See RFC 4252.
-func (c *connection) clientAuthenticate(config *ClientConfig) error {
- // initiate user auth session
- if err := c.transport.writePacket(Marshal(&serviceRequestMsg{serviceUserAuth})); err != nil {
- return err
- }
- packet, err := c.transport.readPacket()
- if err != nil {
- return err
- }
- var serviceAccept serviceAcceptMsg
- if err := Unmarshal(packet, &serviceAccept); err != nil {
- return err
- }
-
- // during the authentication phase the client first attempts the "none" method
- // then any untried methods suggested by the server.
- tried := make(map[string]bool)
- var lastMethods []string
-
- sessionID := c.transport.getSessionID()
- for auth := AuthMethod(new(noneAuth)); auth != nil; {
- ok, methods, err := auth.auth(sessionID, config.User, c.transport, config.Rand)
- if err != nil {
- return err
- }
- if ok == authSuccess {
- // success
- return nil
- } else if ok == authFailure {
- tried[auth.method()] = true
- }
- if methods == nil {
- methods = lastMethods
- }
- lastMethods = methods
-
- auth = nil
-
- findNext:
- for _, a := range config.Auth {
- candidateMethod := a.method()
- if tried[candidateMethod] {
- continue
- }
- for _, meth := range methods {
- if meth == candidateMethod {
- auth = a
- break findNext
- }
- }
- }
- }
- return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", keys(tried))
-}
-
-func keys(m map[string]bool) []string {
- s := make([]string, 0, len(m))
-
- for key := range m {
- s = append(s, key)
- }
- return s
-}
-
-// An AuthMethod represents an instance of an RFC 4252 authentication method.
-type AuthMethod interface {
- // auth authenticates user over transport t.
- // Returns true if authentication is successful.
- // If authentication is not successful, a []string of alternative
- // method names is returned. If the slice is nil, it will be ignored
- // and the previous set of possible methods will be reused.
- auth(session []byte, user string, p packetConn, rand io.Reader) (authResult, []string, error)
-
- // method returns the RFC 4252 method name.
- method() string
-}
-
-// "none" authentication, RFC 4252 section 5.2.
-type noneAuth int
-
-func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
- if err := c.writePacket(Marshal(&userAuthRequestMsg{
- User: user,
- Service: serviceSSH,
- Method: "none",
- })); err != nil {
- return authFailure, nil, err
- }
-
- return handleAuthResponse(c)
-}
-
-func (n *noneAuth) method() string {
- return "none"
-}
-
-// passwordCallback is an AuthMethod that fetches the password through
-// a function call, e.g. by prompting the user.
-type passwordCallback func() (password string, err error)
-
-func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
- type passwordAuthMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Reply bool
- Password string
- }
-
- pw, err := cb()
- // REVIEW NOTE: is there a need to support skipping a password attempt?
- // The program may only find out that the user doesn't have a password
- // when prompting.
- if err != nil {
- return authFailure, nil, err
- }
-
- if err := c.writePacket(Marshal(&passwordAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- Reply: false,
- Password: pw,
- })); err != nil {
- return authFailure, nil, err
- }
-
- return handleAuthResponse(c)
-}
-
-func (cb passwordCallback) method() string {
- return "password"
-}
-
-// Password returns an AuthMethod using the given password.
-func Password(secret string) AuthMethod {
- return passwordCallback(func() (string, error) { return secret, nil })
-}
-
-// PasswordCallback returns an AuthMethod that uses a callback for
-// fetching a password.
-func PasswordCallback(prompt func() (secret string, err error)) AuthMethod {
- return passwordCallback(prompt)
-}
-
-type publickeyAuthMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- // HasSig indicates to the receiver packet that the auth request is signed and
- // should be used for authentication of the request.
- HasSig bool
- Algoname string
- PubKey []byte
- // Sig is tagged with "rest" so Marshal will exclude it during
- // validateKey
- Sig []byte `ssh:"rest"`
-}
-
-// publicKeyCallback is an AuthMethod that uses a set of key
-// pairs for authentication.
-type publicKeyCallback func() ([]Signer, error)
-
-func (cb publicKeyCallback) method() string {
- return "publickey"
-}
-
-func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
- // Authentication is performed by sending an enquiry to test if a key is
- // acceptable to the remote. If the key is acceptable, the client will
- // attempt to authenticate with the valid key. If not the client will repeat
- // the process with the remaining keys.
-
- signers, err := cb()
- if err != nil {
- return authFailure, nil, err
- }
- var methods []string
- for _, signer := range signers {
- ok, err := validateKey(signer.PublicKey(), user, c)
- if err != nil {
- return authFailure, nil, err
- }
- if !ok {
- continue
- }
-
- pub := signer.PublicKey()
- pubKey := pub.Marshal()
- sign, err := signer.Sign(rand, buildDataSignedForAuth(session, userAuthRequestMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- }, []byte(pub.Type()), pubKey))
- if err != nil {
- return authFailure, nil, err
- }
-
- // manually wrap the serialized signature in a string
- s := Marshal(sign)
- sig := make([]byte, stringLength(len(s)))
- marshalString(sig, s)
- msg := publickeyAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- HasSig: true,
- Algoname: pub.Type(),
- PubKey: pubKey,
- Sig: sig,
- }
- p := Marshal(&msg)
- if err := c.writePacket(p); err != nil {
- return authFailure, nil, err
- }
- var success authResult
- success, methods, err = handleAuthResponse(c)
- if err != nil {
- return authFailure, nil, err
- }
-
- // If authentication succeeds or the list of available methods does not
- // contain the "publickey" method, do not attempt to authenticate with any
- // other keys. According to RFC 4252 Section 7, the latter can occur when
- // additional authentication methods are required.
- if success == authSuccess || !containsMethod(methods, cb.method()) {
- return success, methods, err
- }
- }
-
- return authFailure, methods, nil
-}
-
-func containsMethod(methods []string, method string) bool {
- for _, m := range methods {
- if m == method {
- return true
- }
- }
-
- return false
-}
-
-// validateKey validates the key provided is acceptable to the server.
-func validateKey(key PublicKey, user string, c packetConn) (bool, error) {
- pubKey := key.Marshal()
- msg := publickeyAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: "publickey",
- HasSig: false,
- Algoname: key.Type(),
- PubKey: pubKey,
- }
- if err := c.writePacket(Marshal(&msg)); err != nil {
- return false, err
- }
-
- return confirmKeyAck(key, c)
-}
-
-func confirmKeyAck(key PublicKey, c packetConn) (bool, error) {
- pubKey := key.Marshal()
- algoname := key.Type()
-
- for {
- packet, err := c.readPacket()
- if err != nil {
- return false, err
- }
- switch packet[0] {
- case msgUserAuthBanner:
- if err := handleBannerResponse(c, packet); err != nil {
- return false, err
- }
- case msgUserAuthPubKeyOk:
- var msg userAuthPubKeyOkMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return false, err
- }
- if msg.Algo != algoname || !bytes.Equal(msg.PubKey, pubKey) {
- return false, nil
- }
- return true, nil
- case msgUserAuthFailure:
- return false, nil
- default:
- return false, unexpectedMessageError(msgUserAuthSuccess, packet[0])
- }
- }
-}
-
-// PublicKeys returns an AuthMethod that uses the given key
-// pairs.
-func PublicKeys(signers ...Signer) AuthMethod {
- return publicKeyCallback(func() ([]Signer, error) { return signers, nil })
-}
-
-// PublicKeysCallback returns an AuthMethod that runs the given
-// function to obtain a list of key pairs.
-func PublicKeysCallback(getSigners func() (signers []Signer, err error)) AuthMethod {
- return publicKeyCallback(getSigners)
-}
-
-// handleAuthResponse returns whether the preceding authentication request succeeded
-// along with a list of remaining authentication methods to try next and
-// an error if an unexpected response was received.
-func handleAuthResponse(c packetConn) (authResult, []string, error) {
- for {
- packet, err := c.readPacket()
- if err != nil {
- return authFailure, nil, err
- }
-
- switch packet[0] {
- case msgUserAuthBanner:
- if err := handleBannerResponse(c, packet); err != nil {
- return authFailure, nil, err
- }
- case msgUserAuthFailure:
- var msg userAuthFailureMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return authFailure, nil, err
- }
- if msg.PartialSuccess {
- return authPartialSuccess, msg.Methods, nil
- }
- return authFailure, msg.Methods, nil
- case msgUserAuthSuccess:
- return authSuccess, nil, nil
- default:
- return authFailure, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0])
- }
- }
-}
-
-func handleBannerResponse(c packetConn, packet []byte) error {
- var msg userAuthBannerMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return err
- }
-
- transport, ok := c.(*handshakeTransport)
- if !ok {
- return nil
- }
-
- if transport.bannerCallback != nil {
- return transport.bannerCallback(msg.Message)
- }
-
- return nil
-}
-
-// KeyboardInteractiveChallenge should print questions, optionally
-// disabling echoing (e.g. for passwords), and return all the answers.
-// Challenge may be called multiple times in a single session. After
-// successful authentication, the server may send a challenge with no
-// questions, for which the user and instruction messages should be
-// printed. RFC 4256 section 3.3 details how the UI should behave for
-// both CLI and GUI environments.
-type KeyboardInteractiveChallenge func(user, instruction string, questions []string, echos []bool) (answers []string, err error)
-
-// KeyboardInteractive returns an AuthMethod using a prompt/response
-// sequence controlled by the server.
-func KeyboardInteractive(challenge KeyboardInteractiveChallenge) AuthMethod {
- return challenge
-}
-
-func (cb KeyboardInteractiveChallenge) method() string {
- return "keyboard-interactive"
-}
-
-func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
- type initiateMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Language string
- Submethods string
- }
-
- if err := c.writePacket(Marshal(&initiateMsg{
- User: user,
- Service: serviceSSH,
- Method: "keyboard-interactive",
- })); err != nil {
- return authFailure, nil, err
- }
-
- for {
- packet, err := c.readPacket()
- if err != nil {
- return authFailure, nil, err
- }
-
- // like handleAuthResponse, but with less options.
- switch packet[0] {
- case msgUserAuthBanner:
- if err := handleBannerResponse(c, packet); err != nil {
- return authFailure, nil, err
- }
- continue
- case msgUserAuthInfoRequest:
- // OK
- case msgUserAuthFailure:
- var msg userAuthFailureMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return authFailure, nil, err
- }
- if msg.PartialSuccess {
- return authPartialSuccess, msg.Methods, nil
- }
- return authFailure, msg.Methods, nil
- case msgUserAuthSuccess:
- return authSuccess, nil, nil
- default:
- return authFailure, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
- }
-
- var msg userAuthInfoRequestMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return authFailure, nil, err
- }
-
- // Manually unpack the prompt/echo pairs.
- rest := msg.Prompts
- var prompts []string
- var echos []bool
- for i := 0; i < int(msg.NumPrompts); i++ {
- prompt, r, ok := parseString(rest)
- if !ok || len(r) == 0 {
- return authFailure, nil, errors.New("ssh: prompt format error")
- }
- prompts = append(prompts, string(prompt))
- echos = append(echos, r[0] != 0)
- rest = r[1:]
- }
-
- if len(rest) != 0 {
- return authFailure, nil, errors.New("ssh: extra data following keyboard-interactive pairs")
- }
-
- answers, err := cb(msg.User, msg.Instruction, prompts, echos)
- if err != nil {
- return authFailure, nil, err
- }
-
- if len(answers) != len(prompts) {
- return authFailure, nil, errors.New("ssh: not enough answers from keyboard-interactive callback")
- }
- responseLength := 1 + 4
- for _, a := range answers {
- responseLength += stringLength(len(a))
- }
- serialized := make([]byte, responseLength)
- p := serialized
- p[0] = msgUserAuthInfoResponse
- p = p[1:]
- p = marshalUint32(p, uint32(len(answers)))
- for _, a := range answers {
- p = marshalString(p, []byte(a))
- }
-
- if err := c.writePacket(serialized); err != nil {
- return authFailure, nil, err
- }
- }
-}
-
-type retryableAuthMethod struct {
- authMethod AuthMethod
- maxTries int
-}
-
-func (r *retryableAuthMethod) auth(session []byte, user string, c packetConn, rand io.Reader) (ok authResult, methods []string, err error) {
- for i := 0; r.maxTries <= 0 || i < r.maxTries; i++ {
- ok, methods, err = r.authMethod.auth(session, user, c, rand)
- if ok != authFailure || err != nil { // either success, partial success or error terminate
- return ok, methods, err
- }
- }
- return ok, methods, err
-}
-
-func (r *retryableAuthMethod) method() string {
- return r.authMethod.method()
-}
-
-// RetryableAuthMethod is a decorator for other auth methods enabling them to
-// be retried up to maxTries before considering that AuthMethod itself failed.
-// If maxTries is <= 0, will retry indefinitely
-//
-// This is useful for interactive clients using challenge/response type
-// authentication (e.g. Keyboard-Interactive, Password, etc) where the user
-// could mistype their response resulting in the server issuing a
-// SSH_MSG_USERAUTH_FAILURE (rfc4252 #8 [password] and rfc4256 #3.4
-// [keyboard-interactive]); Without this decorator, the non-retryable
-// AuthMethod would be removed from future consideration, and never tried again
-// (and so the user would never be able to retry their entry).
-func RetryableAuthMethod(auth AuthMethod, maxTries int) AuthMethod {
- return &retryableAuthMethod{authMethod: auth, maxTries: maxTries}
-}
diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go
deleted file mode 100644
index 04f3620b..00000000
--- a/vendor/golang.org/x/crypto/ssh/common.go
+++ /dev/null
@@ -1,383 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto"
- "crypto/rand"
- "fmt"
- "io"
- "math"
- "sync"
-
- _ "crypto/sha1"
- _ "crypto/sha256"
- _ "crypto/sha512"
-)
-
-// These are string constants in the SSH protocol.
-const (
- compressionNone = "none"
- serviceUserAuth = "ssh-userauth"
- serviceSSH = "ssh-connection"
-)
-
-// supportedCiphers lists ciphers we support but might not recommend.
-var supportedCiphers = []string{
- "aes128-ctr", "aes192-ctr", "aes256-ctr",
- "aes128-gcm@openssh.com",
- chacha20Poly1305ID,
- "arcfour256", "arcfour128", "arcfour",
- aes128cbcID,
- tripledescbcID,
-}
-
-// preferredCiphers specifies the default preference for ciphers.
-var preferredCiphers = []string{
- "aes128-gcm@openssh.com",
- chacha20Poly1305ID,
- "aes128-ctr", "aes192-ctr", "aes256-ctr",
-}
-
-// supportedKexAlgos specifies the supported key-exchange algorithms in
-// preference order.
-var supportedKexAlgos = []string{
- kexAlgoCurve25519SHA256,
- // P384 and P521 are not constant-time yet, but since we don't
- // reuse ephemeral keys, using them for ECDH should be OK.
- kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
- kexAlgoDH14SHA1, kexAlgoDH1SHA1,
-}
-
-// supportedHostKeyAlgos specifies the supported host-key algorithms (i.e. methods
-// of authenticating servers) in preference order.
-var supportedHostKeyAlgos = []string{
- CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,
- CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoED25519v01,
-
- KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
- KeyAlgoRSA, KeyAlgoDSA,
-
- KeyAlgoED25519,
-}
-
-// supportedMACs specifies a default set of MAC algorithms in preference order.
-// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
-// because they have reached the end of their useful life.
-var supportedMACs = []string{
- "hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96",
-}
-
-var supportedCompressions = []string{compressionNone}
-
-// hashFuncs keeps the mapping of supported algorithms to their respective
-// hashes needed for signature verification.
-var hashFuncs = map[string]crypto.Hash{
- KeyAlgoRSA: crypto.SHA1,
- KeyAlgoDSA: crypto.SHA1,
- KeyAlgoECDSA256: crypto.SHA256,
- KeyAlgoECDSA384: crypto.SHA384,
- KeyAlgoECDSA521: crypto.SHA512,
- CertAlgoRSAv01: crypto.SHA1,
- CertAlgoDSAv01: crypto.SHA1,
- CertAlgoECDSA256v01: crypto.SHA256,
- CertAlgoECDSA384v01: crypto.SHA384,
- CertAlgoECDSA521v01: crypto.SHA512,
-}
-
-// unexpectedMessageError results when the SSH message that we received didn't
-// match what we wanted.
-func unexpectedMessageError(expected, got uint8) error {
- return fmt.Errorf("ssh: unexpected message type %d (expected %d)", got, expected)
-}
-
-// parseError results from a malformed SSH message.
-func parseError(tag uint8) error {
- return fmt.Errorf("ssh: parse error in message type %d", tag)
-}
-
-func findCommon(what string, client []string, server []string) (common string, err error) {
- for _, c := range client {
- for _, s := range server {
- if c == s {
- return c, nil
- }
- }
- }
- return "", fmt.Errorf("ssh: no common algorithm for %s; client offered: %v, server offered: %v", what, client, server)
-}
-
-type directionAlgorithms struct {
- Cipher string
- MAC string
- Compression string
-}
-
-// rekeyBytes returns a rekeying intervals in bytes.
-func (a *directionAlgorithms) rekeyBytes() int64 {
- // According to RFC4344 block ciphers should rekey after
- // 2^(BLOCKSIZE/4) blocks. For all AES flavors BLOCKSIZE is
- // 128.
- switch a.Cipher {
- case "aes128-ctr", "aes192-ctr", "aes256-ctr", gcmCipherID, aes128cbcID:
- return 16 * (1 << 32)
-
- }
-
- // For others, stick with RFC4253 recommendation to rekey after 1 Gb of data.
- return 1 << 30
-}
-
-type algorithms struct {
- kex string
- hostKey string
- w directionAlgorithms
- r directionAlgorithms
-}
-
-func findAgreedAlgorithms(clientKexInit, serverKexInit *kexInitMsg) (algs *algorithms, err error) {
- result := &algorithms{}
-
- result.kex, err = findCommon("key exchange", clientKexInit.KexAlgos, serverKexInit.KexAlgos)
- if err != nil {
- return
- }
-
- result.hostKey, err = findCommon("host key", clientKexInit.ServerHostKeyAlgos, serverKexInit.ServerHostKeyAlgos)
- if err != nil {
- return
- }
-
- result.w.Cipher, err = findCommon("client to server cipher", clientKexInit.CiphersClientServer, serverKexInit.CiphersClientServer)
- if err != nil {
- return
- }
-
- result.r.Cipher, err = findCommon("server to client cipher", clientKexInit.CiphersServerClient, serverKexInit.CiphersServerClient)
- if err != nil {
- return
- }
-
- result.w.MAC, err = findCommon("client to server MAC", clientKexInit.MACsClientServer, serverKexInit.MACsClientServer)
- if err != nil {
- return
- }
-
- result.r.MAC, err = findCommon("server to client MAC", clientKexInit.MACsServerClient, serverKexInit.MACsServerClient)
- if err != nil {
- return
- }
-
- result.w.Compression, err = findCommon("client to server compression", clientKexInit.CompressionClientServer, serverKexInit.CompressionClientServer)
- if err != nil {
- return
- }
-
- result.r.Compression, err = findCommon("server to client compression", clientKexInit.CompressionServerClient, serverKexInit.CompressionServerClient)
- if err != nil {
- return
- }
-
- return result, nil
-}
-
-// If rekeythreshold is too small, we can't make any progress sending
-// stuff.
-const minRekeyThreshold uint64 = 256
-
-// Config contains configuration data common to both ServerConfig and
-// ClientConfig.
-type Config struct {
- // Rand provides the source of entropy for cryptographic
- // primitives. If Rand is nil, the cryptographic random reader
- // in package crypto/rand will be used.
- Rand io.Reader
-
- // The maximum number of bytes sent or received after which a
- // new key is negotiated. It must be at least 256. If
- // unspecified, a size suitable for the chosen cipher is used.
- RekeyThreshold uint64
-
- // The allowed key exchanges algorithms. If unspecified then a
- // default set of algorithms is used.
- KeyExchanges []string
-
- // The allowed cipher algorithms. If unspecified then a sensible
- // default is used.
- Ciphers []string
-
- // The allowed MAC algorithms. If unspecified then a sensible default
- // is used.
- MACs []string
-}
-
-// SetDefaults sets sensible values for unset fields in config. This is
-// exported for testing: Configs passed to SSH functions are copied and have
-// default values set automatically.
-func (c *Config) SetDefaults() {
- if c.Rand == nil {
- c.Rand = rand.Reader
- }
- if c.Ciphers == nil {
- c.Ciphers = preferredCiphers
- }
- var ciphers []string
- for _, c := range c.Ciphers {
- if cipherModes[c] != nil {
- // reject the cipher if we have no cipherModes definition
- ciphers = append(ciphers, c)
- }
- }
- c.Ciphers = ciphers
-
- if c.KeyExchanges == nil {
- c.KeyExchanges = supportedKexAlgos
- }
-
- if c.MACs == nil {
- c.MACs = supportedMACs
- }
-
- if c.RekeyThreshold == 0 {
- // cipher specific default
- } else if c.RekeyThreshold < minRekeyThreshold {
- c.RekeyThreshold = minRekeyThreshold
- } else if c.RekeyThreshold >= math.MaxInt64 {
- // Avoid weirdness if somebody uses -1 as a threshold.
- c.RekeyThreshold = math.MaxInt64
- }
-}
-
-// buildDataSignedForAuth returns the data that is signed in order to prove
-// possession of a private key. See RFC 4252, section 7.
-func buildDataSignedForAuth(sessionID []byte, req userAuthRequestMsg, algo, pubKey []byte) []byte {
- data := struct {
- Session []byte
- Type byte
- User string
- Service string
- Method string
- Sign bool
- Algo []byte
- PubKey []byte
- }{
- sessionID,
- msgUserAuthRequest,
- req.User,
- req.Service,
- req.Method,
- true,
- algo,
- pubKey,
- }
- return Marshal(data)
-}
-
-func appendU16(buf []byte, n uint16) []byte {
- return append(buf, byte(n>>8), byte(n))
-}
-
-func appendU32(buf []byte, n uint32) []byte {
- return append(buf, byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
-}
-
-func appendU64(buf []byte, n uint64) []byte {
- return append(buf,
- byte(n>>56), byte(n>>48), byte(n>>40), byte(n>>32),
- byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
-}
-
-func appendInt(buf []byte, n int) []byte {
- return appendU32(buf, uint32(n))
-}
-
-func appendString(buf []byte, s string) []byte {
- buf = appendU32(buf, uint32(len(s)))
- buf = append(buf, s...)
- return buf
-}
-
-func appendBool(buf []byte, b bool) []byte {
- if b {
- return append(buf, 1)
- }
- return append(buf, 0)
-}
-
-// newCond is a helper to hide the fact that there is no usable zero
-// value for sync.Cond.
-func newCond() *sync.Cond { return sync.NewCond(new(sync.Mutex)) }
-
-// window represents the buffer available to clients
-// wishing to write to a channel.
-type window struct {
- *sync.Cond
- win uint32 // RFC 4254 5.2 says the window size can grow to 2^32-1
- writeWaiters int
- closed bool
-}
-
-// add adds win to the amount of window available
-// for consumers.
-func (w *window) add(win uint32) bool {
- // a zero sized window adjust is a noop.
- if win == 0 {
- return true
- }
- w.L.Lock()
- if w.win+win < win {
- w.L.Unlock()
- return false
- }
- w.win += win
- // It is unusual that multiple goroutines would be attempting to reserve
- // window space, but not guaranteed. Use broadcast to notify all waiters
- // that additional window is available.
- w.Broadcast()
- w.L.Unlock()
- return true
-}
-
-// close sets the window to closed, so all reservations fail
-// immediately.
-func (w *window) close() {
- w.L.Lock()
- w.closed = true
- w.Broadcast()
- w.L.Unlock()
-}
-
-// reserve reserves win from the available window capacity.
-// If no capacity remains, reserve will block. reserve may
-// return less than requested.
-func (w *window) reserve(win uint32) (uint32, error) {
- var err error
- w.L.Lock()
- w.writeWaiters++
- w.Broadcast()
- for w.win == 0 && !w.closed {
- w.Wait()
- }
- w.writeWaiters--
- if w.win < win {
- win = w.win
- }
- w.win -= win
- if w.closed {
- err = io.EOF
- }
- w.L.Unlock()
- return win, err
-}
-
-// waitWriterBlocked waits until some goroutine is blocked for further
-// writes. It is used in tests only.
-func (w *window) waitWriterBlocked() {
- w.Cond.L.Lock()
- for w.writeWaiters == 0 {
- w.Cond.Wait()
- }
- w.Cond.L.Unlock()
-}
diff --git a/vendor/golang.org/x/crypto/ssh/connection.go b/vendor/golang.org/x/crypto/ssh/connection.go
deleted file mode 100644
index fd6b0681..00000000
--- a/vendor/golang.org/x/crypto/ssh/connection.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "fmt"
- "net"
-)
-
-// OpenChannelError is returned if the other side rejects an
-// OpenChannel request.
-type OpenChannelError struct {
- Reason RejectionReason
- Message string
-}
-
-func (e *OpenChannelError) Error() string {
- return fmt.Sprintf("ssh: rejected: %s (%s)", e.Reason, e.Message)
-}
-
-// ConnMetadata holds metadata for the connection.
-type ConnMetadata interface {
- // User returns the user ID for this connection.
- User() string
-
- // SessionID returns the session hash, also denoted by H.
- SessionID() []byte
-
- // ClientVersion returns the client's version string as hashed
- // into the session ID.
- ClientVersion() []byte
-
- // ServerVersion returns the server's version string as hashed
- // into the session ID.
- ServerVersion() []byte
-
- // RemoteAddr returns the remote address for this connection.
- RemoteAddr() net.Addr
-
- // LocalAddr returns the local address for this connection.
- LocalAddr() net.Addr
-}
-
-// Conn represents an SSH connection for both server and client roles.
-// Conn is the basis for implementing an application layer, such
-// as ClientConn, which implements the traditional shell access for
-// clients.
-type Conn interface {
- ConnMetadata
-
- // SendRequest sends a global request, and returns the
- // reply. If wantReply is true, it returns the response status
- // and payload. See also RFC4254, section 4.
- SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error)
-
- // OpenChannel tries to open an channel. If the request is
- // rejected, it returns *OpenChannelError. On success it returns
- // the SSH Channel and a Go channel for incoming, out-of-band
- // requests. The Go channel must be serviced, or the
- // connection will hang.
- OpenChannel(name string, data []byte) (Channel, <-chan *Request, error)
-
- // Close closes the underlying network connection
- Close() error
-
- // Wait blocks until the connection has shut down, and returns the
- // error causing the shutdown.
- Wait() error
-
- // TODO(hanwen): consider exposing:
- // RequestKeyChange
- // Disconnect
-}
-
-// DiscardRequests consumes and rejects all requests from the
-// passed-in channel.
-func DiscardRequests(in <-chan *Request) {
- for req := range in {
- if req.WantReply {
- req.Reply(false, nil)
- }
- }
-}
-
-// A connection represents an incoming connection.
-type connection struct {
- transport *handshakeTransport
- sshConn
-
- // The connection protocol.
- *mux
-}
-
-func (c *connection) Close() error {
- return c.sshConn.conn.Close()
-}
-
-// sshconn provides net.Conn metadata, but disallows direct reads and
-// writes.
-type sshConn struct {
- conn net.Conn
-
- user string
- sessionID []byte
- clientVersion []byte
- serverVersion []byte
-}
-
-func dup(src []byte) []byte {
- dst := make([]byte, len(src))
- copy(dst, src)
- return dst
-}
-
-func (c *sshConn) User() string {
- return c.user
-}
-
-func (c *sshConn) RemoteAddr() net.Addr {
- return c.conn.RemoteAddr()
-}
-
-func (c *sshConn) Close() error {
- return c.conn.Close()
-}
-
-func (c *sshConn) LocalAddr() net.Addr {
- return c.conn.LocalAddr()
-}
-
-func (c *sshConn) SessionID() []byte {
- return dup(c.sessionID)
-}
-
-func (c *sshConn) ClientVersion() []byte {
- return dup(c.clientVersion)
-}
-
-func (c *sshConn) ServerVersion() []byte {
- return dup(c.serverVersion)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/doc.go b/vendor/golang.org/x/crypto/ssh/doc.go
deleted file mode 100644
index 67b7322c..00000000
--- a/vendor/golang.org/x/crypto/ssh/doc.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package ssh implements an SSH client and server.
-
-SSH is a transport security protocol, an authentication protocol and a
-family of application protocols. The most typical application level
-protocol is a remote shell and this is specifically implemented. However,
-the multiplexed nature of SSH is exposed to users that wish to support
-others.
-
-References:
- [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD
- [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1
-
-This package does not fall under the stability promise of the Go language itself,
-so its API may be changed when pressing needs arise.
-*/
-package ssh // import "golang.org/x/crypto/ssh"
diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go
deleted file mode 100644
index 4f7912ec..00000000
--- a/vendor/golang.org/x/crypto/ssh/handshake.go
+++ /dev/null
@@ -1,646 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto/rand"
- "errors"
- "fmt"
- "io"
- "log"
- "net"
- "sync"
-)
-
-// debugHandshake, if set, prints messages sent and received. Key
-// exchange messages are printed as if DH were used, so the debug
-// messages are wrong when using ECDH.
-const debugHandshake = false
-
-// chanSize sets the amount of buffering SSH connections. This is
-// primarily for testing: setting chanSize=0 uncovers deadlocks more
-// quickly.
-const chanSize = 16
-
-// keyingTransport is a packet based transport that supports key
-// changes. It need not be thread-safe. It should pass through
-// msgNewKeys in both directions.
-type keyingTransport interface {
- packetConn
-
- // prepareKeyChange sets up a key change. The key change for a
- // direction will be effected if a msgNewKeys message is sent
- // or received.
- prepareKeyChange(*algorithms, *kexResult) error
-}
-
-// handshakeTransport implements rekeying on top of a keyingTransport
-// and offers a thread-safe writePacket() interface.
-type handshakeTransport struct {
- conn keyingTransport
- config *Config
-
- serverVersion []byte
- clientVersion []byte
-
- // hostKeys is non-empty if we are the server. In that case,
- // it contains all host keys that can be used to sign the
- // connection.
- hostKeys []Signer
-
- // hostKeyAlgorithms is non-empty if we are the client. In that case,
- // we accept these key types from the server as host key.
- hostKeyAlgorithms []string
-
- // On read error, incoming is closed, and readError is set.
- incoming chan []byte
- readError error
-
- mu sync.Mutex
- writeError error
- sentInitPacket []byte
- sentInitMsg *kexInitMsg
- pendingPackets [][]byte // Used when a key exchange is in progress.
-
- // If the read loop wants to schedule a kex, it pings this
- // channel, and the write loop will send out a kex
- // message.
- requestKex chan struct{}
-
- // If the other side requests or confirms a kex, its kexInit
- // packet is sent here for the write loop to find it.
- startKex chan *pendingKex
-
- // data for host key checking
- hostKeyCallback HostKeyCallback
- dialAddress string
- remoteAddr net.Addr
-
- // bannerCallback is non-empty if we are the client and it has been set in
- // ClientConfig. In that case it is called during the user authentication
- // dance to handle a custom server's message.
- bannerCallback BannerCallback
-
- // Algorithms agreed in the last key exchange.
- algorithms *algorithms
-
- readPacketsLeft uint32
- readBytesLeft int64
-
- writePacketsLeft uint32
- writeBytesLeft int64
-
- // The session ID or nil if first kex did not complete yet.
- sessionID []byte
-}
-
-type pendingKex struct {
- otherInit []byte
- done chan error
-}
-
-func newHandshakeTransport(conn keyingTransport, config *Config, clientVersion, serverVersion []byte) *handshakeTransport {
- t := &handshakeTransport{
- conn: conn,
- serverVersion: serverVersion,
- clientVersion: clientVersion,
- incoming: make(chan []byte, chanSize),
- requestKex: make(chan struct{}, 1),
- startKex: make(chan *pendingKex, 1),
-
- config: config,
- }
- t.resetReadThresholds()
- t.resetWriteThresholds()
-
- // We always start with a mandatory key exchange.
- t.requestKex <- struct{}{}
- return t
-}
-
-func newClientTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ClientConfig, dialAddr string, addr net.Addr) *handshakeTransport {
- t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion)
- t.dialAddress = dialAddr
- t.remoteAddr = addr
- t.hostKeyCallback = config.HostKeyCallback
- t.bannerCallback = config.BannerCallback
- if config.HostKeyAlgorithms != nil {
- t.hostKeyAlgorithms = config.HostKeyAlgorithms
- } else {
- t.hostKeyAlgorithms = supportedHostKeyAlgos
- }
- go t.readLoop()
- go t.kexLoop()
- return t
-}
-
-func newServerTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ServerConfig) *handshakeTransport {
- t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion)
- t.hostKeys = config.hostKeys
- go t.readLoop()
- go t.kexLoop()
- return t
-}
-
-func (t *handshakeTransport) getSessionID() []byte {
- return t.sessionID
-}
-
-// waitSession waits for the session to be established. This should be
-// the first thing to call after instantiating handshakeTransport.
-func (t *handshakeTransport) waitSession() error {
- p, err := t.readPacket()
- if err != nil {
- return err
- }
- if p[0] != msgNewKeys {
- return fmt.Errorf("ssh: first packet should be msgNewKeys")
- }
-
- return nil
-}
-
-func (t *handshakeTransport) id() string {
- if len(t.hostKeys) > 0 {
- return "server"
- }
- return "client"
-}
-
-func (t *handshakeTransport) printPacket(p []byte, write bool) {
- action := "got"
- if write {
- action = "sent"
- }
-
- if p[0] == msgChannelData || p[0] == msgChannelExtendedData {
- log.Printf("%s %s data (packet %d bytes)", t.id(), action, len(p))
- } else {
- msg, err := decode(p)
- log.Printf("%s %s %T %v (%v)", t.id(), action, msg, msg, err)
- }
-}
-
-func (t *handshakeTransport) readPacket() ([]byte, error) {
- p, ok := <-t.incoming
- if !ok {
- return nil, t.readError
- }
- return p, nil
-}
-
-func (t *handshakeTransport) readLoop() {
- first := true
- for {
- p, err := t.readOnePacket(first)
- first = false
- if err != nil {
- t.readError = err
- close(t.incoming)
- break
- }
- if p[0] == msgIgnore || p[0] == msgDebug {
- continue
- }
- t.incoming <- p
- }
-
- // Stop writers too.
- t.recordWriteError(t.readError)
-
- // Unblock the writer should it wait for this.
- close(t.startKex)
-
- // Don't close t.requestKex; it's also written to from writePacket.
-}
-
-func (t *handshakeTransport) pushPacket(p []byte) error {
- if debugHandshake {
- t.printPacket(p, true)
- }
- return t.conn.writePacket(p)
-}
-
-func (t *handshakeTransport) getWriteError() error {
- t.mu.Lock()
- defer t.mu.Unlock()
- return t.writeError
-}
-
-func (t *handshakeTransport) recordWriteError(err error) {
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.writeError == nil && err != nil {
- t.writeError = err
- }
-}
-
-func (t *handshakeTransport) requestKeyExchange() {
- select {
- case t.requestKex <- struct{}{}:
- default:
- // something already requested a kex, so do nothing.
- }
-}
-
-func (t *handshakeTransport) resetWriteThresholds() {
- t.writePacketsLeft = packetRekeyThreshold
- if t.config.RekeyThreshold > 0 {
- t.writeBytesLeft = int64(t.config.RekeyThreshold)
- } else if t.algorithms != nil {
- t.writeBytesLeft = t.algorithms.w.rekeyBytes()
- } else {
- t.writeBytesLeft = 1 << 30
- }
-}
-
-func (t *handshakeTransport) kexLoop() {
-
-write:
- for t.getWriteError() == nil {
- var request *pendingKex
- var sent bool
-
- for request == nil || !sent {
- var ok bool
- select {
- case request, ok = <-t.startKex:
- if !ok {
- break write
- }
- case <-t.requestKex:
- break
- }
-
- if !sent {
- if err := t.sendKexInit(); err != nil {
- t.recordWriteError(err)
- break
- }
- sent = true
- }
- }
-
- if err := t.getWriteError(); err != nil {
- if request != nil {
- request.done <- err
- }
- break
- }
-
- // We're not servicing t.requestKex, but that is OK:
- // we never block on sending to t.requestKex.
-
- // We're not servicing t.startKex, but the remote end
- // has just sent us a kexInitMsg, so it can't send
- // another key change request, until we close the done
- // channel on the pendingKex request.
-
- err := t.enterKeyExchange(request.otherInit)
-
- t.mu.Lock()
- t.writeError = err
- t.sentInitPacket = nil
- t.sentInitMsg = nil
-
- t.resetWriteThresholds()
-
- // we have completed the key exchange. Since the
- // reader is still blocked, it is safe to clear out
- // the requestKex channel. This avoids the situation
- // where: 1) we consumed our own request for the
- // initial kex, and 2) the kex from the remote side
- // caused another send on the requestKex channel,
- clear:
- for {
- select {
- case <-t.requestKex:
- //
- default:
- break clear
- }
- }
-
- request.done <- t.writeError
-
- // kex finished. Push packets that we received while
- // the kex was in progress. Don't look at t.startKex
- // and don't increment writtenSinceKex: if we trigger
- // another kex while we are still busy with the last
- // one, things will become very confusing.
- for _, p := range t.pendingPackets {
- t.writeError = t.pushPacket(p)
- if t.writeError != nil {
- break
- }
- }
- t.pendingPackets = t.pendingPackets[:0]
- t.mu.Unlock()
- }
-
- // drain startKex channel. We don't service t.requestKex
- // because nobody does blocking sends there.
- go func() {
- for init := range t.startKex {
- init.done <- t.writeError
- }
- }()
-
- // Unblock reader.
- t.conn.Close()
-}
-
-// The protocol uses uint32 for packet counters, so we can't let them
-// reach 1<<32. We will actually read and write more packets than
-// this, though: the other side may send more packets, and after we
-// hit this limit on writing we will send a few more packets for the
-// key exchange itself.
-const packetRekeyThreshold = (1 << 31)
-
-func (t *handshakeTransport) resetReadThresholds() {
- t.readPacketsLeft = packetRekeyThreshold
- if t.config.RekeyThreshold > 0 {
- t.readBytesLeft = int64(t.config.RekeyThreshold)
- } else if t.algorithms != nil {
- t.readBytesLeft = t.algorithms.r.rekeyBytes()
- } else {
- t.readBytesLeft = 1 << 30
- }
-}
-
-func (t *handshakeTransport) readOnePacket(first bool) ([]byte, error) {
- p, err := t.conn.readPacket()
- if err != nil {
- return nil, err
- }
-
- if t.readPacketsLeft > 0 {
- t.readPacketsLeft--
- } else {
- t.requestKeyExchange()
- }
-
- if t.readBytesLeft > 0 {
- t.readBytesLeft -= int64(len(p))
- } else {
- t.requestKeyExchange()
- }
-
- if debugHandshake {
- t.printPacket(p, false)
- }
-
- if first && p[0] != msgKexInit {
- return nil, fmt.Errorf("ssh: first packet should be msgKexInit")
- }
-
- if p[0] != msgKexInit {
- return p, nil
- }
-
- firstKex := t.sessionID == nil
-
- kex := pendingKex{
- done: make(chan error, 1),
- otherInit: p,
- }
- t.startKex <- &kex
- err = <-kex.done
-
- if debugHandshake {
- log.Printf("%s exited key exchange (first %v), err %v", t.id(), firstKex, err)
- }
-
- if err != nil {
- return nil, err
- }
-
- t.resetReadThresholds()
-
- // By default, a key exchange is hidden from higher layers by
- // translating it into msgIgnore.
- successPacket := []byte{msgIgnore}
- if firstKex {
- // sendKexInit() for the first kex waits for
- // msgNewKeys so the authentication process is
- // guaranteed to happen over an encrypted transport.
- successPacket = []byte{msgNewKeys}
- }
-
- return successPacket, nil
-}
-
-// sendKexInit sends a key change message.
-func (t *handshakeTransport) sendKexInit() error {
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.sentInitMsg != nil {
- // kexInits may be sent either in response to the other side,
- // or because our side wants to initiate a key change, so we
- // may have already sent a kexInit. In that case, don't send a
- // second kexInit.
- return nil
- }
-
- msg := &kexInitMsg{
- KexAlgos: t.config.KeyExchanges,
- CiphersClientServer: t.config.Ciphers,
- CiphersServerClient: t.config.Ciphers,
- MACsClientServer: t.config.MACs,
- MACsServerClient: t.config.MACs,
- CompressionClientServer: supportedCompressions,
- CompressionServerClient: supportedCompressions,
- }
- io.ReadFull(rand.Reader, msg.Cookie[:])
-
- if len(t.hostKeys) > 0 {
- for _, k := range t.hostKeys {
- msg.ServerHostKeyAlgos = append(
- msg.ServerHostKeyAlgos, k.PublicKey().Type())
- }
- } else {
- msg.ServerHostKeyAlgos = t.hostKeyAlgorithms
- }
- packet := Marshal(msg)
-
- // writePacket destroys the contents, so save a copy.
- packetCopy := make([]byte, len(packet))
- copy(packetCopy, packet)
-
- if err := t.pushPacket(packetCopy); err != nil {
- return err
- }
-
- t.sentInitMsg = msg
- t.sentInitPacket = packet
-
- return nil
-}
-
-func (t *handshakeTransport) writePacket(p []byte) error {
- switch p[0] {
- case msgKexInit:
- return errors.New("ssh: only handshakeTransport can send kexInit")
- case msgNewKeys:
- return errors.New("ssh: only handshakeTransport can send newKeys")
- }
-
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.writeError != nil {
- return t.writeError
- }
-
- if t.sentInitMsg != nil {
- // Copy the packet so the writer can reuse the buffer.
- cp := make([]byte, len(p))
- copy(cp, p)
- t.pendingPackets = append(t.pendingPackets, cp)
- return nil
- }
-
- if t.writeBytesLeft > 0 {
- t.writeBytesLeft -= int64(len(p))
- } else {
- t.requestKeyExchange()
- }
-
- if t.writePacketsLeft > 0 {
- t.writePacketsLeft--
- } else {
- t.requestKeyExchange()
- }
-
- if err := t.pushPacket(p); err != nil {
- t.writeError = err
- }
-
- return nil
-}
-
-func (t *handshakeTransport) Close() error {
- return t.conn.Close()
-}
-
-func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error {
- if debugHandshake {
- log.Printf("%s entered key exchange", t.id())
- }
-
- otherInit := &kexInitMsg{}
- if err := Unmarshal(otherInitPacket, otherInit); err != nil {
- return err
- }
-
- magics := handshakeMagics{
- clientVersion: t.clientVersion,
- serverVersion: t.serverVersion,
- clientKexInit: otherInitPacket,
- serverKexInit: t.sentInitPacket,
- }
-
- clientInit := otherInit
- serverInit := t.sentInitMsg
- if len(t.hostKeys) == 0 {
- clientInit, serverInit = serverInit, clientInit
-
- magics.clientKexInit = t.sentInitPacket
- magics.serverKexInit = otherInitPacket
- }
-
- var err error
- t.algorithms, err = findAgreedAlgorithms(clientInit, serverInit)
- if err != nil {
- return err
- }
-
- // We don't send FirstKexFollows, but we handle receiving it.
- //
- // RFC 4253 section 7 defines the kex and the agreement method for
- // first_kex_packet_follows. It states that the guessed packet
- // should be ignored if the "kex algorithm and/or the host
- // key algorithm is guessed wrong (server and client have
- // different preferred algorithm), or if any of the other
- // algorithms cannot be agreed upon". The other algorithms have
- // already been checked above so the kex algorithm and host key
- // algorithm are checked here.
- if otherInit.FirstKexFollows && (clientInit.KexAlgos[0] != serverInit.KexAlgos[0] || clientInit.ServerHostKeyAlgos[0] != serverInit.ServerHostKeyAlgos[0]) {
- // other side sent a kex message for the wrong algorithm,
- // which we have to ignore.
- if _, err := t.conn.readPacket(); err != nil {
- return err
- }
- }
-
- kex, ok := kexAlgoMap[t.algorithms.kex]
- if !ok {
- return fmt.Errorf("ssh: unexpected key exchange algorithm %v", t.algorithms.kex)
- }
-
- var result *kexResult
- if len(t.hostKeys) > 0 {
- result, err = t.server(kex, t.algorithms, &magics)
- } else {
- result, err = t.client(kex, t.algorithms, &magics)
- }
-
- if err != nil {
- return err
- }
-
- if t.sessionID == nil {
- t.sessionID = result.H
- }
- result.SessionID = t.sessionID
-
- if err := t.conn.prepareKeyChange(t.algorithms, result); err != nil {
- return err
- }
- if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil {
- return err
- }
- if packet, err := t.conn.readPacket(); err != nil {
- return err
- } else if packet[0] != msgNewKeys {
- return unexpectedMessageError(msgNewKeys, packet[0])
- }
-
- return nil
-}
-
-func (t *handshakeTransport) server(kex kexAlgorithm, algs *algorithms, magics *handshakeMagics) (*kexResult, error) {
- var hostKey Signer
- for _, k := range t.hostKeys {
- if algs.hostKey == k.PublicKey().Type() {
- hostKey = k
- }
- }
-
- r, err := kex.Server(t.conn, t.config.Rand, magics, hostKey)
- return r, err
-}
-
-func (t *handshakeTransport) client(kex kexAlgorithm, algs *algorithms, magics *handshakeMagics) (*kexResult, error) {
- result, err := kex.Client(t.conn, t.config.Rand, magics)
- if err != nil {
- return nil, err
- }
-
- hostKey, err := ParsePublicKey(result.HostKey)
- if err != nil {
- return nil, err
- }
-
- if err := verifyHostKeySignature(hostKey, result); err != nil {
- return nil, err
- }
-
- err = t.hostKeyCallback(t.dialAddress, t.remoteAddr, hostKey)
- if err != nil {
- return nil, err
- }
-
- return result, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/kex.go b/vendor/golang.org/x/crypto/ssh/kex.go
deleted file mode 100644
index f34bcc01..00000000
--- a/vendor/golang.org/x/crypto/ssh/kex.go
+++ /dev/null
@@ -1,540 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/subtle"
- "errors"
- "io"
- "math/big"
-
- "golang.org/x/crypto/curve25519"
-)
-
-const (
- kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1"
- kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1"
- kexAlgoECDH256 = "ecdh-sha2-nistp256"
- kexAlgoECDH384 = "ecdh-sha2-nistp384"
- kexAlgoECDH521 = "ecdh-sha2-nistp521"
- kexAlgoCurve25519SHA256 = "curve25519-sha256@libssh.org"
-)
-
-// kexResult captures the outcome of a key exchange.
-type kexResult struct {
- // Session hash. See also RFC 4253, section 8.
- H []byte
-
- // Shared secret. See also RFC 4253, section 8.
- K []byte
-
- // Host key as hashed into H.
- HostKey []byte
-
- // Signature of H.
- Signature []byte
-
- // A cryptographic hash function that matches the security
- // level of the key exchange algorithm. It is used for
- // calculating H, and for deriving keys from H and K.
- Hash crypto.Hash
-
- // The session ID, which is the first H computed. This is used
- // to derive key material inside the transport.
- SessionID []byte
-}
-
-// handshakeMagics contains data that is always included in the
-// session hash.
-type handshakeMagics struct {
- clientVersion, serverVersion []byte
- clientKexInit, serverKexInit []byte
-}
-
-func (m *handshakeMagics) write(w io.Writer) {
- writeString(w, m.clientVersion)
- writeString(w, m.serverVersion)
- writeString(w, m.clientKexInit)
- writeString(w, m.serverKexInit)
-}
-
-// kexAlgorithm abstracts different key exchange algorithms.
-type kexAlgorithm interface {
- // Server runs server-side key agreement, signing the result
- // with a hostkey.
- Server(p packetConn, rand io.Reader, magics *handshakeMagics, s Signer) (*kexResult, error)
-
- // Client runs the client-side key agreement. Caller is
- // responsible for verifying the host key signature.
- Client(p packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error)
-}
-
-// dhGroup is a multiplicative group suitable for implementing Diffie-Hellman key agreement.
-type dhGroup struct {
- g, p, pMinus1 *big.Int
-}
-
-func (group *dhGroup) diffieHellman(theirPublic, myPrivate *big.Int) (*big.Int, error) {
- if theirPublic.Cmp(bigOne) <= 0 || theirPublic.Cmp(group.pMinus1) >= 0 {
- return nil, errors.New("ssh: DH parameter out of bounds")
- }
- return new(big.Int).Exp(theirPublic, myPrivate, group.p), nil
-}
-
-func (group *dhGroup) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
- hashFunc := crypto.SHA1
-
- var x *big.Int
- for {
- var err error
- if x, err = rand.Int(randSource, group.pMinus1); err != nil {
- return nil, err
- }
- if x.Sign() > 0 {
- break
- }
- }
-
- X := new(big.Int).Exp(group.g, x, group.p)
- kexDHInit := kexDHInitMsg{
- X: X,
- }
- if err := c.writePacket(Marshal(&kexDHInit)); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var kexDHReply kexDHReplyMsg
- if err = Unmarshal(packet, &kexDHReply); err != nil {
- return nil, err
- }
-
- ki, err := group.diffieHellman(kexDHReply.Y, x)
- if err != nil {
- return nil, err
- }
-
- h := hashFunc.New()
- magics.write(h)
- writeString(h, kexDHReply.HostKey)
- writeInt(h, X)
- writeInt(h, kexDHReply.Y)
- K := make([]byte, intLength(ki))
- marshalInt(K, ki)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: kexDHReply.HostKey,
- Signature: kexDHReply.Signature,
- Hash: crypto.SHA1,
- }, nil
-}
-
-func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
- hashFunc := crypto.SHA1
- packet, err := c.readPacket()
- if err != nil {
- return
- }
- var kexDHInit kexDHInitMsg
- if err = Unmarshal(packet, &kexDHInit); err != nil {
- return
- }
-
- var y *big.Int
- for {
- if y, err = rand.Int(randSource, group.pMinus1); err != nil {
- return
- }
- if y.Sign() > 0 {
- break
- }
- }
-
- Y := new(big.Int).Exp(group.g, y, group.p)
- ki, err := group.diffieHellman(kexDHInit.X, y)
- if err != nil {
- return nil, err
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- h := hashFunc.New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeInt(h, kexDHInit.X)
- writeInt(h, Y)
-
- K := make([]byte, intLength(ki))
- marshalInt(K, ki)
- h.Write(K)
-
- H := h.Sum(nil)
-
- // H is already a hash, but the hostkey signing will apply its
- // own key-specific hash algorithm.
- sig, err := signAndMarshal(priv, randSource, H)
- if err != nil {
- return nil, err
- }
-
- kexDHReply := kexDHReplyMsg{
- HostKey: hostKeyBytes,
- Y: Y,
- Signature: sig,
- }
- packet = Marshal(&kexDHReply)
-
- err = c.writePacket(packet)
- return &kexResult{
- H: H,
- K: K,
- HostKey: hostKeyBytes,
- Signature: sig,
- Hash: crypto.SHA1,
- }, nil
-}
-
-// ecdh performs Elliptic Curve Diffie-Hellman key exchange as
-// described in RFC 5656, section 4.
-type ecdh struct {
- curve elliptic.Curve
-}
-
-func (kex *ecdh) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) {
- ephKey, err := ecdsa.GenerateKey(kex.curve, rand)
- if err != nil {
- return nil, err
- }
-
- kexInit := kexECDHInitMsg{
- ClientPubKey: elliptic.Marshal(kex.curve, ephKey.PublicKey.X, ephKey.PublicKey.Y),
- }
-
- serialized := Marshal(&kexInit)
- if err := c.writePacket(serialized); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var reply kexECDHReplyMsg
- if err = Unmarshal(packet, &reply); err != nil {
- return nil, err
- }
-
- x, y, err := unmarshalECKey(kex.curve, reply.EphemeralPubKey)
- if err != nil {
- return nil, err
- }
-
- // generate shared secret
- secret, _ := kex.curve.ScalarMult(x, y, ephKey.D.Bytes())
-
- h := ecHash(kex.curve).New()
- magics.write(h)
- writeString(h, reply.HostKey)
- writeString(h, kexInit.ClientPubKey)
- writeString(h, reply.EphemeralPubKey)
- K := make([]byte, intLength(secret))
- marshalInt(K, secret)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: reply.HostKey,
- Signature: reply.Signature,
- Hash: ecHash(kex.curve),
- }, nil
-}
-
-// unmarshalECKey parses and checks an EC key.
-func unmarshalECKey(curve elliptic.Curve, pubkey []byte) (x, y *big.Int, err error) {
- x, y = elliptic.Unmarshal(curve, pubkey)
- if x == nil {
- return nil, nil, errors.New("ssh: elliptic.Unmarshal failure")
- }
- if !validateECPublicKey(curve, x, y) {
- return nil, nil, errors.New("ssh: public key not on curve")
- }
- return x, y, nil
-}
-
-// validateECPublicKey checks that the point is a valid public key for
-// the given curve. See [SEC1], 3.2.2
-func validateECPublicKey(curve elliptic.Curve, x, y *big.Int) bool {
- if x.Sign() == 0 && y.Sign() == 0 {
- return false
- }
-
- if x.Cmp(curve.Params().P) >= 0 {
- return false
- }
-
- if y.Cmp(curve.Params().P) >= 0 {
- return false
- }
-
- if !curve.IsOnCurve(x, y) {
- return false
- }
-
- // We don't check if N * PubKey == 0, since
- //
- // - the NIST curves have cofactor = 1, so this is implicit.
- // (We don't foresee an implementation that supports non NIST
- // curves)
- //
- // - for ephemeral keys, we don't need to worry about small
- // subgroup attacks.
- return true
-}
-
-func (kex *ecdh) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var kexECDHInit kexECDHInitMsg
- if err = Unmarshal(packet, &kexECDHInit); err != nil {
- return nil, err
- }
-
- clientX, clientY, err := unmarshalECKey(kex.curve, kexECDHInit.ClientPubKey)
- if err != nil {
- return nil, err
- }
-
- // We could cache this key across multiple users/multiple
- // connection attempts, but the benefit is small. OpenSSH
- // generates a new key for each incoming connection.
- ephKey, err := ecdsa.GenerateKey(kex.curve, rand)
- if err != nil {
- return nil, err
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- serializedEphKey := elliptic.Marshal(kex.curve, ephKey.PublicKey.X, ephKey.PublicKey.Y)
-
- // generate shared secret
- secret, _ := kex.curve.ScalarMult(clientX, clientY, ephKey.D.Bytes())
-
- h := ecHash(kex.curve).New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeString(h, kexECDHInit.ClientPubKey)
- writeString(h, serializedEphKey)
-
- K := make([]byte, intLength(secret))
- marshalInt(K, secret)
- h.Write(K)
-
- H := h.Sum(nil)
-
- // H is already a hash, but the hostkey signing will apply its
- // own key-specific hash algorithm.
- sig, err := signAndMarshal(priv, rand, H)
- if err != nil {
- return nil, err
- }
-
- reply := kexECDHReplyMsg{
- EphemeralPubKey: serializedEphKey,
- HostKey: hostKeyBytes,
- Signature: sig,
- }
-
- serialized := Marshal(&reply)
- if err := c.writePacket(serialized); err != nil {
- return nil, err
- }
-
- return &kexResult{
- H: H,
- K: K,
- HostKey: reply.HostKey,
- Signature: sig,
- Hash: ecHash(kex.curve),
- }, nil
-}
-
-var kexAlgoMap = map[string]kexAlgorithm{}
-
-func init() {
- // This is the group called diffie-hellman-group1-sha1 in RFC
- // 4253 and Oakley Group 2 in RFC 2409.
- p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16)
- kexAlgoMap[kexAlgoDH1SHA1] = &dhGroup{
- g: new(big.Int).SetInt64(2),
- p: p,
- pMinus1: new(big.Int).Sub(p, bigOne),
- }
-
- // This is the group called diffie-hellman-group14-sha1 in RFC
- // 4253 and Oakley Group 14 in RFC 3526.
- p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
-
- kexAlgoMap[kexAlgoDH14SHA1] = &dhGroup{
- g: new(big.Int).SetInt64(2),
- p: p,
- pMinus1: new(big.Int).Sub(p, bigOne),
- }
-
- kexAlgoMap[kexAlgoECDH521] = &ecdh{elliptic.P521()}
- kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()}
- kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()}
- kexAlgoMap[kexAlgoCurve25519SHA256] = &curve25519sha256{}
-}
-
-// curve25519sha256 implements the curve25519-sha256@libssh.org key
-// agreement protocol, as described in
-// https://git.libssh.org/projects/libssh.git/tree/doc/curve25519-sha256@libssh.org.txt
-type curve25519sha256 struct{}
-
-type curve25519KeyPair struct {
- priv [32]byte
- pub [32]byte
-}
-
-func (kp *curve25519KeyPair) generate(rand io.Reader) error {
- if _, err := io.ReadFull(rand, kp.priv[:]); err != nil {
- return err
- }
- curve25519.ScalarBaseMult(&kp.pub, &kp.priv)
- return nil
-}
-
-// curve25519Zeros is just an array of 32 zero bytes so that we have something
-// convenient to compare against in order to reject curve25519 points with the
-// wrong order.
-var curve25519Zeros [32]byte
-
-func (kex *curve25519sha256) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) {
- var kp curve25519KeyPair
- if err := kp.generate(rand); err != nil {
- return nil, err
- }
- if err := c.writePacket(Marshal(&kexECDHInitMsg{kp.pub[:]})); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var reply kexECDHReplyMsg
- if err = Unmarshal(packet, &reply); err != nil {
- return nil, err
- }
- if len(reply.EphemeralPubKey) != 32 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong length")
- }
-
- var servPub, secret [32]byte
- copy(servPub[:], reply.EphemeralPubKey)
- curve25519.ScalarMult(&secret, &kp.priv, &servPub)
- if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong order")
- }
-
- h := crypto.SHA256.New()
- magics.write(h)
- writeString(h, reply.HostKey)
- writeString(h, kp.pub[:])
- writeString(h, reply.EphemeralPubKey)
-
- ki := new(big.Int).SetBytes(secret[:])
- K := make([]byte, intLength(ki))
- marshalInt(K, ki)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: reply.HostKey,
- Signature: reply.Signature,
- Hash: crypto.SHA256,
- }, nil
-}
-
-func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
- packet, err := c.readPacket()
- if err != nil {
- return
- }
- var kexInit kexECDHInitMsg
- if err = Unmarshal(packet, &kexInit); err != nil {
- return
- }
-
- if len(kexInit.ClientPubKey) != 32 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong length")
- }
-
- var kp curve25519KeyPair
- if err := kp.generate(rand); err != nil {
- return nil, err
- }
-
- var clientPub, secret [32]byte
- copy(clientPub[:], kexInit.ClientPubKey)
- curve25519.ScalarMult(&secret, &kp.priv, &clientPub)
- if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong order")
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- h := crypto.SHA256.New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeString(h, kexInit.ClientPubKey)
- writeString(h, kp.pub[:])
-
- ki := new(big.Int).SetBytes(secret[:])
- K := make([]byte, intLength(ki))
- marshalInt(K, ki)
- h.Write(K)
-
- H := h.Sum(nil)
-
- sig, err := signAndMarshal(priv, rand, H)
- if err != nil {
- return nil, err
- }
-
- reply := kexECDHReplyMsg{
- EphemeralPubKey: kp.pub[:],
- HostKey: hostKeyBytes,
- Signature: sig,
- }
- if err := c.writePacket(Marshal(&reply)); err != nil {
- return nil, err
- }
- return &kexResult{
- H: H,
- K: K,
- HostKey: hostKeyBytes,
- Signature: sig,
- Hash: crypto.SHA256,
- }, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go
deleted file mode 100644
index 2261dc38..00000000
--- a/vendor/golang.org/x/crypto/ssh/keys.go
+++ /dev/null
@@ -1,1035 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/md5"
- "crypto/rsa"
- "crypto/sha256"
- "crypto/x509"
- "encoding/asn1"
- "encoding/base64"
- "encoding/hex"
- "encoding/pem"
- "errors"
- "fmt"
- "io"
- "math/big"
- "strings"
-
- "golang.org/x/crypto/ed25519"
-)
-
-// These constants represent the algorithm names for key types supported by this
-// package.
-const (
- KeyAlgoRSA = "ssh-rsa"
- KeyAlgoDSA = "ssh-dss"
- KeyAlgoECDSA256 = "ecdsa-sha2-nistp256"
- KeyAlgoECDSA384 = "ecdsa-sha2-nistp384"
- KeyAlgoECDSA521 = "ecdsa-sha2-nistp521"
- KeyAlgoED25519 = "ssh-ed25519"
-)
-
-// parsePubKey parses a public key of the given algorithm.
-// Use ParsePublicKey for keys with prepended algorithm.
-func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err error) {
- switch algo {
- case KeyAlgoRSA:
- return parseRSA(in)
- case KeyAlgoDSA:
- return parseDSA(in)
- case KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521:
- return parseECDSA(in)
- case KeyAlgoED25519:
- return parseED25519(in)
- case CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoED25519v01:
- cert, err := parseCert(in, certToPrivAlgo(algo))
- if err != nil {
- return nil, nil, err
- }
- return cert, nil, nil
- }
- return nil, nil, fmt.Errorf("ssh: unknown key algorithm: %v", algo)
-}
-
-// parseAuthorizedKey parses a public key in OpenSSH authorized_keys format
-// (see sshd(8) manual page) once the options and key type fields have been
-// removed.
-func parseAuthorizedKey(in []byte) (out PublicKey, comment string, err error) {
- in = bytes.TrimSpace(in)
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- i = len(in)
- }
- base64Key := in[:i]
-
- key := make([]byte, base64.StdEncoding.DecodedLen(len(base64Key)))
- n, err := base64.StdEncoding.Decode(key, base64Key)
- if err != nil {
- return nil, "", err
- }
- key = key[:n]
- out, err = ParsePublicKey(key)
- if err != nil {
- return nil, "", err
- }
- comment = string(bytes.TrimSpace(in[i:]))
- return out, comment, nil
-}
-
-// ParseKnownHosts parses an entry in the format of the known_hosts file.
-//
-// The known_hosts format is documented in the sshd(8) manual page. This
-// function will parse a single entry from in. On successful return, marker
-// will contain the optional marker value (i.e. "cert-authority" or "revoked")
-// or else be empty, hosts will contain the hosts that this entry matches,
-// pubKey will contain the public key and comment will contain any trailing
-// comment at the end of the line. See the sshd(8) manual page for the various
-// forms that a host string can take.
-//
-// The unparsed remainder of the input will be returned in rest. This function
-// can be called repeatedly to parse multiple entries.
-//
-// If no entries were found in the input then err will be io.EOF. Otherwise a
-// non-nil err value indicates a parse error.
-func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey, comment string, rest []byte, err error) {
- for len(in) > 0 {
- end := bytes.IndexByte(in, '\n')
- if end != -1 {
- rest = in[end+1:]
- in = in[:end]
- } else {
- rest = nil
- }
-
- end = bytes.IndexByte(in, '\r')
- if end != -1 {
- in = in[:end]
- }
-
- in = bytes.TrimSpace(in)
- if len(in) == 0 || in[0] == '#' {
- in = rest
- continue
- }
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- // Strip out the beginning of the known_host key.
- // This is either an optional marker or a (set of) hostname(s).
- keyFields := bytes.Fields(in)
- if len(keyFields) < 3 || len(keyFields) > 5 {
- return "", nil, nil, "", nil, errors.New("ssh: invalid entry in known_hosts data")
- }
-
- // keyFields[0] is either "@cert-authority", "@revoked" or a comma separated
- // list of hosts
- marker := ""
- if keyFields[0][0] == '@' {
- marker = string(keyFields[0][1:])
- keyFields = keyFields[1:]
- }
-
- hosts := string(keyFields[0])
- // keyFields[1] contains the key type (e.g. “ssh-rsa”).
- // However, that information is duplicated inside the
- // base64-encoded key and so is ignored here.
-
- key := bytes.Join(keyFields[2:], []byte(" "))
- if pubKey, comment, err = parseAuthorizedKey(key); err != nil {
- return "", nil, nil, "", nil, err
- }
-
- return marker, strings.Split(hosts, ","), pubKey, comment, rest, nil
- }
-
- return "", nil, nil, "", nil, io.EOF
-}
-
-// ParseAuthorizedKeys parses a public key from an authorized_keys
-// file used in OpenSSH according to the sshd(8) manual page.
-func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) {
- for len(in) > 0 {
- end := bytes.IndexByte(in, '\n')
- if end != -1 {
- rest = in[end+1:]
- in = in[:end]
- } else {
- rest = nil
- }
-
- end = bytes.IndexByte(in, '\r')
- if end != -1 {
- in = in[:end]
- }
-
- in = bytes.TrimSpace(in)
- if len(in) == 0 || in[0] == '#' {
- in = rest
- continue
- }
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
- return out, comment, options, rest, nil
- }
-
- // No key type recognised. Maybe there's an options field at
- // the beginning.
- var b byte
- inQuote := false
- var candidateOptions []string
- optionStart := 0
- for i, b = range in {
- isEnd := !inQuote && (b == ' ' || b == '\t')
- if (b == ',' && !inQuote) || isEnd {
- if i-optionStart > 0 {
- candidateOptions = append(candidateOptions, string(in[optionStart:i]))
- }
- optionStart = i + 1
- }
- if isEnd {
- break
- }
- if b == '"' && (i == 0 || (i > 0 && in[i-1] != '\\')) {
- inQuote = !inQuote
- }
- }
- for i < len(in) && (in[i] == ' ' || in[i] == '\t') {
- i++
- }
- if i == len(in) {
- // Invalid line: unmatched quote
- in = rest
- continue
- }
-
- in = in[i:]
- i = bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
- options = candidateOptions
- return out, comment, options, rest, nil
- }
-
- in = rest
- continue
- }
-
- return nil, "", nil, nil, errors.New("ssh: no key found")
-}
-
-// ParsePublicKey parses an SSH public key formatted for use in
-// the SSH wire protocol according to RFC 4253, section 6.6.
-func ParsePublicKey(in []byte) (out PublicKey, err error) {
- algo, in, ok := parseString(in)
- if !ok {
- return nil, errShortRead
- }
- var rest []byte
- out, rest, err = parsePubKey(in, string(algo))
- if len(rest) > 0 {
- return nil, errors.New("ssh: trailing junk in public key")
- }
-
- return out, err
-}
-
-// MarshalAuthorizedKey serializes key for inclusion in an OpenSSH
-// authorized_keys file. The return value ends with newline.
-func MarshalAuthorizedKey(key PublicKey) []byte {
- b := &bytes.Buffer{}
- b.WriteString(key.Type())
- b.WriteByte(' ')
- e := base64.NewEncoder(base64.StdEncoding, b)
- e.Write(key.Marshal())
- e.Close()
- b.WriteByte('\n')
- return b.Bytes()
-}
-
-// PublicKey is an abstraction of different types of public keys.
-type PublicKey interface {
- // Type returns the key's type, e.g. "ssh-rsa".
- Type() string
-
- // Marshal returns the serialized key data in SSH wire format,
- // with the name prefix. To unmarshal the returned data, use
- // the ParsePublicKey function.
- Marshal() []byte
-
- // Verify that sig is a signature on the given data using this
- // key. This function will hash the data appropriately first.
- Verify(data []byte, sig *Signature) error
-}
-
-// CryptoPublicKey, if implemented by a PublicKey,
-// returns the underlying crypto.PublicKey form of the key.
-type CryptoPublicKey interface {
- CryptoPublicKey() crypto.PublicKey
-}
-
-// A Signer can create signatures that verify against a public key.
-type Signer interface {
- // PublicKey returns an associated PublicKey instance.
- PublicKey() PublicKey
-
- // Sign returns raw signature for the given data. This method
- // will apply the hash specified for the keytype to the data.
- Sign(rand io.Reader, data []byte) (*Signature, error)
-}
-
-type rsaPublicKey rsa.PublicKey
-
-func (r *rsaPublicKey) Type() string {
- return "ssh-rsa"
-}
-
-// parseRSA parses an RSA key according to RFC 4253, section 6.6.
-func parseRSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- E *big.Int
- N *big.Int
- Rest []byte `ssh:"rest"`
- }
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- if w.E.BitLen() > 24 {
- return nil, nil, errors.New("ssh: exponent too large")
- }
- e := w.E.Int64()
- if e < 3 || e&1 == 0 {
- return nil, nil, errors.New("ssh: incorrect exponent")
- }
-
- var key rsa.PublicKey
- key.E = int(e)
- key.N = w.N
- return (*rsaPublicKey)(&key), w.Rest, nil
-}
-
-func (r *rsaPublicKey) Marshal() []byte {
- e := new(big.Int).SetInt64(int64(r.E))
- // RSA publickey struct layout should match the struct used by
- // parseRSACert in the x/crypto/ssh/agent package.
- wirekey := struct {
- Name string
- E *big.Int
- N *big.Int
- }{
- KeyAlgoRSA,
- e,
- r.N,
- }
- return Marshal(&wirekey)
-}
-
-func (r *rsaPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != r.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, r.Type())
- }
- h := crypto.SHA1.New()
- h.Write(data)
- digest := h.Sum(nil)
- return rsa.VerifyPKCS1v15((*rsa.PublicKey)(r), crypto.SHA1, digest, sig.Blob)
-}
-
-func (r *rsaPublicKey) CryptoPublicKey() crypto.PublicKey {
- return (*rsa.PublicKey)(r)
-}
-
-type dsaPublicKey dsa.PublicKey
-
-func (k *dsaPublicKey) Type() string {
- return "ssh-dss"
-}
-
-func checkDSAParams(param *dsa.Parameters) error {
- // SSH specifies FIPS 186-2, which only provided a single size
- // (1024 bits) DSA key. FIPS 186-3 allows for larger key
- // sizes, which would confuse SSH.
- if l := param.P.BitLen(); l != 1024 {
- return fmt.Errorf("ssh: unsupported DSA key size %d", l)
- }
-
- return nil
-}
-
-// parseDSA parses an DSA key according to RFC 4253, section 6.6.
-func parseDSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- P, Q, G, Y *big.Int
- Rest []byte `ssh:"rest"`
- }
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- param := dsa.Parameters{
- P: w.P,
- Q: w.Q,
- G: w.G,
- }
- if err := checkDSAParams(¶m); err != nil {
- return nil, nil, err
- }
-
- key := &dsaPublicKey{
- Parameters: param,
- Y: w.Y,
- }
- return key, w.Rest, nil
-}
-
-func (k *dsaPublicKey) Marshal() []byte {
- // DSA publickey struct layout should match the struct used by
- // parseDSACert in the x/crypto/ssh/agent package.
- w := struct {
- Name string
- P, Q, G, Y *big.Int
- }{
- k.Type(),
- k.P,
- k.Q,
- k.G,
- k.Y,
- }
-
- return Marshal(&w)
-}
-
-func (k *dsaPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
- h := crypto.SHA1.New()
- h.Write(data)
- digest := h.Sum(nil)
-
- // Per RFC 4253, section 6.6,
- // The value for 'dss_signature_blob' is encoded as a string containing
- // r, followed by s (which are 160-bit integers, without lengths or
- // padding, unsigned, and in network byte order).
- // For DSS purposes, sig.Blob should be exactly 40 bytes in length.
- if len(sig.Blob) != 40 {
- return errors.New("ssh: DSA signature parse error")
- }
- r := new(big.Int).SetBytes(sig.Blob[:20])
- s := new(big.Int).SetBytes(sig.Blob[20:])
- if dsa.Verify((*dsa.PublicKey)(k), digest, r, s) {
- return nil
- }
- return errors.New("ssh: signature did not verify")
-}
-
-func (k *dsaPublicKey) CryptoPublicKey() crypto.PublicKey {
- return (*dsa.PublicKey)(k)
-}
-
-type dsaPrivateKey struct {
- *dsa.PrivateKey
-}
-
-func (k *dsaPrivateKey) PublicKey() PublicKey {
- return (*dsaPublicKey)(&k.PrivateKey.PublicKey)
-}
-
-func (k *dsaPrivateKey) Sign(rand io.Reader, data []byte) (*Signature, error) {
- h := crypto.SHA1.New()
- h.Write(data)
- digest := h.Sum(nil)
- r, s, err := dsa.Sign(rand, k.PrivateKey, digest)
- if err != nil {
- return nil, err
- }
-
- sig := make([]byte, 40)
- rb := r.Bytes()
- sb := s.Bytes()
-
- copy(sig[20-len(rb):20], rb)
- copy(sig[40-len(sb):], sb)
-
- return &Signature{
- Format: k.PublicKey().Type(),
- Blob: sig,
- }, nil
-}
-
-type ecdsaPublicKey ecdsa.PublicKey
-
-func (k *ecdsaPublicKey) Type() string {
- return "ecdsa-sha2-" + k.nistID()
-}
-
-func (k *ecdsaPublicKey) nistID() string {
- switch k.Params().BitSize {
- case 256:
- return "nistp256"
- case 384:
- return "nistp384"
- case 521:
- return "nistp521"
- }
- panic("ssh: unsupported ecdsa key size")
-}
-
-type ed25519PublicKey ed25519.PublicKey
-
-func (k ed25519PublicKey) Type() string {
- return KeyAlgoED25519
-}
-
-func parseED25519(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- KeyBytes []byte
- Rest []byte `ssh:"rest"`
- }
-
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- key := ed25519.PublicKey(w.KeyBytes)
-
- return (ed25519PublicKey)(key), w.Rest, nil
-}
-
-func (k ed25519PublicKey) Marshal() []byte {
- w := struct {
- Name string
- KeyBytes []byte
- }{
- KeyAlgoED25519,
- []byte(k),
- }
- return Marshal(&w)
-}
-
-func (k ed25519PublicKey) Verify(b []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
-
- edKey := (ed25519.PublicKey)(k)
- if ok := ed25519.Verify(edKey, b, sig.Blob); !ok {
- return errors.New("ssh: signature did not verify")
- }
-
- return nil
-}
-
-func (k ed25519PublicKey) CryptoPublicKey() crypto.PublicKey {
- return ed25519.PublicKey(k)
-}
-
-func supportedEllipticCurve(curve elliptic.Curve) bool {
- return curve == elliptic.P256() || curve == elliptic.P384() || curve == elliptic.P521()
-}
-
-// ecHash returns the hash to match the given elliptic curve, see RFC
-// 5656, section 6.2.1
-func ecHash(curve elliptic.Curve) crypto.Hash {
- bitSize := curve.Params().BitSize
- switch {
- case bitSize <= 256:
- return crypto.SHA256
- case bitSize <= 384:
- return crypto.SHA384
- }
- return crypto.SHA512
-}
-
-// parseECDSA parses an ECDSA key according to RFC 5656, section 3.1.
-func parseECDSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- Curve string
- KeyBytes []byte
- Rest []byte `ssh:"rest"`
- }
-
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- key := new(ecdsa.PublicKey)
-
- switch w.Curve {
- case "nistp256":
- key.Curve = elliptic.P256()
- case "nistp384":
- key.Curve = elliptic.P384()
- case "nistp521":
- key.Curve = elliptic.P521()
- default:
- return nil, nil, errors.New("ssh: unsupported curve")
- }
-
- key.X, key.Y = elliptic.Unmarshal(key.Curve, w.KeyBytes)
- if key.X == nil || key.Y == nil {
- return nil, nil, errors.New("ssh: invalid curve point")
- }
- return (*ecdsaPublicKey)(key), w.Rest, nil
-}
-
-func (k *ecdsaPublicKey) Marshal() []byte {
- // See RFC 5656, section 3.1.
- keyBytes := elliptic.Marshal(k.Curve, k.X, k.Y)
- // ECDSA publickey struct layout should match the struct used by
- // parseECDSACert in the x/crypto/ssh/agent package.
- w := struct {
- Name string
- ID string
- Key []byte
- }{
- k.Type(),
- k.nistID(),
- keyBytes,
- }
-
- return Marshal(&w)
-}
-
-func (k *ecdsaPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
-
- h := ecHash(k.Curve).New()
- h.Write(data)
- digest := h.Sum(nil)
-
- // Per RFC 5656, section 3.1.2,
- // The ecdsa_signature_blob value has the following specific encoding:
- // mpint r
- // mpint s
- var ecSig struct {
- R *big.Int
- S *big.Int
- }
-
- if err := Unmarshal(sig.Blob, &ecSig); err != nil {
- return err
- }
-
- if ecdsa.Verify((*ecdsa.PublicKey)(k), digest, ecSig.R, ecSig.S) {
- return nil
- }
- return errors.New("ssh: signature did not verify")
-}
-
-func (k *ecdsaPublicKey) CryptoPublicKey() crypto.PublicKey {
- return (*ecdsa.PublicKey)(k)
-}
-
-// NewSignerFromKey takes an *rsa.PrivateKey, *dsa.PrivateKey,
-// *ecdsa.PrivateKey or any other crypto.Signer and returns a
-// corresponding Signer instance. ECDSA keys must use P-256, P-384 or
-// P-521. DSA keys must use parameter size L1024N160.
-func NewSignerFromKey(key interface{}) (Signer, error) {
- switch key := key.(type) {
- case crypto.Signer:
- return NewSignerFromSigner(key)
- case *dsa.PrivateKey:
- return newDSAPrivateKey(key)
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", key)
- }
-}
-
-func newDSAPrivateKey(key *dsa.PrivateKey) (Signer, error) {
- if err := checkDSAParams(&key.PublicKey.Parameters); err != nil {
- return nil, err
- }
-
- return &dsaPrivateKey{key}, nil
-}
-
-type wrappedSigner struct {
- signer crypto.Signer
- pubKey PublicKey
-}
-
-// NewSignerFromSigner takes any crypto.Signer implementation and
-// returns a corresponding Signer interface. This can be used, for
-// example, with keys kept in hardware modules.
-func NewSignerFromSigner(signer crypto.Signer) (Signer, error) {
- pubKey, err := NewPublicKey(signer.Public())
- if err != nil {
- return nil, err
- }
-
- return &wrappedSigner{signer, pubKey}, nil
-}
-
-func (s *wrappedSigner) PublicKey() PublicKey {
- return s.pubKey
-}
-
-func (s *wrappedSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
- var hashFunc crypto.Hash
-
- switch key := s.pubKey.(type) {
- case *rsaPublicKey, *dsaPublicKey:
- hashFunc = crypto.SHA1
- case *ecdsaPublicKey:
- hashFunc = ecHash(key.Curve)
- case ed25519PublicKey:
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", key)
- }
-
- var digest []byte
- if hashFunc != 0 {
- h := hashFunc.New()
- h.Write(data)
- digest = h.Sum(nil)
- } else {
- digest = data
- }
-
- signature, err := s.signer.Sign(rand, digest, hashFunc)
- if err != nil {
- return nil, err
- }
-
- // crypto.Signer.Sign is expected to return an ASN.1-encoded signature
- // for ECDSA and DSA, but that's not the encoding expected by SSH, so
- // re-encode.
- switch s.pubKey.(type) {
- case *ecdsaPublicKey, *dsaPublicKey:
- type asn1Signature struct {
- R, S *big.Int
- }
- asn1Sig := new(asn1Signature)
- _, err := asn1.Unmarshal(signature, asn1Sig)
- if err != nil {
- return nil, err
- }
-
- switch s.pubKey.(type) {
- case *ecdsaPublicKey:
- signature = Marshal(asn1Sig)
-
- case *dsaPublicKey:
- signature = make([]byte, 40)
- r := asn1Sig.R.Bytes()
- s := asn1Sig.S.Bytes()
- copy(signature[20-len(r):20], r)
- copy(signature[40-len(s):40], s)
- }
- }
-
- return &Signature{
- Format: s.pubKey.Type(),
- Blob: signature,
- }, nil
-}
-
-// NewPublicKey takes an *rsa.PublicKey, *dsa.PublicKey, *ecdsa.PublicKey,
-// or ed25519.PublicKey returns a corresponding PublicKey instance.
-// ECDSA keys must use P-256, P-384 or P-521.
-func NewPublicKey(key interface{}) (PublicKey, error) {
- switch key := key.(type) {
- case *rsa.PublicKey:
- return (*rsaPublicKey)(key), nil
- case *ecdsa.PublicKey:
- if !supportedEllipticCurve(key.Curve) {
- return nil, errors.New("ssh: only P-256, P-384 and P-521 EC keys are supported")
- }
- return (*ecdsaPublicKey)(key), nil
- case *dsa.PublicKey:
- return (*dsaPublicKey)(key), nil
- case ed25519.PublicKey:
- return (ed25519PublicKey)(key), nil
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", key)
- }
-}
-
-// ParsePrivateKey returns a Signer from a PEM encoded private key. It supports
-// the same keys as ParseRawPrivateKey.
-func ParsePrivateKey(pemBytes []byte) (Signer, error) {
- key, err := ParseRawPrivateKey(pemBytes)
- if err != nil {
- return nil, err
- }
-
- return NewSignerFromKey(key)
-}
-
-// ParsePrivateKeyWithPassphrase returns a Signer from a PEM encoded private
-// key and passphrase. It supports the same keys as
-// ParseRawPrivateKeyWithPassphrase.
-func ParsePrivateKeyWithPassphrase(pemBytes, passPhrase []byte) (Signer, error) {
- key, err := ParseRawPrivateKeyWithPassphrase(pemBytes, passPhrase)
- if err != nil {
- return nil, err
- }
-
- return NewSignerFromKey(key)
-}
-
-// encryptedBlock tells whether a private key is
-// encrypted by examining its Proc-Type header
-// for a mention of ENCRYPTED
-// according to RFC 1421 Section 4.6.1.1.
-func encryptedBlock(block *pem.Block) bool {
- return strings.Contains(block.Headers["Proc-Type"], "ENCRYPTED")
-}
-
-// ParseRawPrivateKey returns a private key from a PEM encoded private key. It
-// supports RSA (PKCS#1), PKCS#8, DSA (OpenSSL), and ECDSA private keys.
-func ParseRawPrivateKey(pemBytes []byte) (interface{}, error) {
- block, _ := pem.Decode(pemBytes)
- if block == nil {
- return nil, errors.New("ssh: no key found")
- }
-
- if encryptedBlock(block) {
- return nil, errors.New("ssh: cannot decode encrypted private keys")
- }
-
- switch block.Type {
- case "RSA PRIVATE KEY":
- return x509.ParsePKCS1PrivateKey(block.Bytes)
- // RFC5208 - https://tools.ietf.org/html/rfc5208
- case "PRIVATE KEY":
- return x509.ParsePKCS8PrivateKey(block.Bytes)
- case "EC PRIVATE KEY":
- return x509.ParseECPrivateKey(block.Bytes)
- case "DSA PRIVATE KEY":
- return ParseDSAPrivateKey(block.Bytes)
- case "OPENSSH PRIVATE KEY":
- return parseOpenSSHPrivateKey(block.Bytes)
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %q", block.Type)
- }
-}
-
-// ParseRawPrivateKeyWithPassphrase returns a private key decrypted with
-// passphrase from a PEM encoded private key. If wrong passphrase, return
-// x509.IncorrectPasswordError.
-func ParseRawPrivateKeyWithPassphrase(pemBytes, passPhrase []byte) (interface{}, error) {
- block, _ := pem.Decode(pemBytes)
- if block == nil {
- return nil, errors.New("ssh: no key found")
- }
- buf := block.Bytes
-
- if encryptedBlock(block) {
- if x509.IsEncryptedPEMBlock(block) {
- var err error
- buf, err = x509.DecryptPEMBlock(block, passPhrase)
- if err != nil {
- if err == x509.IncorrectPasswordError {
- return nil, err
- }
- return nil, fmt.Errorf("ssh: cannot decode encrypted private keys: %v", err)
- }
- }
- }
-
- switch block.Type {
- case "RSA PRIVATE KEY":
- return x509.ParsePKCS1PrivateKey(buf)
- case "EC PRIVATE KEY":
- return x509.ParseECPrivateKey(buf)
- case "DSA PRIVATE KEY":
- return ParseDSAPrivateKey(buf)
- case "OPENSSH PRIVATE KEY":
- return parseOpenSSHPrivateKey(buf)
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %q", block.Type)
- }
-}
-
-// ParseDSAPrivateKey returns a DSA private key from its ASN.1 DER encoding, as
-// specified by the OpenSSL DSA man page.
-func ParseDSAPrivateKey(der []byte) (*dsa.PrivateKey, error) {
- var k struct {
- Version int
- P *big.Int
- Q *big.Int
- G *big.Int
- Pub *big.Int
- Priv *big.Int
- }
- rest, err := asn1.Unmarshal(der, &k)
- if err != nil {
- return nil, errors.New("ssh: failed to parse DSA key: " + err.Error())
- }
- if len(rest) > 0 {
- return nil, errors.New("ssh: garbage after DSA key")
- }
-
- return &dsa.PrivateKey{
- PublicKey: dsa.PublicKey{
- Parameters: dsa.Parameters{
- P: k.P,
- Q: k.Q,
- G: k.G,
- },
- Y: k.Pub,
- },
- X: k.Priv,
- }, nil
-}
-
-// Implemented based on the documentation at
-// https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key
-func parseOpenSSHPrivateKey(key []byte) (crypto.PrivateKey, error) {
- const magic = "openssh-key-v1\x00"
- if len(key) < len(magic) || string(key[:len(magic)]) != magic {
- return nil, errors.New("ssh: invalid openssh private key format")
- }
- remaining := key[len(magic):]
-
- var w struct {
- CipherName string
- KdfName string
- KdfOpts string
- NumKeys uint32
- PubKey []byte
- PrivKeyBlock []byte
- }
-
- if err := Unmarshal(remaining, &w); err != nil {
- return nil, err
- }
-
- if w.KdfName != "none" || w.CipherName != "none" {
- return nil, errors.New("ssh: cannot decode encrypted private keys")
- }
-
- pk1 := struct {
- Check1 uint32
- Check2 uint32
- Keytype string
- Rest []byte `ssh:"rest"`
- }{}
-
- if err := Unmarshal(w.PrivKeyBlock, &pk1); err != nil {
- return nil, err
- }
-
- if pk1.Check1 != pk1.Check2 {
- return nil, errors.New("ssh: checkint mismatch")
- }
-
- // we only handle ed25519 and rsa keys currently
- switch pk1.Keytype {
- case KeyAlgoRSA:
- // https://github.com/openssh/openssh-portable/blob/master/sshkey.c#L2760-L2773
- key := struct {
- N *big.Int
- E *big.Int
- D *big.Int
- Iqmp *big.Int
- P *big.Int
- Q *big.Int
- Comment string
- Pad []byte `ssh:"rest"`
- }{}
-
- if err := Unmarshal(pk1.Rest, &key); err != nil {
- return nil, err
- }
-
- for i, b := range key.Pad {
- if int(b) != i+1 {
- return nil, errors.New("ssh: padding not as expected")
- }
- }
-
- pk := &rsa.PrivateKey{
- PublicKey: rsa.PublicKey{
- N: key.N,
- E: int(key.E.Int64()),
- },
- D: key.D,
- Primes: []*big.Int{key.P, key.Q},
- }
-
- if err := pk.Validate(); err != nil {
- return nil, err
- }
-
- pk.Precompute()
-
- return pk, nil
- case KeyAlgoED25519:
- key := struct {
- Pub []byte
- Priv []byte
- Comment string
- Pad []byte `ssh:"rest"`
- }{}
-
- if err := Unmarshal(pk1.Rest, &key); err != nil {
- return nil, err
- }
-
- if len(key.Priv) != ed25519.PrivateKeySize {
- return nil, errors.New("ssh: private key unexpected length")
- }
-
- for i, b := range key.Pad {
- if int(b) != i+1 {
- return nil, errors.New("ssh: padding not as expected")
- }
- }
-
- pk := ed25519.PrivateKey(make([]byte, ed25519.PrivateKeySize))
- copy(pk, key.Priv)
- return &pk, nil
- default:
- return nil, errors.New("ssh: unhandled key type")
- }
-}
-
-// FingerprintLegacyMD5 returns the user presentation of the key's
-// fingerprint as described by RFC 4716 section 4.
-func FingerprintLegacyMD5(pubKey PublicKey) string {
- md5sum := md5.Sum(pubKey.Marshal())
- hexarray := make([]string, len(md5sum))
- for i, c := range md5sum {
- hexarray[i] = hex.EncodeToString([]byte{c})
- }
- return strings.Join(hexarray, ":")
-}
-
-// FingerprintSHA256 returns the user presentation of the key's
-// fingerprint as unpadded base64 encoded sha256 hash.
-// This format was introduced from OpenSSH 6.8.
-// https://www.openssh.com/txt/release-6.8
-// https://tools.ietf.org/html/rfc4648#section-3.2 (unpadded base64 encoding)
-func FingerprintSHA256(pubKey PublicKey) string {
- sha256sum := sha256.Sum256(pubKey.Marshal())
- hash := base64.RawStdEncoding.EncodeToString(sha256sum[:])
- return "SHA256:" + hash
-}
diff --git a/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go b/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go
deleted file mode 100644
index bc3db737..00000000
--- a/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go
+++ /dev/null
@@ -1,540 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package knownhosts implements a parser for the OpenSSH known_hosts
-// host key database, and provides utility functions for writing
-// OpenSSH compliant known_hosts files.
-package knownhosts
-
-import (
- "bufio"
- "bytes"
- "crypto/hmac"
- "crypto/rand"
- "crypto/sha1"
- "encoding/base64"
- "errors"
- "fmt"
- "io"
- "net"
- "os"
- "strings"
-
- "golang.org/x/crypto/ssh"
-)
-
-// See the sshd manpage
-// (http://man.openbsd.org/sshd#SSH_KNOWN_HOSTS_FILE_FORMAT) for
-// background.
-
-type addr struct{ host, port string }
-
-func (a *addr) String() string {
- h := a.host
- if strings.Contains(h, ":") {
- h = "[" + h + "]"
- }
- return h + ":" + a.port
-}
-
-type matcher interface {
- match(addr) bool
-}
-
-type hostPattern struct {
- negate bool
- addr addr
-}
-
-func (p *hostPattern) String() string {
- n := ""
- if p.negate {
- n = "!"
- }
-
- return n + p.addr.String()
-}
-
-type hostPatterns []hostPattern
-
-func (ps hostPatterns) match(a addr) bool {
- matched := false
- for _, p := range ps {
- if !p.match(a) {
- continue
- }
- if p.negate {
- return false
- }
- matched = true
- }
- return matched
-}
-
-// See
-// https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/addrmatch.c
-// The matching of * has no regard for separators, unlike filesystem globs
-func wildcardMatch(pat []byte, str []byte) bool {
- for {
- if len(pat) == 0 {
- return len(str) == 0
- }
- if len(str) == 0 {
- return false
- }
-
- if pat[0] == '*' {
- if len(pat) == 1 {
- return true
- }
-
- for j := range str {
- if wildcardMatch(pat[1:], str[j:]) {
- return true
- }
- }
- return false
- }
-
- if pat[0] == '?' || pat[0] == str[0] {
- pat = pat[1:]
- str = str[1:]
- } else {
- return false
- }
- }
-}
-
-func (p *hostPattern) match(a addr) bool {
- return wildcardMatch([]byte(p.addr.host), []byte(a.host)) && p.addr.port == a.port
-}
-
-type keyDBLine struct {
- cert bool
- matcher matcher
- knownKey KnownKey
-}
-
-func serialize(k ssh.PublicKey) string {
- return k.Type() + " " + base64.StdEncoding.EncodeToString(k.Marshal())
-}
-
-func (l *keyDBLine) match(a addr) bool {
- return l.matcher.match(a)
-}
-
-type hostKeyDB struct {
- // Serialized version of revoked keys
- revoked map[string]*KnownKey
- lines []keyDBLine
-}
-
-func newHostKeyDB() *hostKeyDB {
- db := &hostKeyDB{
- revoked: make(map[string]*KnownKey),
- }
-
- return db
-}
-
-func keyEq(a, b ssh.PublicKey) bool {
- return bytes.Equal(a.Marshal(), b.Marshal())
-}
-
-// IsAuthorityForHost can be used as a callback in ssh.CertChecker
-func (db *hostKeyDB) IsHostAuthority(remote ssh.PublicKey, address string) bool {
- h, p, err := net.SplitHostPort(address)
- if err != nil {
- return false
- }
- a := addr{host: h, port: p}
-
- for _, l := range db.lines {
- if l.cert && keyEq(l.knownKey.Key, remote) && l.match(a) {
- return true
- }
- }
- return false
-}
-
-// IsRevoked can be used as a callback in ssh.CertChecker
-func (db *hostKeyDB) IsRevoked(key *ssh.Certificate) bool {
- _, ok := db.revoked[string(key.Marshal())]
- return ok
-}
-
-const markerCert = "@cert-authority"
-const markerRevoked = "@revoked"
-
-func nextWord(line []byte) (string, []byte) {
- i := bytes.IndexAny(line, "\t ")
- if i == -1 {
- return string(line), nil
- }
-
- return string(line[:i]), bytes.TrimSpace(line[i:])
-}
-
-func parseLine(line []byte) (marker, host string, key ssh.PublicKey, err error) {
- if w, next := nextWord(line); w == markerCert || w == markerRevoked {
- marker = w
- line = next
- }
-
- host, line = nextWord(line)
- if len(line) == 0 {
- return "", "", nil, errors.New("knownhosts: missing host pattern")
- }
-
- // ignore the keytype as it's in the key blob anyway.
- _, line = nextWord(line)
- if len(line) == 0 {
- return "", "", nil, errors.New("knownhosts: missing key type pattern")
- }
-
- keyBlob, _ := nextWord(line)
-
- keyBytes, err := base64.StdEncoding.DecodeString(keyBlob)
- if err != nil {
- return "", "", nil, err
- }
- key, err = ssh.ParsePublicKey(keyBytes)
- if err != nil {
- return "", "", nil, err
- }
-
- return marker, host, key, nil
-}
-
-func (db *hostKeyDB) parseLine(line []byte, filename string, linenum int) error {
- marker, pattern, key, err := parseLine(line)
- if err != nil {
- return err
- }
-
- if marker == markerRevoked {
- db.revoked[string(key.Marshal())] = &KnownKey{
- Key: key,
- Filename: filename,
- Line: linenum,
- }
-
- return nil
- }
-
- entry := keyDBLine{
- cert: marker == markerCert,
- knownKey: KnownKey{
- Filename: filename,
- Line: linenum,
- Key: key,
- },
- }
-
- if pattern[0] == '|' {
- entry.matcher, err = newHashedHost(pattern)
- } else {
- entry.matcher, err = newHostnameMatcher(pattern)
- }
-
- if err != nil {
- return err
- }
-
- db.lines = append(db.lines, entry)
- return nil
-}
-
-func newHostnameMatcher(pattern string) (matcher, error) {
- var hps hostPatterns
- for _, p := range strings.Split(pattern, ",") {
- if len(p) == 0 {
- continue
- }
-
- var a addr
- var negate bool
- if p[0] == '!' {
- negate = true
- p = p[1:]
- }
-
- if len(p) == 0 {
- return nil, errors.New("knownhosts: negation without following hostname")
- }
-
- var err error
- if p[0] == '[' {
- a.host, a.port, err = net.SplitHostPort(p)
- if err != nil {
- return nil, err
- }
- } else {
- a.host, a.port, err = net.SplitHostPort(p)
- if err != nil {
- a.host = p
- a.port = "22"
- }
- }
- hps = append(hps, hostPattern{
- negate: negate,
- addr: a,
- })
- }
- return hps, nil
-}
-
-// KnownKey represents a key declared in a known_hosts file.
-type KnownKey struct {
- Key ssh.PublicKey
- Filename string
- Line int
-}
-
-func (k *KnownKey) String() string {
- return fmt.Sprintf("%s:%d: %s", k.Filename, k.Line, serialize(k.Key))
-}
-
-// KeyError is returned if we did not find the key in the host key
-// database, or there was a mismatch. Typically, in batch
-// applications, this should be interpreted as failure. Interactive
-// applications can offer an interactive prompt to the user.
-type KeyError struct {
- // Want holds the accepted host keys. For each key algorithm,
- // there can be one hostkey. If Want is empty, the host is
- // unknown. If Want is non-empty, there was a mismatch, which
- // can signify a MITM attack.
- Want []KnownKey
-}
-
-func (u *KeyError) Error() string {
- if len(u.Want) == 0 {
- return "knownhosts: key is unknown"
- }
- return "knownhosts: key mismatch"
-}
-
-// RevokedError is returned if we found a key that was revoked.
-type RevokedError struct {
- Revoked KnownKey
-}
-
-func (r *RevokedError) Error() string {
- return "knownhosts: key is revoked"
-}
-
-// check checks a key against the host database. This should not be
-// used for verifying certificates.
-func (db *hostKeyDB) check(address string, remote net.Addr, remoteKey ssh.PublicKey) error {
- if revoked := db.revoked[string(remoteKey.Marshal())]; revoked != nil {
- return &RevokedError{Revoked: *revoked}
- }
-
- host, port, err := net.SplitHostPort(remote.String())
- if err != nil {
- return fmt.Errorf("knownhosts: SplitHostPort(%s): %v", remote, err)
- }
-
- hostToCheck := addr{host, port}
- if address != "" {
- // Give preference to the hostname if available.
- host, port, err := net.SplitHostPort(address)
- if err != nil {
- return fmt.Errorf("knownhosts: SplitHostPort(%s): %v", address, err)
- }
-
- hostToCheck = addr{host, port}
- }
-
- return db.checkAddr(hostToCheck, remoteKey)
-}
-
-// checkAddrs checks if we can find the given public key for any of
-// the given addresses. If we only find an entry for the IP address,
-// or only the hostname, then this still succeeds.
-func (db *hostKeyDB) checkAddr(a addr, remoteKey ssh.PublicKey) error {
- // TODO(hanwen): are these the right semantics? What if there
- // is just a key for the IP address, but not for the
- // hostname?
-
- // Algorithm => key.
- knownKeys := map[string]KnownKey{}
- for _, l := range db.lines {
- if l.match(a) {
- typ := l.knownKey.Key.Type()
- if _, ok := knownKeys[typ]; !ok {
- knownKeys[typ] = l.knownKey
- }
- }
- }
-
- keyErr := &KeyError{}
- for _, v := range knownKeys {
- keyErr.Want = append(keyErr.Want, v)
- }
-
- // Unknown remote host.
- if len(knownKeys) == 0 {
- return keyErr
- }
-
- // If the remote host starts using a different, unknown key type, we
- // also interpret that as a mismatch.
- if known, ok := knownKeys[remoteKey.Type()]; !ok || !keyEq(known.Key, remoteKey) {
- return keyErr
- }
-
- return nil
-}
-
-// The Read function parses file contents.
-func (db *hostKeyDB) Read(r io.Reader, filename string) error {
- scanner := bufio.NewScanner(r)
-
- lineNum := 0
- for scanner.Scan() {
- lineNum++
- line := scanner.Bytes()
- line = bytes.TrimSpace(line)
- if len(line) == 0 || line[0] == '#' {
- continue
- }
-
- if err := db.parseLine(line, filename, lineNum); err != nil {
- return fmt.Errorf("knownhosts: %s:%d: %v", filename, lineNum, err)
- }
- }
- return scanner.Err()
-}
-
-// New creates a host key callback from the given OpenSSH host key
-// files. The returned callback is for use in
-// ssh.ClientConfig.HostKeyCallback. By preference, the key check
-// operates on the hostname if available, i.e. if a server changes its
-// IP address, the host key check will still succeed, even though a
-// record of the new IP address is not available.
-func New(files ...string) (ssh.HostKeyCallback, error) {
- db := newHostKeyDB()
- for _, fn := range files {
- f, err := os.Open(fn)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- if err := db.Read(f, fn); err != nil {
- return nil, err
- }
- }
-
- var certChecker ssh.CertChecker
- certChecker.IsHostAuthority = db.IsHostAuthority
- certChecker.IsRevoked = db.IsRevoked
- certChecker.HostKeyFallback = db.check
-
- return certChecker.CheckHostKey, nil
-}
-
-// Normalize normalizes an address into the form used in known_hosts
-func Normalize(address string) string {
- host, port, err := net.SplitHostPort(address)
- if err != nil {
- host = address
- port = "22"
- }
- entry := host
- if port != "22" {
- entry = "[" + entry + "]:" + port
- } else if strings.Contains(host, ":") && !strings.HasPrefix(host, "[") {
- entry = "[" + entry + "]"
- }
- return entry
-}
-
-// Line returns a line to add append to the known_hosts files.
-func Line(addresses []string, key ssh.PublicKey) string {
- var trimmed []string
- for _, a := range addresses {
- trimmed = append(trimmed, Normalize(a))
- }
-
- return strings.Join(trimmed, ",") + " " + serialize(key)
-}
-
-// HashHostname hashes the given hostname. The hostname is not
-// normalized before hashing.
-func HashHostname(hostname string) string {
- // TODO(hanwen): check if we can safely normalize this always.
- salt := make([]byte, sha1.Size)
-
- _, err := rand.Read(salt)
- if err != nil {
- panic(fmt.Sprintf("crypto/rand failure %v", err))
- }
-
- hash := hashHost(hostname, salt)
- return encodeHash(sha1HashType, salt, hash)
-}
-
-func decodeHash(encoded string) (hashType string, salt, hash []byte, err error) {
- if len(encoded) == 0 || encoded[0] != '|' {
- err = errors.New("knownhosts: hashed host must start with '|'")
- return
- }
- components := strings.Split(encoded, "|")
- if len(components) != 4 {
- err = fmt.Errorf("knownhosts: got %d components, want 3", len(components))
- return
- }
-
- hashType = components[1]
- if salt, err = base64.StdEncoding.DecodeString(components[2]); err != nil {
- return
- }
- if hash, err = base64.StdEncoding.DecodeString(components[3]); err != nil {
- return
- }
- return
-}
-
-func encodeHash(typ string, salt []byte, hash []byte) string {
- return strings.Join([]string{"",
- typ,
- base64.StdEncoding.EncodeToString(salt),
- base64.StdEncoding.EncodeToString(hash),
- }, "|")
-}
-
-// See https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/hostfile.c#120
-func hashHost(hostname string, salt []byte) []byte {
- mac := hmac.New(sha1.New, salt)
- mac.Write([]byte(hostname))
- return mac.Sum(nil)
-}
-
-type hashedHost struct {
- salt []byte
- hash []byte
-}
-
-const sha1HashType = "1"
-
-func newHashedHost(encoded string) (*hashedHost, error) {
- typ, salt, hash, err := decodeHash(encoded)
- if err != nil {
- return nil, err
- }
-
- // The type field seems for future algorithm agility, but it's
- // actually hardcoded in openssh currently, see
- // https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/hostfile.c#120
- if typ != sha1HashType {
- return nil, fmt.Errorf("knownhosts: got hash type %s, must be '1'", typ)
- }
-
- return &hashedHost{salt: salt, hash: hash}, nil
-}
-
-func (h *hashedHost) match(a addr) bool {
- return bytes.Equal(hashHost(Normalize(a.String()), h.salt), h.hash)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/mac.go b/vendor/golang.org/x/crypto/ssh/mac.go
deleted file mode 100644
index c07a0628..00000000
--- a/vendor/golang.org/x/crypto/ssh/mac.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Message authentication support
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "crypto/sha256"
- "hash"
-)
-
-type macMode struct {
- keySize int
- etm bool
- new func(key []byte) hash.Hash
-}
-
-// truncatingMAC wraps around a hash.Hash and truncates the output digest to
-// a given size.
-type truncatingMAC struct {
- length int
- hmac hash.Hash
-}
-
-func (t truncatingMAC) Write(data []byte) (int, error) {
- return t.hmac.Write(data)
-}
-
-func (t truncatingMAC) Sum(in []byte) []byte {
- out := t.hmac.Sum(in)
- return out[:len(in)+t.length]
-}
-
-func (t truncatingMAC) Reset() {
- t.hmac.Reset()
-}
-
-func (t truncatingMAC) Size() int {
- return t.length
-}
-
-func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() }
-
-var macModes = map[string]*macMode{
- "hmac-sha2-256-etm@openssh.com": {32, true, func(key []byte) hash.Hash {
- return hmac.New(sha256.New, key)
- }},
- "hmac-sha2-256": {32, false, func(key []byte) hash.Hash {
- return hmac.New(sha256.New, key)
- }},
- "hmac-sha1": {20, false, func(key []byte) hash.Hash {
- return hmac.New(sha1.New, key)
- }},
- "hmac-sha1-96": {20, false, func(key []byte) hash.Hash {
- return truncatingMAC{12, hmac.New(sha1.New, key)}
- }},
-}
diff --git a/vendor/golang.org/x/crypto/ssh/messages.go b/vendor/golang.org/x/crypto/ssh/messages.go
deleted file mode 100644
index 08d28117..00000000
--- a/vendor/golang.org/x/crypto/ssh/messages.go
+++ /dev/null
@@ -1,766 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "math/big"
- "reflect"
- "strconv"
- "strings"
-)
-
-// These are SSH message type numbers. They are scattered around several
-// documents but many were taken from [SSH-PARAMETERS].
-const (
- msgIgnore = 2
- msgUnimplemented = 3
- msgDebug = 4
- msgNewKeys = 21
-)
-
-// SSH messages:
-//
-// These structures mirror the wire format of the corresponding SSH messages.
-// They are marshaled using reflection with the marshal and unmarshal functions
-// in this file. The only wrinkle is that a final member of type []byte with a
-// ssh tag of "rest" receives the remainder of a packet when unmarshaling.
-
-// See RFC 4253, section 11.1.
-const msgDisconnect = 1
-
-// disconnectMsg is the message that signals a disconnect. It is also
-// the error type returned from mux.Wait()
-type disconnectMsg struct {
- Reason uint32 `sshtype:"1"`
- Message string
- Language string
-}
-
-func (d *disconnectMsg) Error() string {
- return fmt.Sprintf("ssh: disconnect, reason %d: %s", d.Reason, d.Message)
-}
-
-// See RFC 4253, section 7.1.
-const msgKexInit = 20
-
-type kexInitMsg struct {
- Cookie [16]byte `sshtype:"20"`
- KexAlgos []string
- ServerHostKeyAlgos []string
- CiphersClientServer []string
- CiphersServerClient []string
- MACsClientServer []string
- MACsServerClient []string
- CompressionClientServer []string
- CompressionServerClient []string
- LanguagesClientServer []string
- LanguagesServerClient []string
- FirstKexFollows bool
- Reserved uint32
-}
-
-// See RFC 4253, section 8.
-
-// Diffie-Helman
-const msgKexDHInit = 30
-
-type kexDHInitMsg struct {
- X *big.Int `sshtype:"30"`
-}
-
-const msgKexECDHInit = 30
-
-type kexECDHInitMsg struct {
- ClientPubKey []byte `sshtype:"30"`
-}
-
-const msgKexECDHReply = 31
-
-type kexECDHReplyMsg struct {
- HostKey []byte `sshtype:"31"`
- EphemeralPubKey []byte
- Signature []byte
-}
-
-const msgKexDHReply = 31
-
-type kexDHReplyMsg struct {
- HostKey []byte `sshtype:"31"`
- Y *big.Int
- Signature []byte
-}
-
-// See RFC 4253, section 10.
-const msgServiceRequest = 5
-
-type serviceRequestMsg struct {
- Service string `sshtype:"5"`
-}
-
-// See RFC 4253, section 10.
-const msgServiceAccept = 6
-
-type serviceAcceptMsg struct {
- Service string `sshtype:"6"`
-}
-
-// See RFC 4252, section 5.
-const msgUserAuthRequest = 50
-
-type userAuthRequestMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Payload []byte `ssh:"rest"`
-}
-
-// Used for debug printouts of packets.
-type userAuthSuccessMsg struct {
-}
-
-// See RFC 4252, section 5.1
-const msgUserAuthFailure = 51
-
-type userAuthFailureMsg struct {
- Methods []string `sshtype:"51"`
- PartialSuccess bool
-}
-
-// See RFC 4252, section 5.1
-const msgUserAuthSuccess = 52
-
-// See RFC 4252, section 5.4
-const msgUserAuthBanner = 53
-
-type userAuthBannerMsg struct {
- Message string `sshtype:"53"`
- // unused, but required to allow message parsing
- Language string
-}
-
-// See RFC 4256, section 3.2
-const msgUserAuthInfoRequest = 60
-const msgUserAuthInfoResponse = 61
-
-type userAuthInfoRequestMsg struct {
- User string `sshtype:"60"`
- Instruction string
- DeprecatedLanguage string
- NumPrompts uint32
- Prompts []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.1.
-const msgChannelOpen = 90
-
-type channelOpenMsg struct {
- ChanType string `sshtype:"90"`
- PeersID uint32
- PeersWindow uint32
- MaxPacketSize uint32
- TypeSpecificData []byte `ssh:"rest"`
-}
-
-const msgChannelExtendedData = 95
-const msgChannelData = 94
-
-// Used for debug print outs of packets.
-type channelDataMsg struct {
- PeersID uint32 `sshtype:"94"`
- Length uint32
- Rest []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.1.
-const msgChannelOpenConfirm = 91
-
-type channelOpenConfirmMsg struct {
- PeersID uint32 `sshtype:"91"`
- MyID uint32
- MyWindow uint32
- MaxPacketSize uint32
- TypeSpecificData []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.1.
-const msgChannelOpenFailure = 92
-
-type channelOpenFailureMsg struct {
- PeersID uint32 `sshtype:"92"`
- Reason RejectionReason
- Message string
- Language string
-}
-
-const msgChannelRequest = 98
-
-type channelRequestMsg struct {
- PeersID uint32 `sshtype:"98"`
- Request string
- WantReply bool
- RequestSpecificData []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.4.
-const msgChannelSuccess = 99
-
-type channelRequestSuccessMsg struct {
- PeersID uint32 `sshtype:"99"`
-}
-
-// See RFC 4254, section 5.4.
-const msgChannelFailure = 100
-
-type channelRequestFailureMsg struct {
- PeersID uint32 `sshtype:"100"`
-}
-
-// See RFC 4254, section 5.3
-const msgChannelClose = 97
-
-type channelCloseMsg struct {
- PeersID uint32 `sshtype:"97"`
-}
-
-// See RFC 4254, section 5.3
-const msgChannelEOF = 96
-
-type channelEOFMsg struct {
- PeersID uint32 `sshtype:"96"`
-}
-
-// See RFC 4254, section 4
-const msgGlobalRequest = 80
-
-type globalRequestMsg struct {
- Type string `sshtype:"80"`
- WantReply bool
- Data []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 4
-const msgRequestSuccess = 81
-
-type globalRequestSuccessMsg struct {
- Data []byte `ssh:"rest" sshtype:"81"`
-}
-
-// See RFC 4254, section 4
-const msgRequestFailure = 82
-
-type globalRequestFailureMsg struct {
- Data []byte `ssh:"rest" sshtype:"82"`
-}
-
-// See RFC 4254, section 5.2
-const msgChannelWindowAdjust = 93
-
-type windowAdjustMsg struct {
- PeersID uint32 `sshtype:"93"`
- AdditionalBytes uint32
-}
-
-// See RFC 4252, section 7
-const msgUserAuthPubKeyOk = 60
-
-type userAuthPubKeyOkMsg struct {
- Algo string `sshtype:"60"`
- PubKey []byte
-}
-
-// typeTags returns the possible type bytes for the given reflect.Type, which
-// should be a struct. The possible values are separated by a '|' character.
-func typeTags(structType reflect.Type) (tags []byte) {
- tagStr := structType.Field(0).Tag.Get("sshtype")
-
- for _, tag := range strings.Split(tagStr, "|") {
- i, err := strconv.Atoi(tag)
- if err == nil {
- tags = append(tags, byte(i))
- }
- }
-
- return tags
-}
-
-func fieldError(t reflect.Type, field int, problem string) error {
- if problem != "" {
- problem = ": " + problem
- }
- return fmt.Errorf("ssh: unmarshal error for field %s of type %s%s", t.Field(field).Name, t.Name(), problem)
-}
-
-var errShortRead = errors.New("ssh: short read")
-
-// Unmarshal parses data in SSH wire format into a structure. The out
-// argument should be a pointer to struct. If the first member of the
-// struct has the "sshtype" tag set to a '|'-separated set of numbers
-// in decimal, the packet must start with one of those numbers. In
-// case of error, Unmarshal returns a ParseError or
-// UnexpectedMessageError.
-func Unmarshal(data []byte, out interface{}) error {
- v := reflect.ValueOf(out).Elem()
- structType := v.Type()
- expectedTypes := typeTags(structType)
-
- var expectedType byte
- if len(expectedTypes) > 0 {
- expectedType = expectedTypes[0]
- }
-
- if len(data) == 0 {
- return parseError(expectedType)
- }
-
- if len(expectedTypes) > 0 {
- goodType := false
- for _, e := range expectedTypes {
- if e > 0 && data[0] == e {
- goodType = true
- break
- }
- }
- if !goodType {
- return fmt.Errorf("ssh: unexpected message type %d (expected one of %v)", data[0], expectedTypes)
- }
- data = data[1:]
- }
-
- var ok bool
- for i := 0; i < v.NumField(); i++ {
- field := v.Field(i)
- t := field.Type()
- switch t.Kind() {
- case reflect.Bool:
- if len(data) < 1 {
- return errShortRead
- }
- field.SetBool(data[0] != 0)
- data = data[1:]
- case reflect.Array:
- if t.Elem().Kind() != reflect.Uint8 {
- return fieldError(structType, i, "array of unsupported type")
- }
- if len(data) < t.Len() {
- return errShortRead
- }
- for j, n := 0, t.Len(); j < n; j++ {
- field.Index(j).Set(reflect.ValueOf(data[j]))
- }
- data = data[t.Len():]
- case reflect.Uint64:
- var u64 uint64
- if u64, data, ok = parseUint64(data); !ok {
- return errShortRead
- }
- field.SetUint(u64)
- case reflect.Uint32:
- var u32 uint32
- if u32, data, ok = parseUint32(data); !ok {
- return errShortRead
- }
- field.SetUint(uint64(u32))
- case reflect.Uint8:
- if len(data) < 1 {
- return errShortRead
- }
- field.SetUint(uint64(data[0]))
- data = data[1:]
- case reflect.String:
- var s []byte
- if s, data, ok = parseString(data); !ok {
- return fieldError(structType, i, "")
- }
- field.SetString(string(s))
- case reflect.Slice:
- switch t.Elem().Kind() {
- case reflect.Uint8:
- if structType.Field(i).Tag.Get("ssh") == "rest" {
- field.Set(reflect.ValueOf(data))
- data = nil
- } else {
- var s []byte
- if s, data, ok = parseString(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(s))
- }
- case reflect.String:
- var nl []string
- if nl, data, ok = parseNameList(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(nl))
- default:
- return fieldError(structType, i, "slice of unsupported type")
- }
- case reflect.Ptr:
- if t == bigIntType {
- var n *big.Int
- if n, data, ok = parseInt(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(n))
- } else {
- return fieldError(structType, i, "pointer to unsupported type")
- }
- default:
- return fieldError(structType, i, fmt.Sprintf("unsupported type: %v", t))
- }
- }
-
- if len(data) != 0 {
- return parseError(expectedType)
- }
-
- return nil
-}
-
-// Marshal serializes the message in msg to SSH wire format. The msg
-// argument should be a struct or pointer to struct. If the first
-// member has the "sshtype" tag set to a number in decimal, that
-// number is prepended to the result. If the last of member has the
-// "ssh" tag set to "rest", its contents are appended to the output.
-func Marshal(msg interface{}) []byte {
- out := make([]byte, 0, 64)
- return marshalStruct(out, msg)
-}
-
-func marshalStruct(out []byte, msg interface{}) []byte {
- v := reflect.Indirect(reflect.ValueOf(msg))
- msgTypes := typeTags(v.Type())
- if len(msgTypes) > 0 {
- out = append(out, msgTypes[0])
- }
-
- for i, n := 0, v.NumField(); i < n; i++ {
- field := v.Field(i)
- switch t := field.Type(); t.Kind() {
- case reflect.Bool:
- var v uint8
- if field.Bool() {
- v = 1
- }
- out = append(out, v)
- case reflect.Array:
- if t.Elem().Kind() != reflect.Uint8 {
- panic(fmt.Sprintf("array of non-uint8 in field %d: %T", i, field.Interface()))
- }
- for j, l := 0, t.Len(); j < l; j++ {
- out = append(out, uint8(field.Index(j).Uint()))
- }
- case reflect.Uint32:
- out = appendU32(out, uint32(field.Uint()))
- case reflect.Uint64:
- out = appendU64(out, uint64(field.Uint()))
- case reflect.Uint8:
- out = append(out, uint8(field.Uint()))
- case reflect.String:
- s := field.String()
- out = appendInt(out, len(s))
- out = append(out, s...)
- case reflect.Slice:
- switch t.Elem().Kind() {
- case reflect.Uint8:
- if v.Type().Field(i).Tag.Get("ssh") != "rest" {
- out = appendInt(out, field.Len())
- }
- out = append(out, field.Bytes()...)
- case reflect.String:
- offset := len(out)
- out = appendU32(out, 0)
- if n := field.Len(); n > 0 {
- for j := 0; j < n; j++ {
- f := field.Index(j)
- if j != 0 {
- out = append(out, ',')
- }
- out = append(out, f.String()...)
- }
- // overwrite length value
- binary.BigEndian.PutUint32(out[offset:], uint32(len(out)-offset-4))
- }
- default:
- panic(fmt.Sprintf("slice of unknown type in field %d: %T", i, field.Interface()))
- }
- case reflect.Ptr:
- if t == bigIntType {
- var n *big.Int
- nValue := reflect.ValueOf(&n)
- nValue.Elem().Set(field)
- needed := intLength(n)
- oldLength := len(out)
-
- if cap(out)-len(out) < needed {
- newOut := make([]byte, len(out), 2*(len(out)+needed))
- copy(newOut, out)
- out = newOut
- }
- out = out[:oldLength+needed]
- marshalInt(out[oldLength:], n)
- } else {
- panic(fmt.Sprintf("pointer to unknown type in field %d: %T", i, field.Interface()))
- }
- }
- }
-
- return out
-}
-
-var bigOne = big.NewInt(1)
-
-func parseString(in []byte) (out, rest []byte, ok bool) {
- if len(in) < 4 {
- return
- }
- length := binary.BigEndian.Uint32(in)
- in = in[4:]
- if uint32(len(in)) < length {
- return
- }
- out = in[:length]
- rest = in[length:]
- ok = true
- return
-}
-
-var (
- comma = []byte{','}
- emptyNameList = []string{}
-)
-
-func parseNameList(in []byte) (out []string, rest []byte, ok bool) {
- contents, rest, ok := parseString(in)
- if !ok {
- return
- }
- if len(contents) == 0 {
- out = emptyNameList
- return
- }
- parts := bytes.Split(contents, comma)
- out = make([]string, len(parts))
- for i, part := range parts {
- out[i] = string(part)
- }
- return
-}
-
-func parseInt(in []byte) (out *big.Int, rest []byte, ok bool) {
- contents, rest, ok := parseString(in)
- if !ok {
- return
- }
- out = new(big.Int)
-
- if len(contents) > 0 && contents[0]&0x80 == 0x80 {
- // This is a negative number
- notBytes := make([]byte, len(contents))
- for i := range notBytes {
- notBytes[i] = ^contents[i]
- }
- out.SetBytes(notBytes)
- out.Add(out, bigOne)
- out.Neg(out)
- } else {
- // Positive number
- out.SetBytes(contents)
- }
- ok = true
- return
-}
-
-func parseUint32(in []byte) (uint32, []byte, bool) {
- if len(in) < 4 {
- return 0, nil, false
- }
- return binary.BigEndian.Uint32(in), in[4:], true
-}
-
-func parseUint64(in []byte) (uint64, []byte, bool) {
- if len(in) < 8 {
- return 0, nil, false
- }
- return binary.BigEndian.Uint64(in), in[8:], true
-}
-
-func intLength(n *big.Int) int {
- length := 4 /* length bytes */
- if n.Sign() < 0 {
- nMinus1 := new(big.Int).Neg(n)
- nMinus1.Sub(nMinus1, bigOne)
- bitLen := nMinus1.BitLen()
- if bitLen%8 == 0 {
- // The number will need 0xff padding
- length++
- }
- length += (bitLen + 7) / 8
- } else if n.Sign() == 0 {
- // A zero is the zero length string
- } else {
- bitLen := n.BitLen()
- if bitLen%8 == 0 {
- // The number will need 0x00 padding
- length++
- }
- length += (bitLen + 7) / 8
- }
-
- return length
-}
-
-func marshalUint32(to []byte, n uint32) []byte {
- binary.BigEndian.PutUint32(to, n)
- return to[4:]
-}
-
-func marshalUint64(to []byte, n uint64) []byte {
- binary.BigEndian.PutUint64(to, n)
- return to[8:]
-}
-
-func marshalInt(to []byte, n *big.Int) []byte {
- lengthBytes := to
- to = to[4:]
- length := 0
-
- if n.Sign() < 0 {
- // A negative number has to be converted to two's-complement
- // form. So we'll subtract 1 and invert. If the
- // most-significant-bit isn't set then we'll need to pad the
- // beginning with 0xff in order to keep the number negative.
- nMinus1 := new(big.Int).Neg(n)
- nMinus1.Sub(nMinus1, bigOne)
- bytes := nMinus1.Bytes()
- for i := range bytes {
- bytes[i] ^= 0xff
- }
- if len(bytes) == 0 || bytes[0]&0x80 == 0 {
- to[0] = 0xff
- to = to[1:]
- length++
- }
- nBytes := copy(to, bytes)
- to = to[nBytes:]
- length += nBytes
- } else if n.Sign() == 0 {
- // A zero is the zero length string
- } else {
- bytes := n.Bytes()
- if len(bytes) > 0 && bytes[0]&0x80 != 0 {
- // We'll have to pad this with a 0x00 in order to
- // stop it looking like a negative number.
- to[0] = 0
- to = to[1:]
- length++
- }
- nBytes := copy(to, bytes)
- to = to[nBytes:]
- length += nBytes
- }
-
- lengthBytes[0] = byte(length >> 24)
- lengthBytes[1] = byte(length >> 16)
- lengthBytes[2] = byte(length >> 8)
- lengthBytes[3] = byte(length)
- return to
-}
-
-func writeInt(w io.Writer, n *big.Int) {
- length := intLength(n)
- buf := make([]byte, length)
- marshalInt(buf, n)
- w.Write(buf)
-}
-
-func writeString(w io.Writer, s []byte) {
- var lengthBytes [4]byte
- lengthBytes[0] = byte(len(s) >> 24)
- lengthBytes[1] = byte(len(s) >> 16)
- lengthBytes[2] = byte(len(s) >> 8)
- lengthBytes[3] = byte(len(s))
- w.Write(lengthBytes[:])
- w.Write(s)
-}
-
-func stringLength(n int) int {
- return 4 + n
-}
-
-func marshalString(to []byte, s []byte) []byte {
- to[0] = byte(len(s) >> 24)
- to[1] = byte(len(s) >> 16)
- to[2] = byte(len(s) >> 8)
- to[3] = byte(len(s))
- to = to[4:]
- copy(to, s)
- return to[len(s):]
-}
-
-var bigIntType = reflect.TypeOf((*big.Int)(nil))
-
-// Decode a packet into its corresponding message.
-func decode(packet []byte) (interface{}, error) {
- var msg interface{}
- switch packet[0] {
- case msgDisconnect:
- msg = new(disconnectMsg)
- case msgServiceRequest:
- msg = new(serviceRequestMsg)
- case msgServiceAccept:
- msg = new(serviceAcceptMsg)
- case msgKexInit:
- msg = new(kexInitMsg)
- case msgKexDHInit:
- msg = new(kexDHInitMsg)
- case msgKexDHReply:
- msg = new(kexDHReplyMsg)
- case msgUserAuthRequest:
- msg = new(userAuthRequestMsg)
- case msgUserAuthSuccess:
- return new(userAuthSuccessMsg), nil
- case msgUserAuthFailure:
- msg = new(userAuthFailureMsg)
- case msgUserAuthPubKeyOk:
- msg = new(userAuthPubKeyOkMsg)
- case msgGlobalRequest:
- msg = new(globalRequestMsg)
- case msgRequestSuccess:
- msg = new(globalRequestSuccessMsg)
- case msgRequestFailure:
- msg = new(globalRequestFailureMsg)
- case msgChannelOpen:
- msg = new(channelOpenMsg)
- case msgChannelData:
- msg = new(channelDataMsg)
- case msgChannelOpenConfirm:
- msg = new(channelOpenConfirmMsg)
- case msgChannelOpenFailure:
- msg = new(channelOpenFailureMsg)
- case msgChannelWindowAdjust:
- msg = new(windowAdjustMsg)
- case msgChannelEOF:
- msg = new(channelEOFMsg)
- case msgChannelClose:
- msg = new(channelCloseMsg)
- case msgChannelRequest:
- msg = new(channelRequestMsg)
- case msgChannelSuccess:
- msg = new(channelRequestSuccessMsg)
- case msgChannelFailure:
- msg = new(channelRequestFailureMsg)
- default:
- return nil, unexpectedMessageError(0, packet[0])
- }
- if err := Unmarshal(packet, msg); err != nil {
- return nil, err
- }
- return msg, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/mux.go b/vendor/golang.org/x/crypto/ssh/mux.go
deleted file mode 100644
index f1901627..00000000
--- a/vendor/golang.org/x/crypto/ssh/mux.go
+++ /dev/null
@@ -1,330 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "encoding/binary"
- "fmt"
- "io"
- "log"
- "sync"
- "sync/atomic"
-)
-
-// debugMux, if set, causes messages in the connection protocol to be
-// logged.
-const debugMux = false
-
-// chanList is a thread safe channel list.
-type chanList struct {
- // protects concurrent access to chans
- sync.Mutex
-
- // chans are indexed by the local id of the channel, which the
- // other side should send in the PeersId field.
- chans []*channel
-
- // This is a debugging aid: it offsets all IDs by this
- // amount. This helps distinguish otherwise identical
- // server/client muxes
- offset uint32
-}
-
-// Assigns a channel ID to the given channel.
-func (c *chanList) add(ch *channel) uint32 {
- c.Lock()
- defer c.Unlock()
- for i := range c.chans {
- if c.chans[i] == nil {
- c.chans[i] = ch
- return uint32(i) + c.offset
- }
- }
- c.chans = append(c.chans, ch)
- return uint32(len(c.chans)-1) + c.offset
-}
-
-// getChan returns the channel for the given ID.
-func (c *chanList) getChan(id uint32) *channel {
- id -= c.offset
-
- c.Lock()
- defer c.Unlock()
- if id < uint32(len(c.chans)) {
- return c.chans[id]
- }
- return nil
-}
-
-func (c *chanList) remove(id uint32) {
- id -= c.offset
- c.Lock()
- if id < uint32(len(c.chans)) {
- c.chans[id] = nil
- }
- c.Unlock()
-}
-
-// dropAll forgets all channels it knows, returning them in a slice.
-func (c *chanList) dropAll() []*channel {
- c.Lock()
- defer c.Unlock()
- var r []*channel
-
- for _, ch := range c.chans {
- if ch == nil {
- continue
- }
- r = append(r, ch)
- }
- c.chans = nil
- return r
-}
-
-// mux represents the state for the SSH connection protocol, which
-// multiplexes many channels onto a single packet transport.
-type mux struct {
- conn packetConn
- chanList chanList
-
- incomingChannels chan NewChannel
-
- globalSentMu sync.Mutex
- globalResponses chan interface{}
- incomingRequests chan *Request
-
- errCond *sync.Cond
- err error
-}
-
-// When debugging, each new chanList instantiation has a different
-// offset.
-var globalOff uint32
-
-func (m *mux) Wait() error {
- m.errCond.L.Lock()
- defer m.errCond.L.Unlock()
- for m.err == nil {
- m.errCond.Wait()
- }
- return m.err
-}
-
-// newMux returns a mux that runs over the given connection.
-func newMux(p packetConn) *mux {
- m := &mux{
- conn: p,
- incomingChannels: make(chan NewChannel, chanSize),
- globalResponses: make(chan interface{}, 1),
- incomingRequests: make(chan *Request, chanSize),
- errCond: newCond(),
- }
- if debugMux {
- m.chanList.offset = atomic.AddUint32(&globalOff, 1)
- }
-
- go m.loop()
- return m
-}
-
-func (m *mux) sendMessage(msg interface{}) error {
- p := Marshal(msg)
- if debugMux {
- log.Printf("send global(%d): %#v", m.chanList.offset, msg)
- }
- return m.conn.writePacket(p)
-}
-
-func (m *mux) SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error) {
- if wantReply {
- m.globalSentMu.Lock()
- defer m.globalSentMu.Unlock()
- }
-
- if err := m.sendMessage(globalRequestMsg{
- Type: name,
- WantReply: wantReply,
- Data: payload,
- }); err != nil {
- return false, nil, err
- }
-
- if !wantReply {
- return false, nil, nil
- }
-
- msg, ok := <-m.globalResponses
- if !ok {
- return false, nil, io.EOF
- }
- switch msg := msg.(type) {
- case *globalRequestFailureMsg:
- return false, msg.Data, nil
- case *globalRequestSuccessMsg:
- return true, msg.Data, nil
- default:
- return false, nil, fmt.Errorf("ssh: unexpected response to request: %#v", msg)
- }
-}
-
-// ackRequest must be called after processing a global request that
-// has WantReply set.
-func (m *mux) ackRequest(ok bool, data []byte) error {
- if ok {
- return m.sendMessage(globalRequestSuccessMsg{Data: data})
- }
- return m.sendMessage(globalRequestFailureMsg{Data: data})
-}
-
-func (m *mux) Close() error {
- return m.conn.Close()
-}
-
-// loop runs the connection machine. It will process packets until an
-// error is encountered. To synchronize on loop exit, use mux.Wait.
-func (m *mux) loop() {
- var err error
- for err == nil {
- err = m.onePacket()
- }
-
- for _, ch := range m.chanList.dropAll() {
- ch.close()
- }
-
- close(m.incomingChannels)
- close(m.incomingRequests)
- close(m.globalResponses)
-
- m.conn.Close()
-
- m.errCond.L.Lock()
- m.err = err
- m.errCond.Broadcast()
- m.errCond.L.Unlock()
-
- if debugMux {
- log.Println("loop exit", err)
- }
-}
-
-// onePacket reads and processes one packet.
-func (m *mux) onePacket() error {
- packet, err := m.conn.readPacket()
- if err != nil {
- return err
- }
-
- if debugMux {
- if packet[0] == msgChannelData || packet[0] == msgChannelExtendedData {
- log.Printf("decoding(%d): data packet - %d bytes", m.chanList.offset, len(packet))
- } else {
- p, _ := decode(packet)
- log.Printf("decoding(%d): %d %#v - %d bytes", m.chanList.offset, packet[0], p, len(packet))
- }
- }
-
- switch packet[0] {
- case msgChannelOpen:
- return m.handleChannelOpen(packet)
- case msgGlobalRequest, msgRequestSuccess, msgRequestFailure:
- return m.handleGlobalPacket(packet)
- }
-
- // assume a channel packet.
- if len(packet) < 5 {
- return parseError(packet[0])
- }
- id := binary.BigEndian.Uint32(packet[1:])
- ch := m.chanList.getChan(id)
- if ch == nil {
- return fmt.Errorf("ssh: invalid channel %d", id)
- }
-
- return ch.handlePacket(packet)
-}
-
-func (m *mux) handleGlobalPacket(packet []byte) error {
- msg, err := decode(packet)
- if err != nil {
- return err
- }
-
- switch msg := msg.(type) {
- case *globalRequestMsg:
- m.incomingRequests <- &Request{
- Type: msg.Type,
- WantReply: msg.WantReply,
- Payload: msg.Data,
- mux: m,
- }
- case *globalRequestSuccessMsg, *globalRequestFailureMsg:
- m.globalResponses <- msg
- default:
- panic(fmt.Sprintf("not a global message %#v", msg))
- }
-
- return nil
-}
-
-// handleChannelOpen schedules a channel to be Accept()ed.
-func (m *mux) handleChannelOpen(packet []byte) error {
- var msg channelOpenMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return err
- }
-
- if msg.MaxPacketSize < minPacketLength || msg.MaxPacketSize > 1<<31 {
- failMsg := channelOpenFailureMsg{
- PeersID: msg.PeersID,
- Reason: ConnectionFailed,
- Message: "invalid request",
- Language: "en_US.UTF-8",
- }
- return m.sendMessage(failMsg)
- }
-
- c := m.newChannel(msg.ChanType, channelInbound, msg.TypeSpecificData)
- c.remoteId = msg.PeersID
- c.maxRemotePayload = msg.MaxPacketSize
- c.remoteWin.add(msg.PeersWindow)
- m.incomingChannels <- c
- return nil
-}
-
-func (m *mux) OpenChannel(chanType string, extra []byte) (Channel, <-chan *Request, error) {
- ch, err := m.openChannel(chanType, extra)
- if err != nil {
- return nil, nil, err
- }
-
- return ch, ch.incomingRequests, nil
-}
-
-func (m *mux) openChannel(chanType string, extra []byte) (*channel, error) {
- ch := m.newChannel(chanType, channelOutbound, extra)
-
- ch.maxIncomingPayload = channelMaxPacket
-
- open := channelOpenMsg{
- ChanType: chanType,
- PeersWindow: ch.myWindow,
- MaxPacketSize: ch.maxIncomingPayload,
- TypeSpecificData: extra,
- PeersID: ch.localId,
- }
- if err := m.sendMessage(open); err != nil {
- return nil, err
- }
-
- switch msg := (<-ch.msg).(type) {
- case *channelOpenConfirmMsg:
- return ch, nil
- case *channelOpenFailureMsg:
- return nil, &OpenChannelError{msg.Reason, msg.Message}
- default:
- return nil, fmt.Errorf("ssh: unexpected packet in response to channel open: %T", msg)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go
deleted file mode 100644
index d0f48253..00000000
--- a/vendor/golang.org/x/crypto/ssh/server.go
+++ /dev/null
@@ -1,593 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "net"
- "strings"
-)
-
-// The Permissions type holds fine-grained permissions that are
-// specific to a user or a specific authentication method for a user.
-// The Permissions value for a successful authentication attempt is
-// available in ServerConn, so it can be used to pass information from
-// the user-authentication phase to the application layer.
-type Permissions struct {
- // CriticalOptions indicate restrictions to the default
- // permissions, and are typically used in conjunction with
- // user certificates. The standard for SSH certificates
- // defines "force-command" (only allow the given command to
- // execute) and "source-address" (only allow connections from
- // the given address). The SSH package currently only enforces
- // the "source-address" critical option. It is up to server
- // implementations to enforce other critical options, such as
- // "force-command", by checking them after the SSH handshake
- // is successful. In general, SSH servers should reject
- // connections that specify critical options that are unknown
- // or not supported.
- CriticalOptions map[string]string
-
- // Extensions are extra functionality that the server may
- // offer on authenticated connections. Lack of support for an
- // extension does not preclude authenticating a user. Common
- // extensions are "permit-agent-forwarding",
- // "permit-X11-forwarding". The Go SSH library currently does
- // not act on any extension, and it is up to server
- // implementations to honor them. Extensions can be used to
- // pass data from the authentication callbacks to the server
- // application layer.
- Extensions map[string]string
-}
-
-// ServerConfig holds server specific configuration data.
-type ServerConfig struct {
- // Config contains configuration shared between client and server.
- Config
-
- hostKeys []Signer
-
- // NoClientAuth is true if clients are allowed to connect without
- // authenticating.
- NoClientAuth bool
-
- // MaxAuthTries specifies the maximum number of authentication attempts
- // permitted per connection. If set to a negative number, the number of
- // attempts are unlimited. If set to zero, the number of attempts are limited
- // to 6.
- MaxAuthTries int
-
- // PasswordCallback, if non-nil, is called when a user
- // attempts to authenticate using a password.
- PasswordCallback func(conn ConnMetadata, password []byte) (*Permissions, error)
-
- // PublicKeyCallback, if non-nil, is called when a client
- // offers a public key for authentication. It must return a nil error
- // if the given public key can be used to authenticate the
- // given user. For example, see CertChecker.Authenticate. A
- // call to this function does not guarantee that the key
- // offered is in fact used to authenticate. To record any data
- // depending on the public key, store it inside a
- // Permissions.Extensions entry.
- PublicKeyCallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
-
- // KeyboardInteractiveCallback, if non-nil, is called when
- // keyboard-interactive authentication is selected (RFC
- // 4256). The client object's Challenge function should be
- // used to query the user. The callback may offer multiple
- // Challenge rounds. To avoid information leaks, the client
- // should be presented a challenge even if the user is
- // unknown.
- KeyboardInteractiveCallback func(conn ConnMetadata, client KeyboardInteractiveChallenge) (*Permissions, error)
-
- // AuthLogCallback, if non-nil, is called to log all authentication
- // attempts.
- AuthLogCallback func(conn ConnMetadata, method string, err error)
-
- // ServerVersion is the version identification string to announce in
- // the public handshake.
- // If empty, a reasonable default is used.
- // Note that RFC 4253 section 4.2 requires that this string start with
- // "SSH-2.0-".
- ServerVersion string
-
- // BannerCallback, if present, is called and the return string is sent to
- // the client after key exchange completed but before authentication.
- BannerCallback func(conn ConnMetadata) string
-}
-
-// AddHostKey adds a private key as a host key. If an existing host
-// key exists with the same algorithm, it is overwritten. Each server
-// config must have at least one host key.
-func (s *ServerConfig) AddHostKey(key Signer) {
- for i, k := range s.hostKeys {
- if k.PublicKey().Type() == key.PublicKey().Type() {
- s.hostKeys[i] = key
- return
- }
- }
-
- s.hostKeys = append(s.hostKeys, key)
-}
-
-// cachedPubKey contains the results of querying whether a public key is
-// acceptable for a user.
-type cachedPubKey struct {
- user string
- pubKeyData []byte
- result error
- perms *Permissions
-}
-
-const maxCachedPubKeys = 16
-
-// pubKeyCache caches tests for public keys. Since SSH clients
-// will query whether a public key is acceptable before attempting to
-// authenticate with it, we end up with duplicate queries for public
-// key validity. The cache only applies to a single ServerConn.
-type pubKeyCache struct {
- keys []cachedPubKey
-}
-
-// get returns the result for a given user/algo/key tuple.
-func (c *pubKeyCache) get(user string, pubKeyData []byte) (cachedPubKey, bool) {
- for _, k := range c.keys {
- if k.user == user && bytes.Equal(k.pubKeyData, pubKeyData) {
- return k, true
- }
- }
- return cachedPubKey{}, false
-}
-
-// add adds the given tuple to the cache.
-func (c *pubKeyCache) add(candidate cachedPubKey) {
- if len(c.keys) < maxCachedPubKeys {
- c.keys = append(c.keys, candidate)
- }
-}
-
-// ServerConn is an authenticated SSH connection, as seen from the
-// server
-type ServerConn struct {
- Conn
-
- // If the succeeding authentication callback returned a
- // non-nil Permissions pointer, it is stored here.
- Permissions *Permissions
-}
-
-// NewServerConn starts a new SSH server with c as the underlying
-// transport. It starts with a handshake and, if the handshake is
-// unsuccessful, it closes the connection and returns an error. The
-// Request and NewChannel channels must be serviced, or the connection
-// will hang.
-//
-// The returned error may be of type *ServerAuthError for
-// authentication errors.
-func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewChannel, <-chan *Request, error) {
- fullConf := *config
- fullConf.SetDefaults()
- if fullConf.MaxAuthTries == 0 {
- fullConf.MaxAuthTries = 6
- }
-
- s := &connection{
- sshConn: sshConn{conn: c},
- }
- perms, err := s.serverHandshake(&fullConf)
- if err != nil {
- c.Close()
- return nil, nil, nil, err
- }
- return &ServerConn{s, perms}, s.mux.incomingChannels, s.mux.incomingRequests, nil
-}
-
-// signAndMarshal signs the data with the appropriate algorithm,
-// and serializes the result in SSH wire format.
-func signAndMarshal(k Signer, rand io.Reader, data []byte) ([]byte, error) {
- sig, err := k.Sign(rand, data)
- if err != nil {
- return nil, err
- }
-
- return Marshal(sig), nil
-}
-
-// handshake performs key exchange and user authentication.
-func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error) {
- if len(config.hostKeys) == 0 {
- return nil, errors.New("ssh: server has no host keys")
- }
-
- if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil && config.KeyboardInteractiveCallback == nil {
- return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
- }
-
- if config.ServerVersion != "" {
- s.serverVersion = []byte(config.ServerVersion)
- } else {
- s.serverVersion = []byte(packageVersion)
- }
- var err error
- s.clientVersion, err = exchangeVersions(s.sshConn.conn, s.serverVersion)
- if err != nil {
- return nil, err
- }
-
- tr := newTransport(s.sshConn.conn, config.Rand, false /* not client */)
- s.transport = newServerTransport(tr, s.clientVersion, s.serverVersion, config)
-
- if err := s.transport.waitSession(); err != nil {
- return nil, err
- }
-
- // We just did the key change, so the session ID is established.
- s.sessionID = s.transport.getSessionID()
-
- var packet []byte
- if packet, err = s.transport.readPacket(); err != nil {
- return nil, err
- }
-
- var serviceRequest serviceRequestMsg
- if err = Unmarshal(packet, &serviceRequest); err != nil {
- return nil, err
- }
- if serviceRequest.Service != serviceUserAuth {
- return nil, errors.New("ssh: requested service '" + serviceRequest.Service + "' before authenticating")
- }
- serviceAccept := serviceAcceptMsg{
- Service: serviceUserAuth,
- }
- if err := s.transport.writePacket(Marshal(&serviceAccept)); err != nil {
- return nil, err
- }
-
- perms, err := s.serverAuthenticate(config)
- if err != nil {
- return nil, err
- }
- s.mux = newMux(s.transport)
- return perms, err
-}
-
-func isAcceptableAlgo(algo string) bool {
- switch algo {
- case KeyAlgoRSA, KeyAlgoDSA, KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521, KeyAlgoED25519,
- CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoED25519v01:
- return true
- }
- return false
-}
-
-func checkSourceAddress(addr net.Addr, sourceAddrs string) error {
- if addr == nil {
- return errors.New("ssh: no address known for client, but source-address match required")
- }
-
- tcpAddr, ok := addr.(*net.TCPAddr)
- if !ok {
- return fmt.Errorf("ssh: remote address %v is not an TCP address when checking source-address match", addr)
- }
-
- for _, sourceAddr := range strings.Split(sourceAddrs, ",") {
- if allowedIP := net.ParseIP(sourceAddr); allowedIP != nil {
- if allowedIP.Equal(tcpAddr.IP) {
- return nil
- }
- } else {
- _, ipNet, err := net.ParseCIDR(sourceAddr)
- if err != nil {
- return fmt.Errorf("ssh: error parsing source-address restriction %q: %v", sourceAddr, err)
- }
-
- if ipNet.Contains(tcpAddr.IP) {
- return nil
- }
- }
- }
-
- return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr)
-}
-
-// ServerAuthError represents server authentication errors and is
-// sometimes returned by NewServerConn. It appends any authentication
-// errors that may occur, and is returned if all of the authentication
-// methods provided by the user failed to authenticate.
-type ServerAuthError struct {
- // Errors contains authentication errors returned by the authentication
- // callback methods. The first entry is typically ErrNoAuth.
- Errors []error
-}
-
-func (l ServerAuthError) Error() string {
- var errs []string
- for _, err := range l.Errors {
- errs = append(errs, err.Error())
- }
- return "[" + strings.Join(errs, ", ") + "]"
-}
-
-// ErrNoAuth is the error value returned if no
-// authentication method has been passed yet. This happens as a normal
-// part of the authentication loop, since the client first tries
-// 'none' authentication to discover available methods.
-// It is returned in ServerAuthError.Errors from NewServerConn.
-var ErrNoAuth = errors.New("ssh: no auth passed yet")
-
-func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, error) {
- sessionID := s.transport.getSessionID()
- var cache pubKeyCache
- var perms *Permissions
-
- authFailures := 0
- var authErrs []error
- var displayedBanner bool
-
-userAuthLoop:
- for {
- if authFailures >= config.MaxAuthTries && config.MaxAuthTries > 0 {
- discMsg := &disconnectMsg{
- Reason: 2,
- Message: "too many authentication failures",
- }
-
- if err := s.transport.writePacket(Marshal(discMsg)); err != nil {
- return nil, err
- }
-
- return nil, discMsg
- }
-
- var userAuthReq userAuthRequestMsg
- if packet, err := s.transport.readPacket(); err != nil {
- if err == io.EOF {
- return nil, &ServerAuthError{Errors: authErrs}
- }
- return nil, err
- } else if err = Unmarshal(packet, &userAuthReq); err != nil {
- return nil, err
- }
-
- if userAuthReq.Service != serviceSSH {
- return nil, errors.New("ssh: client attempted to negotiate for unknown service: " + userAuthReq.Service)
- }
-
- s.user = userAuthReq.User
-
- if !displayedBanner && config.BannerCallback != nil {
- displayedBanner = true
- msg := config.BannerCallback(s)
- if msg != "" {
- bannerMsg := &userAuthBannerMsg{
- Message: msg,
- }
- if err := s.transport.writePacket(Marshal(bannerMsg)); err != nil {
- return nil, err
- }
- }
- }
-
- perms = nil
- authErr := ErrNoAuth
-
- switch userAuthReq.Method {
- case "none":
- if config.NoClientAuth {
- authErr = nil
- }
-
- // allow initial attempt of 'none' without penalty
- if authFailures == 0 {
- authFailures--
- }
- case "password":
- if config.PasswordCallback == nil {
- authErr = errors.New("ssh: password auth not configured")
- break
- }
- payload := userAuthReq.Payload
- if len(payload) < 1 || payload[0] != 0 {
- return nil, parseError(msgUserAuthRequest)
- }
- payload = payload[1:]
- password, payload, ok := parseString(payload)
- if !ok || len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
-
- perms, authErr = config.PasswordCallback(s, password)
- case "keyboard-interactive":
- if config.KeyboardInteractiveCallback == nil {
- authErr = errors.New("ssh: keyboard-interactive auth not configubred")
- break
- }
-
- prompter := &sshClientKeyboardInteractive{s}
- perms, authErr = config.KeyboardInteractiveCallback(s, prompter.Challenge)
- case "publickey":
- if config.PublicKeyCallback == nil {
- authErr = errors.New("ssh: publickey auth not configured")
- break
- }
- payload := userAuthReq.Payload
- if len(payload) < 1 {
- return nil, parseError(msgUserAuthRequest)
- }
- isQuery := payload[0] == 0
- payload = payload[1:]
- algoBytes, payload, ok := parseString(payload)
- if !ok {
- return nil, parseError(msgUserAuthRequest)
- }
- algo := string(algoBytes)
- if !isAcceptableAlgo(algo) {
- authErr = fmt.Errorf("ssh: algorithm %q not accepted", algo)
- break
- }
-
- pubKeyData, payload, ok := parseString(payload)
- if !ok {
- return nil, parseError(msgUserAuthRequest)
- }
-
- pubKey, err := ParsePublicKey(pubKeyData)
- if err != nil {
- return nil, err
- }
-
- candidate, ok := cache.get(s.user, pubKeyData)
- if !ok {
- candidate.user = s.user
- candidate.pubKeyData = pubKeyData
- candidate.perms, candidate.result = config.PublicKeyCallback(s, pubKey)
- if candidate.result == nil && candidate.perms != nil && candidate.perms.CriticalOptions != nil && candidate.perms.CriticalOptions[sourceAddressCriticalOption] != "" {
- candidate.result = checkSourceAddress(
- s.RemoteAddr(),
- candidate.perms.CriticalOptions[sourceAddressCriticalOption])
- }
- cache.add(candidate)
- }
-
- if isQuery {
- // The client can query if the given public key
- // would be okay.
-
- if len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
-
- if candidate.result == nil {
- okMsg := userAuthPubKeyOkMsg{
- Algo: algo,
- PubKey: pubKeyData,
- }
- if err = s.transport.writePacket(Marshal(&okMsg)); err != nil {
- return nil, err
- }
- continue userAuthLoop
- }
- authErr = candidate.result
- } else {
- sig, payload, ok := parseSignature(payload)
- if !ok || len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
- // Ensure the public key algo and signature algo
- // are supported. Compare the private key
- // algorithm name that corresponds to algo with
- // sig.Format. This is usually the same, but
- // for certs, the names differ.
- if !isAcceptableAlgo(sig.Format) {
- break
- }
- signedData := buildDataSignedForAuth(sessionID, userAuthReq, algoBytes, pubKeyData)
-
- if err := pubKey.Verify(signedData, sig); err != nil {
- return nil, err
- }
-
- authErr = candidate.result
- perms = candidate.perms
- }
- default:
- authErr = fmt.Errorf("ssh: unknown method %q", userAuthReq.Method)
- }
-
- authErrs = append(authErrs, authErr)
-
- if config.AuthLogCallback != nil {
- config.AuthLogCallback(s, userAuthReq.Method, authErr)
- }
-
- if authErr == nil {
- break userAuthLoop
- }
-
- authFailures++
-
- var failureMsg userAuthFailureMsg
- if config.PasswordCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "password")
- }
- if config.PublicKeyCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "publickey")
- }
- if config.KeyboardInteractiveCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "keyboard-interactive")
- }
-
- if len(failureMsg.Methods) == 0 {
- return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
- }
-
- if err := s.transport.writePacket(Marshal(&failureMsg)); err != nil {
- return nil, err
- }
- }
-
- if err := s.transport.writePacket([]byte{msgUserAuthSuccess}); err != nil {
- return nil, err
- }
- return perms, nil
-}
-
-// sshClientKeyboardInteractive implements a ClientKeyboardInteractive by
-// asking the client on the other side of a ServerConn.
-type sshClientKeyboardInteractive struct {
- *connection
-}
-
-func (c *sshClientKeyboardInteractive) Challenge(user, instruction string, questions []string, echos []bool) (answers []string, err error) {
- if len(questions) != len(echos) {
- return nil, errors.New("ssh: echos and questions must have equal length")
- }
-
- var prompts []byte
- for i := range questions {
- prompts = appendString(prompts, questions[i])
- prompts = appendBool(prompts, echos[i])
- }
-
- if err := c.transport.writePacket(Marshal(&userAuthInfoRequestMsg{
- Instruction: instruction,
- NumPrompts: uint32(len(questions)),
- Prompts: prompts,
- })); err != nil {
- return nil, err
- }
-
- packet, err := c.transport.readPacket()
- if err != nil {
- return nil, err
- }
- if packet[0] != msgUserAuthInfoResponse {
- return nil, unexpectedMessageError(msgUserAuthInfoResponse, packet[0])
- }
- packet = packet[1:]
-
- n, packet, ok := parseUint32(packet)
- if !ok || int(n) != len(questions) {
- return nil, parseError(msgUserAuthInfoResponse)
- }
-
- for i := uint32(0); i < n; i++ {
- ans, rest, ok := parseString(packet)
- if !ok {
- return nil, parseError(msgUserAuthInfoResponse)
- }
-
- answers = append(answers, string(ans))
- packet = rest
- }
- if len(packet) != 0 {
- return nil, errors.New("ssh: junk at end of message")
- }
-
- return answers, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/session.go b/vendor/golang.org/x/crypto/ssh/session.go
deleted file mode 100644
index d3321f6b..00000000
--- a/vendor/golang.org/x/crypto/ssh/session.go
+++ /dev/null
@@ -1,647 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Session implements an interactive session described in
-// "RFC 4254, section 6".
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "sync"
-)
-
-type Signal string
-
-// POSIX signals as listed in RFC 4254 Section 6.10.
-const (
- SIGABRT Signal = "ABRT"
- SIGALRM Signal = "ALRM"
- SIGFPE Signal = "FPE"
- SIGHUP Signal = "HUP"
- SIGILL Signal = "ILL"
- SIGINT Signal = "INT"
- SIGKILL Signal = "KILL"
- SIGPIPE Signal = "PIPE"
- SIGQUIT Signal = "QUIT"
- SIGSEGV Signal = "SEGV"
- SIGTERM Signal = "TERM"
- SIGUSR1 Signal = "USR1"
- SIGUSR2 Signal = "USR2"
-)
-
-var signals = map[Signal]int{
- SIGABRT: 6,
- SIGALRM: 14,
- SIGFPE: 8,
- SIGHUP: 1,
- SIGILL: 4,
- SIGINT: 2,
- SIGKILL: 9,
- SIGPIPE: 13,
- SIGQUIT: 3,
- SIGSEGV: 11,
- SIGTERM: 15,
-}
-
-type TerminalModes map[uint8]uint32
-
-// POSIX terminal mode flags as listed in RFC 4254 Section 8.
-const (
- tty_OP_END = 0
- VINTR = 1
- VQUIT = 2
- VERASE = 3
- VKILL = 4
- VEOF = 5
- VEOL = 6
- VEOL2 = 7
- VSTART = 8
- VSTOP = 9
- VSUSP = 10
- VDSUSP = 11
- VREPRINT = 12
- VWERASE = 13
- VLNEXT = 14
- VFLUSH = 15
- VSWTCH = 16
- VSTATUS = 17
- VDISCARD = 18
- IGNPAR = 30
- PARMRK = 31
- INPCK = 32
- ISTRIP = 33
- INLCR = 34
- IGNCR = 35
- ICRNL = 36
- IUCLC = 37
- IXON = 38
- IXANY = 39
- IXOFF = 40
- IMAXBEL = 41
- ISIG = 50
- ICANON = 51
- XCASE = 52
- ECHO = 53
- ECHOE = 54
- ECHOK = 55
- ECHONL = 56
- NOFLSH = 57
- TOSTOP = 58
- IEXTEN = 59
- ECHOCTL = 60
- ECHOKE = 61
- PENDIN = 62
- OPOST = 70
- OLCUC = 71
- ONLCR = 72
- OCRNL = 73
- ONOCR = 74
- ONLRET = 75
- CS7 = 90
- CS8 = 91
- PARENB = 92
- PARODD = 93
- TTY_OP_ISPEED = 128
- TTY_OP_OSPEED = 129
-)
-
-// A Session represents a connection to a remote command or shell.
-type Session struct {
- // Stdin specifies the remote process's standard input.
- // If Stdin is nil, the remote process reads from an empty
- // bytes.Buffer.
- Stdin io.Reader
-
- // Stdout and Stderr specify the remote process's standard
- // output and error.
- //
- // If either is nil, Run connects the corresponding file
- // descriptor to an instance of ioutil.Discard. There is a
- // fixed amount of buffering that is shared for the two streams.
- // If either blocks it may eventually cause the remote
- // command to block.
- Stdout io.Writer
- Stderr io.Writer
-
- ch Channel // the channel backing this session
- started bool // true once Start, Run or Shell is invoked.
- copyFuncs []func() error
- errors chan error // one send per copyFunc
-
- // true if pipe method is active
- stdinpipe, stdoutpipe, stderrpipe bool
-
- // stdinPipeWriter is non-nil if StdinPipe has not been called
- // and Stdin was specified by the user; it is the write end of
- // a pipe connecting Session.Stdin to the stdin channel.
- stdinPipeWriter io.WriteCloser
-
- exitStatus chan error
-}
-
-// SendRequest sends an out-of-band channel request on the SSH channel
-// underlying the session.
-func (s *Session) SendRequest(name string, wantReply bool, payload []byte) (bool, error) {
- return s.ch.SendRequest(name, wantReply, payload)
-}
-
-func (s *Session) Close() error {
- return s.ch.Close()
-}
-
-// RFC 4254 Section 6.4.
-type setenvRequest struct {
- Name string
- Value string
-}
-
-// Setenv sets an environment variable that will be applied to any
-// command executed by Shell or Run.
-func (s *Session) Setenv(name, value string) error {
- msg := setenvRequest{
- Name: name,
- Value: value,
- }
- ok, err := s.ch.SendRequest("env", true, Marshal(&msg))
- if err == nil && !ok {
- err = errors.New("ssh: setenv failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.2.
-type ptyRequestMsg struct {
- Term string
- Columns uint32
- Rows uint32
- Width uint32
- Height uint32
- Modelist string
-}
-
-// RequestPty requests the association of a pty with the session on the remote host.
-func (s *Session) RequestPty(term string, h, w int, termmodes TerminalModes) error {
- var tm []byte
- for k, v := range termmodes {
- kv := struct {
- Key byte
- Val uint32
- }{k, v}
-
- tm = append(tm, Marshal(&kv)...)
- }
- tm = append(tm, tty_OP_END)
- req := ptyRequestMsg{
- Term: term,
- Columns: uint32(w),
- Rows: uint32(h),
- Width: uint32(w * 8),
- Height: uint32(h * 8),
- Modelist: string(tm),
- }
- ok, err := s.ch.SendRequest("pty-req", true, Marshal(&req))
- if err == nil && !ok {
- err = errors.New("ssh: pty-req failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.5.
-type subsystemRequestMsg struct {
- Subsystem string
-}
-
-// RequestSubsystem requests the association of a subsystem with the session on the remote host.
-// A subsystem is a predefined command that runs in the background when the ssh session is initiated
-func (s *Session) RequestSubsystem(subsystem string) error {
- msg := subsystemRequestMsg{
- Subsystem: subsystem,
- }
- ok, err := s.ch.SendRequest("subsystem", true, Marshal(&msg))
- if err == nil && !ok {
- err = errors.New("ssh: subsystem request failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.7.
-type ptyWindowChangeMsg struct {
- Columns uint32
- Rows uint32
- Width uint32
- Height uint32
-}
-
-// WindowChange informs the remote host about a terminal window dimension change to h rows and w columns.
-func (s *Session) WindowChange(h, w int) error {
- req := ptyWindowChangeMsg{
- Columns: uint32(w),
- Rows: uint32(h),
- Width: uint32(w * 8),
- Height: uint32(h * 8),
- }
- _, err := s.ch.SendRequest("window-change", false, Marshal(&req))
- return err
-}
-
-// RFC 4254 Section 6.9.
-type signalMsg struct {
- Signal string
-}
-
-// Signal sends the given signal to the remote process.
-// sig is one of the SIG* constants.
-func (s *Session) Signal(sig Signal) error {
- msg := signalMsg{
- Signal: string(sig),
- }
-
- _, err := s.ch.SendRequest("signal", false, Marshal(&msg))
- return err
-}
-
-// RFC 4254 Section 6.5.
-type execMsg struct {
- Command string
-}
-
-// Start runs cmd on the remote host. Typically, the remote
-// server passes cmd to the shell for interpretation.
-// A Session only accepts one call to Run, Start or Shell.
-func (s *Session) Start(cmd string) error {
- if s.started {
- return errors.New("ssh: session already started")
- }
- req := execMsg{
- Command: cmd,
- }
-
- ok, err := s.ch.SendRequest("exec", true, Marshal(&req))
- if err == nil && !ok {
- err = fmt.Errorf("ssh: command %v failed", cmd)
- }
- if err != nil {
- return err
- }
- return s.start()
-}
-
-// Run runs cmd on the remote host. Typically, the remote
-// server passes cmd to the shell for interpretation.
-// A Session only accepts one call to Run, Start, Shell, Output,
-// or CombinedOutput.
-//
-// The returned error is nil if the command runs, has no problems
-// copying stdin, stdout, and stderr, and exits with a zero exit
-// status.
-//
-// If the remote server does not send an exit status, an error of type
-// *ExitMissingError is returned. If the command completes
-// unsuccessfully or is interrupted by a signal, the error is of type
-// *ExitError. Other error types may be returned for I/O problems.
-func (s *Session) Run(cmd string) error {
- err := s.Start(cmd)
- if err != nil {
- return err
- }
- return s.Wait()
-}
-
-// Output runs cmd on the remote host and returns its standard output.
-func (s *Session) Output(cmd string) ([]byte, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- var b bytes.Buffer
- s.Stdout = &b
- err := s.Run(cmd)
- return b.Bytes(), err
-}
-
-type singleWriter struct {
- b bytes.Buffer
- mu sync.Mutex
-}
-
-func (w *singleWriter) Write(p []byte) (int, error) {
- w.mu.Lock()
- defer w.mu.Unlock()
- return w.b.Write(p)
-}
-
-// CombinedOutput runs cmd on the remote host and returns its combined
-// standard output and standard error.
-func (s *Session) CombinedOutput(cmd string) ([]byte, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- if s.Stderr != nil {
- return nil, errors.New("ssh: Stderr already set")
- }
- var b singleWriter
- s.Stdout = &b
- s.Stderr = &b
- err := s.Run(cmd)
- return b.b.Bytes(), err
-}
-
-// Shell starts a login shell on the remote host. A Session only
-// accepts one call to Run, Start, Shell, Output, or CombinedOutput.
-func (s *Session) Shell() error {
- if s.started {
- return errors.New("ssh: session already started")
- }
-
- ok, err := s.ch.SendRequest("shell", true, nil)
- if err == nil && !ok {
- return errors.New("ssh: could not start shell")
- }
- if err != nil {
- return err
- }
- return s.start()
-}
-
-func (s *Session) start() error {
- s.started = true
-
- type F func(*Session)
- for _, setupFd := range []F{(*Session).stdin, (*Session).stdout, (*Session).stderr} {
- setupFd(s)
- }
-
- s.errors = make(chan error, len(s.copyFuncs))
- for _, fn := range s.copyFuncs {
- go func(fn func() error) {
- s.errors <- fn()
- }(fn)
- }
- return nil
-}
-
-// Wait waits for the remote command to exit.
-//
-// The returned error is nil if the command runs, has no problems
-// copying stdin, stdout, and stderr, and exits with a zero exit
-// status.
-//
-// If the remote server does not send an exit status, an error of type
-// *ExitMissingError is returned. If the command completes
-// unsuccessfully or is interrupted by a signal, the error is of type
-// *ExitError. Other error types may be returned for I/O problems.
-func (s *Session) Wait() error {
- if !s.started {
- return errors.New("ssh: session not started")
- }
- waitErr := <-s.exitStatus
-
- if s.stdinPipeWriter != nil {
- s.stdinPipeWriter.Close()
- }
- var copyError error
- for range s.copyFuncs {
- if err := <-s.errors; err != nil && copyError == nil {
- copyError = err
- }
- }
- if waitErr != nil {
- return waitErr
- }
- return copyError
-}
-
-func (s *Session) wait(reqs <-chan *Request) error {
- wm := Waitmsg{status: -1}
- // Wait for msg channel to be closed before returning.
- for msg := range reqs {
- switch msg.Type {
- case "exit-status":
- wm.status = int(binary.BigEndian.Uint32(msg.Payload))
- case "exit-signal":
- var sigval struct {
- Signal string
- CoreDumped bool
- Error string
- Lang string
- }
- if err := Unmarshal(msg.Payload, &sigval); err != nil {
- return err
- }
-
- // Must sanitize strings?
- wm.signal = sigval.Signal
- wm.msg = sigval.Error
- wm.lang = sigval.Lang
- default:
- // This handles keepalives and matches
- // OpenSSH's behaviour.
- if msg.WantReply {
- msg.Reply(false, nil)
- }
- }
- }
- if wm.status == 0 {
- return nil
- }
- if wm.status == -1 {
- // exit-status was never sent from server
- if wm.signal == "" {
- // signal was not sent either. RFC 4254
- // section 6.10 recommends against this
- // behavior, but it is allowed, so we let
- // clients handle it.
- return &ExitMissingError{}
- }
- wm.status = 128
- if _, ok := signals[Signal(wm.signal)]; ok {
- wm.status += signals[Signal(wm.signal)]
- }
- }
-
- return &ExitError{wm}
-}
-
-// ExitMissingError is returned if a session is torn down cleanly, but
-// the server sends no confirmation of the exit status.
-type ExitMissingError struct{}
-
-func (e *ExitMissingError) Error() string {
- return "wait: remote command exited without exit status or exit signal"
-}
-
-func (s *Session) stdin() {
- if s.stdinpipe {
- return
- }
- var stdin io.Reader
- if s.Stdin == nil {
- stdin = new(bytes.Buffer)
- } else {
- r, w := io.Pipe()
- go func() {
- _, err := io.Copy(w, s.Stdin)
- w.CloseWithError(err)
- }()
- stdin, s.stdinPipeWriter = r, w
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.ch, stdin)
- if err1 := s.ch.CloseWrite(); err == nil && err1 != io.EOF {
- err = err1
- }
- return err
- })
-}
-
-func (s *Session) stdout() {
- if s.stdoutpipe {
- return
- }
- if s.Stdout == nil {
- s.Stdout = ioutil.Discard
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.Stdout, s.ch)
- return err
- })
-}
-
-func (s *Session) stderr() {
- if s.stderrpipe {
- return
- }
- if s.Stderr == nil {
- s.Stderr = ioutil.Discard
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.Stderr, s.ch.Stderr())
- return err
- })
-}
-
-// sessionStdin reroutes Close to CloseWrite.
-type sessionStdin struct {
- io.Writer
- ch Channel
-}
-
-func (s *sessionStdin) Close() error {
- return s.ch.CloseWrite()
-}
-
-// StdinPipe returns a pipe that will be connected to the
-// remote command's standard input when the command starts.
-func (s *Session) StdinPipe() (io.WriteCloser, error) {
- if s.Stdin != nil {
- return nil, errors.New("ssh: Stdin already set")
- }
- if s.started {
- return nil, errors.New("ssh: StdinPipe after process started")
- }
- s.stdinpipe = true
- return &sessionStdin{s.ch, s.ch}, nil
-}
-
-// StdoutPipe returns a pipe that will be connected to the
-// remote command's standard output when the command starts.
-// There is a fixed amount of buffering that is shared between
-// stdout and stderr streams. If the StdoutPipe reader is
-// not serviced fast enough it may eventually cause the
-// remote command to block.
-func (s *Session) StdoutPipe() (io.Reader, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- if s.started {
- return nil, errors.New("ssh: StdoutPipe after process started")
- }
- s.stdoutpipe = true
- return s.ch, nil
-}
-
-// StderrPipe returns a pipe that will be connected to the
-// remote command's standard error when the command starts.
-// There is a fixed amount of buffering that is shared between
-// stdout and stderr streams. If the StderrPipe reader is
-// not serviced fast enough it may eventually cause the
-// remote command to block.
-func (s *Session) StderrPipe() (io.Reader, error) {
- if s.Stderr != nil {
- return nil, errors.New("ssh: Stderr already set")
- }
- if s.started {
- return nil, errors.New("ssh: StderrPipe after process started")
- }
- s.stderrpipe = true
- return s.ch.Stderr(), nil
-}
-
-// newSession returns a new interactive session on the remote host.
-func newSession(ch Channel, reqs <-chan *Request) (*Session, error) {
- s := &Session{
- ch: ch,
- }
- s.exitStatus = make(chan error, 1)
- go func() {
- s.exitStatus <- s.wait(reqs)
- }()
-
- return s, nil
-}
-
-// An ExitError reports unsuccessful completion of a remote command.
-type ExitError struct {
- Waitmsg
-}
-
-func (e *ExitError) Error() string {
- return e.Waitmsg.String()
-}
-
-// Waitmsg stores the information about an exited remote command
-// as reported by Wait.
-type Waitmsg struct {
- status int
- signal string
- msg string
- lang string
-}
-
-// ExitStatus returns the exit status of the remote command.
-func (w Waitmsg) ExitStatus() int {
- return w.status
-}
-
-// Signal returns the exit signal of the remote command if
-// it was terminated violently.
-func (w Waitmsg) Signal() string {
- return w.signal
-}
-
-// Msg returns the exit message given by the remote command
-func (w Waitmsg) Msg() string {
- return w.msg
-}
-
-// Lang returns the language tag. See RFC 3066
-func (w Waitmsg) Lang() string {
- return w.lang
-}
-
-func (w Waitmsg) String() string {
- str := fmt.Sprintf("Process exited with status %v", w.status)
- if w.signal != "" {
- str += fmt.Sprintf(" from signal %v", w.signal)
- }
- if w.msg != "" {
- str += fmt.Sprintf(". Reason was: %v", w.msg)
- }
- return str
-}
diff --git a/vendor/golang.org/x/crypto/ssh/streamlocal.go b/vendor/golang.org/x/crypto/ssh/streamlocal.go
deleted file mode 100644
index b171b330..00000000
--- a/vendor/golang.org/x/crypto/ssh/streamlocal.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package ssh
-
-import (
- "errors"
- "io"
- "net"
-)
-
-// streamLocalChannelOpenDirectMsg is a struct used for SSH_MSG_CHANNEL_OPEN message
-// with "direct-streamlocal@openssh.com" string.
-//
-// See openssh-portable/PROTOCOL, section 2.4. connection: Unix domain socket forwarding
-// https://github.com/openssh/openssh-portable/blob/master/PROTOCOL#L235
-type streamLocalChannelOpenDirectMsg struct {
- socketPath string
- reserved0 string
- reserved1 uint32
-}
-
-// forwardedStreamLocalPayload is a struct used for SSH_MSG_CHANNEL_OPEN message
-// with "forwarded-streamlocal@openssh.com" string.
-type forwardedStreamLocalPayload struct {
- SocketPath string
- Reserved0 string
-}
-
-// streamLocalChannelForwardMsg is a struct used for SSH2_MSG_GLOBAL_REQUEST message
-// with "streamlocal-forward@openssh.com"/"cancel-streamlocal-forward@openssh.com" string.
-type streamLocalChannelForwardMsg struct {
- socketPath string
-}
-
-// ListenUnix is similar to ListenTCP but uses a Unix domain socket.
-func (c *Client) ListenUnix(socketPath string) (net.Listener, error) {
- c.handleForwardsOnce.Do(c.handleForwards)
- m := streamLocalChannelForwardMsg{
- socketPath,
- }
- // send message
- ok, _, err := c.SendRequest("streamlocal-forward@openssh.com", true, Marshal(&m))
- if err != nil {
- return nil, err
- }
- if !ok {
- return nil, errors.New("ssh: streamlocal-forward@openssh.com request denied by peer")
- }
- ch := c.forwards.add(&net.UnixAddr{Name: socketPath, Net: "unix"})
-
- return &unixListener{socketPath, c, ch}, nil
-}
-
-func (c *Client) dialStreamLocal(socketPath string) (Channel, error) {
- msg := streamLocalChannelOpenDirectMsg{
- socketPath: socketPath,
- }
- ch, in, err := c.OpenChannel("direct-streamlocal@openssh.com", Marshal(&msg))
- if err != nil {
- return nil, err
- }
- go DiscardRequests(in)
- return ch, err
-}
-
-type unixListener struct {
- socketPath string
-
- conn *Client
- in <-chan forward
-}
-
-// Accept waits for and returns the next connection to the listener.
-func (l *unixListener) Accept() (net.Conn, error) {
- s, ok := <-l.in
- if !ok {
- return nil, io.EOF
- }
- ch, incoming, err := s.newCh.Accept()
- if err != nil {
- return nil, err
- }
- go DiscardRequests(incoming)
-
- return &chanConn{
- Channel: ch,
- laddr: &net.UnixAddr{
- Name: l.socketPath,
- Net: "unix",
- },
- raddr: &net.UnixAddr{
- Name: "@",
- Net: "unix",
- },
- }, nil
-}
-
-// Close closes the listener.
-func (l *unixListener) Close() error {
- // this also closes the listener.
- l.conn.forwards.remove(&net.UnixAddr{Name: l.socketPath, Net: "unix"})
- m := streamLocalChannelForwardMsg{
- l.socketPath,
- }
- ok, _, err := l.conn.SendRequest("cancel-streamlocal-forward@openssh.com", true, Marshal(&m))
- if err == nil && !ok {
- err = errors.New("ssh: cancel-streamlocal-forward@openssh.com failed")
- }
- return err
-}
-
-// Addr returns the listener's network address.
-func (l *unixListener) Addr() net.Addr {
- return &net.UnixAddr{
- Name: l.socketPath,
- Net: "unix",
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/tcpip.go b/vendor/golang.org/x/crypto/ssh/tcpip.go
deleted file mode 100644
index 80d35f5e..00000000
--- a/vendor/golang.org/x/crypto/ssh/tcpip.go
+++ /dev/null
@@ -1,474 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "errors"
- "fmt"
- "io"
- "math/rand"
- "net"
- "strconv"
- "strings"
- "sync"
- "time"
-)
-
-// Listen requests the remote peer open a listening socket on
-// addr. Incoming connections will be available by calling Accept on
-// the returned net.Listener. The listener must be serviced, or the
-// SSH connection may hang.
-// N must be "tcp", "tcp4", "tcp6", or "unix".
-func (c *Client) Listen(n, addr string) (net.Listener, error) {
- switch n {
- case "tcp", "tcp4", "tcp6":
- laddr, err := net.ResolveTCPAddr(n, addr)
- if err != nil {
- return nil, err
- }
- return c.ListenTCP(laddr)
- case "unix":
- return c.ListenUnix(addr)
- default:
- return nil, fmt.Errorf("ssh: unsupported protocol: %s", n)
- }
-}
-
-// Automatic port allocation is broken with OpenSSH before 6.0. See
-// also https://bugzilla.mindrot.org/show_bug.cgi?id=2017. In
-// particular, OpenSSH 5.9 sends a channelOpenMsg with port number 0,
-// rather than the actual port number. This means you can never open
-// two different listeners with auto allocated ports. We work around
-// this by trying explicit ports until we succeed.
-
-const openSSHPrefix = "OpenSSH_"
-
-var portRandomizer = rand.New(rand.NewSource(time.Now().UnixNano()))
-
-// isBrokenOpenSSHVersion returns true if the given version string
-// specifies a version of OpenSSH that is known to have a bug in port
-// forwarding.
-func isBrokenOpenSSHVersion(versionStr string) bool {
- i := strings.Index(versionStr, openSSHPrefix)
- if i < 0 {
- return false
- }
- i += len(openSSHPrefix)
- j := i
- for ; j < len(versionStr); j++ {
- if versionStr[j] < '0' || versionStr[j] > '9' {
- break
- }
- }
- version, _ := strconv.Atoi(versionStr[i:j])
- return version < 6
-}
-
-// autoPortListenWorkaround simulates automatic port allocation by
-// trying random ports repeatedly.
-func (c *Client) autoPortListenWorkaround(laddr *net.TCPAddr) (net.Listener, error) {
- var sshListener net.Listener
- var err error
- const tries = 10
- for i := 0; i < tries; i++ {
- addr := *laddr
- addr.Port = 1024 + portRandomizer.Intn(60000)
- sshListener, err = c.ListenTCP(&addr)
- if err == nil {
- laddr.Port = addr.Port
- return sshListener, err
- }
- }
- return nil, fmt.Errorf("ssh: listen on random port failed after %d tries: %v", tries, err)
-}
-
-// RFC 4254 7.1
-type channelForwardMsg struct {
- addr string
- rport uint32
-}
-
-// handleForwards starts goroutines handling forwarded connections.
-// It's called on first use by (*Client).ListenTCP to not launch
-// goroutines until needed.
-func (c *Client) handleForwards() {
- go c.forwards.handleChannels(c.HandleChannelOpen("forwarded-tcpip"))
- go c.forwards.handleChannels(c.HandleChannelOpen("forwarded-streamlocal@openssh.com"))
-}
-
-// ListenTCP requests the remote peer open a listening socket
-// on laddr. Incoming connections will be available by calling
-// Accept on the returned net.Listener.
-func (c *Client) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) {
- c.handleForwardsOnce.Do(c.handleForwards)
- if laddr.Port == 0 && isBrokenOpenSSHVersion(string(c.ServerVersion())) {
- return c.autoPortListenWorkaround(laddr)
- }
-
- m := channelForwardMsg{
- laddr.IP.String(),
- uint32(laddr.Port),
- }
- // send message
- ok, resp, err := c.SendRequest("tcpip-forward", true, Marshal(&m))
- if err != nil {
- return nil, err
- }
- if !ok {
- return nil, errors.New("ssh: tcpip-forward request denied by peer")
- }
-
- // If the original port was 0, then the remote side will
- // supply a real port number in the response.
- if laddr.Port == 0 {
- var p struct {
- Port uint32
- }
- if err := Unmarshal(resp, &p); err != nil {
- return nil, err
- }
- laddr.Port = int(p.Port)
- }
-
- // Register this forward, using the port number we obtained.
- ch := c.forwards.add(laddr)
-
- return &tcpListener{laddr, c, ch}, nil
-}
-
-// forwardList stores a mapping between remote
-// forward requests and the tcpListeners.
-type forwardList struct {
- sync.Mutex
- entries []forwardEntry
-}
-
-// forwardEntry represents an established mapping of a laddr on a
-// remote ssh server to a channel connected to a tcpListener.
-type forwardEntry struct {
- laddr net.Addr
- c chan forward
-}
-
-// forward represents an incoming forwarded tcpip connection. The
-// arguments to add/remove/lookup should be address as specified in
-// the original forward-request.
-type forward struct {
- newCh NewChannel // the ssh client channel underlying this forward
- raddr net.Addr // the raddr of the incoming connection
-}
-
-func (l *forwardList) add(addr net.Addr) chan forward {
- l.Lock()
- defer l.Unlock()
- f := forwardEntry{
- laddr: addr,
- c: make(chan forward, 1),
- }
- l.entries = append(l.entries, f)
- return f.c
-}
-
-// See RFC 4254, section 7.2
-type forwardedTCPPayload struct {
- Addr string
- Port uint32
- OriginAddr string
- OriginPort uint32
-}
-
-// parseTCPAddr parses the originating address from the remote into a *net.TCPAddr.
-func parseTCPAddr(addr string, port uint32) (*net.TCPAddr, error) {
- if port == 0 || port > 65535 {
- return nil, fmt.Errorf("ssh: port number out of range: %d", port)
- }
- ip := net.ParseIP(string(addr))
- if ip == nil {
- return nil, fmt.Errorf("ssh: cannot parse IP address %q", addr)
- }
- return &net.TCPAddr{IP: ip, Port: int(port)}, nil
-}
-
-func (l *forwardList) handleChannels(in <-chan NewChannel) {
- for ch := range in {
- var (
- laddr net.Addr
- raddr net.Addr
- err error
- )
- switch channelType := ch.ChannelType(); channelType {
- case "forwarded-tcpip":
- var payload forwardedTCPPayload
- if err = Unmarshal(ch.ExtraData(), &payload); err != nil {
- ch.Reject(ConnectionFailed, "could not parse forwarded-tcpip payload: "+err.Error())
- continue
- }
-
- // RFC 4254 section 7.2 specifies that incoming
- // addresses should list the address, in string
- // format. It is implied that this should be an IP
- // address, as it would be impossible to connect to it
- // otherwise.
- laddr, err = parseTCPAddr(payload.Addr, payload.Port)
- if err != nil {
- ch.Reject(ConnectionFailed, err.Error())
- continue
- }
- raddr, err = parseTCPAddr(payload.OriginAddr, payload.OriginPort)
- if err != nil {
- ch.Reject(ConnectionFailed, err.Error())
- continue
- }
-
- case "forwarded-streamlocal@openssh.com":
- var payload forwardedStreamLocalPayload
- if err = Unmarshal(ch.ExtraData(), &payload); err != nil {
- ch.Reject(ConnectionFailed, "could not parse forwarded-streamlocal@openssh.com payload: "+err.Error())
- continue
- }
- laddr = &net.UnixAddr{
- Name: payload.SocketPath,
- Net: "unix",
- }
- raddr = &net.UnixAddr{
- Name: "@",
- Net: "unix",
- }
- default:
- panic(fmt.Errorf("ssh: unknown channel type %s", channelType))
- }
- if ok := l.forward(laddr, raddr, ch); !ok {
- // Section 7.2, implementations MUST reject spurious incoming
- // connections.
- ch.Reject(Prohibited, "no forward for address")
- continue
- }
-
- }
-}
-
-// remove removes the forward entry, and the channel feeding its
-// listener.
-func (l *forwardList) remove(addr net.Addr) {
- l.Lock()
- defer l.Unlock()
- for i, f := range l.entries {
- if addr.Network() == f.laddr.Network() && addr.String() == f.laddr.String() {
- l.entries = append(l.entries[:i], l.entries[i+1:]...)
- close(f.c)
- return
- }
- }
-}
-
-// closeAll closes and clears all forwards.
-func (l *forwardList) closeAll() {
- l.Lock()
- defer l.Unlock()
- for _, f := range l.entries {
- close(f.c)
- }
- l.entries = nil
-}
-
-func (l *forwardList) forward(laddr, raddr net.Addr, ch NewChannel) bool {
- l.Lock()
- defer l.Unlock()
- for _, f := range l.entries {
- if laddr.Network() == f.laddr.Network() && laddr.String() == f.laddr.String() {
- f.c <- forward{newCh: ch, raddr: raddr}
- return true
- }
- }
- return false
-}
-
-type tcpListener struct {
- laddr *net.TCPAddr
-
- conn *Client
- in <-chan forward
-}
-
-// Accept waits for and returns the next connection to the listener.
-func (l *tcpListener) Accept() (net.Conn, error) {
- s, ok := <-l.in
- if !ok {
- return nil, io.EOF
- }
- ch, incoming, err := s.newCh.Accept()
- if err != nil {
- return nil, err
- }
- go DiscardRequests(incoming)
-
- return &chanConn{
- Channel: ch,
- laddr: l.laddr,
- raddr: s.raddr,
- }, nil
-}
-
-// Close closes the listener.
-func (l *tcpListener) Close() error {
- m := channelForwardMsg{
- l.laddr.IP.String(),
- uint32(l.laddr.Port),
- }
-
- // this also closes the listener.
- l.conn.forwards.remove(l.laddr)
- ok, _, err := l.conn.SendRequest("cancel-tcpip-forward", true, Marshal(&m))
- if err == nil && !ok {
- err = errors.New("ssh: cancel-tcpip-forward failed")
- }
- return err
-}
-
-// Addr returns the listener's network address.
-func (l *tcpListener) Addr() net.Addr {
- return l.laddr
-}
-
-// Dial initiates a connection to the addr from the remote host.
-// The resulting connection has a zero LocalAddr() and RemoteAddr().
-func (c *Client) Dial(n, addr string) (net.Conn, error) {
- var ch Channel
- switch n {
- case "tcp", "tcp4", "tcp6":
- // Parse the address into host and numeric port.
- host, portString, err := net.SplitHostPort(addr)
- if err != nil {
- return nil, err
- }
- port, err := strconv.ParseUint(portString, 10, 16)
- if err != nil {
- return nil, err
- }
- ch, err = c.dial(net.IPv4zero.String(), 0, host, int(port))
- if err != nil {
- return nil, err
- }
- // Use a zero address for local and remote address.
- zeroAddr := &net.TCPAddr{
- IP: net.IPv4zero,
- Port: 0,
- }
- return &chanConn{
- Channel: ch,
- laddr: zeroAddr,
- raddr: zeroAddr,
- }, nil
- case "unix":
- var err error
- ch, err = c.dialStreamLocal(addr)
- if err != nil {
- return nil, err
- }
- return &chanConn{
- Channel: ch,
- laddr: &net.UnixAddr{
- Name: "@",
- Net: "unix",
- },
- raddr: &net.UnixAddr{
- Name: addr,
- Net: "unix",
- },
- }, nil
- default:
- return nil, fmt.Errorf("ssh: unsupported protocol: %s", n)
- }
-}
-
-// DialTCP connects to the remote address raddr on the network net,
-// which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is used
-// as the local address for the connection.
-func (c *Client) DialTCP(n string, laddr, raddr *net.TCPAddr) (net.Conn, error) {
- if laddr == nil {
- laddr = &net.TCPAddr{
- IP: net.IPv4zero,
- Port: 0,
- }
- }
- ch, err := c.dial(laddr.IP.String(), laddr.Port, raddr.IP.String(), raddr.Port)
- if err != nil {
- return nil, err
- }
- return &chanConn{
- Channel: ch,
- laddr: laddr,
- raddr: raddr,
- }, nil
-}
-
-// RFC 4254 7.2
-type channelOpenDirectMsg struct {
- raddr string
- rport uint32
- laddr string
- lport uint32
-}
-
-func (c *Client) dial(laddr string, lport int, raddr string, rport int) (Channel, error) {
- msg := channelOpenDirectMsg{
- raddr: raddr,
- rport: uint32(rport),
- laddr: laddr,
- lport: uint32(lport),
- }
- ch, in, err := c.OpenChannel("direct-tcpip", Marshal(&msg))
- if err != nil {
- return nil, err
- }
- go DiscardRequests(in)
- return ch, err
-}
-
-type tcpChan struct {
- Channel // the backing channel
-}
-
-// chanConn fulfills the net.Conn interface without
-// the tcpChan having to hold laddr or raddr directly.
-type chanConn struct {
- Channel
- laddr, raddr net.Addr
-}
-
-// LocalAddr returns the local network address.
-func (t *chanConn) LocalAddr() net.Addr {
- return t.laddr
-}
-
-// RemoteAddr returns the remote network address.
-func (t *chanConn) RemoteAddr() net.Addr {
- return t.raddr
-}
-
-// SetDeadline sets the read and write deadlines associated
-// with the connection.
-func (t *chanConn) SetDeadline(deadline time.Time) error {
- if err := t.SetReadDeadline(deadline); err != nil {
- return err
- }
- return t.SetWriteDeadline(deadline)
-}
-
-// SetReadDeadline sets the read deadline.
-// A zero value for t means Read will not time out.
-// After the deadline, the error from Read will implement net.Error
-// with Timeout() == true.
-func (t *chanConn) SetReadDeadline(deadline time.Time) error {
- // for compatibility with previous version,
- // the error message contains "tcpChan"
- return errors.New("ssh: tcpChan: deadline not supported")
-}
-
-// SetWriteDeadline exists to satisfy the net.Conn interface
-// but is not implemented by this type. It always returns an error.
-func (t *chanConn) SetWriteDeadline(deadline time.Time) error {
- return errors.New("ssh: tcpChan: deadline not supported")
-}
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go b/vendor/golang.org/x/crypto/ssh/terminal/terminal.go
deleted file mode 100644
index 9a887598..00000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go
+++ /dev/null
@@ -1,951 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package terminal
-
-import (
- "bytes"
- "io"
- "sync"
- "unicode/utf8"
-)
-
-// EscapeCodes contains escape sequences that can be written to the terminal in
-// order to achieve different styles of text.
-type EscapeCodes struct {
- // Foreground colors
- Black, Red, Green, Yellow, Blue, Magenta, Cyan, White []byte
-
- // Reset all attributes
- Reset []byte
-}
-
-var vt100EscapeCodes = EscapeCodes{
- Black: []byte{keyEscape, '[', '3', '0', 'm'},
- Red: []byte{keyEscape, '[', '3', '1', 'm'},
- Green: []byte{keyEscape, '[', '3', '2', 'm'},
- Yellow: []byte{keyEscape, '[', '3', '3', 'm'},
- Blue: []byte{keyEscape, '[', '3', '4', 'm'},
- Magenta: []byte{keyEscape, '[', '3', '5', 'm'},
- Cyan: []byte{keyEscape, '[', '3', '6', 'm'},
- White: []byte{keyEscape, '[', '3', '7', 'm'},
-
- Reset: []byte{keyEscape, '[', '0', 'm'},
-}
-
-// Terminal contains the state for running a VT100 terminal that is capable of
-// reading lines of input.
-type Terminal struct {
- // AutoCompleteCallback, if non-null, is called for each keypress with
- // the full input line and the current position of the cursor (in
- // bytes, as an index into |line|). If it returns ok=false, the key
- // press is processed normally. Otherwise it returns a replacement line
- // and the new cursor position.
- AutoCompleteCallback func(line string, pos int, key rune) (newLine string, newPos int, ok bool)
-
- // Escape contains a pointer to the escape codes for this terminal.
- // It's always a valid pointer, although the escape codes themselves
- // may be empty if the terminal doesn't support them.
- Escape *EscapeCodes
-
- // lock protects the terminal and the state in this object from
- // concurrent processing of a key press and a Write() call.
- lock sync.Mutex
-
- c io.ReadWriter
- prompt []rune
-
- // line is the current line being entered.
- line []rune
- // pos is the logical position of the cursor in line
- pos int
- // echo is true if local echo is enabled
- echo bool
- // pasteActive is true iff there is a bracketed paste operation in
- // progress.
- pasteActive bool
-
- // cursorX contains the current X value of the cursor where the left
- // edge is 0. cursorY contains the row number where the first row of
- // the current line is 0.
- cursorX, cursorY int
- // maxLine is the greatest value of cursorY so far.
- maxLine int
-
- termWidth, termHeight int
-
- // outBuf contains the terminal data to be sent.
- outBuf []byte
- // remainder contains the remainder of any partial key sequences after
- // a read. It aliases into inBuf.
- remainder []byte
- inBuf [256]byte
-
- // history contains previously entered commands so that they can be
- // accessed with the up and down keys.
- history stRingBuffer
- // historyIndex stores the currently accessed history entry, where zero
- // means the immediately previous entry.
- historyIndex int
- // When navigating up and down the history it's possible to return to
- // the incomplete, initial line. That value is stored in
- // historyPending.
- historyPending string
-}
-
-// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is
-// a local terminal, that terminal must first have been put into raw mode.
-// prompt is a string that is written at the start of each input line (i.e.
-// "> ").
-func NewTerminal(c io.ReadWriter, prompt string) *Terminal {
- return &Terminal{
- Escape: &vt100EscapeCodes,
- c: c,
- prompt: []rune(prompt),
- termWidth: 80,
- termHeight: 24,
- echo: true,
- historyIndex: -1,
- }
-}
-
-const (
- keyCtrlD = 4
- keyCtrlU = 21
- keyEnter = '\r'
- keyEscape = 27
- keyBackspace = 127
- keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota
- keyUp
- keyDown
- keyLeft
- keyRight
- keyAltLeft
- keyAltRight
- keyHome
- keyEnd
- keyDeleteWord
- keyDeleteLine
- keyClearScreen
- keyPasteStart
- keyPasteEnd
-)
-
-var (
- crlf = []byte{'\r', '\n'}
- pasteStart = []byte{keyEscape, '[', '2', '0', '0', '~'}
- pasteEnd = []byte{keyEscape, '[', '2', '0', '1', '~'}
-)
-
-// bytesToKey tries to parse a key sequence from b. If successful, it returns
-// the key and the remainder of the input. Otherwise it returns utf8.RuneError.
-func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
- if len(b) == 0 {
- return utf8.RuneError, nil
- }
-
- if !pasteActive {
- switch b[0] {
- case 1: // ^A
- return keyHome, b[1:]
- case 5: // ^E
- return keyEnd, b[1:]
- case 8: // ^H
- return keyBackspace, b[1:]
- case 11: // ^K
- return keyDeleteLine, b[1:]
- case 12: // ^L
- return keyClearScreen, b[1:]
- case 23: // ^W
- return keyDeleteWord, b[1:]
- }
- }
-
- if b[0] != keyEscape {
- if !utf8.FullRune(b) {
- return utf8.RuneError, b
- }
- r, l := utf8.DecodeRune(b)
- return r, b[l:]
- }
-
- if !pasteActive && len(b) >= 3 && b[0] == keyEscape && b[1] == '[' {
- switch b[2] {
- case 'A':
- return keyUp, b[3:]
- case 'B':
- return keyDown, b[3:]
- case 'C':
- return keyRight, b[3:]
- case 'D':
- return keyLeft, b[3:]
- case 'H':
- return keyHome, b[3:]
- case 'F':
- return keyEnd, b[3:]
- }
- }
-
- if !pasteActive && len(b) >= 6 && b[0] == keyEscape && b[1] == '[' && b[2] == '1' && b[3] == ';' && b[4] == '3' {
- switch b[5] {
- case 'C':
- return keyAltRight, b[6:]
- case 'D':
- return keyAltLeft, b[6:]
- }
- }
-
- if !pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteStart) {
- return keyPasteStart, b[6:]
- }
-
- if pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteEnd) {
- return keyPasteEnd, b[6:]
- }
-
- // If we get here then we have a key that we don't recognise, or a
- // partial sequence. It's not clear how one should find the end of a
- // sequence without knowing them all, but it seems that [a-zA-Z~] only
- // appears at the end of a sequence.
- for i, c := range b[0:] {
- if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '~' {
- return keyUnknown, b[i+1:]
- }
- }
-
- return utf8.RuneError, b
-}
-
-// queue appends data to the end of t.outBuf
-func (t *Terminal) queue(data []rune) {
- t.outBuf = append(t.outBuf, []byte(string(data))...)
-}
-
-var eraseUnderCursor = []rune{' ', keyEscape, '[', 'D'}
-var space = []rune{' '}
-
-func isPrintable(key rune) bool {
- isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
- return key >= 32 && !isInSurrogateArea
-}
-
-// moveCursorToPos appends data to t.outBuf which will move the cursor to the
-// given, logical position in the text.
-func (t *Terminal) moveCursorToPos(pos int) {
- if !t.echo {
- return
- }
-
- x := visualLength(t.prompt) + pos
- y := x / t.termWidth
- x = x % t.termWidth
-
- up := 0
- if y < t.cursorY {
- up = t.cursorY - y
- }
-
- down := 0
- if y > t.cursorY {
- down = y - t.cursorY
- }
-
- left := 0
- if x < t.cursorX {
- left = t.cursorX - x
- }
-
- right := 0
- if x > t.cursorX {
- right = x - t.cursorX
- }
-
- t.cursorX = x
- t.cursorY = y
- t.move(up, down, left, right)
-}
-
-func (t *Terminal) move(up, down, left, right int) {
- movement := make([]rune, 3*(up+down+left+right))
- m := movement
- for i := 0; i < up; i++ {
- m[0] = keyEscape
- m[1] = '['
- m[2] = 'A'
- m = m[3:]
- }
- for i := 0; i < down; i++ {
- m[0] = keyEscape
- m[1] = '['
- m[2] = 'B'
- m = m[3:]
- }
- for i := 0; i < left; i++ {
- m[0] = keyEscape
- m[1] = '['
- m[2] = 'D'
- m = m[3:]
- }
- for i := 0; i < right; i++ {
- m[0] = keyEscape
- m[1] = '['
- m[2] = 'C'
- m = m[3:]
- }
-
- t.queue(movement)
-}
-
-func (t *Terminal) clearLineToRight() {
- op := []rune{keyEscape, '[', 'K'}
- t.queue(op)
-}
-
-const maxLineLength = 4096
-
-func (t *Terminal) setLine(newLine []rune, newPos int) {
- if t.echo {
- t.moveCursorToPos(0)
- t.writeLine(newLine)
- for i := len(newLine); i < len(t.line); i++ {
- t.writeLine(space)
- }
- t.moveCursorToPos(newPos)
- }
- t.line = newLine
- t.pos = newPos
-}
-
-func (t *Terminal) advanceCursor(places int) {
- t.cursorX += places
- t.cursorY += t.cursorX / t.termWidth
- if t.cursorY > t.maxLine {
- t.maxLine = t.cursorY
- }
- t.cursorX = t.cursorX % t.termWidth
-
- if places > 0 && t.cursorX == 0 {
- // Normally terminals will advance the current position
- // when writing a character. But that doesn't happen
- // for the last character in a line. However, when
- // writing a character (except a new line) that causes
- // a line wrap, the position will be advanced two
- // places.
- //
- // So, if we are stopping at the end of a line, we
- // need to write a newline so that our cursor can be
- // advanced to the next line.
- t.outBuf = append(t.outBuf, '\r', '\n')
- }
-}
-
-func (t *Terminal) eraseNPreviousChars(n int) {
- if n == 0 {
- return
- }
-
- if t.pos < n {
- n = t.pos
- }
- t.pos -= n
- t.moveCursorToPos(t.pos)
-
- copy(t.line[t.pos:], t.line[n+t.pos:])
- t.line = t.line[:len(t.line)-n]
- if t.echo {
- t.writeLine(t.line[t.pos:])
- for i := 0; i < n; i++ {
- t.queue(space)
- }
- t.advanceCursor(n)
- t.moveCursorToPos(t.pos)
- }
-}
-
-// countToLeftWord returns then number of characters from the cursor to the
-// start of the previous word.
-func (t *Terminal) countToLeftWord() int {
- if t.pos == 0 {
- return 0
- }
-
- pos := t.pos - 1
- for pos > 0 {
- if t.line[pos] != ' ' {
- break
- }
- pos--
- }
- for pos > 0 {
- if t.line[pos] == ' ' {
- pos++
- break
- }
- pos--
- }
-
- return t.pos - pos
-}
-
-// countToRightWord returns then number of characters from the cursor to the
-// start of the next word.
-func (t *Terminal) countToRightWord() int {
- pos := t.pos
- for pos < len(t.line) {
- if t.line[pos] == ' ' {
- break
- }
- pos++
- }
- for pos < len(t.line) {
- if t.line[pos] != ' ' {
- break
- }
- pos++
- }
- return pos - t.pos
-}
-
-// visualLength returns the number of visible glyphs in s.
-func visualLength(runes []rune) int {
- inEscapeSeq := false
- length := 0
-
- for _, r := range runes {
- switch {
- case inEscapeSeq:
- if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
- inEscapeSeq = false
- }
- case r == '\x1b':
- inEscapeSeq = true
- default:
- length++
- }
- }
-
- return length
-}
-
-// handleKey processes the given key and, optionally, returns a line of text
-// that the user has entered.
-func (t *Terminal) handleKey(key rune) (line string, ok bool) {
- if t.pasteActive && key != keyEnter {
- t.addKeyToLine(key)
- return
- }
-
- switch key {
- case keyBackspace:
- if t.pos == 0 {
- return
- }
- t.eraseNPreviousChars(1)
- case keyAltLeft:
- // move left by a word.
- t.pos -= t.countToLeftWord()
- t.moveCursorToPos(t.pos)
- case keyAltRight:
- // move right by a word.
- t.pos += t.countToRightWord()
- t.moveCursorToPos(t.pos)
- case keyLeft:
- if t.pos == 0 {
- return
- }
- t.pos--
- t.moveCursorToPos(t.pos)
- case keyRight:
- if t.pos == len(t.line) {
- return
- }
- t.pos++
- t.moveCursorToPos(t.pos)
- case keyHome:
- if t.pos == 0 {
- return
- }
- t.pos = 0
- t.moveCursorToPos(t.pos)
- case keyEnd:
- if t.pos == len(t.line) {
- return
- }
- t.pos = len(t.line)
- t.moveCursorToPos(t.pos)
- case keyUp:
- entry, ok := t.history.NthPreviousEntry(t.historyIndex + 1)
- if !ok {
- return "", false
- }
- if t.historyIndex == -1 {
- t.historyPending = string(t.line)
- }
- t.historyIndex++
- runes := []rune(entry)
- t.setLine(runes, len(runes))
- case keyDown:
- switch t.historyIndex {
- case -1:
- return
- case 0:
- runes := []rune(t.historyPending)
- t.setLine(runes, len(runes))
- t.historyIndex--
- default:
- entry, ok := t.history.NthPreviousEntry(t.historyIndex - 1)
- if ok {
- t.historyIndex--
- runes := []rune(entry)
- t.setLine(runes, len(runes))
- }
- }
- case keyEnter:
- t.moveCursorToPos(len(t.line))
- t.queue([]rune("\r\n"))
- line = string(t.line)
- ok = true
- t.line = t.line[:0]
- t.pos = 0
- t.cursorX = 0
- t.cursorY = 0
- t.maxLine = 0
- case keyDeleteWord:
- // Delete zero or more spaces and then one or more characters.
- t.eraseNPreviousChars(t.countToLeftWord())
- case keyDeleteLine:
- // Delete everything from the current cursor position to the
- // end of line.
- for i := t.pos; i < len(t.line); i++ {
- t.queue(space)
- t.advanceCursor(1)
- }
- t.line = t.line[:t.pos]
- t.moveCursorToPos(t.pos)
- case keyCtrlD:
- // Erase the character under the current position.
- // The EOF case when the line is empty is handled in
- // readLine().
- if t.pos < len(t.line) {
- t.pos++
- t.eraseNPreviousChars(1)
- }
- case keyCtrlU:
- t.eraseNPreviousChars(t.pos)
- case keyClearScreen:
- // Erases the screen and moves the cursor to the home position.
- t.queue([]rune("\x1b[2J\x1b[H"))
- t.queue(t.prompt)
- t.cursorX, t.cursorY = 0, 0
- t.advanceCursor(visualLength(t.prompt))
- t.setLine(t.line, t.pos)
- default:
- if t.AutoCompleteCallback != nil {
- prefix := string(t.line[:t.pos])
- suffix := string(t.line[t.pos:])
-
- t.lock.Unlock()
- newLine, newPos, completeOk := t.AutoCompleteCallback(prefix+suffix, len(prefix), key)
- t.lock.Lock()
-
- if completeOk {
- t.setLine([]rune(newLine), utf8.RuneCount([]byte(newLine)[:newPos]))
- return
- }
- }
- if !isPrintable(key) {
- return
- }
- if len(t.line) == maxLineLength {
- return
- }
- t.addKeyToLine(key)
- }
- return
-}
-
-// addKeyToLine inserts the given key at the current position in the current
-// line.
-func (t *Terminal) addKeyToLine(key rune) {
- if len(t.line) == cap(t.line) {
- newLine := make([]rune, len(t.line), 2*(1+len(t.line)))
- copy(newLine, t.line)
- t.line = newLine
- }
- t.line = t.line[:len(t.line)+1]
- copy(t.line[t.pos+1:], t.line[t.pos:])
- t.line[t.pos] = key
- if t.echo {
- t.writeLine(t.line[t.pos:])
- }
- t.pos++
- t.moveCursorToPos(t.pos)
-}
-
-func (t *Terminal) writeLine(line []rune) {
- for len(line) != 0 {
- remainingOnLine := t.termWidth - t.cursorX
- todo := len(line)
- if todo > remainingOnLine {
- todo = remainingOnLine
- }
- t.queue(line[:todo])
- t.advanceCursor(visualLength(line[:todo]))
- line = line[todo:]
- }
-}
-
-// writeWithCRLF writes buf to w but replaces all occurrences of \n with \r\n.
-func writeWithCRLF(w io.Writer, buf []byte) (n int, err error) {
- for len(buf) > 0 {
- i := bytes.IndexByte(buf, '\n')
- todo := len(buf)
- if i >= 0 {
- todo = i
- }
-
- var nn int
- nn, err = w.Write(buf[:todo])
- n += nn
- if err != nil {
- return n, err
- }
- buf = buf[todo:]
-
- if i >= 0 {
- if _, err = w.Write(crlf); err != nil {
- return n, err
- }
- n++
- buf = buf[1:]
- }
- }
-
- return n, nil
-}
-
-func (t *Terminal) Write(buf []byte) (n int, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- if t.cursorX == 0 && t.cursorY == 0 {
- // This is the easy case: there's nothing on the screen that we
- // have to move out of the way.
- return writeWithCRLF(t.c, buf)
- }
-
- // We have a prompt and possibly user input on the screen. We
- // have to clear it first.
- t.move(0 /* up */, 0 /* down */, t.cursorX /* left */, 0 /* right */)
- t.cursorX = 0
- t.clearLineToRight()
-
- for t.cursorY > 0 {
- t.move(1 /* up */, 0, 0, 0)
- t.cursorY--
- t.clearLineToRight()
- }
-
- if _, err = t.c.Write(t.outBuf); err != nil {
- return
- }
- t.outBuf = t.outBuf[:0]
-
- if n, err = writeWithCRLF(t.c, buf); err != nil {
- return
- }
-
- t.writeLine(t.prompt)
- if t.echo {
- t.writeLine(t.line)
- }
-
- t.moveCursorToPos(t.pos)
-
- if _, err = t.c.Write(t.outBuf); err != nil {
- return
- }
- t.outBuf = t.outBuf[:0]
- return
-}
-
-// ReadPassword temporarily changes the prompt and reads a password, without
-// echo, from the terminal.
-func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- oldPrompt := t.prompt
- t.prompt = []rune(prompt)
- t.echo = false
-
- line, err = t.readLine()
-
- t.prompt = oldPrompt
- t.echo = true
-
- return
-}
-
-// ReadLine returns a line of input from the terminal.
-func (t *Terminal) ReadLine() (line string, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- return t.readLine()
-}
-
-func (t *Terminal) readLine() (line string, err error) {
- // t.lock must be held at this point
-
- if t.cursorX == 0 && t.cursorY == 0 {
- t.writeLine(t.prompt)
- t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- }
-
- lineIsPasted := t.pasteActive
-
- for {
- rest := t.remainder
- lineOk := false
- for !lineOk {
- var key rune
- key, rest = bytesToKey(rest, t.pasteActive)
- if key == utf8.RuneError {
- break
- }
- if !t.pasteActive {
- if key == keyCtrlD {
- if len(t.line) == 0 {
- return "", io.EOF
- }
- }
- if key == keyPasteStart {
- t.pasteActive = true
- if len(t.line) == 0 {
- lineIsPasted = true
- }
- continue
- }
- } else if key == keyPasteEnd {
- t.pasteActive = false
- continue
- }
- if !t.pasteActive {
- lineIsPasted = false
- }
- line, lineOk = t.handleKey(key)
- }
- if len(rest) > 0 {
- n := copy(t.inBuf[:], rest)
- t.remainder = t.inBuf[:n]
- } else {
- t.remainder = nil
- }
- t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- if lineOk {
- if t.echo {
- t.historyIndex = -1
- t.history.Add(line)
- }
- if lineIsPasted {
- err = ErrPasteIndicator
- }
- return
- }
-
- // t.remainder is a slice at the beginning of t.inBuf
- // containing a partial key sequence
- readBuf := t.inBuf[len(t.remainder):]
- var n int
-
- t.lock.Unlock()
- n, err = t.c.Read(readBuf)
- t.lock.Lock()
-
- if err != nil {
- return
- }
-
- t.remainder = t.inBuf[:n+len(t.remainder)]
- }
-}
-
-// SetPrompt sets the prompt to be used when reading subsequent lines.
-func (t *Terminal) SetPrompt(prompt string) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- t.prompt = []rune(prompt)
-}
-
-func (t *Terminal) clearAndRepaintLinePlusNPrevious(numPrevLines int) {
- // Move cursor to column zero at the start of the line.
- t.move(t.cursorY, 0, t.cursorX, 0)
- t.cursorX, t.cursorY = 0, 0
- t.clearLineToRight()
- for t.cursorY < numPrevLines {
- // Move down a line
- t.move(0, 1, 0, 0)
- t.cursorY++
- t.clearLineToRight()
- }
- // Move back to beginning.
- t.move(t.cursorY, 0, 0, 0)
- t.cursorX, t.cursorY = 0, 0
-
- t.queue(t.prompt)
- t.advanceCursor(visualLength(t.prompt))
- t.writeLine(t.line)
- t.moveCursorToPos(t.pos)
-}
-
-func (t *Terminal) SetSize(width, height int) error {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- if width == 0 {
- width = 1
- }
-
- oldWidth := t.termWidth
- t.termWidth, t.termHeight = width, height
-
- switch {
- case width == oldWidth:
- // If the width didn't change then nothing else needs to be
- // done.
- return nil
- case len(t.line) == 0 && t.cursorX == 0 && t.cursorY == 0:
- // If there is nothing on current line and no prompt printed,
- // just do nothing
- return nil
- case width < oldWidth:
- // Some terminals (e.g. xterm) will truncate lines that were
- // too long when shinking. Others, (e.g. gnome-terminal) will
- // attempt to wrap them. For the former, repainting t.maxLine
- // works great, but that behaviour goes badly wrong in the case
- // of the latter because they have doubled every full line.
-
- // We assume that we are working on a terminal that wraps lines
- // and adjust the cursor position based on every previous line
- // wrapping and turning into two. This causes the prompt on
- // xterms to move upwards, which isn't great, but it avoids a
- // huge mess with gnome-terminal.
- if t.cursorX >= t.termWidth {
- t.cursorX = t.termWidth - 1
- }
- t.cursorY *= 2
- t.clearAndRepaintLinePlusNPrevious(t.maxLine * 2)
- case width > oldWidth:
- // If the terminal expands then our position calculations will
- // be wrong in the future because we think the cursor is
- // |t.pos| chars into the string, but there will be a gap at
- // the end of any wrapped line.
- //
- // But the position will actually be correct until we move, so
- // we can move back to the beginning and repaint everything.
- t.clearAndRepaintLinePlusNPrevious(t.maxLine)
- }
-
- _, err := t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- return err
-}
-
-type pasteIndicatorError struct{}
-
-func (pasteIndicatorError) Error() string {
- return "terminal: ErrPasteIndicator not correctly handled"
-}
-
-// ErrPasteIndicator may be returned from ReadLine as the error, in addition
-// to valid line data. It indicates that bracketed paste mode is enabled and
-// that the returned line consists only of pasted data. Programs may wish to
-// interpret pasted data more literally than typed data.
-var ErrPasteIndicator = pasteIndicatorError{}
-
-// SetBracketedPasteMode requests that the terminal bracket paste operations
-// with markers. Not all terminals support this but, if it is supported, then
-// enabling this mode will stop any autocomplete callback from running due to
-// pastes. Additionally, any lines that are completely pasted will be returned
-// from ReadLine with the error set to ErrPasteIndicator.
-func (t *Terminal) SetBracketedPasteMode(on bool) {
- if on {
- io.WriteString(t.c, "\x1b[?2004h")
- } else {
- io.WriteString(t.c, "\x1b[?2004l")
- }
-}
-
-// stRingBuffer is a ring buffer of strings.
-type stRingBuffer struct {
- // entries contains max elements.
- entries []string
- max int
- // head contains the index of the element most recently added to the ring.
- head int
- // size contains the number of elements in the ring.
- size int
-}
-
-func (s *stRingBuffer) Add(a string) {
- if s.entries == nil {
- const defaultNumEntries = 100
- s.entries = make([]string, defaultNumEntries)
- s.max = defaultNumEntries
- }
-
- s.head = (s.head + 1) % s.max
- s.entries[s.head] = a
- if s.size < s.max {
- s.size++
- }
-}
-
-// NthPreviousEntry returns the value passed to the nth previous call to Add.
-// If n is zero then the immediately prior value is returned, if one, then the
-// next most recent, and so on. If such an element doesn't exist then ok is
-// false.
-func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
- if n >= s.size {
- return "", false
- }
- index := s.head - n
- if index < 0 {
- index += s.max
- }
- return s.entries[index], true
-}
-
-// readPasswordLine reads from reader until it finds \n or io.EOF.
-// The slice returned does not include the \n.
-// readPasswordLine also ignores any \r it finds.
-func readPasswordLine(reader io.Reader) ([]byte, error) {
- var buf [1]byte
- var ret []byte
-
- for {
- n, err := reader.Read(buf[:])
- if n > 0 {
- switch buf[0] {
- case '\n':
- return ret, nil
- case '\r':
- // remove \r from passwords on Windows
- default:
- ret = append(ret, buf[0])
- }
- continue
- }
- if err != nil {
- if err == io.EOF && len(ret) > 0 {
- return ret, nil
- }
- return ret, err
- }
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util.go b/vendor/golang.org/x/crypto/ssh/terminal/util.go
deleted file mode 100644
index 731c89a2..00000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/util.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := terminal.MakeRaw(0)
-// if err != nil {
-// panic(err)
-// }
-// defer terminal.Restore(0, oldState)
-package terminal // import "golang.org/x/crypto/ssh/terminal"
-
-import (
- "golang.org/x/sys/unix"
-)
-
-// State contains the state of a terminal.
-type State struct {
- termios unix.Termios
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- return err == nil
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- if err != nil {
- return nil, err
- }
-
- oldState := State{termios: *termios}
-
- // This attempts to replicate the behaviour documented for cfmakeraw in
- // the termios(3) manpage.
- termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
- termios.Oflag &^= unix.OPOST
- termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
- termios.Cflag &^= unix.CSIZE | unix.PARENB
- termios.Cflag |= unix.CS8
- termios.Cc[unix.VMIN] = 1
- termios.Cc[unix.VTIME] = 0
- if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, termios); err != nil {
- return nil, err
- }
-
- return &oldState, nil
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- if err != nil {
- return nil, err
- }
-
- return &State{termios: *termios}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
- return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios)
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
- if err != nil {
- return -1, -1, err
- }
- return int(ws.Col), int(ws.Row), nil
-}
-
-// passwordReader is an io.Reader that reads from a specific file descriptor.
-type passwordReader int
-
-func (r passwordReader) Read(buf []byte) (int, error) {
- return unix.Read(int(r), buf)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- if err != nil {
- return nil, err
- }
-
- newState := *termios
- newState.Lflag &^= unix.ECHO
- newState.Lflag |= unix.ICANON | unix.ISIG
- newState.Iflag |= unix.ICRNL
- if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, &newState); err != nil {
- return nil, err
- }
-
- defer unix.IoctlSetTermios(fd, ioctlWriteTermios, termios)
-
- return readPasswordLine(passwordReader(fd))
-}
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go b/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go
deleted file mode 100644
index cb23a590..00000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd netbsd openbsd
-
-package terminal
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TIOCGETA
-const ioctlWriteTermios = unix.TIOCSETA
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go b/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go
deleted file mode 100644
index 5fadfe8a..00000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package terminal
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TCGETS
-const ioctlWriteTermios = unix.TCSETS
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go b/vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go
deleted file mode 100644
index 799f049f..00000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := terminal.MakeRaw(0)
-// if err != nil {
-// panic(err)
-// }
-// defer terminal.Restore(0, oldState)
-package terminal
-
-import (
- "fmt"
- "runtime"
-)
-
-type State struct{}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- return false
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
- return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go b/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go
deleted file mode 100644
index 9e41b9f4..00000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build solaris
-
-package terminal // import "golang.org/x/crypto/ssh/terminal"
-
-import (
- "golang.org/x/sys/unix"
- "io"
- "syscall"
-)
-
-// State contains the state of a terminal.
-type State struct {
- termios unix.Termios
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- _, err := unix.IoctlGetTermio(fd, unix.TCGETA)
- return err == nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- // see also: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libast/common/uwin/getpass.c
- val, err := unix.IoctlGetTermios(fd, unix.TCGETS)
- if err != nil {
- return nil, err
- }
- oldState := *val
-
- newState := oldState
- newState.Lflag &^= syscall.ECHO
- newState.Lflag |= syscall.ICANON | syscall.ISIG
- newState.Iflag |= syscall.ICRNL
- err = unix.IoctlSetTermios(fd, unix.TCSETS, &newState)
- if err != nil {
- return nil, err
- }
-
- defer unix.IoctlSetTermios(fd, unix.TCSETS, &oldState)
-
- var buf [16]byte
- var ret []byte
- for {
- n, err := syscall.Read(fd, buf[:])
- if err != nil {
- return nil, err
- }
- if n == 0 {
- if len(ret) == 0 {
- return nil, io.EOF
- }
- break
- }
- if buf[n-1] == '\n' {
- n--
- }
- ret = append(ret, buf[:n]...)
- if n < len(buf) {
- break
- }
- }
-
- return ret, nil
-}
-
-// MakeRaw puts the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-// see http://cr.illumos.org/~webrev/andy_js/1060/
-func MakeRaw(fd int) (*State, error) {
- termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
- if err != nil {
- return nil, err
- }
-
- oldState := State{termios: *termios}
-
- termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
- termios.Oflag &^= unix.OPOST
- termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
- termios.Cflag &^= unix.CSIZE | unix.PARENB
- termios.Cflag |= unix.CS8
- termios.Cc[unix.VMIN] = 1
- termios.Cc[unix.VTIME] = 0
-
- if err := unix.IoctlSetTermios(fd, unix.TCSETS, termios); err != nil {
- return nil, err
- }
-
- return &oldState, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, oldState *State) error {
- return unix.IoctlSetTermios(fd, unix.TCSETS, &oldState.termios)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
- if err != nil {
- return nil, err
- }
-
- return &State{termios: *termios}, nil
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
- if err != nil {
- return 0, 0, err
- }
- return int(ws.Col), int(ws.Row), nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go b/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go
deleted file mode 100644
index 8618955d..00000000
--- a/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := terminal.MakeRaw(0)
-// if err != nil {
-// panic(err)
-// }
-// defer terminal.Restore(0, oldState)
-package terminal
-
-import (
- "os"
-
- "golang.org/x/sys/windows"
-)
-
-type State struct {
- mode uint32
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- var st uint32
- err := windows.GetConsoleMode(windows.Handle(fd), &st)
- return err == nil
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- var st uint32
- if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
- return nil, err
- }
- raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
- if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
- return nil, err
- }
- return &State{st}, nil
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- var st uint32
- if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
- return nil, err
- }
- return &State{st}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
- return windows.SetConsoleMode(windows.Handle(fd), state.mode)
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- var info windows.ConsoleScreenBufferInfo
- if err := windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info); err != nil {
- return 0, 0, err
- }
- return int(info.Size.X), int(info.Size.Y), nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- var st uint32
- if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
- return nil, err
- }
- old := st
-
- st &^= (windows.ENABLE_ECHO_INPUT)
- st |= (windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
- if err := windows.SetConsoleMode(windows.Handle(fd), st); err != nil {
- return nil, err
- }
-
- defer windows.SetConsoleMode(windows.Handle(fd), old)
-
- var h windows.Handle
- p, _ := windows.GetCurrentProcess()
- if err := windows.DuplicateHandle(p, windows.Handle(fd), p, &h, 0, false, windows.DUPLICATE_SAME_ACCESS); err != nil {
- return nil, err
- }
-
- f := os.NewFile(uintptr(h), "stdin")
- defer f.Close()
- return readPasswordLine(f)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/transport.go b/vendor/golang.org/x/crypto/ssh/transport.go
deleted file mode 100644
index f6fae1db..00000000
--- a/vendor/golang.org/x/crypto/ssh/transport.go
+++ /dev/null
@@ -1,353 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bufio"
- "bytes"
- "errors"
- "io"
- "log"
-)
-
-// debugTransport if set, will print packet types as they go over the
-// wire. No message decoding is done, to minimize the impact on timing.
-const debugTransport = false
-
-const (
- gcmCipherID = "aes128-gcm@openssh.com"
- aes128cbcID = "aes128-cbc"
- tripledescbcID = "3des-cbc"
-)
-
-// packetConn represents a transport that implements packet based
-// operations.
-type packetConn interface {
- // Encrypt and send a packet of data to the remote peer.
- writePacket(packet []byte) error
-
- // Read a packet from the connection. The read is blocking,
- // i.e. if error is nil, then the returned byte slice is
- // always non-empty.
- readPacket() ([]byte, error)
-
- // Close closes the write-side of the connection.
- Close() error
-}
-
-// transport is the keyingTransport that implements the SSH packet
-// protocol.
-type transport struct {
- reader connectionState
- writer connectionState
-
- bufReader *bufio.Reader
- bufWriter *bufio.Writer
- rand io.Reader
- isClient bool
- io.Closer
-}
-
-// packetCipher represents a combination of SSH encryption/MAC
-// protocol. A single instance should be used for one direction only.
-type packetCipher interface {
- // writePacket encrypts the packet and writes it to w. The
- // contents of the packet are generally scrambled.
- writePacket(seqnum uint32, w io.Writer, rand io.Reader, packet []byte) error
-
- // readPacket reads and decrypts a packet of data. The
- // returned packet may be overwritten by future calls of
- // readPacket.
- readPacket(seqnum uint32, r io.Reader) ([]byte, error)
-}
-
-// connectionState represents one side (read or write) of the
-// connection. This is necessary because each direction has its own
-// keys, and can even have its own algorithms
-type connectionState struct {
- packetCipher
- seqNum uint32
- dir direction
- pendingKeyChange chan packetCipher
-}
-
-// prepareKeyChange sets up key material for a keychange. The key changes in
-// both directions are triggered by reading and writing a msgNewKey packet
-// respectively.
-func (t *transport) prepareKeyChange(algs *algorithms, kexResult *kexResult) error {
- ciph, err := newPacketCipher(t.reader.dir, algs.r, kexResult)
- if err != nil {
- return err
- }
- t.reader.pendingKeyChange <- ciph
-
- ciph, err = newPacketCipher(t.writer.dir, algs.w, kexResult)
- if err != nil {
- return err
- }
- t.writer.pendingKeyChange <- ciph
-
- return nil
-}
-
-func (t *transport) printPacket(p []byte, write bool) {
- if len(p) == 0 {
- return
- }
- who := "server"
- if t.isClient {
- who = "client"
- }
- what := "read"
- if write {
- what = "write"
- }
-
- log.Println(what, who, p[0])
-}
-
-// Read and decrypt next packet.
-func (t *transport) readPacket() (p []byte, err error) {
- for {
- p, err = t.reader.readPacket(t.bufReader)
- if err != nil {
- break
- }
- if len(p) == 0 || (p[0] != msgIgnore && p[0] != msgDebug) {
- break
- }
- }
- if debugTransport {
- t.printPacket(p, false)
- }
-
- return p, err
-}
-
-func (s *connectionState) readPacket(r *bufio.Reader) ([]byte, error) {
- packet, err := s.packetCipher.readPacket(s.seqNum, r)
- s.seqNum++
- if err == nil && len(packet) == 0 {
- err = errors.New("ssh: zero length packet")
- }
-
- if len(packet) > 0 {
- switch packet[0] {
- case msgNewKeys:
- select {
- case cipher := <-s.pendingKeyChange:
- s.packetCipher = cipher
- default:
- return nil, errors.New("ssh: got bogus newkeys message")
- }
-
- case msgDisconnect:
- // Transform a disconnect message into an
- // error. Since this is lowest level at which
- // we interpret message types, doing it here
- // ensures that we don't have to handle it
- // elsewhere.
- var msg disconnectMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return nil, err
- }
- return nil, &msg
- }
- }
-
- // The packet may point to an internal buffer, so copy the
- // packet out here.
- fresh := make([]byte, len(packet))
- copy(fresh, packet)
-
- return fresh, err
-}
-
-func (t *transport) writePacket(packet []byte) error {
- if debugTransport {
- t.printPacket(packet, true)
- }
- return t.writer.writePacket(t.bufWriter, t.rand, packet)
-}
-
-func (s *connectionState) writePacket(w *bufio.Writer, rand io.Reader, packet []byte) error {
- changeKeys := len(packet) > 0 && packet[0] == msgNewKeys
-
- err := s.packetCipher.writePacket(s.seqNum, w, rand, packet)
- if err != nil {
- return err
- }
- if err = w.Flush(); err != nil {
- return err
- }
- s.seqNum++
- if changeKeys {
- select {
- case cipher := <-s.pendingKeyChange:
- s.packetCipher = cipher
- default:
- panic("ssh: no key material for msgNewKeys")
- }
- }
- return err
-}
-
-func newTransport(rwc io.ReadWriteCloser, rand io.Reader, isClient bool) *transport {
- t := &transport{
- bufReader: bufio.NewReader(rwc),
- bufWriter: bufio.NewWriter(rwc),
- rand: rand,
- reader: connectionState{
- packetCipher: &streamPacketCipher{cipher: noneCipher{}},
- pendingKeyChange: make(chan packetCipher, 1),
- },
- writer: connectionState{
- packetCipher: &streamPacketCipher{cipher: noneCipher{}},
- pendingKeyChange: make(chan packetCipher, 1),
- },
- Closer: rwc,
- }
- t.isClient = isClient
-
- if isClient {
- t.reader.dir = serverKeys
- t.writer.dir = clientKeys
- } else {
- t.reader.dir = clientKeys
- t.writer.dir = serverKeys
- }
-
- return t
-}
-
-type direction struct {
- ivTag []byte
- keyTag []byte
- macKeyTag []byte
-}
-
-var (
- serverKeys = direction{[]byte{'B'}, []byte{'D'}, []byte{'F'}}
- clientKeys = direction{[]byte{'A'}, []byte{'C'}, []byte{'E'}}
-)
-
-// setupKeys sets the cipher and MAC keys from kex.K, kex.H and sessionId, as
-// described in RFC 4253, section 6.4. direction should either be serverKeys
-// (to setup server->client keys) or clientKeys (for client->server keys).
-func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (packetCipher, error) {
- cipherMode := cipherModes[algs.Cipher]
- macMode := macModes[algs.MAC]
-
- iv := make([]byte, cipherMode.ivSize)
- key := make([]byte, cipherMode.keySize)
- macKey := make([]byte, macMode.keySize)
-
- generateKeyMaterial(iv, d.ivTag, kex)
- generateKeyMaterial(key, d.keyTag, kex)
- generateKeyMaterial(macKey, d.macKeyTag, kex)
-
- return cipherModes[algs.Cipher].create(key, iv, macKey, algs)
-}
-
-// generateKeyMaterial fills out with key material generated from tag, K, H
-// and sessionId, as specified in RFC 4253, section 7.2.
-func generateKeyMaterial(out, tag []byte, r *kexResult) {
- var digestsSoFar []byte
-
- h := r.Hash.New()
- for len(out) > 0 {
- h.Reset()
- h.Write(r.K)
- h.Write(r.H)
-
- if len(digestsSoFar) == 0 {
- h.Write(tag)
- h.Write(r.SessionID)
- } else {
- h.Write(digestsSoFar)
- }
-
- digest := h.Sum(nil)
- n := copy(out, digest)
- out = out[n:]
- if len(out) > 0 {
- digestsSoFar = append(digestsSoFar, digest...)
- }
- }
-}
-
-const packageVersion = "SSH-2.0-Go"
-
-// Sends and receives a version line. The versionLine string should
-// be US ASCII, start with "SSH-2.0-", and should not include a
-// newline. exchangeVersions returns the other side's version line.
-func exchangeVersions(rw io.ReadWriter, versionLine []byte) (them []byte, err error) {
- // Contrary to the RFC, we do not ignore lines that don't
- // start with "SSH-2.0-" to make the library usable with
- // nonconforming servers.
- for _, c := range versionLine {
- // The spec disallows non US-ASCII chars, and
- // specifically forbids null chars.
- if c < 32 {
- return nil, errors.New("ssh: junk character in version line")
- }
- }
- if _, err = rw.Write(append(versionLine, '\r', '\n')); err != nil {
- return
- }
-
- them, err = readVersion(rw)
- return them, err
-}
-
-// maxVersionStringBytes is the maximum number of bytes that we'll
-// accept as a version string. RFC 4253 section 4.2 limits this at 255
-// chars
-const maxVersionStringBytes = 255
-
-// Read version string as specified by RFC 4253, section 4.2.
-func readVersion(r io.Reader) ([]byte, error) {
- versionString := make([]byte, 0, 64)
- var ok bool
- var buf [1]byte
-
- for length := 0; length < maxVersionStringBytes; length++ {
- _, err := io.ReadFull(r, buf[:])
- if err != nil {
- return nil, err
- }
- // The RFC says that the version should be terminated with \r\n
- // but several SSH servers actually only send a \n.
- if buf[0] == '\n' {
- if !bytes.HasPrefix(versionString, []byte("SSH-")) {
- // RFC 4253 says we need to ignore all version string lines
- // except the one containing the SSH version (provided that
- // all the lines do not exceed 255 bytes in total).
- versionString = versionString[:0]
- continue
- }
- ok = true
- break
- }
-
- // non ASCII chars are disallowed, but we are lenient,
- // since Go doesn't use null-terminated strings.
-
- // The RFC allows a comment after a space, however,
- // all of it (version and comments) goes into the
- // session hash.
- versionString = append(versionString, buf[0])
- }
-
- if !ok {
- return nil, errors.New("ssh: overflow reading version string")
- }
-
- // There might be a '\r' on the end which we should remove.
- if len(versionString) > 0 && versionString[len(versionString)-1] == '\r' {
- versionString = versionString[:len(versionString)-1]
- }
- return versionString, nil
-}
diff --git a/vendor/golang.org/x/net/AUTHORS b/vendor/golang.org/x/net/AUTHORS
deleted file mode 100644
index 15167cd7..00000000
--- a/vendor/golang.org/x/net/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/vendor/golang.org/x/net/CONTRIBUTORS b/vendor/golang.org/x/net/CONTRIBUTORS
deleted file mode 100644
index 1c4577e9..00000000
--- a/vendor/golang.org/x/net/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE
deleted file mode 100644
index 6a66aea5..00000000
--- a/vendor/golang.org/x/net/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-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.
diff --git a/vendor/golang.org/x/net/PATENTS b/vendor/golang.org/x/net/PATENTS
deleted file mode 100644
index 73309904..00000000
--- a/vendor/golang.org/x/net/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go
deleted file mode 100644
index a3c021d3..00000000
--- a/vendor/golang.org/x/net/context/context.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package context defines the Context type, which carries deadlines,
-// cancelation signals, and other request-scoped values across API boundaries
-// and between processes.
-// As of Go 1.7 this package is available in the standard library under the
-// name context. https://golang.org/pkg/context.
-//
-// Incoming requests to a server should create a Context, and outgoing calls to
-// servers should accept a Context. The chain of function calls between must
-// propagate the Context, optionally replacing it with a modified copy created
-// using WithDeadline, WithTimeout, WithCancel, or WithValue.
-//
-// Programs that use Contexts should follow these rules to keep interfaces
-// consistent across packages and enable static analysis tools to check context
-// propagation:
-//
-// Do not store Contexts inside a struct type; instead, pass a Context
-// explicitly to each function that needs it. The Context should be the first
-// parameter, typically named ctx:
-//
-// func DoSomething(ctx context.Context, arg Arg) error {
-// // ... use ctx ...
-// }
-//
-// Do not pass a nil Context, even if a function permits it. Pass context.TODO
-// if you are unsure about which Context to use.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-//
-// The same Context may be passed to functions running in different goroutines;
-// Contexts are safe for simultaneous use by multiple goroutines.
-//
-// See http://blog.golang.org/context for example code for a server that uses
-// Contexts.
-package context // import "golang.org/x/net/context"
-
-// Background returns a non-nil, empty Context. It is never canceled, has no
-// values, and has no deadline. It is typically used by the main function,
-// initialization, and tests, and as the top-level Context for incoming
-// requests.
-func Background() Context {
- return background
-}
-
-// TODO returns a non-nil, empty Context. Code should use context.TODO when
-// it's unclear which Context to use or it is not yet available (because the
-// surrounding function has not yet been extended to accept a Context
-// parameter). TODO is recognized by static analysis tools that determine
-// whether Contexts are propagated correctly in a program.
-func TODO() Context {
- return todo
-}
diff --git a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go b/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go
deleted file mode 100644
index 606cf1f9..00000000
--- a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-// Package ctxhttp provides helper functions for performing context-aware HTTP requests.
-package ctxhttp // import "golang.org/x/net/context/ctxhttp"
-
-import (
- "io"
- "net/http"
- "net/url"
- "strings"
-
- "golang.org/x/net/context"
-)
-
-// Do sends an HTTP request with the provided http.Client and returns
-// an HTTP response.
-//
-// If the client is nil, http.DefaultClient is used.
-//
-// The provided ctx must be non-nil. If it is canceled or times out,
-// ctx.Err() will be returned.
-func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
- if client == nil {
- client = http.DefaultClient
- }
- resp, err := client.Do(req.WithContext(ctx))
- // If we got an error, and the context has been canceled,
- // the context's error is probably more useful.
- if err != nil {
- select {
- case <-ctx.Done():
- err = ctx.Err()
- default:
- }
- }
- return resp, err
-}
-
-// Get issues a GET request via the Do function.
-func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("GET", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Head issues a HEAD request via the Do function.
-func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("HEAD", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Post issues a POST request via the Do function.
-func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) {
- req, err := http.NewRequest("POST", url, body)
- if err != nil {
- return nil, err
- }
- req.Header.Set("Content-Type", bodyType)
- return Do(ctx, client, req)
-}
-
-// PostForm issues a POST request via the Do function.
-func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) {
- return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
-}
diff --git a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go b/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go
deleted file mode 100644
index 926870cc..00000000
--- a/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.7
-
-package ctxhttp // import "golang.org/x/net/context/ctxhttp"
-
-import (
- "io"
- "net/http"
- "net/url"
- "strings"
-
- "golang.org/x/net/context"
-)
-
-func nop() {}
-
-var (
- testHookContextDoneBeforeHeaders = nop
- testHookDoReturned = nop
- testHookDidBodyClose = nop
-)
-
-// Do sends an HTTP request with the provided http.Client and returns an HTTP response.
-// If the client is nil, http.DefaultClient is used.
-// If the context is canceled or times out, ctx.Err() will be returned.
-func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
- if client == nil {
- client = http.DefaultClient
- }
-
- // TODO(djd): Respect any existing value of req.Cancel.
- cancel := make(chan struct{})
- req.Cancel = cancel
-
- type responseAndError struct {
- resp *http.Response
- err error
- }
- result := make(chan responseAndError, 1)
-
- // Make local copies of test hooks closed over by goroutines below.
- // Prevents data races in tests.
- testHookDoReturned := testHookDoReturned
- testHookDidBodyClose := testHookDidBodyClose
-
- go func() {
- resp, err := client.Do(req)
- testHookDoReturned()
- result <- responseAndError{resp, err}
- }()
-
- var resp *http.Response
-
- select {
- case <-ctx.Done():
- testHookContextDoneBeforeHeaders()
- close(cancel)
- // Clean up after the goroutine calling client.Do:
- go func() {
- if r := <-result; r.resp != nil {
- testHookDidBodyClose()
- r.resp.Body.Close()
- }
- }()
- return nil, ctx.Err()
- case r := <-result:
- var err error
- resp, err = r.resp, r.err
- if err != nil {
- return resp, err
- }
- }
-
- c := make(chan struct{})
- go func() {
- select {
- case <-ctx.Done():
- close(cancel)
- case <-c:
- // The response's Body is closed.
- }
- }()
- resp.Body = ¬ifyingReader{resp.Body, c}
-
- return resp, nil
-}
-
-// Get issues a GET request via the Do function.
-func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("GET", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Head issues a HEAD request via the Do function.
-func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("HEAD", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Post issues a POST request via the Do function.
-func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) {
- req, err := http.NewRequest("POST", url, body)
- if err != nil {
- return nil, err
- }
- req.Header.Set("Content-Type", bodyType)
- return Do(ctx, client, req)
-}
-
-// PostForm issues a POST request via the Do function.
-func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) {
- return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
-}
-
-// notifyingReader is an io.ReadCloser that closes the notify channel after
-// Close is called or a Read fails on the underlying ReadCloser.
-type notifyingReader struct {
- io.ReadCloser
- notify chan<- struct{}
-}
-
-func (r *notifyingReader) Read(p []byte) (int, error) {
- n, err := r.ReadCloser.Read(p)
- if err != nil && r.notify != nil {
- close(r.notify)
- r.notify = nil
- }
- return n, err
-}
-
-func (r *notifyingReader) Close() error {
- err := r.ReadCloser.Close()
- if r.notify != nil {
- close(r.notify)
- r.notify = nil
- }
- return err
-}
diff --git a/vendor/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go
deleted file mode 100644
index d20f52b7..00000000
--- a/vendor/golang.org/x/net/context/go17.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-package context
-
-import (
- "context" // standard library's context, as of Go 1.7
- "time"
-)
-
-var (
- todo = context.TODO()
- background = context.Background()
-)
-
-// Canceled is the error returned by Context.Err when the context is canceled.
-var Canceled = context.Canceled
-
-// DeadlineExceeded is the error returned by Context.Err when the context's
-// deadline passes.
-var DeadlineExceeded = context.DeadlineExceeded
-
-// WithCancel returns a copy of parent with a new Done channel. The returned
-// context's Done channel is closed when the returned cancel function is called
-// or when the parent context's Done channel is closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
- ctx, f := context.WithCancel(parent)
- return ctx, CancelFunc(f)
-}
-
-// WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d. If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent. The returned
-// context's Done channel is closed when the deadline expires, when the returned
-// cancel function is called, or when the parent context's Done channel is
-// closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
- ctx, f := context.WithDeadline(parent, deadline)
- return ctx, CancelFunc(f)
-}
-
-// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete:
-//
-// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
-// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
-// defer cancel() // releases resources if slowOperation completes before timeout elapses
-// return slowOperation(ctx)
-// }
-func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
- return WithDeadline(parent, time.Now().Add(timeout))
-}
-
-// WithValue returns a copy of parent in which the value associated with key is
-// val.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-func WithValue(parent Context, key interface{}, val interface{}) Context {
- return context.WithValue(parent, key, val)
-}
diff --git a/vendor/golang.org/x/net/context/go19.go b/vendor/golang.org/x/net/context/go19.go
deleted file mode 100644
index d88bd1db..00000000
--- a/vendor/golang.org/x/net/context/go19.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.9
-
-package context
-
-import "context" // standard library's context, as of Go 1.7
-
-// A Context carries a deadline, a cancelation signal, and other values across
-// API boundaries.
-//
-// Context's methods may be called by multiple goroutines simultaneously.
-type Context = context.Context
-
-// A CancelFunc tells an operation to abandon its work.
-// A CancelFunc does not wait for the work to stop.
-// After the first call, subsequent calls to a CancelFunc do nothing.
-type CancelFunc = context.CancelFunc
diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go
deleted file mode 100644
index 0f35592d..00000000
--- a/vendor/golang.org/x/net/context/pre_go17.go
+++ /dev/null
@@ -1,300 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.7
-
-package context
-
-import (
- "errors"
- "fmt"
- "sync"
- "time"
-)
-
-// An emptyCtx is never canceled, has no values, and has no deadline. It is not
-// struct{}, since vars of this type must have distinct addresses.
-type emptyCtx int
-
-func (*emptyCtx) Deadline() (deadline time.Time, ok bool) {
- return
-}
-
-func (*emptyCtx) Done() <-chan struct{} {
- return nil
-}
-
-func (*emptyCtx) Err() error {
- return nil
-}
-
-func (*emptyCtx) Value(key interface{}) interface{} {
- return nil
-}
-
-func (e *emptyCtx) String() string {
- switch e {
- case background:
- return "context.Background"
- case todo:
- return "context.TODO"
- }
- return "unknown empty Context"
-}
-
-var (
- background = new(emptyCtx)
- todo = new(emptyCtx)
-)
-
-// Canceled is the error returned by Context.Err when the context is canceled.
-var Canceled = errors.New("context canceled")
-
-// DeadlineExceeded is the error returned by Context.Err when the context's
-// deadline passes.
-var DeadlineExceeded = errors.New("context deadline exceeded")
-
-// WithCancel returns a copy of parent with a new Done channel. The returned
-// context's Done channel is closed when the returned cancel function is called
-// or when the parent context's Done channel is closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
- c := newCancelCtx(parent)
- propagateCancel(parent, c)
- return c, func() { c.cancel(true, Canceled) }
-}
-
-// newCancelCtx returns an initialized cancelCtx.
-func newCancelCtx(parent Context) *cancelCtx {
- return &cancelCtx{
- Context: parent,
- done: make(chan struct{}),
- }
-}
-
-// propagateCancel arranges for child to be canceled when parent is.
-func propagateCancel(parent Context, child canceler) {
- if parent.Done() == nil {
- return // parent is never canceled
- }
- if p, ok := parentCancelCtx(parent); ok {
- p.mu.Lock()
- if p.err != nil {
- // parent has already been canceled
- child.cancel(false, p.err)
- } else {
- if p.children == nil {
- p.children = make(map[canceler]bool)
- }
- p.children[child] = true
- }
- p.mu.Unlock()
- } else {
- go func() {
- select {
- case <-parent.Done():
- child.cancel(false, parent.Err())
- case <-child.Done():
- }
- }()
- }
-}
-
-// parentCancelCtx follows a chain of parent references until it finds a
-// *cancelCtx. This function understands how each of the concrete types in this
-// package represents its parent.
-func parentCancelCtx(parent Context) (*cancelCtx, bool) {
- for {
- switch c := parent.(type) {
- case *cancelCtx:
- return c, true
- case *timerCtx:
- return c.cancelCtx, true
- case *valueCtx:
- parent = c.Context
- default:
- return nil, false
- }
- }
-}
-
-// removeChild removes a context from its parent.
-func removeChild(parent Context, child canceler) {
- p, ok := parentCancelCtx(parent)
- if !ok {
- return
- }
- p.mu.Lock()
- if p.children != nil {
- delete(p.children, child)
- }
- p.mu.Unlock()
-}
-
-// A canceler is a context type that can be canceled directly. The
-// implementations are *cancelCtx and *timerCtx.
-type canceler interface {
- cancel(removeFromParent bool, err error)
- Done() <-chan struct{}
-}
-
-// A cancelCtx can be canceled. When canceled, it also cancels any children
-// that implement canceler.
-type cancelCtx struct {
- Context
-
- done chan struct{} // closed by the first cancel call.
-
- mu sync.Mutex
- children map[canceler]bool // set to nil by the first cancel call
- err error // set to non-nil by the first cancel call
-}
-
-func (c *cancelCtx) Done() <-chan struct{} {
- return c.done
-}
-
-func (c *cancelCtx) Err() error {
- c.mu.Lock()
- defer c.mu.Unlock()
- return c.err
-}
-
-func (c *cancelCtx) String() string {
- return fmt.Sprintf("%v.WithCancel", c.Context)
-}
-
-// cancel closes c.done, cancels each of c's children, and, if
-// removeFromParent is true, removes c from its parent's children.
-func (c *cancelCtx) cancel(removeFromParent bool, err error) {
- if err == nil {
- panic("context: internal error: missing cancel error")
- }
- c.mu.Lock()
- if c.err != nil {
- c.mu.Unlock()
- return // already canceled
- }
- c.err = err
- close(c.done)
- for child := range c.children {
- // NOTE: acquiring the child's lock while holding parent's lock.
- child.cancel(false, err)
- }
- c.children = nil
- c.mu.Unlock()
-
- if removeFromParent {
- removeChild(c.Context, c)
- }
-}
-
-// WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d. If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent. The returned
-// context's Done channel is closed when the deadline expires, when the returned
-// cancel function is called, or when the parent context's Done channel is
-// closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
- if cur, ok := parent.Deadline(); ok && cur.Before(deadline) {
- // The current deadline is already sooner than the new one.
- return WithCancel(parent)
- }
- c := &timerCtx{
- cancelCtx: newCancelCtx(parent),
- deadline: deadline,
- }
- propagateCancel(parent, c)
- d := deadline.Sub(time.Now())
- if d <= 0 {
- c.cancel(true, DeadlineExceeded) // deadline has already passed
- return c, func() { c.cancel(true, Canceled) }
- }
- c.mu.Lock()
- defer c.mu.Unlock()
- if c.err == nil {
- c.timer = time.AfterFunc(d, func() {
- c.cancel(true, DeadlineExceeded)
- })
- }
- return c, func() { c.cancel(true, Canceled) }
-}
-
-// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to
-// implement Done and Err. It implements cancel by stopping its timer then
-// delegating to cancelCtx.cancel.
-type timerCtx struct {
- *cancelCtx
- timer *time.Timer // Under cancelCtx.mu.
-
- deadline time.Time
-}
-
-func (c *timerCtx) Deadline() (deadline time.Time, ok bool) {
- return c.deadline, true
-}
-
-func (c *timerCtx) String() string {
- return fmt.Sprintf("%v.WithDeadline(%s [%s])", c.cancelCtx.Context, c.deadline, c.deadline.Sub(time.Now()))
-}
-
-func (c *timerCtx) cancel(removeFromParent bool, err error) {
- c.cancelCtx.cancel(false, err)
- if removeFromParent {
- // Remove this timerCtx from its parent cancelCtx's children.
- removeChild(c.cancelCtx.Context, c)
- }
- c.mu.Lock()
- if c.timer != nil {
- c.timer.Stop()
- c.timer = nil
- }
- c.mu.Unlock()
-}
-
-// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete:
-//
-// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
-// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
-// defer cancel() // releases resources if slowOperation completes before timeout elapses
-// return slowOperation(ctx)
-// }
-func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
- return WithDeadline(parent, time.Now().Add(timeout))
-}
-
-// WithValue returns a copy of parent in which the value associated with key is
-// val.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-func WithValue(parent Context, key interface{}, val interface{}) Context {
- return &valueCtx{parent, key, val}
-}
-
-// A valueCtx carries a key-value pair. It implements Value for that key and
-// delegates all other calls to the embedded Context.
-type valueCtx struct {
- Context
- key, val interface{}
-}
-
-func (c *valueCtx) String() string {
- return fmt.Sprintf("%v.WithValue(%#v, %#v)", c.Context, c.key, c.val)
-}
-
-func (c *valueCtx) Value(key interface{}) interface{} {
- if c.key == key {
- return c.val
- }
- return c.Context.Value(key)
-}
diff --git a/vendor/golang.org/x/net/context/pre_go19.go b/vendor/golang.org/x/net/context/pre_go19.go
deleted file mode 100644
index b105f80b..00000000
--- a/vendor/golang.org/x/net/context/pre_go19.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.9
-
-package context
-
-import "time"
-
-// A Context carries a deadline, a cancelation signal, and other values across
-// API boundaries.
-//
-// Context's methods may be called by multiple goroutines simultaneously.
-type Context interface {
- // Deadline returns the time when work done on behalf of this context
- // should be canceled. Deadline returns ok==false when no deadline is
- // set. Successive calls to Deadline return the same results.
- Deadline() (deadline time.Time, ok bool)
-
- // Done returns a channel that's closed when work done on behalf of this
- // context should be canceled. Done may return nil if this context can
- // never be canceled. Successive calls to Done return the same value.
- //
- // WithCancel arranges for Done to be closed when cancel is called;
- // WithDeadline arranges for Done to be closed when the deadline
- // expires; WithTimeout arranges for Done to be closed when the timeout
- // elapses.
- //
- // Done is provided for use in select statements:
- //
- // // Stream generates values with DoSomething and sends them to out
- // // until DoSomething returns an error or ctx.Done is closed.
- // func Stream(ctx context.Context, out chan<- Value) error {
- // for {
- // v, err := DoSomething(ctx)
- // if err != nil {
- // return err
- // }
- // select {
- // case <-ctx.Done():
- // return ctx.Err()
- // case out <- v:
- // }
- // }
- // }
- //
- // See http://blog.golang.org/pipelines for more examples of how to use
- // a Done channel for cancelation.
- Done() <-chan struct{}
-
- // Err returns a non-nil error value after Done is closed. Err returns
- // Canceled if the context was canceled or DeadlineExceeded if the
- // context's deadline passed. No other values for Err are defined.
- // After Done is closed, successive calls to Err return the same value.
- Err() error
-
- // Value returns the value associated with this context for key, or nil
- // if no value is associated with key. Successive calls to Value with
- // the same key returns the same result.
- //
- // Use context values only for request-scoped data that transits
- // processes and API boundaries, not for passing optional parameters to
- // functions.
- //
- // A key identifies a specific value in a Context. Functions that wish
- // to store values in Context typically allocate a key in a global
- // variable then use that key as the argument to context.WithValue and
- // Context.Value. A key can be any type that supports equality;
- // packages should define keys as an unexported type to avoid
- // collisions.
- //
- // Packages that define a Context key should provide type-safe accessors
- // for the values stores using that key:
- //
- // // Package user defines a User type that's stored in Contexts.
- // package user
- //
- // import "golang.org/x/net/context"
- //
- // // User is the type of value stored in the Contexts.
- // type User struct {...}
- //
- // // key is an unexported type for keys defined in this package.
- // // This prevents collisions with keys defined in other packages.
- // type key int
- //
- // // userKey is the key for user.User values in Contexts. It is
- // // unexported; clients use user.NewContext and user.FromContext
- // // instead of using this key directly.
- // var userKey key = 0
- //
- // // NewContext returns a new Context that carries value u.
- // func NewContext(ctx context.Context, u *User) context.Context {
- // return context.WithValue(ctx, userKey, u)
- // }
- //
- // // FromContext returns the User value stored in ctx, if any.
- // func FromContext(ctx context.Context) (*User, bool) {
- // u, ok := ctx.Value(userKey).(*User)
- // return u, ok
- // }
- Value(key interface{}) interface{}
-}
-
-// A CancelFunc tells an operation to abandon its work.
-// A CancelFunc does not wait for the work to stop.
-// After the first call, subsequent calls to a CancelFunc do nothing.
-type CancelFunc func()
diff --git a/vendor/golang.org/x/oauth2/.travis.yml b/vendor/golang.org/x/oauth2/.travis.yml
deleted file mode 100644
index fa139db2..00000000
--- a/vendor/golang.org/x/oauth2/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: go
-
-go:
- - tip
-
-install:
- - export GOPATH="$HOME/gopath"
- - mkdir -p "$GOPATH/src/golang.org/x"
- - mv "$TRAVIS_BUILD_DIR" "$GOPATH/src/golang.org/x/oauth2"
- - go get -v -t -d golang.org/x/oauth2/...
-
-script:
- - go test -v golang.org/x/oauth2/...
diff --git a/vendor/golang.org/x/oauth2/AUTHORS b/vendor/golang.org/x/oauth2/AUTHORS
deleted file mode 100644
index 15167cd7..00000000
--- a/vendor/golang.org/x/oauth2/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/vendor/golang.org/x/oauth2/CONTRIBUTING.md b/vendor/golang.org/x/oauth2/CONTRIBUTING.md
deleted file mode 100644
index dfbed62c..00000000
--- a/vendor/golang.org/x/oauth2/CONTRIBUTING.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Contributing to Go
-
-Go is an open source project.
-
-It is the work of hundreds of contributors. We appreciate your help!
-
-## Filing issues
-
-When [filing an issue](https://github.com/golang/oauth2/issues), make sure to answer these five questions:
-
-1. What version of Go are you using (`go version`)?
-2. What operating system and processor architecture are you using?
-3. What did you do?
-4. What did you expect to see?
-5. What did you see instead?
-
-General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker.
-The gophers there will answer or ask you to file an issue if you've tripped over a bug.
-
-## Contributing code
-
-Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html)
-before sending patches.
-
-Unless otherwise noted, the Go source files are distributed under
-the BSD-style license found in the LICENSE file.
diff --git a/vendor/golang.org/x/oauth2/CONTRIBUTORS b/vendor/golang.org/x/oauth2/CONTRIBUTORS
deleted file mode 100644
index 1c4577e9..00000000
--- a/vendor/golang.org/x/oauth2/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/golang.org/x/oauth2/LICENSE b/vendor/golang.org/x/oauth2/LICENSE
deleted file mode 100644
index 6a66aea5..00000000
--- a/vendor/golang.org/x/oauth2/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-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.
diff --git a/vendor/golang.org/x/oauth2/README.md b/vendor/golang.org/x/oauth2/README.md
deleted file mode 100644
index eb8dcee1..00000000
--- a/vendor/golang.org/x/oauth2/README.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# OAuth2 for Go
-
-[](https://travis-ci.org/golang/oauth2)
-[](https://godoc.org/golang.org/x/oauth2)
-
-oauth2 package contains a client implementation for OAuth 2.0 spec.
-
-## Installation
-
-~~~~
-go get golang.org/x/oauth2
-~~~~
-
-Or you can manually git clone the repository to
-`$(go env GOPATH)/src/golang.org/x/oauth2`.
-
-See godoc for further documentation and examples.
-
-* [godoc.org/golang.org/x/oauth2](http://godoc.org/golang.org/x/oauth2)
-* [godoc.org/golang.org/x/oauth2/google](http://godoc.org/golang.org/x/oauth2/google)
-
-
-## App Engine
-
-In change 96e89be (March 2015), we removed the `oauth2.Context2` type in favor
-of the [`context.Context`](https://golang.org/x/net/context#Context) type from
-the `golang.org/x/net/context` package
-
-This means it's no longer possible to use the "Classic App Engine"
-`appengine.Context` type with the `oauth2` package. (You're using
-Classic App Engine if you import the package `"appengine"`.)
-
-To work around this, you may use the new `"google.golang.org/appengine"`
-package. This package has almost the same API as the `"appengine"` package,
-but it can be fetched with `go get` and used on "Managed VMs" and well as
-Classic App Engine.
-
-See the [new `appengine` package's readme](https://github.com/golang/appengine#updating-a-go-app-engine-app)
-for information on updating your app.
-
-If you don't want to update your entire app to use the new App Engine packages,
-you may use both sets of packages in parallel, using only the new packages
-with the `oauth2` package.
-
-```go
-import (
- "golang.org/x/net/context"
- "golang.org/x/oauth2"
- "golang.org/x/oauth2/google"
- newappengine "google.golang.org/appengine"
- newurlfetch "google.golang.org/appengine/urlfetch"
-
- "appengine"
-)
-
-func handler(w http.ResponseWriter, r *http.Request) {
- var c appengine.Context = appengine.NewContext(r)
- c.Infof("Logging a message with the old package")
-
- var ctx context.Context = newappengine.NewContext(r)
- client := &http.Client{
- Transport: &oauth2.Transport{
- Source: google.AppEngineTokenSource(ctx, "scope"),
- Base: &newurlfetch.Transport{Context: ctx},
- },
- }
- client.Get("...")
-}
-```
-
-## Report Issues / Send Patches
-
-This repository uses Gerrit for code changes. To learn how to submit changes to
-this repository, see https://golang.org/doc/contribute.html.
-
-The main issue tracker for the oauth2 repository is located at
-https://github.com/golang/oauth2/issues.
diff --git a/vendor/golang.org/x/oauth2/internal/client_appengine.go b/vendor/golang.org/x/oauth2/internal/client_appengine.go
deleted file mode 100644
index 74348718..00000000
--- a/vendor/golang.org/x/oauth2/internal/client_appengine.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build appengine
-
-package internal
-
-import "google.golang.org/appengine/urlfetch"
-
-func init() {
- appengineClientHook = urlfetch.Client
-}
diff --git a/vendor/golang.org/x/oauth2/internal/doc.go b/vendor/golang.org/x/oauth2/internal/doc.go
deleted file mode 100644
index 03265e88..00000000
--- a/vendor/golang.org/x/oauth2/internal/doc.go
+++ /dev/null
@@ -1,6 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package internal contains support packages for oauth2 package.
-package internal
diff --git a/vendor/golang.org/x/oauth2/internal/oauth2.go b/vendor/golang.org/x/oauth2/internal/oauth2.go
deleted file mode 100644
index fc63fcab..00000000
--- a/vendor/golang.org/x/oauth2/internal/oauth2.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "crypto/rsa"
- "crypto/x509"
- "encoding/pem"
- "errors"
- "fmt"
-)
-
-// ParseKey converts the binary contents of a private key file
-// to an *rsa.PrivateKey. It detects whether the private key is in a
-// PEM container or not. If so, it extracts the the private key
-// from PEM container before conversion. It only supports PEM
-// containers with no passphrase.
-func ParseKey(key []byte) (*rsa.PrivateKey, error) {
- block, _ := pem.Decode(key)
- if block != nil {
- key = block.Bytes
- }
- parsedKey, err := x509.ParsePKCS8PrivateKey(key)
- if err != nil {
- parsedKey, err = x509.ParsePKCS1PrivateKey(key)
- if err != nil {
- return nil, fmt.Errorf("private key should be a PEM or plain PKSC1 or PKCS8; parse error: %v", err)
- }
- }
- parsed, ok := parsedKey.(*rsa.PrivateKey)
- if !ok {
- return nil, errors.New("private key is invalid")
- }
- return parsed, nil
-}
diff --git a/vendor/golang.org/x/oauth2/internal/token.go b/vendor/golang.org/x/oauth2/internal/token.go
deleted file mode 100644
index 5c5451ad..00000000
--- a/vendor/golang.org/x/oauth2/internal/token.go
+++ /dev/null
@@ -1,272 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "mime"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "golang.org/x/net/context"
- "golang.org/x/net/context/ctxhttp"
-)
-
-// Token represents the credentials used to authorize
-// the requests to access protected resources on the OAuth 2.0
-// provider's backend.
-//
-// This type is a mirror of oauth2.Token and exists to break
-// an otherwise-circular dependency. Other internal packages
-// should convert this Token into an oauth2.Token before use.
-type Token struct {
- // AccessToken is the token that authorizes and authenticates
- // the requests.
- AccessToken string
-
- // TokenType is the type of token.
- // The Type method returns either this or "Bearer", the default.
- TokenType string
-
- // RefreshToken is a token that's used by the application
- // (as opposed to the user) to refresh the access token
- // if it expires.
- RefreshToken string
-
- // Expiry is the optional expiration time of the access token.
- //
- // If zero, TokenSource implementations will reuse the same
- // token forever and RefreshToken or equivalent
- // mechanisms for that TokenSource will not be used.
- Expiry time.Time
-
- // Raw optionally contains extra metadata from the server
- // when updating a token.
- Raw interface{}
-}
-
-// tokenJSON is the struct representing the HTTP response from OAuth2
-// providers returning a token in JSON form.
-type tokenJSON struct {
- AccessToken string `json:"access_token"`
- TokenType string `json:"token_type"`
- RefreshToken string `json:"refresh_token"`
- ExpiresIn expirationTime `json:"expires_in"` // at least PayPal returns string, while most return number
- Expires expirationTime `json:"expires"` // broken Facebook spelling of expires_in
-}
-
-func (e *tokenJSON) expiry() (t time.Time) {
- if v := e.ExpiresIn; v != 0 {
- return time.Now().Add(time.Duration(v) * time.Second)
- }
- if v := e.Expires; v != 0 {
- return time.Now().Add(time.Duration(v) * time.Second)
- }
- return
-}
-
-type expirationTime int32
-
-func (e *expirationTime) UnmarshalJSON(b []byte) error {
- var n json.Number
- err := json.Unmarshal(b, &n)
- if err != nil {
- return err
- }
- i, err := n.Int64()
- if err != nil {
- return err
- }
- *e = expirationTime(i)
- return nil
-}
-
-var brokenAuthHeaderProviders = []string{
- "https://accounts.google.com/",
- "https://api.codeswholesale.com/oauth/token",
- "https://api.dropbox.com/",
- "https://api.dropboxapi.com/",
- "https://api.instagram.com/",
- "https://api.netatmo.net/",
- "https://api.odnoklassniki.ru/",
- "https://api.pushbullet.com/",
- "https://api.soundcloud.com/",
- "https://api.twitch.tv/",
- "https://id.twitch.tv/",
- "https://app.box.com/",
- "https://api.box.com/",
- "https://connect.stripe.com/",
- "https://login.mailchimp.com/",
- "https://login.microsoftonline.com/",
- "https://login.salesforce.com/",
- "https://login.windows.net",
- "https://login.live.com/",
- "https://oauth.sandbox.trainingpeaks.com/",
- "https://oauth.trainingpeaks.com/",
- "https://oauth.vk.com/",
- "https://openapi.baidu.com/",
- "https://slack.com/",
- "https://test-sandbox.auth.corp.google.com",
- "https://test.salesforce.com/",
- "https://user.gini.net/",
- "https://www.douban.com/",
- "https://www.googleapis.com/",
- "https://www.linkedin.com/",
- "https://www.strava.com/oauth/",
- "https://www.wunderlist.com/oauth/",
- "https://api.patreon.com/",
- "https://sandbox.codeswholesale.com/oauth/token",
- "https://api.sipgate.com/v1/authorization/oauth",
- "https://api.medium.com/v1/tokens",
- "https://log.finalsurge.com/oauth/token",
- "https://multisport.todaysplan.com.au/rest/oauth/access_token",
- "https://whats.todaysplan.com.au/rest/oauth/access_token",
- "https://stackoverflow.com/oauth/access_token",
- "https://account.health.nokia.com",
-}
-
-// brokenAuthHeaderDomains lists broken providers that issue dynamic endpoints.
-var brokenAuthHeaderDomains = []string{
- ".auth0.com",
- ".force.com",
- ".myshopify.com",
- ".okta.com",
- ".oktapreview.com",
-}
-
-func RegisterBrokenAuthHeaderProvider(tokenURL string) {
- brokenAuthHeaderProviders = append(brokenAuthHeaderProviders, tokenURL)
-}
-
-// providerAuthHeaderWorks reports whether the OAuth2 server identified by the tokenURL
-// implements the OAuth2 spec correctly
-// See https://code.google.com/p/goauth2/issues/detail?id=31 for background.
-// In summary:
-// - Reddit only accepts client secret in the Authorization header
-// - Dropbox accepts either it in URL param or Auth header, but not both.
-// - Google only accepts URL param (not spec compliant?), not Auth header
-// - Stripe only accepts client secret in Auth header with Bearer method, not Basic
-func providerAuthHeaderWorks(tokenURL string) bool {
- for _, s := range brokenAuthHeaderProviders {
- if strings.HasPrefix(tokenURL, s) {
- // Some sites fail to implement the OAuth2 spec fully.
- return false
- }
- }
-
- if u, err := url.Parse(tokenURL); err == nil {
- for _, s := range brokenAuthHeaderDomains {
- if strings.HasSuffix(u.Host, s) {
- return false
- }
- }
- }
-
- // Assume the provider implements the spec properly
- // otherwise. We can add more exceptions as they're
- // discovered. We will _not_ be adding configurable hooks
- // to this package to let users select server bugs.
- return true
-}
-
-func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string, v url.Values) (*Token, error) {
- bustedAuth := !providerAuthHeaderWorks(tokenURL)
- if bustedAuth {
- if clientID != "" {
- v.Set("client_id", clientID)
- }
- if clientSecret != "" {
- v.Set("client_secret", clientSecret)
- }
- }
- req, err := http.NewRequest("POST", tokenURL, strings.NewReader(v.Encode()))
- if err != nil {
- return nil, err
- }
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- if !bustedAuth {
- req.SetBasicAuth(url.QueryEscape(clientID), url.QueryEscape(clientSecret))
- }
- r, err := ctxhttp.Do(ctx, ContextClient(ctx), req)
- if err != nil {
- return nil, err
- }
- defer r.Body.Close()
- body, err := ioutil.ReadAll(io.LimitReader(r.Body, 1<<20))
- if err != nil {
- return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
- }
- if code := r.StatusCode; code < 200 || code > 299 {
- return nil, &RetrieveError{
- Response: r,
- Body: body,
- }
- }
-
- var token *Token
- content, _, _ := mime.ParseMediaType(r.Header.Get("Content-Type"))
- switch content {
- case "application/x-www-form-urlencoded", "text/plain":
- vals, err := url.ParseQuery(string(body))
- if err != nil {
- return nil, err
- }
- token = &Token{
- AccessToken: vals.Get("access_token"),
- TokenType: vals.Get("token_type"),
- RefreshToken: vals.Get("refresh_token"),
- Raw: vals,
- }
- e := vals.Get("expires_in")
- if e == "" {
- // TODO(jbd): Facebook's OAuth2 implementation is broken and
- // returns expires_in field in expires. Remove the fallback to expires,
- // when Facebook fixes their implementation.
- e = vals.Get("expires")
- }
- expires, _ := strconv.Atoi(e)
- if expires != 0 {
- token.Expiry = time.Now().Add(time.Duration(expires) * time.Second)
- }
- default:
- var tj tokenJSON
- if err = json.Unmarshal(body, &tj); err != nil {
- return nil, err
- }
- token = &Token{
- AccessToken: tj.AccessToken,
- TokenType: tj.TokenType,
- RefreshToken: tj.RefreshToken,
- Expiry: tj.expiry(),
- Raw: make(map[string]interface{}),
- }
- json.Unmarshal(body, &token.Raw) // no error checks for optional fields
- }
- // Don't overwrite `RefreshToken` with an empty value
- // if this was a token refreshing request.
- if token.RefreshToken == "" {
- token.RefreshToken = v.Get("refresh_token")
- }
- if token.AccessToken == "" {
- return token, errors.New("oauth2: server response missing access_token")
- }
- return token, nil
-}
-
-type RetrieveError struct {
- Response *http.Response
- Body []byte
-}
-
-func (r *RetrieveError) Error() string {
- return fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", r.Response.Status, r.Body)
-}
diff --git a/vendor/golang.org/x/oauth2/internal/transport.go b/vendor/golang.org/x/oauth2/internal/transport.go
deleted file mode 100644
index d16f9ae1..00000000
--- a/vendor/golang.org/x/oauth2/internal/transport.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "net/http"
-
- "golang.org/x/net/context"
-)
-
-// HTTPClient is the context key to use with golang.org/x/net/context's
-// WithValue function to associate an *http.Client value with a context.
-var HTTPClient ContextKey
-
-// ContextKey is just an empty struct. It exists so HTTPClient can be
-// an immutable public variable with a unique type. It's immutable
-// because nobody else can create a ContextKey, being unexported.
-type ContextKey struct{}
-
-var appengineClientHook func(context.Context) *http.Client
-
-func ContextClient(ctx context.Context) *http.Client {
- if ctx != nil {
- if hc, ok := ctx.Value(HTTPClient).(*http.Client); ok {
- return hc
- }
- }
- if appengineClientHook != nil {
- return appengineClientHook(ctx)
- }
- return http.DefaultClient
-}
diff --git a/vendor/golang.org/x/oauth2/oauth2.go b/vendor/golang.org/x/oauth2/oauth2.go
deleted file mode 100644
index 16775d08..00000000
--- a/vendor/golang.org/x/oauth2/oauth2.go
+++ /dev/null
@@ -1,362 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package oauth2 provides support for making
-// OAuth2 authorized and authenticated HTTP requests,
-// as specified in RFC 6749.
-// It can additionally grant authorization with Bearer JWT.
-package oauth2 // import "golang.org/x/oauth2"
-
-import (
- "bytes"
- "errors"
- "net/http"
- "net/url"
- "strings"
- "sync"
-
- "golang.org/x/net/context"
- "golang.org/x/oauth2/internal"
-)
-
-// NoContext is the default context you should supply if not using
-// your own context.Context (see https://golang.org/x/net/context).
-//
-// Deprecated: Use context.Background() or context.TODO() instead.
-var NoContext = context.TODO()
-
-// RegisterBrokenAuthHeaderProvider registers an OAuth2 server
-// identified by the tokenURL prefix as an OAuth2 implementation
-// which doesn't support the HTTP Basic authentication
-// scheme to authenticate with the authorization server.
-// Once a server is registered, credentials (client_id and client_secret)
-// will be passed as query parameters rather than being present
-// in the Authorization header.
-// See https://code.google.com/p/goauth2/issues/detail?id=31 for background.
-func RegisterBrokenAuthHeaderProvider(tokenURL string) {
- internal.RegisterBrokenAuthHeaderProvider(tokenURL)
-}
-
-// Config describes a typical 3-legged OAuth2 flow, with both the
-// client application information and the server's endpoint URLs.
-// For the client credentials 2-legged OAuth2 flow, see the clientcredentials
-// package (https://golang.org/x/oauth2/clientcredentials).
-type Config struct {
- // ClientID is the application's ID.
- ClientID string
-
- // ClientSecret is the application's secret.
- ClientSecret string
-
- // Endpoint contains the resource server's token endpoint
- // URLs. These are constants specific to each server and are
- // often available via site-specific packages, such as
- // google.Endpoint or github.Endpoint.
- Endpoint Endpoint
-
- // RedirectURL is the URL to redirect users going through
- // the OAuth flow, after the resource owner's URLs.
- RedirectURL string
-
- // Scope specifies optional requested permissions.
- Scopes []string
-}
-
-// A TokenSource is anything that can return a token.
-type TokenSource interface {
- // Token returns a token or an error.
- // Token must be safe for concurrent use by multiple goroutines.
- // The returned Token must not be modified.
- Token() (*Token, error)
-}
-
-// Endpoint contains the OAuth 2.0 provider's authorization and token
-// endpoint URLs.
-type Endpoint struct {
- AuthURL string
- TokenURL string
-}
-
-var (
- // AccessTypeOnline and AccessTypeOffline are options passed
- // to the Options.AuthCodeURL method. They modify the
- // "access_type" field that gets sent in the URL returned by
- // AuthCodeURL.
- //
- // Online is the default if neither is specified. If your
- // application needs to refresh access tokens when the user
- // is not present at the browser, then use offline. This will
- // result in your application obtaining a refresh token the
- // first time your application exchanges an authorization
- // code for a user.
- AccessTypeOnline AuthCodeOption = SetAuthURLParam("access_type", "online")
- AccessTypeOffline AuthCodeOption = SetAuthURLParam("access_type", "offline")
-
- // ApprovalForce forces the users to view the consent dialog
- // and confirm the permissions request at the URL returned
- // from AuthCodeURL, even if they've already done so.
- ApprovalForce AuthCodeOption = SetAuthURLParam("approval_prompt", "force")
-)
-
-// An AuthCodeOption is passed to Config.AuthCodeURL.
-type AuthCodeOption interface {
- setValue(url.Values)
-}
-
-type setParam struct{ k, v string }
-
-func (p setParam) setValue(m url.Values) { m.Set(p.k, p.v) }
-
-// SetAuthURLParam builds an AuthCodeOption which passes key/value parameters
-// to a provider's authorization endpoint.
-func SetAuthURLParam(key, value string) AuthCodeOption {
- return setParam{key, value}
-}
-
-// AuthCodeURL returns a URL to OAuth 2.0 provider's consent page
-// that asks for permissions for the required scopes explicitly.
-//
-// State is a token to protect the user from CSRF attacks. You must
-// always provide a non-empty string and validate that it matches the
-// the state query parameter on your redirect callback.
-// See http://tools.ietf.org/html/rfc6749#section-10.12 for more info.
-//
-// Opts may include AccessTypeOnline or AccessTypeOffline, as well
-// as ApprovalForce.
-// It can also be used to pass the PKCE challange.
-// See https://www.oauth.com/oauth2-servers/pkce/ for more info.
-func (c *Config) AuthCodeURL(state string, opts ...AuthCodeOption) string {
- var buf bytes.Buffer
- buf.WriteString(c.Endpoint.AuthURL)
- v := url.Values{
- "response_type": {"code"},
- "client_id": {c.ClientID},
- }
- if c.RedirectURL != "" {
- v.Set("redirect_uri", c.RedirectURL)
- }
- if len(c.Scopes) > 0 {
- v.Set("scope", strings.Join(c.Scopes, " "))
- }
- if state != "" {
- // TODO(light): Docs say never to omit state; don't allow empty.
- v.Set("state", state)
- }
- for _, opt := range opts {
- opt.setValue(v)
- }
- if strings.Contains(c.Endpoint.AuthURL, "?") {
- buf.WriteByte('&')
- } else {
- buf.WriteByte('?')
- }
- buf.WriteString(v.Encode())
- return buf.String()
-}
-
-// PasswordCredentialsToken converts a resource owner username and password
-// pair into a token.
-//
-// Per the RFC, this grant type should only be used "when there is a high
-// degree of trust between the resource owner and the client (e.g., the client
-// is part of the device operating system or a highly privileged application),
-// and when other authorization grant types are not available."
-// See https://tools.ietf.org/html/rfc6749#section-4.3 for more info.
-//
-// The HTTP client to use is derived from the context.
-// If nil, http.DefaultClient is used.
-func (c *Config) PasswordCredentialsToken(ctx context.Context, username, password string) (*Token, error) {
- v := url.Values{
- "grant_type": {"password"},
- "username": {username},
- "password": {password},
- }
- if len(c.Scopes) > 0 {
- v.Set("scope", strings.Join(c.Scopes, " "))
- }
- return retrieveToken(ctx, c, v)
-}
-
-// Exchange converts an authorization code into a token.
-//
-// It is used after a resource provider redirects the user back
-// to the Redirect URI (the URL obtained from AuthCodeURL).
-//
-// The HTTP client to use is derived from the context.
-// If a client is not provided via the context, http.DefaultClient is used.
-//
-// The code will be in the *http.Request.FormValue("code"). Before
-// calling Exchange, be sure to validate FormValue("state").
-//
-// Opts may include the PKCE verifier code if previously used in AuthCodeURL.
-// See https://www.oauth.com/oauth2-servers/pkce/ for more info.
-func (c *Config) Exchange(ctx context.Context, code string, opts ...AuthCodeOption) (*Token, error) {
- v := url.Values{
- "grant_type": {"authorization_code"},
- "code": {code},
- }
- if c.RedirectURL != "" {
- v.Set("redirect_uri", c.RedirectURL)
- }
- for _, opt := range opts {
- opt.setValue(v)
- }
- return retrieveToken(ctx, c, v)
-}
-
-// Client returns an HTTP client using the provided token.
-// The token will auto-refresh as necessary. The underlying
-// HTTP transport will be obtained using the provided context.
-// The returned client and its Transport should not be modified.
-func (c *Config) Client(ctx context.Context, t *Token) *http.Client {
- return NewClient(ctx, c.TokenSource(ctx, t))
-}
-
-// TokenSource returns a TokenSource that returns t until t expires,
-// automatically refreshing it as necessary using the provided context.
-//
-// Most users will use Config.Client instead.
-func (c *Config) TokenSource(ctx context.Context, t *Token) TokenSource {
- tkr := &tokenRefresher{
- ctx: ctx,
- conf: c,
- }
- if t != nil {
- tkr.refreshToken = t.RefreshToken
- }
- return &reuseTokenSource{
- t: t,
- new: tkr,
- }
-}
-
-// tokenRefresher is a TokenSource that makes "grant_type"=="refresh_token"
-// HTTP requests to renew a token using a RefreshToken.
-type tokenRefresher struct {
- ctx context.Context // used to get HTTP requests
- conf *Config
- refreshToken string
-}
-
-// WARNING: Token is not safe for concurrent access, as it
-// updates the tokenRefresher's refreshToken field.
-// Within this package, it is used by reuseTokenSource which
-// synchronizes calls to this method with its own mutex.
-func (tf *tokenRefresher) Token() (*Token, error) {
- if tf.refreshToken == "" {
- return nil, errors.New("oauth2: token expired and refresh token is not set")
- }
-
- tk, err := retrieveToken(tf.ctx, tf.conf, url.Values{
- "grant_type": {"refresh_token"},
- "refresh_token": {tf.refreshToken},
- })
-
- if err != nil {
- return nil, err
- }
- if tf.refreshToken != tk.RefreshToken {
- tf.refreshToken = tk.RefreshToken
- }
- return tk, err
-}
-
-// reuseTokenSource is a TokenSource that holds a single token in memory
-// and validates its expiry before each call to retrieve it with
-// Token. If it's expired, it will be auto-refreshed using the
-// new TokenSource.
-type reuseTokenSource struct {
- new TokenSource // called when t is expired.
-
- mu sync.Mutex // guards t
- t *Token
-}
-
-// Token returns the current token if it's still valid, else will
-// refresh the current token (using r.Context for HTTP client
-// information) and return the new one.
-func (s *reuseTokenSource) Token() (*Token, error) {
- s.mu.Lock()
- defer s.mu.Unlock()
- if s.t.Valid() {
- return s.t, nil
- }
- t, err := s.new.Token()
- if err != nil {
- return nil, err
- }
- s.t = t
- return t, nil
-}
-
-// StaticTokenSource returns a TokenSource that always returns the same token.
-// Because the provided token t is never refreshed, StaticTokenSource is only
-// useful for tokens that never expire.
-func StaticTokenSource(t *Token) TokenSource {
- return staticTokenSource{t}
-}
-
-// staticTokenSource is a TokenSource that always returns the same Token.
-type staticTokenSource struct {
- t *Token
-}
-
-func (s staticTokenSource) Token() (*Token, error) {
- return s.t, nil
-}
-
-// HTTPClient is the context key to use with golang.org/x/net/context's
-// WithValue function to associate an *http.Client value with a context.
-var HTTPClient internal.ContextKey
-
-// NewClient creates an *http.Client from a Context and TokenSource.
-// The returned client is not valid beyond the lifetime of the context.
-//
-// Note that if a custom *http.Client is provided via the Context it
-// is used only for token acquisition and is not used to configure the
-// *http.Client returned from NewClient.
-//
-// As a special case, if src is nil, a non-OAuth2 client is returned
-// using the provided context. This exists to support related OAuth2
-// packages.
-func NewClient(ctx context.Context, src TokenSource) *http.Client {
- if src == nil {
- return internal.ContextClient(ctx)
- }
- return &http.Client{
- Transport: &Transport{
- Base: internal.ContextClient(ctx).Transport,
- Source: ReuseTokenSource(nil, src),
- },
- }
-}
-
-// ReuseTokenSource returns a TokenSource which repeatedly returns the
-// same token as long as it's valid, starting with t.
-// When its cached token is invalid, a new token is obtained from src.
-//
-// ReuseTokenSource is typically used to reuse tokens from a cache
-// (such as a file on disk) between runs of a program, rather than
-// obtaining new tokens unnecessarily.
-//
-// The initial token t may be nil, in which case the TokenSource is
-// wrapped in a caching version if it isn't one already. This also
-// means it's always safe to wrap ReuseTokenSource around any other
-// TokenSource without adverse effects.
-func ReuseTokenSource(t *Token, src TokenSource) TokenSource {
- // Don't wrap a reuseTokenSource in itself. That would work,
- // but cause an unnecessary number of mutex operations.
- // Just build the equivalent one.
- if rt, ok := src.(*reuseTokenSource); ok {
- if t == nil {
- // Just use it directly.
- return rt
- }
- src = rt.new
- }
- return &reuseTokenSource{
- t: t,
- new: src,
- }
-}
diff --git a/vendor/golang.org/x/oauth2/token.go b/vendor/golang.org/x/oauth2/token.go
deleted file mode 100644
index 34db8cdc..00000000
--- a/vendor/golang.org/x/oauth2/token.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package oauth2
-
-import (
- "fmt"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "golang.org/x/net/context"
- "golang.org/x/oauth2/internal"
-)
-
-// expiryDelta determines how earlier a token should be considered
-// expired than its actual expiration time. It is used to avoid late
-// expirations due to client-server time mismatches.
-const expiryDelta = 10 * time.Second
-
-// Token represents the credentials used to authorize
-// the requests to access protected resources on the OAuth 2.0
-// provider's backend.
-//
-// Most users of this package should not access fields of Token
-// directly. They're exported mostly for use by related packages
-// implementing derivative OAuth2 flows.
-type Token struct {
- // AccessToken is the token that authorizes and authenticates
- // the requests.
- AccessToken string `json:"access_token"`
-
- // TokenType is the type of token.
- // The Type method returns either this or "Bearer", the default.
- TokenType string `json:"token_type,omitempty"`
-
- // RefreshToken is a token that's used by the application
- // (as opposed to the user) to refresh the access token
- // if it expires.
- RefreshToken string `json:"refresh_token,omitempty"`
-
- // Expiry is the optional expiration time of the access token.
- //
- // If zero, TokenSource implementations will reuse the same
- // token forever and RefreshToken or equivalent
- // mechanisms for that TokenSource will not be used.
- Expiry time.Time `json:"expiry,omitempty"`
-
- // raw optionally contains extra metadata from the server
- // when updating a token.
- raw interface{}
-}
-
-// Type returns t.TokenType if non-empty, else "Bearer".
-func (t *Token) Type() string {
- if strings.EqualFold(t.TokenType, "bearer") {
- return "Bearer"
- }
- if strings.EqualFold(t.TokenType, "mac") {
- return "MAC"
- }
- if strings.EqualFold(t.TokenType, "basic") {
- return "Basic"
- }
- if t.TokenType != "" {
- return t.TokenType
- }
- return "Bearer"
-}
-
-// SetAuthHeader sets the Authorization header to r using the access
-// token in t.
-//
-// This method is unnecessary when using Transport or an HTTP Client
-// returned by this package.
-func (t *Token) SetAuthHeader(r *http.Request) {
- r.Header.Set("Authorization", t.Type()+" "+t.AccessToken)
-}
-
-// WithExtra returns a new Token that's a clone of t, but using the
-// provided raw extra map. This is only intended for use by packages
-// implementing derivative OAuth2 flows.
-func (t *Token) WithExtra(extra interface{}) *Token {
- t2 := new(Token)
- *t2 = *t
- t2.raw = extra
- return t2
-}
-
-// Extra returns an extra field.
-// Extra fields are key-value pairs returned by the server as a
-// part of the token retrieval response.
-func (t *Token) Extra(key string) interface{} {
- if raw, ok := t.raw.(map[string]interface{}); ok {
- return raw[key]
- }
-
- vals, ok := t.raw.(url.Values)
- if !ok {
- return nil
- }
-
- v := vals.Get(key)
- switch s := strings.TrimSpace(v); strings.Count(s, ".") {
- case 0: // Contains no "."; try to parse as int
- if i, err := strconv.ParseInt(s, 10, 64); err == nil {
- return i
- }
- case 1: // Contains a single "."; try to parse as float
- if f, err := strconv.ParseFloat(s, 64); err == nil {
- return f
- }
- }
-
- return v
-}
-
-// expired reports whether the token is expired.
-// t must be non-nil.
-func (t *Token) expired() bool {
- if t.Expiry.IsZero() {
- return false
- }
- return t.Expiry.Round(0).Add(-expiryDelta).Before(time.Now())
-}
-
-// Valid reports whether t is non-nil, has an AccessToken, and is not expired.
-func (t *Token) Valid() bool {
- return t != nil && t.AccessToken != "" && !t.expired()
-}
-
-// tokenFromInternal maps an *internal.Token struct into
-// a *Token struct.
-func tokenFromInternal(t *internal.Token) *Token {
- if t == nil {
- return nil
- }
- return &Token{
- AccessToken: t.AccessToken,
- TokenType: t.TokenType,
- RefreshToken: t.RefreshToken,
- Expiry: t.Expiry,
- raw: t.Raw,
- }
-}
-
-// retrieveToken takes a *Config and uses that to retrieve an *internal.Token.
-// This token is then mapped from *internal.Token into an *oauth2.Token which is returned along
-// with an error..
-func retrieveToken(ctx context.Context, c *Config, v url.Values) (*Token, error) {
- tk, err := internal.RetrieveToken(ctx, c.ClientID, c.ClientSecret, c.Endpoint.TokenURL, v)
- if err != nil {
- if rErr, ok := err.(*internal.RetrieveError); ok {
- return nil, (*RetrieveError)(rErr)
- }
- return nil, err
- }
- return tokenFromInternal(tk), nil
-}
-
-// RetrieveError is the error returned when the token endpoint returns a
-// non-2XX HTTP status code.
-type RetrieveError struct {
- Response *http.Response
- // Body is the body that was consumed by reading Response.Body.
- // It may be truncated.
- Body []byte
-}
-
-func (r *RetrieveError) Error() string {
- return fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", r.Response.Status, r.Body)
-}
diff --git a/vendor/golang.org/x/oauth2/transport.go b/vendor/golang.org/x/oauth2/transport.go
deleted file mode 100644
index aa0d34f1..00000000
--- a/vendor/golang.org/x/oauth2/transport.go
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package oauth2
-
-import (
- "errors"
- "io"
- "net/http"
- "sync"
-)
-
-// Transport is an http.RoundTripper that makes OAuth 2.0 HTTP requests,
-// wrapping a base RoundTripper and adding an Authorization header
-// with a token from the supplied Sources.
-//
-// Transport is a low-level mechanism. Most code will use the
-// higher-level Config.Client method instead.
-type Transport struct {
- // Source supplies the token to add to outgoing requests'
- // Authorization headers.
- Source TokenSource
-
- // Base is the base RoundTripper used to make HTTP requests.
- // If nil, http.DefaultTransport is used.
- Base http.RoundTripper
-
- mu sync.Mutex // guards modReq
- modReq map[*http.Request]*http.Request // original -> modified
-}
-
-// RoundTrip authorizes and authenticates the request with an
-// access token from Transport's Source.
-func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
- reqBodyClosed := false
- if req.Body != nil {
- defer func() {
- if !reqBodyClosed {
- req.Body.Close()
- }
- }()
- }
-
- if t.Source == nil {
- return nil, errors.New("oauth2: Transport's Source is nil")
- }
- token, err := t.Source.Token()
- if err != nil {
- return nil, err
- }
-
- req2 := cloneRequest(req) // per RoundTripper contract
- token.SetAuthHeader(req2)
- t.setModReq(req, req2)
- res, err := t.base().RoundTrip(req2)
-
- // req.Body is assumed to have been closed by the base RoundTripper.
- reqBodyClosed = true
-
- if err != nil {
- t.setModReq(req, nil)
- return nil, err
- }
- res.Body = &onEOFReader{
- rc: res.Body,
- fn: func() { t.setModReq(req, nil) },
- }
- return res, nil
-}
-
-// CancelRequest cancels an in-flight request by closing its connection.
-func (t *Transport) CancelRequest(req *http.Request) {
- type canceler interface {
- CancelRequest(*http.Request)
- }
- if cr, ok := t.base().(canceler); ok {
- t.mu.Lock()
- modReq := t.modReq[req]
- delete(t.modReq, req)
- t.mu.Unlock()
- cr.CancelRequest(modReq)
- }
-}
-
-func (t *Transport) base() http.RoundTripper {
- if t.Base != nil {
- return t.Base
- }
- return http.DefaultTransport
-}
-
-func (t *Transport) setModReq(orig, mod *http.Request) {
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.modReq == nil {
- t.modReq = make(map[*http.Request]*http.Request)
- }
- if mod == nil {
- delete(t.modReq, orig)
- } else {
- t.modReq[orig] = mod
- }
-}
-
-// cloneRequest returns a clone of the provided *http.Request.
-// The clone is a shallow copy of the struct and its Header map.
-func cloneRequest(r *http.Request) *http.Request {
- // shallow copy of the struct
- r2 := new(http.Request)
- *r2 = *r
- // deep copy of the Header
- r2.Header = make(http.Header, len(r.Header))
- for k, s := range r.Header {
- r2.Header[k] = append([]string(nil), s...)
- }
- return r2
-}
-
-type onEOFReader struct {
- rc io.ReadCloser
- fn func()
-}
-
-func (r *onEOFReader) Read(p []byte) (n int, err error) {
- n, err = r.rc.Read(p)
- if err == io.EOF {
- r.runFunc()
- }
- return
-}
-
-func (r *onEOFReader) Close() error {
- err := r.rc.Close()
- r.runFunc()
- return err
-}
-
-func (r *onEOFReader) runFunc() {
- if fn := r.fn; fn != nil {
- fn()
- r.fn = nil
- }
-}
diff --git a/vendor/golang.org/x/sys/AUTHORS b/vendor/golang.org/x/sys/AUTHORS
deleted file mode 100644
index 15167cd7..00000000
--- a/vendor/golang.org/x/sys/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/vendor/golang.org/x/sys/CONTRIBUTORS b/vendor/golang.org/x/sys/CONTRIBUTORS
deleted file mode 100644
index 1c4577e9..00000000
--- a/vendor/golang.org/x/sys/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/golang.org/x/sys/LICENSE b/vendor/golang.org/x/sys/LICENSE
deleted file mode 100644
index 6a66aea5..00000000
--- a/vendor/golang.org/x/sys/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-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.
diff --git a/vendor/golang.org/x/sys/PATENTS b/vendor/golang.org/x/sys/PATENTS
deleted file mode 100644
index 73309904..00000000
--- a/vendor/golang.org/x/sys/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/sys/unix/.gitignore b/vendor/golang.org/x/sys/unix/.gitignore
deleted file mode 100644
index e3e0fc6f..00000000
--- a/vendor/golang.org/x/sys/unix/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-_obj/
-unix.test
diff --git a/vendor/golang.org/x/sys/unix/README.md b/vendor/golang.org/x/sys/unix/README.md
deleted file mode 100644
index bc6f6031..00000000
--- a/vendor/golang.org/x/sys/unix/README.md
+++ /dev/null
@@ -1,173 +0,0 @@
-# Building `sys/unix`
-
-The sys/unix package provides access to the raw system call interface of the
-underlying operating system. See: https://godoc.org/golang.org/x/sys/unix
-
-Porting Go to a new architecture/OS combination or adding syscalls, types, or
-constants to an existing architecture/OS pair requires some manual effort;
-however, there are tools that automate much of the process.
-
-## Build Systems
-
-There are currently two ways we generate the necessary files. We are currently
-migrating the build system to use containers so the builds are reproducible.
-This is being done on an OS-by-OS basis. Please update this documentation as
-components of the build system change.
-
-### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`)
-
-The old build system generates the Go files based on the C header files
-present on your system. This means that files
-for a given GOOS/GOARCH pair must be generated on a system with that OS and
-architecture. This also means that the generated code can differ from system
-to system, based on differences in the header files.
-
-To avoid this, if you are using the old build system, only generate the Go
-files on an installation with unmodified header files. It is also important to
-keep track of which version of the OS the files were generated from (ex.
-Darwin 14 vs Darwin 15). This makes it easier to track the progress of changes
-and have each OS upgrade correspond to a single change.
-
-To build the files for your current OS and architecture, make sure GOOS and
-GOARCH are set correctly and run `mkall.sh`. This will generate the files for
-your specific system. Running `mkall.sh -n` shows the commands that will be run.
-
-Requirements: bash, perl, go
-
-### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`)
-
-The new build system uses a Docker container to generate the go files directly
-from source checkouts of the kernel and various system libraries. This means
-that on any platform that supports Docker, all the files using the new build
-system can be generated at once, and generated files will not change based on
-what the person running the scripts has installed on their computer.
-
-The OS specific files for the new build system are located in the `${GOOS}`
-directory, and the build is coordinated by the `${GOOS}/mkall.go` program. When
-the kernel or system library updates, modify the Dockerfile at
-`${GOOS}/Dockerfile` to checkout the new release of the source.
-
-To build all the files under the new build system, you must be on an amd64/Linux
-system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
-then generate all of the files for all of the GOOS/GOARCH pairs in the new build
-system. Running `mkall.sh -n` shows the commands that will be run.
-
-Requirements: bash, perl, go, docker
-
-## Component files
-
-This section describes the various files used in the code generation process.
-It also contains instructions on how to modify these files to add a new
-architecture/OS or to add additional syscalls, types, or constants. Note that
-if you are using the new build system, the scripts cannot be called normally.
-They must be called from within the docker container.
-
-### asm files
-
-The hand-written assembly file at `asm_${GOOS}_${GOARCH}.s` implements system
-call dispatch. There are three entry points:
-```
- func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
- func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
- func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
-```
-The first and second are the standard ones; they differ only in how many
-arguments can be passed to the kernel. The third is for low-level use by the
-ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
-let it know that a system call is running.
-
-When porting Go to an new architecture/OS, this file must be implemented for
-each GOOS/GOARCH pair.
-
-### mksysnum
-
-Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl`
-for the old system). This script takes in a list of header files containing the
-syscall number declarations and parses them to produce the corresponding list of
-Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
-constants.
-
-Adding new syscall numbers is mostly done by running the build on a sufficiently
-new installation of the target OS (or updating the source checkouts for the
-new build system). However, depending on the OS, you make need to update the
-parsing in mksysnum.
-
-### mksyscall.pl
-
-The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
-hand-written Go files which implement system calls (for unix, the specific OS,
-or the specific OS/Architecture pair respectively) that need special handling
-and list `//sys` comments giving prototypes for ones that can be generated.
-
-The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts
-them into syscalls. This requires the name of the prototype in the comment to
-match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
-prototype can be exported (capitalized) or not.
-
-Adding a new syscall often just requires adding a new `//sys` function prototype
-with the desired arguments and a capitalized name so it is exported. However, if
-you want the interface to the syscall to be different, often one will make an
-unexported `//sys` prototype, an then write a custom wrapper in
-`syscall_${GOOS}.go`.
-
-### types files
-
-For each OS, there is a hand-written Go file at `${GOOS}/types.go` (or
-`types_${GOOS}.go` on the old system). This file includes standard C headers and
-creates Go type aliases to the corresponding C types. The file is then fed
-through godef to get the Go compatible definitions. Finally, the generated code
-is fed though mkpost.go to format the code correctly and remove any hidden or
-private identifiers. This cleaned-up code is written to
-`ztypes_${GOOS}_${GOARCH}.go`.
-
-The hardest part about preparing this file is figuring out which headers to
-include and which symbols need to be `#define`d to get the actual data
-structures that pass through to the kernel system calls. Some C libraries
-preset alternate versions for binary compatibility and translate them on the
-way in and out of system calls, but there is almost always a `#define` that can
-get the real ones.
-See `types_darwin.go` and `linux/types.go` for examples.
-
-To add a new type, add in the necessary include statement at the top of the
-file (if it is not already there) and add in a type alias line. Note that if
-your type is significantly different on different architectures, you may need
-some `#if/#elif` macros in your include statements.
-
-### mkerrors.sh
-
-This script is used to generate the system's various constants. This doesn't
-just include the error numbers and error strings, but also the signal numbers
-an a wide variety of miscellaneous constants. The constants come from the list
-of include files in the `includes_${uname}` variable. A regex then picks out
-the desired `#define` statements, and generates the corresponding Go constants.
-The error numbers and strings are generated from `#include `, and the
-signal numbers and strings are generated from `#include `. All of
-these constants are written to `zerrors_${GOOS}_${GOARCH}.go` via a C program,
-`_errors.c`, which prints out all the constants.
-
-To add a constant, add the header that includes it to the appropriate variable.
-Then, edit the regex (if necessary) to match the desired constant. Avoid making
-the regex too broad to avoid matching unintended constants.
-
-
-## Generated files
-
-### `zerror_${GOOS}_${GOARCH}.go`
-
-A file containing all of the system's generated error numbers, error strings,
-signal numbers, and constants. Generated by `mkerrors.sh` (see above).
-
-### `zsyscall_${GOOS}_${GOARCH}.go`
-
-A file containing all the generated syscalls for a specific GOOS and GOARCH.
-Generated by `mksyscall.pl` (see above).
-
-### `zsysnum_${GOOS}_${GOARCH}.go`
-
-A list of numeric constants for all the syscall number of the specific GOOS
-and GOARCH. Generated by mksysnum (see above).
-
-### `ztypes_${GOOS}_${GOARCH}.go`
-
-A file containing Go types for passing into (or returning from) syscalls.
-Generated by godefs and the types file (see above).
diff --git a/vendor/golang.org/x/sys/unix/affinity_linux.go b/vendor/golang.org/x/sys/unix/affinity_linux.go
deleted file mode 100644
index 72afe333..00000000
--- a/vendor/golang.org/x/sys/unix/affinity_linux.go
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// CPU affinity functions
-
-package unix
-
-import (
- "unsafe"
-)
-
-const cpuSetSize = _CPU_SETSIZE / _NCPUBITS
-
-// CPUSet represents a CPU affinity mask.
-type CPUSet [cpuSetSize]cpuMask
-
-func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
- _, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set)))
- if e != 0 {
- return errnoErr(e)
- }
- return nil
-}
-
-// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
-// If pid is 0 the calling thread is used.
-func SchedGetaffinity(pid int, set *CPUSet) error {
- return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set)
-}
-
-// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
-// If pid is 0 the calling thread is used.
-func SchedSetaffinity(pid int, set *CPUSet) error {
- return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set)
-}
-
-// Zero clears the set s, so that it contains no CPUs.
-func (s *CPUSet) Zero() {
- for i := range s {
- s[i] = 0
- }
-}
-
-func cpuBitsIndex(cpu int) int {
- return cpu / _NCPUBITS
-}
-
-func cpuBitsMask(cpu int) cpuMask {
- return cpuMask(1 << (uint(cpu) % _NCPUBITS))
-}
-
-// Set adds cpu to the set s.
-func (s *CPUSet) Set(cpu int) {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- s[i] |= cpuBitsMask(cpu)
- }
-}
-
-// Clear removes cpu from the set s.
-func (s *CPUSet) Clear(cpu int) {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- s[i] &^= cpuBitsMask(cpu)
- }
-}
-
-// IsSet reports whether cpu is in the set s.
-func (s *CPUSet) IsSet(cpu int) bool {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- return s[i]&cpuBitsMask(cpu) != 0
- }
- return false
-}
-
-// Count returns the number of CPUs in the set s.
-func (s *CPUSet) Count() int {
- c := 0
- for _, b := range s {
- c += onesCount64(uint64(b))
- }
- return c
-}
-
-// onesCount64 is a copy of Go 1.9's math/bits.OnesCount64.
-// Once this package can require Go 1.9, we can delete this
-// and update the caller to use bits.OnesCount64.
-func onesCount64(x uint64) int {
- const m0 = 0x5555555555555555 // 01010101 ...
- const m1 = 0x3333333333333333 // 00110011 ...
- const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ...
- const m3 = 0x00ff00ff00ff00ff // etc.
- const m4 = 0x0000ffff0000ffff
-
- // Implementation: Parallel summing of adjacent bits.
- // See "Hacker's Delight", Chap. 5: Counting Bits.
- // The following pattern shows the general approach:
- //
- // x = x>>1&(m0&m) + x&(m0&m)
- // x = x>>2&(m1&m) + x&(m1&m)
- // x = x>>4&(m2&m) + x&(m2&m)
- // x = x>>8&(m3&m) + x&(m3&m)
- // x = x>>16&(m4&m) + x&(m4&m)
- // x = x>>32&(m5&m) + x&(m5&m)
- // return int(x)
- //
- // Masking (& operations) can be left away when there's no
- // danger that a field's sum will carry over into the next
- // field: Since the result cannot be > 64, 8 bits is enough
- // and we can ignore the masks for the shifts by 8 and up.
- // Per "Hacker's Delight", the first line can be simplified
- // more, but it saves at best one instruction, so we leave
- // it alone for clarity.
- const m = 1<<64 - 1
- x = x>>1&(m0&m) + x&(m0&m)
- x = x>>2&(m1&m) + x&(m1&m)
- x = (x>>4 + x) & (m2 & m)
- x += x >> 8
- x += x >> 16
- x += x >> 32
- return int(x) & (1<<7 - 1)
-}
diff --git a/vendor/golang.org/x/sys/unix/aliases.go b/vendor/golang.org/x/sys/unix/aliases.go
deleted file mode 100644
index 951fce4d..00000000
--- a/vendor/golang.org/x/sys/unix/aliases.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-// +build go1.9
-
-package unix
-
-import "syscall"
-
-type Signal = syscall.Signal
-type Errno = syscall.Errno
-type SysProcAttr = syscall.SysProcAttr
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_386.s b/vendor/golang.org/x/sys/unix/asm_darwin_386.s
deleted file mode 100644
index 8a727831..00000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s b/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
deleted file mode 100644
index 6321421f..00000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
deleted file mode 100644
index 333242d5..00000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-// +build arm,darwin
-
-#include "textflag.h"
-
-//
-// System call support for ARM, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
deleted file mode 100644
index 97e01743..00000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-// +build arm64,darwin
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
deleted file mode 100644
index 603dd572..00000000
--- a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, DragonFly
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s b/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
deleted file mode 100644
index c9a0a260..00000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
deleted file mode 100644
index 35172477..00000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
deleted file mode 100644
index 9227c875..00000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s
deleted file mode 100644
index 448bebbb..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_386.s
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for 386, Linux
-//
-
-// See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
-// instead of the glibc-specific "CALL 0x10(GS)".
-#define INVOKE_SYSCALL INT $0x80
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- CALL runtime·entersyscall(SB)
- MOVL trap+0(FP), AX // syscall entry
- MOVL a1+4(FP), BX
- MOVL a2+8(FP), CX
- MOVL a3+12(FP), DX
- MOVL $0, SI
- MOVL $0, DI
- INVOKE_SYSCALL
- MOVL AX, r1+16(FP)
- MOVL DX, r2+20(FP)
- CALL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVL trap+0(FP), AX // syscall entry
- MOVL a1+4(FP), BX
- MOVL a2+8(FP), CX
- MOVL a3+12(FP), DX
- MOVL $0, SI
- MOVL $0, DI
- INVOKE_SYSCALL
- MOVL AX, r1+16(FP)
- MOVL DX, r2+20(FP)
- RET
-
-TEXT ·socketcall(SB),NOSPLIT,$0-36
- JMP syscall·socketcall(SB)
-
-TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
- JMP syscall·rawsocketcall(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-28
- JMP syscall·seek(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
deleted file mode 100644
index c6468a95..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for AMD64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- CALL runtime·entersyscall(SB)
- MOVQ a1+8(FP), DI
- MOVQ a2+16(FP), SI
- MOVQ a3+24(FP), DX
- MOVQ $0, R10
- MOVQ $0, R8
- MOVQ $0, R9
- MOVQ trap+0(FP), AX // syscall entry
- SYSCALL
- MOVQ AX, r1+32(FP)
- MOVQ DX, r2+40(FP)
- CALL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVQ a1+8(FP), DI
- MOVQ a2+16(FP), SI
- MOVQ a3+24(FP), DX
- MOVQ $0, R10
- MOVQ $0, R8
- MOVQ $0, R9
- MOVQ trap+0(FP), AX // syscall entry
- SYSCALL
- MOVQ AX, r1+32(FP)
- MOVQ DX, r2+40(FP)
- RET
-
-TEXT ·gettimeofday(SB),NOSPLIT,$0-16
- JMP syscall·gettimeofday(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s
deleted file mode 100644
index cf0f3575..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for arm, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- BL runtime·entersyscall(SB)
- MOVW trap+0(FP), R7
- MOVW a1+4(FP), R0
- MOVW a2+8(FP), R1
- MOVW a3+12(FP), R2
- MOVW $0, R3
- MOVW $0, R4
- MOVW $0, R5
- SWI $0
- MOVW R0, r1+16(FP)
- MOVW $0, R0
- MOVW R0, r2+20(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVW trap+0(FP), R7 // syscall entry
- MOVW a1+4(FP), R0
- MOVW a2+8(FP), R1
- MOVW a3+12(FP), R2
- SWI $0
- MOVW R0, r1+16(FP)
- MOVW $0, R0
- MOVW R0, r2+20(FP)
- RET
-
-TEXT ·seek(SB),NOSPLIT,$0-28
- B syscall·seek(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
deleted file mode 100644
index afe6fdf6..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build arm64
-// +build !gccgo
-
-#include "textflag.h"
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R0
- MOVD a2+16(FP), R1
- MOVD a3+24(FP), R2
- MOVD $0, R3
- MOVD $0, R4
- MOVD $0, R5
- MOVD trap+0(FP), R8 // syscall entry
- SVC
- MOVD R0, r1+32(FP) // r1
- MOVD R1, r2+40(FP) // r2
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R0
- MOVD a2+16(FP), R1
- MOVD a3+24(FP), R2
- MOVD $0, R3
- MOVD $0, R4
- MOVD $0, R5
- MOVD trap+0(FP), R8 // syscall entry
- SVC
- MOVD R0, r1+32(FP)
- MOVD R1, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
deleted file mode 100644
index ab9d6383..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build mips64 mips64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for mips64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- JAL runtime·entersyscall(SB)
- MOVV a1+8(FP), R4
- MOVV a2+16(FP), R5
- MOVV a3+24(FP), R6
- MOVV R0, R7
- MOVV R0, R8
- MOVV R0, R9
- MOVV trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVV R2, r1+32(FP)
- MOVV R3, r2+40(FP)
- JAL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVV a1+8(FP), R4
- MOVV a2+16(FP), R5
- MOVV a3+24(FP), R6
- MOVV R0, R7
- MOVV R0, R8
- MOVV R0, R9
- MOVV trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVV R2, r1+32(FP)
- MOVV R3, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
deleted file mode 100644
index 99e53990..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build mips mipsle
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for mips, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- JAL runtime·entersyscall(SB)
- MOVW a1+4(FP), R4
- MOVW a2+8(FP), R5
- MOVW a3+12(FP), R6
- MOVW R0, R7
- MOVW trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVW R2, r1+16(FP) // r1
- MOVW R3, r2+20(FP) // r2
- JAL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVW a1+4(FP), R4
- MOVW a2+8(FP), R5
- MOVW a3+12(FP), R6
- MOVW trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVW R2, r1+16(FP)
- MOVW R3, r2+20(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
deleted file mode 100644
index 649e5871..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build ppc64 ppc64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for ppc64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- BR syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- BR syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R3
- MOVD a2+16(FP), R4
- MOVD a3+24(FP), R5
- MOVD R0, R6
- MOVD R0, R7
- MOVD R0, R8
- MOVD trap+0(FP), R9 // syscall entry
- SYSCALL R9
- MOVD R3, r1+32(FP)
- MOVD R4, r2+40(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- BR syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- BR syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R3
- MOVD a2+16(FP), R4
- MOVD a3+24(FP), R5
- MOVD R0, R6
- MOVD R0, R7
- MOVD R0, R8
- MOVD trap+0(FP), R9 // syscall entry
- SYSCALL R9
- MOVD R3, r1+32(FP)
- MOVD R4, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
deleted file mode 100644
index a5a863c6..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build s390x
-// +build linux
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for s390x, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- BR syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- BR syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R2
- MOVD a2+16(FP), R3
- MOVD a3+24(FP), R4
- MOVD $0, R5
- MOVD $0, R6
- MOVD $0, R7
- MOVD trap+0(FP), R1 // syscall entry
- SYSCALL
- MOVD R2, r1+32(FP)
- MOVD R3, r2+40(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- BR syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- BR syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R2
- MOVD a2+16(FP), R3
- MOVD a3+24(FP), R4
- MOVD $0, R5
- MOVD $0, R6
- MOVD $0, R7
- MOVD trap+0(FP), R1 // syscall entry
- SYSCALL
- MOVD R2, r1+32(FP)
- MOVD R3, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s b/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
deleted file mode 100644
index 48bdcd76..00000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
deleted file mode 100644
index 2ede05c7..00000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
deleted file mode 100644
index e8928571..00000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s b/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
deleted file mode 100644
index 00576f3c..00000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
deleted file mode 100644
index 790ef77f..00000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
deleted file mode 100644
index 469bfa10..00000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
deleted file mode 100644
index ded8260f..00000000
--- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
-//
-
-TEXT ·sysvicall6(SB),NOSPLIT,$0-88
- JMP syscall·sysvicall6(SB)
-
-TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
- JMP syscall·rawSysvicall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/bluetooth_linux.go b/vendor/golang.org/x/sys/unix/bluetooth_linux.go
deleted file mode 100644
index 6e322969..00000000
--- a/vendor/golang.org/x/sys/unix/bluetooth_linux.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Bluetooth sockets and messages
-
-package unix
-
-// Bluetooth Protocols
-const (
- BTPROTO_L2CAP = 0
- BTPROTO_HCI = 1
- BTPROTO_SCO = 2
- BTPROTO_RFCOMM = 3
- BTPROTO_BNEP = 4
- BTPROTO_CMTP = 5
- BTPROTO_HIDP = 6
- BTPROTO_AVDTP = 7
-)
-
-const (
- HCI_CHANNEL_RAW = 0
- HCI_CHANNEL_USER = 1
- HCI_CHANNEL_MONITOR = 2
- HCI_CHANNEL_CONTROL = 3
-)
-
-// Socketoption Level
-const (
- SOL_BLUETOOTH = 0x112
- SOL_HCI = 0x0
- SOL_L2CAP = 0x6
- SOL_RFCOMM = 0x12
- SOL_SCO = 0x11
-)
diff --git a/vendor/golang.org/x/sys/unix/cap_freebsd.go b/vendor/golang.org/x/sys/unix/cap_freebsd.go
deleted file mode 100644
index df520487..00000000
--- a/vendor/golang.org/x/sys/unix/cap_freebsd.go
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build freebsd
-
-package unix
-
-import (
- "errors"
- "fmt"
-)
-
-// Go implementation of C mostly found in /usr/src/sys/kern/subr_capability.c
-
-const (
- // This is the version of CapRights this package understands. See C implementation for parallels.
- capRightsGoVersion = CAP_RIGHTS_VERSION_00
- capArSizeMin = CAP_RIGHTS_VERSION_00 + 2
- capArSizeMax = capRightsGoVersion + 2
-)
-
-var (
- bit2idx = []int{
- -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1,
- 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- }
-)
-
-func capidxbit(right uint64) int {
- return int((right >> 57) & 0x1f)
-}
-
-func rightToIndex(right uint64) (int, error) {
- idx := capidxbit(right)
- if idx < 0 || idx >= len(bit2idx) {
- return -2, fmt.Errorf("index for right 0x%x out of range", right)
- }
- return bit2idx[idx], nil
-}
-
-func caprver(right uint64) int {
- return int(right >> 62)
-}
-
-func capver(rights *CapRights) int {
- return caprver(rights.Rights[0])
-}
-
-func caparsize(rights *CapRights) int {
- return capver(rights) + 2
-}
-
-// CapRightsSet sets the permissions in setrights in rights.
-func CapRightsSet(rights *CapRights, setrights []uint64) error {
- // This is essentially a copy of cap_rights_vset()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return errors.New("bad rights size")
- }
-
- for _, right := range setrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return err
- }
- if i >= n {
- return errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch")
- }
- rights.Rights[i] |= right
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch (after assign)")
- }
- }
-
- return nil
-}
-
-// CapRightsClear clears the permissions in clearrights from rights.
-func CapRightsClear(rights *CapRights, clearrights []uint64) error {
- // This is essentially a copy of cap_rights_vclear()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return errors.New("bad rights size")
- }
-
- for _, right := range clearrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return err
- }
- if i >= n {
- return errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch")
- }
- rights.Rights[i] &= ^(right & 0x01FFFFFFFFFFFFFF)
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch (after assign)")
- }
- }
-
- return nil
-}
-
-// CapRightsIsSet checks whether all the permissions in setrights are present in rights.
-func CapRightsIsSet(rights *CapRights, setrights []uint64) (bool, error) {
- // This is essentially a copy of cap_rights_is_vset()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return false, fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return false, errors.New("bad rights size")
- }
-
- for _, right := range setrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return false, errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return false, err
- }
- if i >= n {
- return false, errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return false, errors.New("index mismatch")
- }
- if (rights.Rights[i] & right) != right {
- return false, nil
- }
- }
-
- return true, nil
-}
-
-func capright(idx uint64, bit uint64) uint64 {
- return ((1 << (57 + idx)) | bit)
-}
-
-// CapRightsInit returns a pointer to an initialised CapRights structure filled with rights.
-// See man cap_rights_init(3) and rights(4).
-func CapRightsInit(rights []uint64) (*CapRights, error) {
- var r CapRights
- r.Rights[0] = (capRightsGoVersion << 62) | capright(0, 0)
- r.Rights[1] = capright(1, 0)
-
- err := CapRightsSet(&r, rights)
- if err != nil {
- return nil, err
- }
- return &r, nil
-}
-
-// CapRightsLimit reduces the operations permitted on fd to at most those contained in rights.
-// The capability rights on fd can never be increased by CapRightsLimit.
-// See man cap_rights_limit(2) and rights(4).
-func CapRightsLimit(fd uintptr, rights *CapRights) error {
- return capRightsLimit(int(fd), rights)
-}
-
-// CapRightsGet returns a CapRights structure containing the operations permitted on fd.
-// See man cap_rights_get(3) and rights(4).
-func CapRightsGet(fd uintptr) (*CapRights, error) {
- r, err := CapRightsInit(nil)
- if err != nil {
- return nil, err
- }
- err = capRightsGet(capRightsGoVersion, int(fd), r)
- if err != nil {
- return nil, err
- }
- return r, nil
-}
diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go
deleted file mode 100644
index 3a6ac648..00000000
--- a/vendor/golang.org/x/sys/unix/constants.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-const (
- R_OK = 0x4
- W_OK = 0x2
- X_OK = 0x1
-)
diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
deleted file mode 100644
index 5e5fb451..00000000
--- a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix
-// +build ppc
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by AIX.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 16) & 0xffff)
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff)
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- return uint64(((major) << 16) | (minor))
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
deleted file mode 100644
index 8b401244..00000000
--- a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix
-// +build ppc64
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used AIX.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x3fffffff00000000) >> 32)
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- return uint32((dev & 0x00000000ffffffff) >> 0)
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- var DEVNO64 uint64
- DEVNO64 = 0x8000000000000000
- return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64)
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_darwin.go b/vendor/golang.org/x/sys/unix/dev_darwin.go
deleted file mode 100644
index 8d1dc0fa..00000000
--- a/vendor/golang.org/x/sys/unix/dev_darwin.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in Darwin's sys/types.h header.
-
-package unix
-
-// Major returns the major component of a Darwin device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 24) & 0xff)
-}
-
-// Minor returns the minor component of a Darwin device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffffff)
-}
-
-// Mkdev returns a Darwin device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 24) | uint64(minor)
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_dragonfly.go b/vendor/golang.org/x/sys/unix/dev_dragonfly.go
deleted file mode 100644
index 8502f202..00000000
--- a/vendor/golang.org/x/sys/unix/dev_dragonfly.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in Dragonfly's sys/types.h header.
-//
-// The information below is extracted and adapted from sys/types.h:
-//
-// Minor gives a cookie instead of an index since in order to avoid changing the
-// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
-// devices that don't use them.
-
-package unix
-
-// Major returns the major component of a DragonFlyBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 8) & 0xff)
-}
-
-// Minor returns the minor component of a DragonFlyBSD device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff00ff)
-}
-
-// Mkdev returns a DragonFlyBSD device number generated from the given major and
-// minor components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 8) | uint64(minor)
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_freebsd.go b/vendor/golang.org/x/sys/unix/dev_freebsd.go
deleted file mode 100644
index eba3b4bd..00000000
--- a/vendor/golang.org/x/sys/unix/dev_freebsd.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in FreeBSD's sys/types.h header.
-//
-// The information below is extracted and adapted from sys/types.h:
-//
-// Minor gives a cookie instead of an index since in order to avoid changing the
-// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
-// devices that don't use them.
-
-package unix
-
-// Major returns the major component of a FreeBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 8) & 0xff)
-}
-
-// Minor returns the minor component of a FreeBSD device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff00ff)
-}
-
-// Mkdev returns a FreeBSD device number generated from the given major and
-// minor components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 8) | uint64(minor)
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_linux.go b/vendor/golang.org/x/sys/unix/dev_linux.go
deleted file mode 100644
index d165d6f3..00000000
--- a/vendor/golang.org/x/sys/unix/dev_linux.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by the Linux kernel and glibc.
-//
-// The information below is extracted and adapted from bits/sysmacros.h in the
-// glibc sources:
-//
-// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
-// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
-// number and m is a hex digit of the minor number. This is backward compatible
-// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
-// backward compatible with the Linux kernel, which for some architectures uses
-// 32-bit dev_t, encoded as mmmM MMmm.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- major := uint32((dev & 0x00000000000fff00) >> 8)
- major |= uint32((dev & 0xfffff00000000000) >> 32)
- return major
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x00000000000000ff) >> 0)
- minor |= uint32((dev & 0x00000ffffff00000) >> 12)
- return minor
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) & 0x00000fff) << 8
- dev |= (uint64(major) & 0xfffff000) << 32
- dev |= (uint64(minor) & 0x000000ff) << 0
- dev |= (uint64(minor) & 0xffffff00) << 12
- return dev
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_netbsd.go b/vendor/golang.org/x/sys/unix/dev_netbsd.go
deleted file mode 100644
index b4a203d0..00000000
--- a/vendor/golang.org/x/sys/unix/dev_netbsd.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in NetBSD's sys/types.h header.
-
-package unix
-
-// Major returns the major component of a NetBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x000fff00) >> 8)
-}
-
-// Minor returns the minor component of a NetBSD device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x000000ff) >> 0)
- minor |= uint32((dev & 0xfff00000) >> 12)
- return minor
-}
-
-// Mkdev returns a NetBSD device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) << 8) & 0x000fff00
- dev |= (uint64(minor) << 12) & 0xfff00000
- dev |= (uint64(minor) << 0) & 0x000000ff
- return dev
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_openbsd.go b/vendor/golang.org/x/sys/unix/dev_openbsd.go
deleted file mode 100644
index f3430c42..00000000
--- a/vendor/golang.org/x/sys/unix/dev_openbsd.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in OpenBSD's sys/types.h header.
-
-package unix
-
-// Major returns the major component of an OpenBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x0000ff00) >> 8)
-}
-
-// Minor returns the minor component of an OpenBSD device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x000000ff) >> 0)
- minor |= uint32((dev & 0xffff0000) >> 8)
- return minor
-}
-
-// Mkdev returns an OpenBSD device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) << 8) & 0x0000ff00
- dev |= (uint64(minor) << 8) & 0xffff0000
- dev |= (uint64(minor) << 0) & 0x000000ff
- return dev
-}
diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go
deleted file mode 100644
index 4407c505..00000000
--- a/vendor/golang.org/x/sys/unix/dirent.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
-
-package unix
-
-import "syscall"
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number of
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- return syscall.ParseDirent(buf, max, names)
-}
diff --git a/vendor/golang.org/x/sys/unix/endian_big.go b/vendor/golang.org/x/sys/unix/endian_big.go
deleted file mode 100644
index 5e926906..00000000
--- a/vendor/golang.org/x/sys/unix/endian_big.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-//
-// +build ppc64 s390x mips mips64
-
-package unix
-
-const isBigEndian = true
diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go
deleted file mode 100644
index 085df2d8..00000000
--- a/vendor/golang.org/x/sys/unix/endian_little.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-//
-// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le
-
-package unix
-
-const isBigEndian = false
diff --git a/vendor/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go
deleted file mode 100644
index 84178b0a..00000000
--- a/vendor/golang.org/x/sys/unix/env_unix.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-// Unix environment variables.
-
-package unix
-
-import "syscall"
-
-func Getenv(key string) (value string, found bool) {
- return syscall.Getenv(key)
-}
-
-func Setenv(key, value string) error {
- return syscall.Setenv(key, value)
-}
-
-func Clearenv() {
- syscall.Clearenv()
-}
-
-func Environ() []string {
- return syscall.Environ()
-}
-
-func Unsetenv(key string) error {
- return syscall.Unsetenv(key)
-}
diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_386.go b/vendor/golang.org/x/sys/unix/errors_freebsd_386.go
deleted file mode 100644
index c56bc8b0..00000000
--- a/vendor/golang.org/x/sys/unix/errors_freebsd_386.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
-// them here for backwards compatibility.
-
-package unix
-
-const (
- IFF_SMART = 0x20
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAITH = 0xf2
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_IPXIP = 0xf9
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8030720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8030720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
deleted file mode 100644
index 3e977117..00000000
--- a/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
-// them here for backwards compatibility.
-
-package unix
-
-const (
- IFF_SMART = 0x20
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAITH = 0xf2
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_IPXIP = 0xf9
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8040720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8040720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
deleted file mode 100644
index 856dca32..00000000
--- a/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-const (
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
-
- // missing constants on FreeBSD-11.1-RELEASE, copied from old values in ztypes_freebsd_arm.go
- IFF_SMART = 0x20
- IFT_FAITH = 0xf2
- IFT_IPXIP = 0xf9
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8030720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8030720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go
deleted file mode 100644
index 9379ba9c..00000000
--- a/vendor/golang.org/x/sys/unix/fcntl.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd
-
-package unix
-
-import "unsafe"
-
-// fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
-// systems by flock_linux_32bit.go to be SYS_FCNTL64.
-var fcntl64Syscall uintptr = SYS_FCNTL
-
-// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
-func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
- valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg))
- var err error
- if errno != 0 {
- err = errno
- }
- return int(valptr), err
-}
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
- _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
- if errno == 0 {
- return nil
- }
- return errno
-}
diff --git a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
deleted file mode 100644
index fc0e50e0..00000000
--- a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build linux,386 linux,arm linux,mips linux,mipsle
-
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-func init() {
- // On 32-bit Linux systems, the fcntl syscall that matches Go's
- // Flock_t type is SYS_FCNTL64, not SYS_FCNTL.
- fcntl64Syscall = SYS_FCNTL64
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go
deleted file mode 100644
index cd6f5a61..00000000
--- a/vendor/golang.org/x/sys/unix/gccgo.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo
-// +build !aix
-
-package unix
-
-import "syscall"
-
-// We can't use the gc-syntax .s files for gccgo. On the plus side
-// much of the functionality can be written directly in Go.
-
-//extern gccgoRealSyscallNoError
-func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
-
-//extern gccgoRealSyscall
-func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
-
-func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
- syscall.Entersyscall()
- r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0
-}
-
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
- r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- return r, 0
-}
-
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
- return r, 0, syscall.Errno(errno)
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c
deleted file mode 100644
index c44730c5..00000000
--- a/vendor/golang.org/x/sys/unix/gccgo_c.c
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo
-// +build !aix
-
-#include
-#include
-#include
-
-#define _STRINGIFY2_(x) #x
-#define _STRINGIFY_(x) _STRINGIFY2_(x)
-#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
-
-// Call syscall from C code because the gccgo support for calling from
-// Go to C does not support varargs functions.
-
-struct ret {
- uintptr_t r;
- uintptr_t err;
-};
-
-struct ret
-gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
-{
- struct ret r;
-
- errno = 0;
- r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
- r.err = errno;
- return r;
-}
-
-uintptr_t
-gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
-{
- return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
deleted file mode 100644
index 251a977a..00000000
--- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo,linux,amd64
-
-package unix
-
-import "syscall"
-
-//extern gettimeofday
-func realGettimeofday(*Timeval, *byte) int32
-
-func gettimeofday(tv *Timeval) (err syscall.Errno) {
- r := realGettimeofday(tv, nil)
- if r < 0 {
- return syscall.GetErrno()
- }
- return 0
-}
diff --git a/vendor/golang.org/x/sys/unix/ioctl.go b/vendor/golang.org/x/sys/unix/ioctl.go
deleted file mode 100644
index f121a8d6..00000000
--- a/vendor/golang.org/x/sys/unix/ioctl.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-import "runtime"
-
-// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
-//
-// To change fd's window size, the req argument should be TIOCSWINSZ.
-func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
- // TODO: if we get the chance, remove the req parameter and
- // hardcode TIOCSWINSZ.
- err := ioctlSetWinsize(fd, req, value)
- runtime.KeepAlive(value)
- return err
-}
-
-// IoctlSetTermios performs an ioctl on fd with a *Termios.
-//
-// The req value will usually be TCSETA or TIOCSETA.
-func IoctlSetTermios(fd int, req uint, value *Termios) error {
- // TODO: if we get the chance, remove the req parameter.
- err := ioctlSetTermios(fd, req, value)
- runtime.KeepAlive(value)
- return err
-}
diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh
deleted file mode 100755
index edb176f1..00000000
--- a/vendor/golang.org/x/sys/unix/mkall.sh
+++ /dev/null
@@ -1,198 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# This script runs or (given -n) prints suggested commands to generate files for
-# the Architecture/OS specified by the GOARCH and GOOS environment variables.
-# See README.md for more information about how the build system works.
-
-GOOSARCH="${GOOS}_${GOARCH}"
-
-# defaults
-mksyscall="./mksyscall.pl"
-mkerrors="./mkerrors.sh"
-zerrors="zerrors_$GOOSARCH.go"
-mksysctl=""
-zsysctl="zsysctl_$GOOSARCH.go"
-mksysnum=
-mktypes=
-run="sh"
-cmd=""
-
-case "$1" in
--syscalls)
- for i in zsyscall*go
- do
- # Run the command line that appears in the first line
- # of the generated file to regenerate it.
- sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
- rm _$i
- done
- exit 0
- ;;
--n)
- run="cat"
- cmd="echo"
- shift
-esac
-
-case "$#" in
-0)
- ;;
-*)
- echo 'usage: mkall.sh [-n]' 1>&2
- exit 2
-esac
-
-if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
- # Use then new build system
- # Files generated through docker (use $cmd so you can Ctl-C the build or run)
- $cmd docker build --tag generate:$GOOS $GOOS
- $cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
- exit
-fi
-
-GOOSARCH_in=syscall_$GOOSARCH.go
-case "$GOOSARCH" in
-_* | *_ | _)
- echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
- exit 1
- ;;
-aix_ppc)
- mkerrors="$mkerrors -maix32"
- mksyscall="perl mksyscall_aix.pl -aix"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-aix_ppc64)
- mkerrors="$mkerrors -maix64"
- mksyscall="perl mksyscall_aix.pl -aix"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32"
- mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_amd64)
- mkerrors="$mkerrors -m64"
- mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_arm)
- mkerrors="$mkerrors"
- mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_arm64)
- mkerrors="$mkerrors -m64"
- mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-dragonfly_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="./mksyscall.pl -dragonfly"
- mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32"
- mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_amd64)
- mkerrors="$mkerrors -m64"
- mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_arm)
- mkerrors="$mkerrors"
- mksyscall="./mksyscall.pl -l32 -arm"
- mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-linux_sparc64)
- GOOSARCH_in=syscall_linux_sparc64.go
- unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h
- mkerrors="$mkerrors -m64"
- mksysnum="./mksysnum_linux.pl $unistd_h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32 -netbsd"
- mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="./mksyscall.pl -netbsd"
- mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_arm)
- mkerrors="$mkerrors"
- mksyscall="./mksyscall.pl -l32 -netbsd -arm"
- mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-openbsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32 -openbsd"
- mksysctl="./mksysctl_openbsd.pl"
- mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="./mksyscall.pl -openbsd"
- mksysctl="./mksysctl_openbsd.pl"
- mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_arm)
- mkerrors="$mkerrors"
- mksyscall="./mksyscall.pl -l32 -openbsd -arm"
- mksysctl="./mksysctl_openbsd.pl"
- mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-solaris_amd64)
- mksyscall="./mksyscall_solaris.pl"
- mkerrors="$mkerrors -m64"
- mksysnum=
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-*)
- echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
- exit 1
- ;;
-esac
-
-(
- if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
- case "$GOOS" in
- *)
- syscall_goos="syscall_$GOOS.go"
- case "$GOOS" in
- darwin | dragonfly | freebsd | netbsd | openbsd)
- syscall_goos="syscall_bsd.go $syscall_goos"
- ;;
- esac
- if [ -n "$mksyscall" ]; then echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
- ;;
- esac
- if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
- if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
- if [ -n "$mktypes" ]; then
- echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
- fi
-) | $run
diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh
deleted file mode 100755
index ec8e6132..00000000
--- a/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ /dev/null
@@ -1,652 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# Generate Go code listing errors and other #defined constant
-# values (ENAMETOOLONG etc.), by asking the preprocessor
-# about the definitions.
-
-unset LANG
-export LC_ALL=C
-export LC_CTYPE=C
-
-if test -z "$GOARCH" -o -z "$GOOS"; then
- echo 1>&2 "GOARCH or GOOS not defined in environment"
- exit 1
-fi
-
-# Check that we are using the new build system if we should
-if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
- if [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
- echo 1>&2 "In the new build system, mkerrors should not be called directly."
- echo 1>&2 "See README.md"
- exit 1
- fi
-fi
-
-if [[ "$GOOS" = "aix" ]]; then
- CC=${CC:-gcc}
-else
- CC=${CC:-cc}
-fi
-
-if [[ "$GOOS" = "solaris" ]]; then
- # Assumes GNU versions of utilities in PATH.
- export PATH=/usr/gnu/bin:$PATH
-fi
-
-uname=$(uname)
-
-includes_AIX='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include