From ec7ec42e4c0ac7a920b7e10de913c86ce1cb393c Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 24 Feb 2017 14:36:54 -0500 Subject: [PATCH] Update deps --- .../github.com/aws/aws-sdk-go/aws/config.go | 17 +- .../stscreds/assume_role_provider.go | 159 ++++- .../aws/aws-sdk-go/aws/session/doc.go | 71 ++- .../aws/aws-sdk-go/aws/session/session.go | 91 ++- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../service/dynamodb/dynamodbattribute/doc.go | 6 +- .../aws/aws-sdk-go/service/ec2/api.go | 86 ++- .../circonus-gometrics/api/api.go | 2 +- .../api/dashboard-example.json | 390 ------------ .../circonus-gometrics/api/dashboard.go | 6 +- .../circonus-gometrics/api/metric.go | 2 +- .../circonus-gometrics/checkmgr/cert.go | 19 +- .../circonus-gometrics/checkmgr/check.go | 12 + .../circonus-gometrics/checkmgr/checkmgr.go | 4 +- .../circonus-gometrics/circonus-gometrics.go | 2 +- .../github.com/coreos/etcd/clientv3/README.md | 4 +- .../github.com/coreos/etcd/clientv3/client.go | 58 +- .../github.com/coreos/etcd/clientv3/config.go | 8 + .../github.com/coreos/etcd/clientv3/lease.go | 2 +- .../coreos/etcd/pkg/fileutil/dir_unix.go | 22 - .../coreos/etcd/pkg/fileutil/dir_windows.go | 46 -- .../coreos/etcd/pkg/fileutil/fileutil.go | 121 ---- .../coreos/etcd/pkg/fileutil/lock.go | 26 - .../coreos/etcd/pkg/fileutil/lock_flock.go | 49 -- .../coreos/etcd/pkg/fileutil/lock_linux.go | 96 --- .../coreos/etcd/pkg/fileutil/lock_plan9.go | 45 -- .../coreos/etcd/pkg/fileutil/lock_solaris.go | 62 -- .../coreos/etcd/pkg/fileutil/lock_unix.go | 29 - .../coreos/etcd/pkg/fileutil/lock_windows.go | 125 ---- .../coreos/etcd/pkg/fileutil/preallocate.go | 47 -- .../etcd/pkg/fileutil/preallocate_darwin.go | 43 -- .../etcd/pkg/fileutil/preallocate_unix.go | 49 -- .../pkg/fileutil/preallocate_unsupported.go | 25 - .../coreos/etcd/pkg/fileutil/purge.go | 78 --- .../coreos/etcd/pkg/fileutil/sync.go | 29 - .../coreos/etcd/pkg/fileutil/sync_darwin.go | 40 -- .../coreos/etcd/pkg/fileutil/sync_linux.go | 34 -- .../coreos/etcd/pkg/transport/listener.go | 3 +- vendor/github.com/coreos/go-systemd/LICENSE | 191 ------ .../coreos/go-systemd/journal/journal.go | 179 ------ vendor/github.com/coreos/pkg/LICENSE | 202 ------- vendor/github.com/coreos/pkg/NOTICE | 5 - .../github.com/coreos/pkg/capnslog/README.md | 39 -- .../coreos/pkg/capnslog/formatters.go | 157 ----- .../coreos/pkg/capnslog/glog_formatter.go | 96 --- vendor/github.com/coreos/pkg/capnslog/init.go | 49 -- .../coreos/pkg/capnslog/init_windows.go | 25 - .../coreos/pkg/capnslog/journald_formatter.go | 68 --- .../coreos/pkg/capnslog/log_hijack.go | 39 -- .../github.com/coreos/pkg/capnslog/logmap.go | 245 -------- .../coreos/pkg/capnslog/pkg_logger.go | 177 ------ .../coreos/pkg/capnslog/syslog_formatter.go | 65 -- vendor/github.com/go-ini/ini/ini.go | 55 +- vendor/github.com/go-ini/ini/key.go | 47 ++ vendor/github.com/go-ini/ini/parser.go | 13 +- vendor/github.com/go-ini/ini/section.go | 14 +- vendor/github.com/google/go-github/LICENSE | 2 +- .../google/go-github/github/activity.go | 8 +- .../go-github/github/activity_events.go | 51 +- .../github/activity_notifications.go | 57 +- .../google/go-github/github/activity_star.go | 29 +- .../go-github/github/activity_watching.go | 35 +- .../google/go-github/github/admin.go | 13 +- .../google/go-github/github/authorizations.go | 67 ++- .../github.com/google/go-github/github/doc.go | 21 +- .../google/go-github/github/event_types.go | 69 +-- .../google/go-github/github/gists.go | 85 +-- .../google/go-github/github/gists_comments.go | 31 +- .../github.com/google/go-github/github/git.go | 2 +- .../google/go-github/github/git_blobs.go | 15 +- .../google/go-github/github/git_commits.go | 13 +- .../google/go-github/github/git_refs.go | 31 +- .../google/go-github/github/git_tags.go | 13 +- .../google/go-github/github/git_trees.go | 17 +- .../google/go-github/github/github.go | 64 +- .../google/go-github/github/gitignore.go | 19 +- .../google/go-github/github/integration.go | 6 +- .../github/integration_installation.go | 6 +- .../google/go-github/github/issues.go | 51 +- .../go-github/github/issues_assignees.go | 25 +- .../go-github/github/issues_comments.go | 31 +- .../google/go-github/github/issues_events.go | 13 +- .../google/go-github/github/issues_labels.go | 67 ++- .../go-github/github/issues_milestones.go | 23 +- .../go-github/github/issues_timeline.go | 5 +- .../google/go-github/github/licenses.go | 13 +- .../google/go-github/github/messages.go | 6 +- .../google/go-github/github/migrations.go | 25 +- .../github/migrations_source_import.go | 37 +- .../google/go-github/github/misc.go | 25 +- .../google/go-github/github/orgs.go | 25 +- .../google/go-github/github/orgs_hooks.go | 29 +- .../google/go-github/github/orgs_members.go | 66 +- .../github/orgs_outside_collaborators.go | 53 ++ .../google/go-github/github/orgs_teams.go | 85 +-- .../google/go-github/github/projects.go | 65 +- .../google/go-github/github/pulls.go | 41 +- .../google/go-github/github/pulls_comments.go | 21 +- .../google/go-github/github/pulls_reviews.go | 29 +- .../google/go-github/github/reactions.go | 41 +- .../google/go-github/github/repos.go | 93 +-- .../go-github/github/repos_collaborators.go | 39 +- .../google/go-github/github/repos_comments.go | 37 +- .../google/go-github/github/repos_commits.go | 25 +- .../google/go-github/github/repos_contents.go | 60 +- .../go-github/github/repos_deployments.go | 26 +- .../google/go-github/github/repos_forks.go | 15 +- .../google/go-github/github/repos_hooks.go | 46 +- .../go-github/github/repos_invitations.go | 17 +- .../google/go-github/github/repos_keys.go | 35 +- .../google/go-github/github/repos_merging.go | 5 +- .../google/go-github/github/repos_pages.go | 25 +- .../google/go-github/github/repos_projects.go | 13 +- .../google/go-github/github/repos_releases.go | 81 +-- .../google/go-github/github/repos_stats.go | 31 +- .../google/go-github/github/repos_statuses.go | 17 +- .../google/go-github/github/repos_traffic.go | 21 +- .../google/go-github/github/search.go | 37 +- .../google/go-github/github/users.go | 41 +- .../go-github/github/users_administration.go | 21 +- .../google/go-github/github/users_emails.go | 20 +- .../go-github/github/users_followers.go | 35 +- .../google/go-github/github/users_gpg_keys.go | 17 +- .../google/go-github/github/users_keys.go | 29 +- .../grpc-gateway/runtime/query.go | 71 ++- .../keybase/go-crypto/openpgp/keys.go | 4 +- .../mattn/go-colorable/colorable_windows.go | 76 +-- vendor/github.com/mitchellh/cli/README.md | 1 + vendor/github.com/mitchellh/cli/cli.go | 4 +- vendor/golang.org/x/net/http2/hpack/encode.go | 11 +- vendor/golang.org/x/net/http2/hpack/hpack.go | 26 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 4 + .../x/sys/unix/zerrors_linux_386.go | 2 + .../x/sys/unix/zerrors_linux_amd64.go | 8 + .../x/sys/unix/zerrors_linux_arm.go | 6 + .../x/sys/unix/zerrors_linux_arm64.go | 5 + .../x/sys/unix/zerrors_linux_mips.go | 8 + .../x/sys/unix/zerrors_linux_mips64.go | 2 + .../x/sys/unix/zerrors_linux_mips64le.go | 2 + .../x/sys/unix/zerrors_linux_ppc64.go | 5 + .../x/sys/unix/zerrors_linux_ppc64le.go | 2 + .../x/sys/unix/zerrors_linux_s390x.go | 1 + .../grpc/credentials/credentials_util_go17.go | 3 +- .../grpc/credentials/credentials_util_go18.go | 53 ++ .../credentials/credentials_util_pre_go17.go | 2 - vendor/vendor.json | 564 +++++++++--------- 146 files changed, 2195 insertions(+), 4457 deletions(-) delete mode 100644 vendor/github.com/circonus-labs/circonus-gometrics/api/dashboard-example.json delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/dir_unix.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/dir_windows.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/fileutil.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/lock.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/lock_flock.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/lock_linux.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/lock_plan9.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/lock_solaris.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/lock_unix.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/lock_windows.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/preallocate.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_darwin.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unix.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unsupported.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/purge.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/sync.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/sync_darwin.go delete mode 100644 vendor/github.com/coreos/etcd/pkg/fileutil/sync_linux.go delete mode 100644 vendor/github.com/coreos/go-systemd/LICENSE delete mode 100644 vendor/github.com/coreos/go-systemd/journal/journal.go delete mode 100644 vendor/github.com/coreos/pkg/LICENSE delete mode 100644 vendor/github.com/coreos/pkg/NOTICE delete mode 100644 vendor/github.com/coreos/pkg/capnslog/README.md delete mode 100644 vendor/github.com/coreos/pkg/capnslog/formatters.go delete mode 100644 vendor/github.com/coreos/pkg/capnslog/glog_formatter.go delete mode 100644 vendor/github.com/coreos/pkg/capnslog/init.go delete mode 100644 vendor/github.com/coreos/pkg/capnslog/init_windows.go delete mode 100644 vendor/github.com/coreos/pkg/capnslog/journald_formatter.go delete mode 100644 vendor/github.com/coreos/pkg/capnslog/log_hijack.go delete mode 100644 vendor/github.com/coreos/pkg/capnslog/logmap.go delete mode 100644 vendor/github.com/coreos/pkg/capnslog/pkg_logger.go delete mode 100644 vendor/github.com/coreos/pkg/capnslog/syslog_formatter.go create mode 100644 vendor/github.com/google/go-github/github/orgs_outside_collaborators.go create mode 100644 vendor/google.golang.org/grpc/credentials/credentials_util_go18.go diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go index d58b81280a..f5a7c37920 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -22,9 +22,9 @@ type RequestRetryer interface{} // // // Create Session with MaxRetry configuration to be shared by multiple // // service clients. -// sess, err := session.NewSession(&aws.Config{ +// sess := session.Must(session.NewSession(&aws.Config{ // MaxRetries: aws.Int(3), -// }) +// })) // // // Create S3 service client with a specific Region. // svc := s3.New(sess, &aws.Config{ @@ -154,7 +154,8 @@ type Config struct { // the EC2Metadata overriding the timeout for default credentials chain. // // Example: - // sess, err := session.NewSession(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // sess := session.Must(session.NewSession(aws.NewConfig() + // .WithEC2MetadataDiableTimeoutOverride(true))) // // svc := s3.New(sess) // @@ -174,7 +175,7 @@ type Config struct { // // Only supported with. // - // sess, err := session.NewSession() + // sess := session.Must(session.NewSession()) // // svc := s3.New(sess, &aws.Config{ // UseDualStack: aws.Bool(true), @@ -192,7 +193,9 @@ type Config struct { // Will default to false. This would only be used for empty directory names in s3 requests. // // Example: - // sess, err := session.NewSession(&aws.Config{DisableRestProtocolURICleaning: aws.Bool(true)) + // sess := session.Must(session.NewSession(&aws.Config{ + // DisableRestProtocolURICleaning: aws.Bool(true), + // })) // // svc := s3.New(sess) // out, err := svc.GetObject(&s3.GetObjectInput { @@ -207,9 +210,9 @@ type Config struct { // // // Create Session with MaxRetry configuration to be shared by multiple // // service clients. -// sess, err := session.NewSession(aws.NewConfig(). +// sess := session.Must(session.NewSession(aws.NewConfig(). // WithMaxRetries(3), -// ) +// )) // // // Create S3 service client with a specific Region. // svc := s3.New(sess, aws.NewConfig(). diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index 30c847ae22..b84062332e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -1,7 +1,81 @@ -// Package stscreds are credential Providers to retrieve STS AWS credentials. -// -// STS provides multiple ways to retrieve credentials which can be used when making -// future AWS service API operation calls. +/* +Package stscreds are credential Providers to retrieve STS AWS credentials. + +STS provides multiple ways to retrieve credentials which can be used when making +future AWS service API operation calls. + +The SDK will ensure that per instance of credentials.Credentials all requests +to refresh the credentials will be synchronized. But, the SDK is unable to +ensure synchronous usage of the AssumeRoleProvider if the value is shared +between multiple Credentials, Sessions or service clients. + +Assume Role + +To assume an IAM role using STS with the SDK you can create a new Credentials +with the SDKs's stscreds package. + + // Initial credentials loaded from SDK's default credential chain. Such as + // the environment, shared credentials (~/.aws/credentials), or EC2 Instance + // Role. These credentials will be used to to make the STS Assume Role API. + sess := session.Must(session.NewSession()) + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN. + creds := stscreds.NewCredentials(sess, "myRoleArn") + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +Assume Role with static MFA Token + +To assume an IAM role with a MFA token you can either specify a MFA token code +directly or provide a function to prompt the user each time the credentials +need to refresh the role's credentials. Specifying the TokenCode should be used +for short lived operations that will not need to be refreshed, and when you do +not want to have direct control over the user provides their MFA token. + +With TokenCode the AssumeRoleProvider will be not be able to refresh the role's +credentials. + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN using the MFA token code provided. + creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { + p.SerialNumber = aws.String("myTokenSerialNumber") + p.TokenCode = aws.String("00000000") + }) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +Assume Role with MFA Token Provider + +To assume an IAM role with MFA for longer running tasks where the credentials +may need to be refreshed setting the TokenProvider field of AssumeRoleProvider +will allow the credential provider to prompt for new MFA token code when the +role's credentials need to be refreshed. + +The StdinTokenProvider function is available to prompt on stdin to retrieve +the MFA token code from the user. You can also implement custom prompts by +satisfing the TokenProvider function signature. + +Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will +have undesirable results as the StdinTokenProvider will not be synchronized. A +single Credentials with an AssumeRoleProvider can be shared safely. + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN. Prompting for MFA token from stdin. + creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { + p.SerialNumber = aws.String("myTokenSerialNumber") + p.TokenProvider = stscreds.StdinTokenProvider + }) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +*/ package stscreds import ( @@ -9,11 +83,31 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/service/sts" ) +// StdinTokenProvider will prompt on stdout and read from stdin for a string value. +// An error is returned if reading from stdin fails. +// +// Use this function go read MFA tokens from stdin. The function makes no attempt +// to make atomic prompts from stdin across multiple gorouties. +// +// Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will +// have undesirable results as the StdinTokenProvider will not be synchronized. A +// single Credentials with an AssumeRoleProvider can be shared safely +// +// Will wait forever until something is provided on the stdin. +func StdinTokenProvider() (string, error) { + var v string + fmt.Printf("Assume Role MFA token code: ") + _, err := fmt.Scanln(&v) + + return v, err +} + // ProviderName provides a name of AssumeRole provider const ProviderName = "AssumeRoleProvider" @@ -27,8 +121,15 @@ type AssumeRoler interface { var DefaultDuration = time.Duration(15) * time.Minute // AssumeRoleProvider retrieves temporary credentials from the STS service, and -// keeps track of their expiration time. This provider must be used explicitly, -// as it is not included in the credentials chain. +// keeps track of their expiration time. +// +// This credential provider will be used by the SDKs default credential change +// when shared configuration is enabled, and the shared config or shared credentials +// file configure assume role. See Session docs for how to do this. +// +// AssumeRoleProvider does not provide any synchronization and it is not safe +// to share this value across multiple Credentials, Sessions, or service clients +// without also sharing the same Credentials instance. type AssumeRoleProvider struct { credentials.Expiry @@ -65,8 +166,23 @@ type AssumeRoleProvider struct { // assumed requires MFA (that is, if the policy includes a condition that tests // for MFA). If the role being assumed requires MFA and if the TokenCode value // is missing or expired, the AssumeRole call returns an "access denied" error. + // + // If SerialNumber is set and neither TokenCode nor TokenProvider are also + // set an error will be returned. TokenCode *string + // Async method of providing MFA token code for assuming an IAM role with MFA. + // The value returned by the function will be used as the TokenCode in the Retrieve + // call. See StdinTokenProvider for a provider that prompts and reads from stdin. + // + // This token provider will be called when ever the assumed role's + // credentials need to be refreshed when SerialNumber is also set and + // TokenCode is not set. + // + // If both TokenCode and TokenProvider is set, TokenProvider will be used and + // TokenCode is ignored. + TokenProvider func() (string, error) + // ExpiryWindow will allow the credentials to trigger refreshing prior to // the credentials actually expiring. This is beneficial so race conditions // with expiring credentials do not cause request to fail unexpectedly @@ -85,6 +201,10 @@ type AssumeRoleProvider struct { // // Takes a Config provider to create the STS client. The ConfigProvider is // satisfied by the session.Session type. +// +// It is safe to share the returned Credentials with multiple Sessions and +// service clients. All access to the credentials and refreshing them +// will be synchronized. func NewCredentials(c client.ConfigProvider, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { p := &AssumeRoleProvider{ Client: sts.New(c), @@ -103,7 +223,11 @@ func NewCredentials(c client.ConfigProvider, roleARN string, options ...func(*As // AssumeRoleProvider. The credentials will expire every 15 minutes and the // role will be named after a nanosecond timestamp of this operation. // -// Takes an AssumeRoler which can be satisfiede by the STS client. +// Takes an AssumeRoler which can be satisfied by the STS client. +// +// It is safe to share the returned Credentials with multiple Sessions and +// service clients. All access to the credentials and refreshing them +// will be synchronized. func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { p := &AssumeRoleProvider{ Client: svc, @@ -139,12 +263,25 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { if p.Policy != nil { input.Policy = p.Policy } - if p.SerialNumber != nil && p.TokenCode != nil { - input.SerialNumber = p.SerialNumber - input.TokenCode = p.TokenCode + if p.SerialNumber != nil { + if p.TokenCode != nil { + input.SerialNumber = p.SerialNumber + input.TokenCode = p.TokenCode + } else if p.TokenProvider != nil { + input.SerialNumber = p.SerialNumber + code, err := p.TokenProvider() + if err != nil { + return credentials.Value{ProviderName: ProviderName}, err + } + input.TokenCode = aws.String(code) + } else { + return credentials.Value{ProviderName: ProviderName}, + awserr.New("AssumeRoleTokenNotAvailable", + "assume role with MFA enabled, but neither TokenCode nor TokenProvider are set", nil) + } } - roleOutput, err := p.Client.AssumeRole(input) + roleOutput, err := p.Client.AssumeRole(input) if err != nil { return credentials.Value{ProviderName: ProviderName}, err } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go index d3dc8404ed..9975e320ce 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -45,16 +45,16 @@ region, and profile loaded from the environment and shared config automatically. Requires the AWS_PROFILE to be set, or "default" is used. // Create Session - sess, err := session.NewSession() + sess := session.Must(session.NewSession()) // Create a Session with a custom region - sess, err := session.NewSession(&aws.Config{Region: aws.String("us-east-1")}) + sess := session.Must(session.NewSession(&aws.Config{ + Region: aws.String("us-east-1"), + })) // Create a S3 client instance from a session - sess, err := session.NewSession() - if err != nil { - // Handle Session creation error - } + sess := session.Must(session.NewSession()) + svc := s3.New(sess) Create Session With Option Overrides @@ -67,23 +67,25 @@ Use NewSessionWithOptions when you want to provide the config profile, or override the shared config state (AWS_SDK_LOAD_CONFIG). // Equivalent to session.NewSession() - sess, err := session.NewSessionWithOptions(session.Options{}) + sess := session.Must(session.NewSessionWithOptions(session.Options{ + // Options + })) // Specify profile to load for the session's config - sess, err := session.NewSessionWithOptions(session.Options{ + sess := session.Must(session.NewSessionWithOptions(session.Options{ Profile: "profile_name", - }) + })) // Specify profile for config and region for requests - sess, err := session.NewSessionWithOptions(session.Options{ + sess := session.Must(session.NewSessionWithOptions(session.Options{ Config: aws.Config{Region: aws.String("us-east-1")}, Profile: "profile_name", - }) + })) // Force enable Shared Config support - sess, err := session.NewSessionWithOptions(session.Options{ + sess := session.Must(session.NewSessionWithOptions(session.Options{ SharedConfigState: SharedConfigEnable, - }) + })) Adding Handlers @@ -93,7 +95,8 @@ handler logs every request and its payload made by a service client: // Create a session, and add additional handlers for all service // clients created with the Session to inherit. Adds logging handler. - sess, err := session.NewSession() + sess := session.Must(session.NewSession()) + sess.Handlers.Send.PushFront(func(r *request.Request) { // Log every request made and its payload logger.Println("Request: %s/%s, Payload: %s", @@ -138,15 +141,14 @@ the other two fields are also provided. Assume Role values allow you to configure the SDK to assume an IAM role using a set of credentials provided in a config file via the source_profile field. -Both "role_arn" and "source_profile" are required. The SDK does not support -assuming a role with MFA token Via the Session's constructor. You can use the -stscreds.AssumeRoleProvider credentials provider to specify custom -configuration and support for MFA. +Both "role_arn" and "source_profile" are required. The SDK supports assuming +a role with MFA token if the session option AssumeRoleTokenProvider +is set. role_arn = arn:aws:iam:::role/ source_profile = profile_with_creds external_id = 1234 - mfa_serial = not supported! + mfa_serial = role_session_name = session_name Region is the region the SDK should use for looking up AWS service endpoints @@ -154,6 +156,37 @@ and signing requests. region = us-east-1 +Assume Role with MFA token + +To create a session with support for assuming an IAM role with MFA set the +session option AssumeRoleTokenProvider to a function that will prompt for the +MFA token code when the SDK assumes the role and refreshes the role's credentials. +This allows you to configure the SDK via the shared config to assumea role +with MFA tokens. + +In order for the SDK to assume a role with MFA the SharedConfigState +session option must be set to SharedConfigEnable, or AWS_SDK_LOAD_CONFIG +environment variable set. + +The shared configuration instructs the SDK to assume an IAM role with MFA +when the mfa_serial configuration field is set in the shared config +(~/.aws/config) or shared credentials (~/.aws/credentials) file. + +If mfa_serial is set in the configuration, the SDK will assume the role, and +the AssumeRoleTokenProvider session option is not set an an error will +be returned when creating the session. + + sess := session.Must(session.NewSessionWithOptions(session.Options{ + AssumeRoleTokenProvider: stscreds.StdinTokenProvider, + })) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess) + +To setup assume role outside of a session see the stscrds.AssumeRoleProvider +documentation. + Environment Variables When a Session is created several environment variables can be set to adjust diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 3d52fc20d7..42ab3632e2 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -52,7 +52,7 @@ func New(cfgs ...*aws.Config) *Session { envCfg := loadEnvConfig() if envCfg.EnableSharedConfig { - s, err := newSession(envCfg, cfgs...) + s, err := newSession(Options{}, envCfg, cfgs...) if err != nil { // Old session.New expected all errors to be discovered when // a request is made, and would report the errors then. This @@ -73,7 +73,7 @@ func New(cfgs ...*aws.Config) *Session { return s } - return oldNewSession(cfgs...) + return deprecatedNewSession(cfgs...) } // NewSession returns a new Session created from SDK defaults, config files, @@ -94,7 +94,7 @@ func New(cfgs ...*aws.Config) *Session { func NewSession(cfgs ...*aws.Config) (*Session, error) { envCfg := loadEnvConfig() - return newSession(envCfg, cfgs...) + return newSession(Options{}, envCfg, cfgs...) } // SharedConfigState provides the ability to optionally override the state @@ -147,6 +147,26 @@ type Options struct { // will allow you to override the AWS_SDK_LOAD_CONFIG environment variable // and enable or disable the shared config functionality. SharedConfigState SharedConfigState + + // When the SDK's shared config is configured to assume a role with MFA + // this option is required in order to provide the mechanism that will + // retrieve the MFA token. There is no default value for this field. If + // it is not set an error will be returned when creating the session. + // + // This token provider will be called when ever the assumed role's + // credentials need to be refreshed. Within the context of service clients + // all sharing the same session the SDK will ensure calls to the token + // provider are atomic. When sharing a token provider across multiple + // sessions additional synchronization logic is needed to ensure the + // token providers do not introduce race conditions. It is recommend to + // share the session where possible. + // + // stscreds.StdinTokenProvider is a basic implementation that will prompt + // from stdin for the MFA token code. + // + // This field is only used if the shared configuration is enabled, and + // the config enables assume role wit MFA via the mfa_serial field. + AssumeRoleTokenProvider func() (string, error) } // NewSessionWithOptions returns a new Session created from SDK defaults, config files, @@ -161,23 +181,23 @@ type Options struct { // to be built with retrieving credentials with AssumeRole set in the config. // // // Equivalent to session.New -// sess, err := session.NewSessionWithOptions(session.Options{}) +// sess := session.Must(session.NewSessionWithOptions(session.Options{})) // // // Specify profile to load for the session's config -// sess, err := session.NewSessionWithOptions(session.Options{ +// sess := session.Must(session.NewSessionWithOptions(session.Options{ // Profile: "profile_name", -// }) +// })) // // // Specify profile for config and region for requests -// sess, err := session.NewSessionWithOptions(session.Options{ +// sess := session.Must(session.NewSessionWithOptions(session.Options{ // Config: aws.Config{Region: aws.String("us-east-1")}, // Profile: "profile_name", -// }) +// })) // // // Force enable Shared Config support -// sess, err := session.NewSessionWithOptions(session.Options{ +// sess := session.Must(session.NewSessionWithOptions(session.Options{ // SharedConfigState: SharedConfigEnable, -// }) +// })) func NewSessionWithOptions(opts Options) (*Session, error) { var envCfg envConfig if opts.SharedConfigState == SharedConfigEnable { @@ -197,7 +217,7 @@ func NewSessionWithOptions(opts Options) (*Session, error) { envCfg.EnableSharedConfig = true } - return newSession(envCfg, &opts.Config) + return newSession(opts, envCfg, &opts.Config) } // Must is a helper function to ensure the Session is valid and there was no @@ -215,7 +235,7 @@ func Must(sess *Session, err error) *Session { return sess } -func oldNewSession(cfgs ...*aws.Config) *Session { +func deprecatedNewSession(cfgs ...*aws.Config) *Session { cfg := defaults.Config() handlers := defaults.Handlers() @@ -242,7 +262,7 @@ func oldNewSession(cfgs ...*aws.Config) *Session { return s } -func newSession(envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { +func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { cfg := defaults.Config() handlers := defaults.Handlers() @@ -266,7 +286,9 @@ func newSession(envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { return nil, err } - mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers) + if err := mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers, opts); err != nil { + return nil, err + } s := &Session{ Config: cfg, @@ -278,7 +300,7 @@ func newSession(envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { return s, nil } -func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers) { +func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers, sessOpts Options) error { // Merge in user provided configuration cfg.MergeIn(userCfg) @@ -302,6 +324,11 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg share cfgCp.Credentials = credentials.NewStaticCredentialsFromCreds( sharedCfg.AssumeRoleSource.Creds, ) + if len(sharedCfg.AssumeRole.MFASerial) > 0 && sessOpts.AssumeRoleTokenProvider == nil { + // AssumeRole Token provider is required if doing Assume Role + // with MFA. + return AssumeRoleTokenProviderNotSetError{} + } cfg.Credentials = stscreds.NewCredentials( &Session{ Config: &cfgCp, @@ -311,11 +338,16 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg share func(opt *stscreds.AssumeRoleProvider) { opt.RoleSessionName = sharedCfg.AssumeRole.RoleSessionName + // Assume role with external ID if len(sharedCfg.AssumeRole.ExternalID) > 0 { opt.ExternalID = aws.String(sharedCfg.AssumeRole.ExternalID) } - // MFA not supported + // Assume role with MFA + if len(sharedCfg.AssumeRole.MFASerial) > 0 { + opt.SerialNumber = aws.String(sharedCfg.AssumeRole.MFASerial) + opt.TokenProvider = sessOpts.AssumeRoleTokenProvider + } }, ) } else if len(sharedCfg.Creds.AccessKeyID) > 0 { @@ -336,6 +368,33 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg share }) } } + + return nil +} + +// AssumeRoleTokenProviderNotSetError is an error returned when creating a session when the +// MFAToken option is not set when shared config is configured load assume a +// role with an MFA token. +type AssumeRoleTokenProviderNotSetError struct{} + +// Code is the short id of the error. +func (e AssumeRoleTokenProviderNotSetError) Code() string { + return "AssumeRoleTokenProviderNotSetError" +} + +// Message is the description of the error +func (e AssumeRoleTokenProviderNotSetError) Message() string { + return fmt.Sprintf("assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.") +} + +// OrigErr is the underlying error that caused the failure. +func (e AssumeRoleTokenProviderNotSetError) OrigErr() error { + return nil +} + +// Error satisfies the error interface. +func (e AssumeRoleTokenProviderNotSetError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", nil) } type credProviderError struct { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 2eb30f030d..f9ea9c394b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.6.24" +const SDKVersion = "1.7.0" diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go index b603b58401..03fd912645 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go @@ -31,11 +31,7 @@ // // Marshal Go value type for DynamoDB.PutItem: // -// sess, err := session.NewSession() -// if err != nil { -// fmt.Println("Failed create session", err) -// return -// } +// sess := session.Must(session.NewSession()) // // svc := dynamodb.New(sess) // item, err := dynamodbattribute.MarshalMap(r) diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go index cb4ded4bce..83191e2d7c 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -9921,7 +9921,7 @@ func (c *EC2) DescribeVolumesModificationsRequest(input *DescribeVolumesModifica // // You can also use CloudWatch Events to check the status of a modification // to an EBS volume. For information about CloudWatch Events, see the Amazon -// CloudWatch Events User Guide (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html). +// CloudWatch Events User Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/). // For more information, see Monitoring Volume Modifications" (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -13080,30 +13080,29 @@ func (c *EC2) ModifyVolumeRequest(input *ModifyVolumeInput) (req *request.Reques // without stopping the instance or detaching the volume from it. For more information // about modifying an EBS volume running Linux, see Modifying the Size, IOPS, // or Type of an EBS Volume on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html). -// For more information about modifying an EBS volume running Windows, see Expanding -// the Storage Space of an EBS Volume on Windows (http://docs.aws.amazon.com/docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). +// For more information about modifying an EBS volume running Windows, see Modifying +// the Size, IOPS, or Type of an EBS Volume on Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). // // When you complete a resize operation on your volume, you need to extend the // volume's file-system size to take advantage of the new storage capacity. // For information about extending a Linux file system, see Extending a Linux // File System (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#recognize-expanded-volume-linux). // For information about extending a Windows file system, see Extending a Windows -// File System (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html#recognize-expanded-volume-windows). +// File System (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html#recognize-expanded-volume-windows). // // You can use CloudWatch Events to check the status of a modification to an // EBS volume. For information about CloudWatch Events, see the Amazon CloudWatch -// Events User Guide (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html). +// Events User Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/). // You can also track the status of a modification using the DescribeVolumesModifications -// (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVolumesModifications.html) // API. For information about tracking status changes using either method, see -// Monitoring Volume Modifications" (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods). +// Monitoring Volume Modifications (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods). // -// With previous-generation volumes and instance types, resizing an EBS volume -// may require detaching and reattaching the volume or stopping and restarting -// the instance. For more information about modifying an EBS volume running -// Linux, see Modifying the Size, IOPS, or Type of an EBS Volume on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html). +// With previous-generation instance types, resizing an EBS volume may require +// detaching and reattaching the volume or stopping and restarting the instance. +// For more information about modifying an EBS volume running Linux, see Modifying +// the Size, IOPS, or Type of an EBS Volume on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html). // For more information about modifying an EBS volume running Windows, see Modifying -// the Size, IOPS, or Type of an EBS Volume on Windows (http://docs.aws.amazon.com/docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). +// the Size, IOPS, or Type of an EBS Volume on Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). // // If you reach the maximum volume modification rate per volume limit, you will // need to wait at least six hours before applying further modifications to @@ -13854,31 +13853,27 @@ func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Requ // in a single request, so you don't have to register the AMI yourself. // // You can also use RegisterImage to create an Amazon EBS-backed Linux AMI from -// a snapshot of a root device volume. For more information, see Launching an -// Instance from a Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_LaunchingInstanceFromSnapshot.html) +// a snapshot of a root device volume. You specify the snapshot using the block +// device mapping. For more information, see Launching an Instance from a Snapshot +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_LaunchingInstanceFromSnapshot.html) // in the Amazon Elastic Compute Cloud User Guide. // +// You can't register an image where a secondary (non-root) snapshot has AWS +// Marketplace product codes. +// // Some Linux distributions, such as Red Hat Enterprise Linux (RHEL) and SUSE -// Linux Enterprise Server (SLES), use the EC2 billingProduct code associated -// with an AMI to verify subscription status for package updates. Creating an -// AMI from an EBS snapshot does not maintain this billing code, and subsequent +// Linux Enterprise Server (SLES), use the EC2 billing product code associated +// with an AMI to verify the subscription status for package updates. Creating +// an AMI from an EBS snapshot does not maintain this billing code, and subsequent // instances launched from such an AMI will not be able to connect to package -// update infrastructure. -// -// Similarly, although you can create a Windows AMI from a snapshot, you can't -// successfully launch an instance from the AMI. -// -// To create Windows AMIs or to create AMIs for Linux operating systems that -// must retain AMI billing codes to work properly, see CreateImage. +// update infrastructure. To create an AMI that must retain billing codes, see +// CreateImage. // // If needed, you can deregister an AMI at any time. Any modifications you make // to an AMI backed by an instance store volume invalidates its registration. // If you make changes to an image, deregister the previous image and register // the new image. // -// You can't register an image where a secondary (non-root) snapshot has AWS -// Marketplace product codes. -// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -40467,6 +40462,8 @@ type ModifyVolumeInput struct { // Only valid for Provisioned IOPS SSD (io1) volumes. For more information about // io1 IOPS configuration, see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html#EBSVolumeTypes_piops // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html#EBSVolumeTypes_piops). + // + // Default: If no IOPS value is specified, the existing value is retained. Iops *int64 `type:"integer"` // Target size in GiB of the volume to be modified. Target volume size must @@ -40482,10 +40479,10 @@ type ModifyVolumeInput struct { // Target EBS volume type of the volume to be modified // - // Valid values are io1 | gp2 | sc1 | st1 - // // The API does not support modifications for volume type standard. You also // cannot change the type of a volume to standard. + // + // Default: If no type is specified, the existing type is retained. VolumeType *string `type:"string" enum:"VolumeType"` } @@ -43248,6 +43245,9 @@ type RegisterImageInput struct { // the architecture specified in the manifest file. Architecture *string `locationName:"architecture" type:"string" enum:"ArchitectureValues"` + // The billing product codes. + BillingProducts []*string `locationName:"BillingProduct" locationNameList:"item" type:"list"` + // One or more block device mapping entries. BlockDeviceMappings []*BlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` @@ -43333,6 +43333,12 @@ func (s *RegisterImageInput) SetArchitecture(v string) *RegisterImageInput { return s } +// SetBillingProducts sets the BillingProducts field's value. +func (s *RegisterImageInput) SetBillingProducts(v []*string) *RegisterImageInput { + s.BillingProducts = v + return s +} + // SetBlockDeviceMappings sets the BlockDeviceMappings field's value. func (s *RegisterImageInput) SetBlockDeviceMappings(v []*BlockDeviceMapping) *RegisterImageInput { s.BlockDeviceMappings = v @@ -51527,8 +51533,8 @@ type VolumeModification struct { // Modification completion or failure time. EndTime *time.Time `locationName:"endTime" type:"timestamp" timestampFormat:"iso8601"` - // Current state of modification. Possible values are modifying | optimizing - // | complete | failed. Modification state is null for unmodified volumes. + // Current state of modification. Modification state is null for unmodified + // volumes. ModificationState *string `locationName:"modificationState" type:"string" enum:"VolumeModificationState"` // Original IOPS rate of the volume being modified. @@ -53314,6 +53320,24 @@ const ( // InstanceTypeI28xlarge is a InstanceType enum value InstanceTypeI28xlarge = "i2.8xlarge" + // InstanceTypeI3Large is a InstanceType enum value + InstanceTypeI3Large = "i3.large" + + // InstanceTypeI3Xlarge is a InstanceType enum value + InstanceTypeI3Xlarge = "i3.xlarge" + + // InstanceTypeI32xlarge is a InstanceType enum value + InstanceTypeI32xlarge = "i3.2xlarge" + + // InstanceTypeI34xlarge is a InstanceType enum value + InstanceTypeI34xlarge = "i3.4xlarge" + + // InstanceTypeI38xlarge is a InstanceType enum value + InstanceTypeI38xlarge = "i3.8xlarge" + + // InstanceTypeI316xlarge is a InstanceType enum value + InstanceTypeI316xlarge = "i3.16xlarge" + // InstanceTypeHi14xlarge is a InstanceType enum value InstanceTypeHi14xlarge = "hi1.4xlarge" diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/api/api.go b/vendor/github.com/circonus-labs/circonus-gometrics/api/api.go index e02be8d9b9..b9265aa7e6 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/api/api.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/api/api.go @@ -251,7 +251,7 @@ func (a *API) apiCall(reqMethod string, reqPath string, data []byte) ([]byte, er reqURL += "/" } if len(reqPath) >= 3 && reqPath[:3] == "/v2" { - reqURL += reqPath[3:len(reqPath)] + reqURL += reqPath[3:] } else { reqURL += reqPath } diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/api/dashboard-example.json b/vendor/github.com/circonus-labs/circonus-gometrics/api/dashboard-example.json deleted file mode 100644 index 627639e740..0000000000 --- a/vendor/github.com/circonus-labs/circonus-gometrics/api/dashboard-example.json +++ /dev/null @@ -1,390 +0,0 @@ -{ - "_active": true, - "_cid": "/dashboard/1234", - "_created": 1483193930, - "_created_by": "/user/1234", - "_dashboard_uuid": "01234567-89ab-cdef-0123-456789abcdef", - "_last_modified": 1483450351, - "account_default": false, - "grid_layout": { - "height": 4, - "width": 4 - }, - "options": { - "access_configs": [ - ], - "fullscreen_hide_title": false, - "hide_grid": false, - "linkages": [ - ], - "scale_text": true, - "text_size": 16 - }, - "shared": false, - "title": "foo bar baz", - "widgets": [ - { - "active": true, - "height": 1, - "name": "Cluster", - "origin": "d0", - "settings": { - "account_id": "1234", - "algorithm": "cor", - "cluster_id": 1234, - "cluster_name": "test", - "layout": "compact", - "size": "medium", - "threshold": 0.7 - }, - "type": "cluster", - "widget_id": "w4", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "HTML", - "origin": "d1", - "settings": { - "markup": "

foo

", - "title": "html" - }, - "type": "html", - "widget_id": "w9", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Chart", - "origin": "c0", - "settings": { - "chart_type": "bar", - "datapoints": [ - { - "_check_id": 1234, - "_metric_type": "numeric", - "account_id": "1234", - "label": "Used", - "metric": "01234567-89ab-cdef-0123-456789abcdef:vm`memory`used" - }, - { - "_check_id": 1234, - "_metric_type": "numeric", - "account_id": "1234", - "label": "Free", - "metric": "01234567-89ab-cdef-0123-456789abcdef:vm`memory`free" - } - ], - "definition": { - "datasource": "realtime", - "derive": "gauge", - "disable_autoformat": false, - "formula": "", - "legend": { - "show": false, - "type": "html" - }, - "period": 0, - "pop_onhover": false, - "wedge_labels": { - "on_chart": true, - "tooltips": false - }, - "wedge_values": { - "angle": "0", - "color": "background", - "show": true - } - }, - "title": "chart graph" - }, - "type": "chart", - "widget_id": "w5", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Alerts", - "origin": "a0", - "settings": { - "account_id": "1234", - "acknowledged": "all", - "cleared": "all", - "contact_groups": [ - ], - "dependents": "all", - "display": "list", - "maintenance": "all", - "min_age": "0", - "off_hours": [ - 17, - 9 - ], - "search": "", - "severity": "12345", - "tag_filter_set": [ - ], - "time_window": "30M", - "title": "alerts", - "week_days": [ - "sun", - "mon", - "tue", - "wed", - "thu", - "fri", - "sat" - ] - }, - "type": "alerts", - "widget_id": "w2", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Graph", - "origin": "c1", - "settings": { - "_graph_title": "foo bar / %Used", - "account_id": "1234", - "date_window": "2w", - "graph_id": "01234567-89ab-cdef-0123-456789abcdef", - "hide_xaxis": false, - "hide_yaxis": false, - "key_inline": false, - "key_loc": "noop", - "key_size": "1", - "key_wrap": false, - "label": "", - "overlay_set_id": "", - "period": "2000", - "previous_graph_id": "null", - "realtime": false, - "show_flags": false - }, - "type": "graph", - "widget_id": "w8", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "List", - "origin": "a2", - "settings": { - "account_id": "1234", - "limit": "10", - "search": "", - "type": "graph" - }, - "type": "list", - "widget_id": "w10", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Status", - "origin": "b2", - "settings": { - "account_id": "1234", - "agent_status_settings": { - "search": "", - "show_agent_types": "both", - "show_contact": false, - "show_feeds": true, - "show_setup": false, - "show_skew": true, - "show_updates": true - }, - "content_type": "agent_status", - "host_status_settings": { - "layout_style": "grid", - "search": "", - "sort_by": "alerts", - "tag_filter_set": [ - ] - } - }, - "type": "status", - "widget_id": "w11", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Text", - "origin": "d2", - "settings": { - "autoformat": false, - "body_format": "

{metric_name} ({value_type})
{metric_value}
{value_date}

", - "datapoints": [ - { - "_cluster_title": "test", - "_label": "Cluster: test", - "account_id": "1234", - "cluster_id": 1234, - "numeric_only": false - } - ], - "period": 0, - "title_format": "Metric Status", - "use_default": true, - "value_type": "gauge" - }, - "type": "text", - "widget_id": "w13", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Chart", - "origin": "b0", - "settings": { - "chart_type": "bar", - "datapoints": [ - { - "_cluster_title": "test", - "_label": "Cluster: test", - "account_id": "1234", - "cluster_id": 1234, - "numeric_only": true - } - ], - "definition": { - "datasource": "realtime", - "derive": "gauge", - "disable_autoformat": false, - "formula": "", - "legend": { - "show": false, - "type": "html" - }, - "period": 0, - "pop_onhover": false, - "wedge_labels": { - "on_chart": true, - "tooltips": false - }, - "wedge_values": { - "angle": "0", - "color": "background", - "show": true - } - }, - "title": "chart metric cluster" - }, - "type": "chart", - "widget_id": "w3", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Gauge", - "origin": "b1", - "settings": { - "_check_id": 1234, - "account_id": "1234", - "check_uuid": "01234567-89ab-cdef-0123-456789abcdef", - "disable_autoformat": false, - "formula": "", - "metric_display_name": "%Used", - "metric_name": "fs`/foo`df_used_percent", - "period": 0, - "range_high": 100, - "range_low": 0, - "thresholds": { - "colors": [ - "#008000", - "#ffcc00", - "#ee0000" - ], - "flip": false, - "values": [ - "75%", - "87.5%" - ] - }, - "title": "Metric Gauge", - "type": "bar", - "value_type": "gauge" - }, - "type": "gauge", - "widget_id": "w7", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Text", - "origin": "c2", - "settings": { - "autoformat": false, - "body_format": "

{metric_name} ({value_type})
{metric_value}
{value_date}

", - "datapoints": [ - { - "_check_id": 1234, - "_metric_type": "numeric", - "account_id": "1234", - "label": "cache entries", - "metric": "01234567-89ab-cdef-0123-456789abcdef:foo`cache_entries" - }, - { - "_check_id": 1234, - "_metric_type": "numeric", - "account_id": "1234", - "label": "cache capacity", - "metric": "01234567-89ab-cdef-0123-456789abcdef:foo`cache_capacity" - }, - { - "_check_id": 1234, - "_metric_type": "numeric", - "account_id": "1234", - "label": "cache size", - "metric": "01234567-89ab-cdef-0123-456789abcdef:foo`cache_size" - } - ], - "period": 0, - "title_format": "Metric Status", - "use_default": true, - "value_type": "gauge" - }, - "type": "text", - "widget_id": "w12", - "width": 1 - }, - { - "active": true, - "height": 1, - "name": "Forecast", - "origin": "a1", - "settings": { - "format": "standard", - "resource_limit": "0", - "resource_usage": "metric:average(\"01234567-89ab-cdef-0123-456789abcdef\",p\"fs%60/foo%60df_used_percent\")", - "thresholds": { - "colors": [ - "#008000", - "#ffcc00", - "#ee0000" - ], - "values": [ - "1d", - "1h" - ] - }, - "title": "Resource Forecast", - "trend": "auto" - }, - "type": "forecast", - "widget_id": "w6", - "width": 1 - } - ] -} diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/api/dashboard.go b/vendor/github.com/circonus-labs/circonus-gometrics/api/dashboard.go index 5bca0a3cde..b219873874 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/api/dashboard.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/api/dashboard.go @@ -144,11 +144,11 @@ type DashboardWidgetSettings struct { HostStatusSettings StatusWidgetHostStatusSettings `json:"host_status_settings,omitempty"` // status KeyInline bool `json:"key_inline,omitempty"` // graphs KeyLoc string `json:"key_loc,omitempty"` // graphs - KeySize string `json:"key_size,omitempty"` // graphs + KeySize uint `json:"key_size,omitempty"` // graphs KeyWrap bool `json:"key_wrap,omitempty"` // graphs Label string `json:"label,omitempty"` // graphs Layout string `json:"layout,omitempty"` // clusters - Limit string `json:"limit,omitempty"` // lists + Limit uint `json:"limit,omitempty"` // lists Maintenance string `json:"maintenance,omitempty"` // alerts Markup string `json:"markup,omitempty"` // html MetricDisplayName string `json:"metric_display_name,omitempty"` // gauges @@ -156,7 +156,7 @@ type DashboardWidgetSettings struct { MinAge string `json:"min_age,omitempty"` // alerts OffHours []uint `json:"off_hours,omitempty"` // alerts OverlaySetID string `json:"overlay_set_id,omitempty"` // graphs - Period interface{} `json:"period,omitempty"` // BUG type switching between widgets (doc: string; gauges, text: uint; graphs: string) + Period uint `json:"period,omitempty"` // gauges, text, graphs RangeHigh int `json:"range_high,omitempty"` // gauges RangeLow int `json:"range_low,omitempty"` // gauges Realtime bool `json:"realtime,omitempty"` // graphs diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/api/metric.go b/vendor/github.com/circonus-labs/circonus-gometrics/api/metric.go index a77d41ce5b..3608b06ff9 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/api/metric.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/api/metric.go @@ -26,7 +26,7 @@ type Metric struct { CheckTags []string `json:"_check_tags,omitempty"` // [] len >= 0 CheckUUID string `json:"_check_uuid,omitempty"` // string CID string `json:"_cid,omitempty"` // string - Histogram bool `json:"_histogram,omitempty"` // boolean + Histogram string `json:"_histogram,omitempty"` // string Link *string `json:"link,omitempty"` // string or null MetricName string `json:"_metric_name,omitempty"` // string MetricType string `json:"_metric_type,omitempty"` // string diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/cert.go b/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/cert.go index 01f65917f8..cbe3ba7068 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/cert.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/cert.go @@ -42,17 +42,22 @@ type CACert struct { } // loadCACert loads the CA cert for the broker designated by the submission url -func (cm *CheckManager) loadCACert() { +func (cm *CheckManager) loadCACert() error { if cm.certPool != nil { - return + return nil } cm.certPool = x509.NewCertPool() - cert, err := cm.fetchCert() - if err != nil { - if cm.Debug { - cm.Log.Printf("[DEBUG] Unable to fetch ca.crt, using default. %+v\n", err) + var cert []byte + var err error + + if cm.enabled { + // only attempt to retrieve broker CA cert if + // the check is being managed. + cert, err = cm.fetchCert() + if err != nil { + return err } } @@ -61,6 +66,8 @@ func (cm *CheckManager) loadCACert() { } cm.certPool.AppendCertsFromPEM(cert) + + return nil } // fetchCert fetches CA certificate using Circonus API diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/check.go b/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/check.go index fd31c6d256..1cf6065a17 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/check.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/check.go @@ -243,6 +243,18 @@ func (cm *CheckManager) initializeTrapURL() error { } cm.trapCN = BrokerCNType(cn) + if cm.enabled { + u, err := url.Parse(string(cm.trapURL)) + if err != nil { + return err + } + if u.Scheme == "https" { + if err := cm.loadCACert(); err != nil { + return err + } + } + } + cm.trapLastUpdate = time.Now() return nil diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/checkmgr.go b/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/checkmgr.go index f78da390f6..d3750bbc35 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/checkmgr.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/checkmgr/checkmgr.go @@ -385,7 +385,9 @@ func (cm *CheckManager) GetSubmissionURL() (*Trap, error) { if u.Scheme == "https" { if cm.certPool == nil { - cm.loadCACert() + if err := cm.loadCACert(); err != nil { + return nil, err + } } t := &tls.Config{ RootCAs: cm.certPool, diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/circonus-gometrics.go b/vendor/github.com/circonus-labs/circonus-gometrics/circonus-gometrics.go index 32cae5bb41..c27950cab7 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/circonus-gometrics.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/circonus-gometrics.go @@ -205,7 +205,7 @@ func New(cfg *Config) (*CirconusMetrics, error) { // note: submit will jettison metrics until initialization has completed. if cm.flushInterval > time.Duration(0) { go func() { - for _ = range time.NewTicker(cm.flushInterval).C { + for range time.NewTicker(cm.flushInterval).C { cm.Flush() } }() diff --git a/vendor/github.com/coreos/etcd/clientv3/README.md b/vendor/github.com/coreos/etcd/clientv3/README.md index 87c32d1a88..f135b9a7dc 100644 --- a/vendor/github.com/coreos/etcd/clientv3/README.md +++ b/vendor/github.com/coreos/etcd/clientv3/README.md @@ -32,7 +32,7 @@ pass `context.WithTimeout` to APIs: ```go ctx, cancel := context.WithTimeout(context.Background(), timeout) -resp, err := kvc.Put(ctx, "sample_key", "sample_value") +resp, err := cli.Put(ctx, "sample_key", "sample_value") cancel() if err != nil { // handle error! @@ -57,7 +57,7 @@ etcd client returns 2 types of errors: Here is the example code to handle client errors: ```go -resp, err := kvc.Put(ctx, "", "") +resp, err := cli.Put(ctx, "", "") if err != nil { switch err { case context.Canceled: diff --git a/vendor/github.com/coreos/etcd/clientv3/client.go b/vendor/github.com/coreos/etcd/clientv3/client.go index 3d36c3ab52..7cfb0b0eb4 100644 --- a/vendor/github.com/coreos/etcd/clientv3/client.go +++ b/vendor/github.com/coreos/etcd/clientv3/client.go @@ -20,6 +20,7 @@ import ( "fmt" "net" "net/url" + "strconv" "strings" "sync" "time" @@ -35,6 +36,7 @@ import ( var ( ErrNoAvailableEndpoints = errors.New("etcdclient: no available endpoints") + ErrOldCluster = errors.New("etcdclient: old cluster version") ) // Client provides and manages an etcd v3 client session. @@ -272,7 +274,7 @@ func (c *Client) dial(endpoint string, dopts ...grpc.DialOption) (*grpc.ClientCo tokenMu: &sync.RWMutex{}, } - err := c.getToken(context.TODO()) + err := c.getToken(c.ctx) if err != nil { return nil, err } @@ -307,7 +309,12 @@ func newClient(cfg *Config) (*Client, error) { } // use a temporary skeleton client to bootstrap first connection - ctx, cancel := context.WithCancel(context.TODO()) + baseCtx := context.TODO() + if cfg.Context != nil { + baseCtx = cfg.Context + } + + ctx, cancel := context.WithCancel(baseCtx) client := &Client{ conn: nil, cfg: *cfg, @@ -353,10 +360,57 @@ func newClient(cfg *Config) (*Client, error) { client.Auth = NewAuth(client) client.Maintenance = NewMaintenance(client) + if cfg.RejectOldCluster { + if err := client.checkVersion(); err != nil { + client.Close() + return nil, err + } + } + go client.autoSync() return client, nil } +func (c *Client) checkVersion() (err error) { + var wg sync.WaitGroup + errc := make(chan error, len(c.cfg.Endpoints)) + ctx, cancel := context.WithCancel(c.ctx) + if c.cfg.DialTimeout > 0 { + ctx, _ = context.WithTimeout(ctx, c.cfg.DialTimeout) + } + wg.Add(len(c.cfg.Endpoints)) + for _, ep := range c.cfg.Endpoints { + // if cluster is current, any endpoint gives a recent version + go func(e string) { + defer wg.Done() + resp, rerr := c.Status(ctx, e) + if rerr != nil { + errc <- rerr + return + } + vs := strings.Split(resp.Version, ".") + maj, min := 0, 0 + if len(vs) >= 2 { + maj, rerr = strconv.Atoi(vs[0]) + min, rerr = strconv.Atoi(vs[1]) + } + if maj < 3 || (maj == 3 && min < 2) { + rerr = ErrOldCluster + } + errc <- rerr + }(ep) + } + // wait for success + for i := 0; i < len(c.cfg.Endpoints); i++ { + if err = <-errc; err == nil { + break + } + } + cancel() + wg.Wait() + return err +} + // ActiveConnection returns the current in-use connection func (c *Client) ActiveConnection() *grpc.ClientConn { return c.conn } diff --git a/vendor/github.com/coreos/etcd/clientv3/config.go b/vendor/github.com/coreos/etcd/clientv3/config.go index 2082f7b91a..dda72a748e 100644 --- a/vendor/github.com/coreos/etcd/clientv3/config.go +++ b/vendor/github.com/coreos/etcd/clientv3/config.go @@ -18,6 +18,7 @@ import ( "crypto/tls" "time" + "golang.org/x/net/context" "google.golang.org/grpc" ) @@ -41,6 +42,13 @@ type Config struct { // Password is a password for authentication. Password string `json:"password"` + // RejectOldCluster when set will refuse to create a client against an outdated cluster. + RejectOldCluster bool `json:"reject-old-cluster"` + // DialOptions is a list of dial options for the grpc client (e.g., for interceptors). DialOptions []grpc.DialOption + + // Context is the default client context; it can be used to cancel grpc dial out and + // other operations that do not have an explicit context. + Context context.Context } diff --git a/vendor/github.com/coreos/etcd/clientv3/lease.go b/vendor/github.com/coreos/etcd/clientv3/lease.go index 6f70f6942a..900769386a 100644 --- a/vendor/github.com/coreos/etcd/clientv3/lease.go +++ b/vendor/github.com/coreos/etcd/clientv3/lease.go @@ -410,7 +410,7 @@ func (l *lessor) recvKeepAlive(resp *pb.LeaseKeepAliveResponse) { } // send update to all channels - nextKeepAlive := time.Now().Add(time.Duration(karesp.TTL+2) / 3 * time.Second) + nextKeepAlive := time.Now().Add((time.Duration(karesp.TTL) * time.Second) / 3.0) ka.deadline = time.Now().Add(time.Duration(karesp.TTL) * time.Second) for _, ch := range ka.chs { select { diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/dir_unix.go b/vendor/github.com/coreos/etcd/pkg/fileutil/dir_unix.go deleted file mode 100644 index 58a77dfc1a..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/dir_unix.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 fileutil - -import "os" - -// OpenDir opens a directory for syncing. -func OpenDir(path string) (*os.File, error) { return os.Open(path) } diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/dir_windows.go b/vendor/github.com/coreos/etcd/pkg/fileutil/dir_windows.go deleted file mode 100644 index c123395c00..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/dir_windows.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 fileutil - -import ( - "os" - "syscall" -) - -// OpenDir opens a directory in windows with write access for syncing. -func OpenDir(path string) (*os.File, error) { - fd, err := openDir(path) - if err != nil { - return nil, err - } - return os.NewFile(uintptr(fd), path), nil -} - -func openDir(path string) (fd syscall.Handle, err error) { - if len(path) == 0 { - return syscall.InvalidHandle, syscall.ERROR_FILE_NOT_FOUND - } - pathp, err := syscall.UTF16PtrFromString(path) - if err != nil { - return syscall.InvalidHandle, err - } - access := uint32(syscall.GENERIC_READ | syscall.GENERIC_WRITE) - sharemode := uint32(syscall.FILE_SHARE_READ | syscall.FILE_SHARE_WRITE) - createmode := uint32(syscall.OPEN_EXISTING) - fl := uint32(syscall.FILE_FLAG_BACKUP_SEMANTICS) - return syscall.CreateFile(pathp, access, sharemode, nil, createmode, fl, 0) -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/fileutil.go b/vendor/github.com/coreos/etcd/pkg/fileutil/fileutil.go deleted file mode 100644 index 9585ed5e0e..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/fileutil.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// 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 fileutil implements utility functions related to files and paths. -package fileutil - -import ( - "fmt" - "io/ioutil" - "os" - "path" - "sort" - - "github.com/coreos/pkg/capnslog" -) - -const ( - // PrivateFileMode grants owner to read/write a file. - PrivateFileMode = 0600 - // PrivateDirMode grants owner to make/remove files inside the directory. - PrivateDirMode = 0700 -) - -var ( - plog = capnslog.NewPackageLogger("github.com/coreos/etcd", "pkg/fileutil") -) - -// IsDirWriteable checks if dir is writable by writing and removing a file -// to dir. It returns nil if dir is writable. -func IsDirWriteable(dir string) error { - f := path.Join(dir, ".touch") - if err := ioutil.WriteFile(f, []byte(""), PrivateFileMode); err != nil { - return err - } - return os.Remove(f) -} - -// ReadDir returns the filenames in the given directory in sorted order. -func ReadDir(dirpath string) ([]string, error) { - dir, err := os.Open(dirpath) - if err != nil { - return nil, err - } - defer dir.Close() - names, err := dir.Readdirnames(-1) - if err != nil { - return nil, err - } - sort.Strings(names) - return names, nil -} - -// TouchDirAll is similar to os.MkdirAll. It creates directories with 0700 permission if any directory -// does not exists. TouchDirAll also ensures the given directory is writable. -func TouchDirAll(dir string) error { - // If path is already a directory, MkdirAll does nothing - // and returns nil. - err := os.MkdirAll(dir, PrivateDirMode) - if err != nil { - // if mkdirAll("a/text") and "text" is not - // a directory, this will return syscall.ENOTDIR - return err - } - return IsDirWriteable(dir) -} - -// CreateDirAll is similar to TouchDirAll but returns error -// if the deepest directory was not empty. -func CreateDirAll(dir string) error { - err := TouchDirAll(dir) - if err == nil { - var ns []string - ns, err = ReadDir(dir) - if err != nil { - return err - } - if len(ns) != 0 { - err = fmt.Errorf("expected %q to be empty, got %q", dir, ns) - } - } - return err -} - -func Exist(name string) bool { - _, err := os.Stat(name) - return err == nil -} - -// ZeroToEnd zeros a file starting from SEEK_CUR to its SEEK_END. May temporarily -// shorten the length of the file. -func ZeroToEnd(f *os.File) error { - // TODO: support FALLOC_FL_ZERO_RANGE - off, err := f.Seek(0, os.SEEK_CUR) - if err != nil { - return err - } - lenf, lerr := f.Seek(0, os.SEEK_END) - if lerr != nil { - return lerr - } - if err = f.Truncate(off); err != nil { - return err - } - // make sure blocks remain allocated - if err = Preallocate(f, lenf, true); err != nil { - return err - } - _, err = f.Seek(off, os.SEEK_SET) - return err -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/lock.go b/vendor/github.com/coreos/etcd/pkg/fileutil/lock.go deleted file mode 100644 index 338627f43c..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/lock.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 fileutil - -import ( - "errors" - "os" -) - -var ( - ErrLocked = errors.New("fileutil: file already locked") -) - -type LockedFile struct{ *os.File } diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_flock.go b/vendor/github.com/coreos/etcd/pkg/fileutil/lock_flock.go deleted file mode 100644 index 542550bc8a..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_flock.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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,!plan9,!solaris - -package fileutil - -import ( - "os" - "syscall" -) - -func flockTryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - f, err := os.OpenFile(path, flag, perm) - if err != nil { - return nil, err - } - if err = syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB); err != nil { - f.Close() - if err == syscall.EWOULDBLOCK { - err = ErrLocked - } - return nil, err - } - return &LockedFile{f}, nil -} - -func flockLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - f, err := os.OpenFile(path, flag, perm) - if err != nil { - return nil, err - } - if err = syscall.Flock(int(f.Fd()), syscall.LOCK_EX); err != nil { - f.Close() - return nil, err - } - return &LockedFile{f}, err -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_linux.go b/vendor/github.com/coreos/etcd/pkg/fileutil/lock_linux.go deleted file mode 100644 index dec25a1af4..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_linux.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 linux - -package fileutil - -import ( - "os" - "syscall" -) - -// This used to call syscall.Flock() but that call fails with EBADF on NFS. -// An alternative is lockf() which works on NFS but that call lets a process lock -// the same file twice. Instead, use Linux's non-standard open file descriptor -// locks which will block if the process already holds the file lock. -// -// constants from /usr/include/bits/fcntl-linux.h -const ( - F_OFD_GETLK = 37 - F_OFD_SETLK = 37 - F_OFD_SETLKW = 38 -) - -var ( - wrlck = syscall.Flock_t{ - Type: syscall.F_WRLCK, - Whence: int16(os.SEEK_SET), - Start: 0, - Len: 0, - } - - linuxTryLockFile = flockTryLockFile - linuxLockFile = flockLockFile -) - -func init() { - // use open file descriptor locks if the system supports it - getlk := syscall.Flock_t{Type: syscall.F_RDLCK} - if err := syscall.FcntlFlock(0, F_OFD_GETLK, &getlk); err == nil { - linuxTryLockFile = ofdTryLockFile - linuxLockFile = ofdLockFile - } -} - -func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - return linuxTryLockFile(path, flag, perm) -} - -func ofdTryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - f, err := os.OpenFile(path, flag, perm) - if err != nil { - return nil, err - } - - flock := wrlck - if err = syscall.FcntlFlock(f.Fd(), F_OFD_SETLK, &flock); err != nil { - f.Close() - if err == syscall.EWOULDBLOCK { - err = ErrLocked - } - return nil, err - } - return &LockedFile{f}, nil -} - -func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - return linuxLockFile(path, flag, perm) -} - -func ofdLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - f, err := os.OpenFile(path, flag, perm) - if err != nil { - return nil, err - } - - flock := wrlck - err = syscall.FcntlFlock(f.Fd(), F_OFD_SETLKW, &flock) - - if err != nil { - f.Close() - return nil, err - } - return &LockedFile{f}, err -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_plan9.go b/vendor/github.com/coreos/etcd/pkg/fileutil/lock_plan9.go deleted file mode 100644 index fee6a7c8f4..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_plan9.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// 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 fileutil - -import ( - "os" - "syscall" - "time" -) - -func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - if err := os.Chmod(path, syscall.DMEXCL|PrivateFileMode); err != nil { - return nil, err - } - f, err := os.Open(path, flag, perm) - if err != nil { - return nil, ErrLocked - } - return &LockedFile{f}, nil -} - -func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - if err := os.Chmod(path, syscall.DMEXCL|PrivateFileMode); err != nil { - return nil, err - } - for { - f, err := os.OpenFile(path, flag, perm) - if err == nil { - return &LockedFile{f}, nil - } - time.Sleep(10 * time.Millisecond) - } -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_solaris.go b/vendor/github.com/coreos/etcd/pkg/fileutil/lock_solaris.go deleted file mode 100644 index 352ca5590d..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_solaris.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// 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 solaris - -package fileutil - -import ( - "os" - "syscall" -) - -func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - var lock syscall.Flock_t - lock.Start = 0 - lock.Len = 0 - lock.Pid = 0 - lock.Type = syscall.F_WRLCK - lock.Whence = 0 - lock.Pid = 0 - f, err := os.OpenFile(path, flag, perm) - if err != nil { - return nil, err - } - if err := syscall.FcntlFlock(f.Fd(), syscall.F_SETLK, &lock); err != nil { - f.Close() - if err == syscall.EAGAIN { - err = ErrLocked - } - return nil, err - } - return &LockedFile{f}, nil -} - -func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - var lock syscall.Flock_t - lock.Start = 0 - lock.Len = 0 - lock.Pid = 0 - lock.Type = syscall.F_WRLCK - lock.Whence = 0 - f, err := os.OpenFile(path, flag, perm) - if err != nil { - return nil, err - } - if err = syscall.FcntlFlock(f.Fd(), syscall.F_SETLKW, &lock); err != nil { - f.Close() - return nil, err - } - return &LockedFile{f}, nil -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_unix.go b/vendor/github.com/coreos/etcd/pkg/fileutil/lock_unix.go deleted file mode 100644 index ed01164de6..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_unix.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// 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,!plan9,!solaris,!linux - -package fileutil - -import ( - "os" -) - -func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - return flockTryLockFile(path, flag, perm) -} - -func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - return flockLockFile(path, flag, perm) -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_windows.go b/vendor/github.com/coreos/etcd/pkg/fileutil/lock_windows.go deleted file mode 100644 index 8698f4a8d1..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/lock_windows.go +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// 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 fileutil - -import ( - "errors" - "fmt" - "os" - "syscall" - "unsafe" -) - -var ( - modkernel32 = syscall.NewLazyDLL("kernel32.dll") - procLockFileEx = modkernel32.NewProc("LockFileEx") - - errLocked = errors.New("The process cannot access the file because another process has locked a portion of the file.") -) - -const ( - // https://msdn.microsoft.com/en-us/library/windows/desktop/aa365203(v=vs.85).aspx - LOCKFILE_EXCLUSIVE_LOCK = 2 - LOCKFILE_FAIL_IMMEDIATELY = 1 - - // see https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx - errLockViolation syscall.Errno = 0x21 -) - -func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - f, err := open(path, flag, perm) - if err != nil { - return nil, err - } - if err := lockFile(syscall.Handle(f.Fd()), LOCKFILE_FAIL_IMMEDIATELY); err != nil { - f.Close() - return nil, err - } - return &LockedFile{f}, nil -} - -func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) { - f, err := open(path, flag, perm) - if err != nil { - return nil, err - } - if err := lockFile(syscall.Handle(f.Fd()), 0); err != nil { - f.Close() - return nil, err - } - return &LockedFile{f}, nil -} - -func open(path string, flag int, perm os.FileMode) (*os.File, error) { - if path == "" { - return nil, fmt.Errorf("cannot open empty filename") - } - var access uint32 - switch flag { - case syscall.O_RDONLY: - access = syscall.GENERIC_READ - case syscall.O_WRONLY: - access = syscall.GENERIC_WRITE - case syscall.O_RDWR: - access = syscall.GENERIC_READ | syscall.GENERIC_WRITE - case syscall.O_WRONLY | syscall.O_CREAT: - access = syscall.GENERIC_ALL - default: - panic(fmt.Errorf("flag %v is not supported", flag)) - } - fd, err := syscall.CreateFile(&(syscall.StringToUTF16(path)[0]), - access, - syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE, - nil, - syscall.OPEN_ALWAYS, - syscall.FILE_ATTRIBUTE_NORMAL, - 0) - if err != nil { - return nil, err - } - return os.NewFile(uintptr(fd), path), nil -} - -func lockFile(fd syscall.Handle, flags uint32) error { - var flag uint32 = LOCKFILE_EXCLUSIVE_LOCK - flag |= flags - if fd == syscall.InvalidHandle { - return nil - } - err := lockFileEx(fd, flag, 1, 0, &syscall.Overlapped{}) - if err == nil { - return nil - } else if err.Error() == errLocked.Error() { - return ErrLocked - } else if err != errLockViolation { - return err - } - return nil -} - -func lockFileEx(h syscall.Handle, flags, locklow, lockhigh uint32, ol *syscall.Overlapped) (err error) { - var reserved uint32 = 0 - r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(h), uintptr(flags), uintptr(reserved), uintptr(locklow), uintptr(lockhigh), uintptr(unsafe.Pointer(ol))) - if r1 == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate.go b/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate.go deleted file mode 100644 index bb7f028123..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// 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 fileutil - -import "os" - -// Preallocate tries to allocate the space for given -// file. This operation is only supported on linux by a -// few filesystems (btrfs, ext4, etc.). -// If the operation is unsupported, no error will be returned. -// Otherwise, the error encountered will be returned. -func Preallocate(f *os.File, sizeInBytes int64, extendFile bool) error { - if extendFile { - return preallocExtend(f, sizeInBytes) - } - return preallocFixed(f, sizeInBytes) -} - -func preallocExtendTrunc(f *os.File, sizeInBytes int64) error { - curOff, err := f.Seek(0, os.SEEK_CUR) - if err != nil { - return err - } - size, err := f.Seek(sizeInBytes, os.SEEK_END) - if err != nil { - return err - } - if _, err = f.Seek(curOff, os.SEEK_SET); err != nil { - return err - } - if sizeInBytes > size { - return nil - } - return f.Truncate(sizeInBytes) -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_darwin.go b/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_darwin.go deleted file mode 100644 index 1ed09c560f..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_darwin.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 darwin - -package fileutil - -import ( - "os" - "syscall" - "unsafe" -) - -func preallocExtend(f *os.File, sizeInBytes int64) error { - if err := preallocFixed(f, sizeInBytes); err != nil { - return err - } - return preallocExtendTrunc(f, sizeInBytes) -} - -func preallocFixed(f *os.File, sizeInBytes int64) error { - fstore := &syscall.Fstore_t{ - Flags: syscall.F_ALLOCATEALL, - Posmode: syscall.F_PEOFPOSMODE, - Length: sizeInBytes} - p := unsafe.Pointer(fstore) - _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_PREALLOCATE), uintptr(p)) - if errno == 0 || errno == syscall.ENOTSUP { - return nil - } - return errno -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unix.go b/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unix.go deleted file mode 100644 index 50bd84f02a..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unix.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 linux - -package fileutil - -import ( - "os" - "syscall" -) - -func preallocExtend(f *os.File, sizeInBytes int64) error { - // use mode = 0 to change size - err := syscall.Fallocate(int(f.Fd()), 0, 0, sizeInBytes) - if err != nil { - errno, ok := err.(syscall.Errno) - // not supported; fallback - // fallocate EINTRs frequently in some environments; fallback - if ok && (errno == syscall.ENOTSUP || errno == syscall.EINTR) { - return preallocExtendTrunc(f, sizeInBytes) - } - } - return err -} - -func preallocFixed(f *os.File, sizeInBytes int64) error { - // use mode = 1 to keep size; see FALLOC_FL_KEEP_SIZE - err := syscall.Fallocate(int(f.Fd()), 1, 0, sizeInBytes) - if err != nil { - errno, ok := err.(syscall.Errno) - // treat not supported as nil error - if ok && errno == syscall.ENOTSUP { - return nil - } - } - return err -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unsupported.go b/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unsupported.go deleted file mode 100644 index 162fbc5f78..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unsupported.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// 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 !linux,!darwin - -package fileutil - -import "os" - -func preallocExtend(f *os.File, sizeInBytes int64) error { - return preallocExtendTrunc(f, sizeInBytes) -} - -func preallocFixed(f *os.File, sizeInBytes int64) error { return nil } diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/purge.go b/vendor/github.com/coreos/etcd/pkg/fileutil/purge.go deleted file mode 100644 index 53bda0c012..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/purge.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// 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 fileutil - -import ( - "os" - "path" - "sort" - "strings" - "time" -) - -func PurgeFile(dirname string, suffix string, max uint, interval time.Duration, stop <-chan struct{}) <-chan error { - return purgeFile(dirname, suffix, max, interval, stop, nil) -} - -// purgeFile is the internal implementation for PurgeFile which can post purged files to purgec if non-nil. -func purgeFile(dirname string, suffix string, max uint, interval time.Duration, stop <-chan struct{}, purgec chan<- string) <-chan error { - errC := make(chan error, 1) - go func() { - for { - fnames, err := ReadDir(dirname) - if err != nil { - errC <- err - return - } - newfnames := make([]string, 0) - for _, fname := range fnames { - if strings.HasSuffix(fname, suffix) { - newfnames = append(newfnames, fname) - } - } - sort.Strings(newfnames) - fnames = newfnames - for len(newfnames) > int(max) { - f := path.Join(dirname, newfnames[0]) - l, err := TryLockFile(f, os.O_WRONLY, PrivateFileMode) - if err != nil { - break - } - if err = os.Remove(f); err != nil { - errC <- err - return - } - if err = l.Close(); err != nil { - plog.Errorf("error unlocking %s when purging file (%v)", l.Name(), err) - errC <- err - return - } - plog.Infof("purged file %s successfully", f) - newfnames = newfnames[1:] - } - if purgec != nil { - for i := 0; i < len(fnames)-len(newfnames); i++ { - purgec <- fnames[i] - } - } - select { - case <-time.After(interval): - case <-stop: - return - } - } - }() - return errC -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/sync.go b/vendor/github.com/coreos/etcd/pkg/fileutil/sync.go deleted file mode 100644 index 54dd41f4f3..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/sync.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 !linux,!darwin - -package fileutil - -import "os" - -// Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform. -func Fsync(f *os.File) error { - return f.Sync() -} - -// Fdatasync is a wrapper around file.Sync(). Special handling is needed on linux platform. -func Fdatasync(f *os.File) error { - return f.Sync() -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/sync_darwin.go b/vendor/github.com/coreos/etcd/pkg/fileutil/sync_darwin.go deleted file mode 100644 index c2f39bf204..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/sync_darwin.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 darwin - -package fileutil - -import ( - "os" - "syscall" -) - -// Fsync on HFS/OSX flushes the data on to the physical drive but the drive -// may not write it to the persistent media for quite sometime and it may be -// written in out-of-order sequence. Using F_FULLFSYNC ensures that the -// physical drive's buffer will also get flushed to the media. -func Fsync(f *os.File) error { - _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_FULLFSYNC), uintptr(0)) - if errno == 0 { - return nil - } - return errno -} - -// Fdatasync on darwin platform invokes fcntl(F_FULLFSYNC) for actual persistence -// on physical drive media. -func Fdatasync(f *os.File) error { - return Fsync(f) -} diff --git a/vendor/github.com/coreos/etcd/pkg/fileutil/sync_linux.go b/vendor/github.com/coreos/etcd/pkg/fileutil/sync_linux.go deleted file mode 100644 index 1bbced915e..0000000000 --- a/vendor/github.com/coreos/etcd/pkg/fileutil/sync_linux.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// 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 linux - -package fileutil - -import ( - "os" - "syscall" -) - -// Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform. -func Fsync(f *os.File) error { - return f.Sync() -} - -// Fdatasync is similar to fsync(), but does not flush modified metadata -// unless that metadata is needed in order to allow a subsequent data retrieval -// to be correctly handled. -func Fdatasync(f *os.File) error { - return syscall.Fdatasync(int(f.Fd())) -} diff --git a/vendor/github.com/coreos/etcd/pkg/transport/listener.go b/vendor/github.com/coreos/etcd/pkg/transport/listener.go index 3596570819..045c3196d1 100644 --- a/vendor/github.com/coreos/etcd/pkg/transport/listener.go +++ b/vendor/github.com/coreos/etcd/pkg/transport/listener.go @@ -30,7 +30,6 @@ import ( "strings" "time" - "github.com/coreos/etcd/pkg/fileutil" "github.com/coreos/etcd/pkg/tlsutil" ) @@ -86,7 +85,7 @@ func (info TLSInfo) Empty() bool { } func SelfCert(dirpath string, hosts []string) (info TLSInfo, err error) { - if err = fileutil.TouchDirAll(dirpath); err != nil { + if err = os.MkdirAll(dirpath, 0700); err != nil { return } diff --git a/vendor/github.com/coreos/go-systemd/LICENSE b/vendor/github.com/coreos/go-systemd/LICENSE deleted file mode 100644 index 37ec93a14f..0000000000 --- a/vendor/github.com/coreos/go-systemd/LICENSE +++ /dev/null @@ -1,191 +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: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -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 -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/coreos/go-systemd/journal/journal.go b/vendor/github.com/coreos/go-systemd/journal/journal.go deleted file mode 100644 index 7f434990d2..0000000000 --- a/vendor/github.com/coreos/go-systemd/journal/journal.go +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 journal provides write bindings to the local systemd journal. -// It is implemented in pure Go and connects to the journal directly over its -// unix socket. -// -// To read from the journal, see the "sdjournal" package, which wraps the -// sd-journal a C API. -// -// http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html -package journal - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "io" - "io/ioutil" - "net" - "os" - "strconv" - "strings" - "syscall" -) - -// Priority of a journal message -type Priority int - -const ( - PriEmerg Priority = iota - PriAlert - PriCrit - PriErr - PriWarning - PriNotice - PriInfo - PriDebug -) - -var conn net.Conn - -func init() { - var err error - conn, err = net.Dial("unixgram", "/run/systemd/journal/socket") - if err != nil { - conn = nil - } -} - -// Enabled returns true if the local systemd journal is available for logging -func Enabled() bool { - return conn != nil -} - -// Send a message to the local systemd journal. vars is a map of journald -// fields to values. Fields must be composed of uppercase letters, numbers, -// and underscores, but must not start with an underscore. Within these -// restrictions, any arbitrary field name may be used. Some names have special -// significance: see the journalctl documentation -// (http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html) -// for more details. vars may be nil. -func Send(message string, priority Priority, vars map[string]string) error { - if conn == nil { - return journalError("could not connect to journald socket") - } - - data := new(bytes.Buffer) - appendVariable(data, "PRIORITY", strconv.Itoa(int(priority))) - appendVariable(data, "MESSAGE", message) - for k, v := range vars { - appendVariable(data, k, v) - } - - _, err := io.Copy(conn, data) - if err != nil && isSocketSpaceError(err) { - file, err := tempFd() - if err != nil { - return journalError(err.Error()) - } - defer file.Close() - _, err = io.Copy(file, data) - if err != nil { - return journalError(err.Error()) - } - - rights := syscall.UnixRights(int(file.Fd())) - - /* this connection should always be a UnixConn, but better safe than sorry */ - unixConn, ok := conn.(*net.UnixConn) - if !ok { - return journalError("can't send file through non-Unix connection") - } - unixConn.WriteMsgUnix([]byte{}, rights, nil) - } else if err != nil { - return journalError(err.Error()) - } - return nil -} - -// Print prints a message to the local systemd journal using Send(). -func Print(priority Priority, format string, a ...interface{}) error { - return Send(fmt.Sprintf(format, a...), priority, nil) -} - -func appendVariable(w io.Writer, name, value string) { - if !validVarName(name) { - journalError("variable name contains invalid character, ignoring") - } - if strings.ContainsRune(value, '\n') { - /* When the value contains a newline, we write: - * - the variable name, followed by a newline - * - the size (in 64bit little endian format) - * - the data, followed by a newline - */ - fmt.Fprintln(w, name) - binary.Write(w, binary.LittleEndian, uint64(len(value))) - fmt.Fprintln(w, value) - } else { - /* just write the variable and value all on one line */ - fmt.Fprintf(w, "%s=%s\n", name, value) - } -} - -func validVarName(name string) bool { - /* The variable name must be in uppercase and consist only of characters, - * numbers and underscores, and may not begin with an underscore. (from the docs) - */ - - valid := name[0] != '_' - for _, c := range name { - valid = valid && ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_' - } - return valid -} - -func isSocketSpaceError(err error) bool { - opErr, ok := err.(*net.OpError) - if !ok { - return false - } - - sysErr, ok := opErr.Err.(syscall.Errno) - if !ok { - return false - } - - return sysErr == syscall.EMSGSIZE || sysErr == syscall.ENOBUFS -} - -func tempFd() (*os.File, error) { - file, err := ioutil.TempFile("/dev/shm/", "journal.XXXXX") - if err != nil { - return nil, err - } - syscall.Unlink(file.Name()) - if err != nil { - return nil, err - } - return file, nil -} - -func journalError(s string) error { - s = "journal error: " + s - fmt.Fprintln(os.Stderr, s) - return errors.New(s) -} diff --git a/vendor/github.com/coreos/pkg/LICENSE b/vendor/github.com/coreos/pkg/LICENSE deleted file mode 100644 index e06d208186..0000000000 --- a/vendor/github.com/coreos/pkg/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/coreos/pkg/NOTICE b/vendor/github.com/coreos/pkg/NOTICE deleted file mode 100644 index b39ddfa5cb..0000000000 --- a/vendor/github.com/coreos/pkg/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -CoreOS Project -Copyright 2014 CoreOS, Inc - -This product includes software developed at CoreOS, Inc. -(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/pkg/capnslog/README.md b/vendor/github.com/coreos/pkg/capnslog/README.md deleted file mode 100644 index 81efb1fb6a..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# capnslog, the CoreOS logging package - -There are far too many logging packages out there, with varying degrees of licenses, far too many features (colorization, all sorts of log frameworks) or are just a pain to use (lack of `Fatalln()`?). -capnslog provides a simple but consistent logging interface suitable for all kinds of projects. - -### Design Principles - -##### `package main` is the place where logging gets turned on and routed - -A library should not touch log options, only generate log entries. Libraries are silent until main lets them speak. - -##### All log options are runtime-configurable. - -Still the job of `main` to expose these configurations. `main` may delegate this to, say, a configuration webhook, but does so explicitly. - -##### There is one log object per package. It is registered under its repository and package name. - -`main` activates logging for its repository and any dependency repositories it would also like to have output in its logstream. `main` also dictates at which level each subpackage logs. - -##### There is *one* output stream, and it is an `io.Writer` composed with a formatter. - -Splitting streams is probably not the job of your program, but rather, your log aggregation framework. If you must split output streams, again, `main` configures this and you can write a very simple two-output struct that satisfies io.Writer. - -Fancy colorful formatting and JSON output are beyond the scope of a basic logging framework -- they're application/log-collector dependant. These are, at best, provided as options, but more likely, provided by your application. - -##### Log objects are an interface - -An object knows best how to print itself. Log objects can collect more interesting metadata if they wish, however, because text isn't going away anytime soon, they must all be marshalable to text. The simplest log object is a string, which returns itself. If you wish to do more fancy tricks for printing your log objects, see also JSON output -- introspect and write a formatter which can handle your advanced log interface. Making strings is the only thing guaranteed. - -##### Log levels have specific meanings: - - * Critical: Unrecoverable. Must fail. - * Error: Data has been lost, a request has failed for a bad reason, or a required resource has been lost - * Warning: (Hopefully) Temporary conditions that may cause errors, but may work fine. A replica disappearing (that may reconnect) is a warning. - * Notice: Normal, but important (uncommon) log information. - * Info: Normal, working log information, everything is fine, but helpful notices for auditing or common operations. - * Debug: Everything is still fine, but even common operations may be logged, and less helpful but more quantity of notices. - * Trace: Anything goes, from logging every function call as part of a common operation, to tracing execution of a query. - diff --git a/vendor/github.com/coreos/pkg/capnslog/formatters.go b/vendor/github.com/coreos/pkg/capnslog/formatters.go deleted file mode 100644 index b305a845fb..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/formatters.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import ( - "bufio" - "fmt" - "io" - "log" - "runtime" - "strings" - "time" -) - -type Formatter interface { - Format(pkg string, level LogLevel, depth int, entries ...interface{}) - Flush() -} - -func NewStringFormatter(w io.Writer) Formatter { - return &StringFormatter{ - w: bufio.NewWriter(w), - } -} - -type StringFormatter struct { - w *bufio.Writer -} - -func (s *StringFormatter) Format(pkg string, l LogLevel, i int, entries ...interface{}) { - now := time.Now().UTC() - s.w.WriteString(now.Format(time.RFC3339)) - s.w.WriteByte(' ') - writeEntries(s.w, pkg, l, i, entries...) - s.Flush() -} - -func writeEntries(w *bufio.Writer, pkg string, _ LogLevel, _ int, entries ...interface{}) { - if pkg != "" { - w.WriteString(pkg + ": ") - } - str := fmt.Sprint(entries...) - endsInNL := strings.HasSuffix(str, "\n") - w.WriteString(str) - if !endsInNL { - w.WriteString("\n") - } -} - -func (s *StringFormatter) Flush() { - s.w.Flush() -} - -func NewPrettyFormatter(w io.Writer, debug bool) Formatter { - return &PrettyFormatter{ - w: bufio.NewWriter(w), - debug: debug, - } -} - -type PrettyFormatter struct { - w *bufio.Writer - debug bool -} - -func (c *PrettyFormatter) Format(pkg string, l LogLevel, depth int, entries ...interface{}) { - now := time.Now() - ts := now.Format("2006-01-02 15:04:05") - c.w.WriteString(ts) - ms := now.Nanosecond() / 1000 - c.w.WriteString(fmt.Sprintf(".%06d", ms)) - if c.debug { - _, file, line, ok := runtime.Caller(depth) // It's always the same number of frames to the user's call. - if !ok { - file = "???" - line = 1 - } else { - slash := strings.LastIndex(file, "/") - if slash >= 0 { - file = file[slash+1:] - } - } - if line < 0 { - line = 0 // not a real line number - } - c.w.WriteString(fmt.Sprintf(" [%s:%d]", file, line)) - } - c.w.WriteString(fmt.Sprint(" ", l.Char(), " | ")) - writeEntries(c.w, pkg, l, depth, entries...) - c.Flush() -} - -func (c *PrettyFormatter) Flush() { - c.w.Flush() -} - -// LogFormatter emulates the form of the traditional built-in logger. -type LogFormatter struct { - logger *log.Logger - prefix string -} - -// NewLogFormatter is a helper to produce a new LogFormatter struct. It uses the -// golang log package to actually do the logging work so that logs look similar. -func NewLogFormatter(w io.Writer, prefix string, flag int) Formatter { - return &LogFormatter{ - logger: log.New(w, "", flag), // don't use prefix here - prefix: prefix, // save it instead - } -} - -// Format builds a log message for the LogFormatter. The LogLevel is ignored. -func (lf *LogFormatter) Format(pkg string, _ LogLevel, _ int, entries ...interface{}) { - str := fmt.Sprint(entries...) - prefix := lf.prefix - if pkg != "" { - prefix = fmt.Sprintf("%s%s: ", prefix, pkg) - } - lf.logger.Output(5, fmt.Sprintf("%s%v", prefix, str)) // call depth is 5 -} - -// Flush is included so that the interface is complete, but is a no-op. -func (lf *LogFormatter) Flush() { - // noop -} - -// NilFormatter is a no-op log formatter that does nothing. -type NilFormatter struct { -} - -// NewNilFormatter is a helper to produce a new LogFormatter struct. It logs no -// messages so that you can cause part of your logging to be silent. -func NewNilFormatter() Formatter { - return &NilFormatter{} -} - -// Format does nothing. -func (_ *NilFormatter) Format(_ string, _ LogLevel, _ int, _ ...interface{}) { - // noop -} - -// Flush is included so that the interface is complete, but is a no-op. -func (_ *NilFormatter) Flush() { - // noop -} diff --git a/vendor/github.com/coreos/pkg/capnslog/glog_formatter.go b/vendor/github.com/coreos/pkg/capnslog/glog_formatter.go deleted file mode 100644 index 426603ef30..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/glog_formatter.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import ( - "bufio" - "bytes" - "io" - "os" - "runtime" - "strconv" - "strings" - "time" -) - -var pid = os.Getpid() - -type GlogFormatter struct { - StringFormatter -} - -func NewGlogFormatter(w io.Writer) *GlogFormatter { - g := &GlogFormatter{} - g.w = bufio.NewWriter(w) - return g -} - -func (g GlogFormatter) Format(pkg string, level LogLevel, depth int, entries ...interface{}) { - g.w.Write(GlogHeader(level, depth+1)) - g.StringFormatter.Format(pkg, level, depth+1, entries...) -} - -func GlogHeader(level LogLevel, depth int) []byte { - // Lmmdd hh:mm:ss.uuuuuu threadid file:line] - now := time.Now().UTC() - _, file, line, ok := runtime.Caller(depth) // It's always the same number of frames to the user's call. - if !ok { - file = "???" - line = 1 - } else { - slash := strings.LastIndex(file, "/") - if slash >= 0 { - file = file[slash+1:] - } - } - if line < 0 { - line = 0 // not a real line number - } - buf := &bytes.Buffer{} - buf.Grow(30) - _, month, day := now.Date() - hour, minute, second := now.Clock() - buf.WriteString(level.Char()) - twoDigits(buf, int(month)) - twoDigits(buf, day) - buf.WriteByte(' ') - twoDigits(buf, hour) - buf.WriteByte(':') - twoDigits(buf, minute) - buf.WriteByte(':') - twoDigits(buf, second) - buf.WriteByte('.') - buf.WriteString(strconv.Itoa(now.Nanosecond() / 1000)) - buf.WriteByte('Z') - buf.WriteByte(' ') - buf.WriteString(strconv.Itoa(pid)) - buf.WriteByte(' ') - buf.WriteString(file) - buf.WriteByte(':') - buf.WriteString(strconv.Itoa(line)) - buf.WriteByte(']') - buf.WriteByte(' ') - return buf.Bytes() -} - -const digits = "0123456789" - -func twoDigits(b *bytes.Buffer, d int) { - c2 := digits[d%10] - d /= 10 - c1 := digits[d%10] - b.WriteByte(c1) - b.WriteByte(c2) -} diff --git a/vendor/github.com/coreos/pkg/capnslog/init.go b/vendor/github.com/coreos/pkg/capnslog/init.go deleted file mode 100644 index 44b8cd361b..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/init.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import ( - "io" - "os" - "syscall" -) - -// Here's where the opinionation comes in. We need some sensible defaults, -// especially after taking over the log package. Your project (whatever it may -// be) may see things differently. That's okay; there should be no defaults in -// the main package that cannot be controlled or overridden programatically, -// otherwise it's a bug. Doing so is creating your own init_log.go file much -// like this one. - -func init() { - initHijack() - - // Go `log` pacakge uses os.Stderr. - SetFormatter(NewDefaultFormatter(os.Stderr)) - SetGlobalLogLevel(INFO) -} - -func NewDefaultFormatter(out io.Writer) Formatter { - if syscall.Getppid() == 1 { - // We're running under init, which may be systemd. - f, err := NewJournaldFormatter() - if err == nil { - return f - } - } - return NewPrettyFormatter(out, false) -} diff --git a/vendor/github.com/coreos/pkg/capnslog/init_windows.go b/vendor/github.com/coreos/pkg/capnslog/init_windows.go deleted file mode 100644 index 4553050653..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/init_windows.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import "os" - -func init() { - initHijack() - - // Go `log` package uses os.Stderr. - SetFormatter(NewPrettyFormatter(os.Stderr, false)) - SetGlobalLogLevel(INFO) -} diff --git a/vendor/github.com/coreos/pkg/capnslog/journald_formatter.go b/vendor/github.com/coreos/pkg/capnslog/journald_formatter.go deleted file mode 100644 index 72e05207c5..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/journald_formatter.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import ( - "errors" - "fmt" - "os" - "path/filepath" - - "github.com/coreos/go-systemd/journal" -) - -func NewJournaldFormatter() (Formatter, error) { - if !journal.Enabled() { - return nil, errors.New("No systemd detected") - } - return &journaldFormatter{}, nil -} - -type journaldFormatter struct{} - -func (j *journaldFormatter) Format(pkg string, l LogLevel, _ int, entries ...interface{}) { - var pri journal.Priority - switch l { - case CRITICAL: - pri = journal.PriCrit - case ERROR: - pri = journal.PriErr - case WARNING: - pri = journal.PriWarning - case NOTICE: - pri = journal.PriNotice - case INFO: - pri = journal.PriInfo - case DEBUG: - pri = journal.PriDebug - case TRACE: - pri = journal.PriDebug - default: - panic("Unhandled loglevel") - } - msg := fmt.Sprint(entries...) - tags := map[string]string{ - "PACKAGE": pkg, - "SYSLOG_IDENTIFIER": filepath.Base(os.Args[0]), - } - err := journal.Send(msg, pri, tags) - if err != nil { - fmt.Fprintln(os.Stderr, err) - } -} - -func (j *journaldFormatter) Flush() {} diff --git a/vendor/github.com/coreos/pkg/capnslog/log_hijack.go b/vendor/github.com/coreos/pkg/capnslog/log_hijack.go deleted file mode 100644 index 970086b9f9..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/log_hijack.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import ( - "log" -) - -func initHijack() { - pkg := NewPackageLogger("log", "") - w := packageWriter{pkg} - log.SetFlags(0) - log.SetPrefix("") - log.SetOutput(w) -} - -type packageWriter struct { - pl *PackageLogger -} - -func (p packageWriter) Write(b []byte) (int, error) { - if p.pl.level < INFO { - return 0, nil - } - p.pl.internalLog(calldepth+2, INFO, string(b)) - return len(b), nil -} diff --git a/vendor/github.com/coreos/pkg/capnslog/logmap.go b/vendor/github.com/coreos/pkg/capnslog/logmap.go deleted file mode 100644 index 226b60c225..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/logmap.go +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import ( - "errors" - "strings" - "sync" -) - -// LogLevel is the set of all log levels. -type LogLevel int8 - -const ( - // CRITICAL is the lowest log level; only errors which will end the program will be propagated. - CRITICAL LogLevel = iota - 1 - // ERROR is for errors that are not fatal but lead to troubling behavior. - ERROR - // WARNING is for errors which are not fatal and not errors, but are unusual. Often sourced from misconfigurations. - WARNING - // NOTICE is for normal but significant conditions. - NOTICE - // INFO is a log level for common, everyday log updates. - INFO - // DEBUG is the default hidden level for more verbose updates about internal processes. - DEBUG - // TRACE is for (potentially) call by call tracing of programs. - TRACE -) - -// Char returns a single-character representation of the log level. -func (l LogLevel) Char() string { - switch l { - case CRITICAL: - return "C" - case ERROR: - return "E" - case WARNING: - return "W" - case NOTICE: - return "N" - case INFO: - return "I" - case DEBUG: - return "D" - case TRACE: - return "T" - default: - panic("Unhandled loglevel") - } -} - -// String returns a multi-character representation of the log level. -func (l LogLevel) String() string { - switch l { - case CRITICAL: - return "CRITICAL" - case ERROR: - return "ERROR" - case WARNING: - return "WARNING" - case NOTICE: - return "NOTICE" - case INFO: - return "INFO" - case DEBUG: - return "DEBUG" - case TRACE: - return "TRACE" - default: - panic("Unhandled loglevel") - } -} - -// Update using the given string value. Fulfills the flag.Value interface. -func (l *LogLevel) Set(s string) error { - value, err := ParseLevel(s) - if err != nil { - return err - } - - *l = value - return nil -} - -// Returns an empty string, only here to fulfill the pflag.Value interface. -func (l *LogLevel) Type() string { - return "" -} - -// ParseLevel translates some potential loglevel strings into their corresponding levels. -func ParseLevel(s string) (LogLevel, error) { - switch s { - case "CRITICAL", "C": - return CRITICAL, nil - case "ERROR", "0", "E": - return ERROR, nil - case "WARNING", "1", "W": - return WARNING, nil - case "NOTICE", "2", "N": - return NOTICE, nil - case "INFO", "3", "I": - return INFO, nil - case "DEBUG", "4", "D": - return DEBUG, nil - case "TRACE", "5", "T": - return TRACE, nil - } - return CRITICAL, errors.New("couldn't parse log level " + s) -} - -type RepoLogger map[string]*PackageLogger - -type loggerStruct struct { - sync.Mutex - repoMap map[string]RepoLogger - formatter Formatter -} - -// logger is the global logger -var logger = new(loggerStruct) - -// SetGlobalLogLevel sets the log level for all packages in all repositories -// registered with capnslog. -func SetGlobalLogLevel(l LogLevel) { - logger.Lock() - defer logger.Unlock() - for _, r := range logger.repoMap { - r.setRepoLogLevelInternal(l) - } -} - -// GetRepoLogger may return the handle to the repository's set of packages' loggers. -func GetRepoLogger(repo string) (RepoLogger, error) { - logger.Lock() - defer logger.Unlock() - r, ok := logger.repoMap[repo] - if !ok { - return nil, errors.New("no packages registered for repo " + repo) - } - return r, nil -} - -// MustRepoLogger returns the handle to the repository's packages' loggers. -func MustRepoLogger(repo string) RepoLogger { - r, err := GetRepoLogger(repo) - if err != nil { - panic(err) - } - return r -} - -// SetRepoLogLevel sets the log level for all packages in the repository. -func (r RepoLogger) SetRepoLogLevel(l LogLevel) { - logger.Lock() - defer logger.Unlock() - r.setRepoLogLevelInternal(l) -} - -func (r RepoLogger) setRepoLogLevelInternal(l LogLevel) { - for _, v := range r { - v.level = l - } -} - -// ParseLogLevelConfig parses a comma-separated string of "package=loglevel", in -// order, and returns a map of the results, for use in SetLogLevel. -func (r RepoLogger) ParseLogLevelConfig(conf string) (map[string]LogLevel, error) { - setlist := strings.Split(conf, ",") - out := make(map[string]LogLevel) - for _, setstring := range setlist { - setting := strings.Split(setstring, "=") - if len(setting) != 2 { - return nil, errors.New("oddly structured `pkg=level` option: " + setstring) - } - l, err := ParseLevel(setting[1]) - if err != nil { - return nil, err - } - out[setting[0]] = l - } - return out, nil -} - -// SetLogLevel takes a map of package names within a repository to their desired -// loglevel, and sets the levels appropriately. Unknown packages are ignored. -// "*" is a special package name that corresponds to all packages, and will be -// processed first. -func (r RepoLogger) SetLogLevel(m map[string]LogLevel) { - logger.Lock() - defer logger.Unlock() - if l, ok := m["*"]; ok { - r.setRepoLogLevelInternal(l) - } - for k, v := range m { - l, ok := r[k] - if !ok { - continue - } - l.level = v - } -} - -// SetFormatter sets the formatting function for all logs. -func SetFormatter(f Formatter) { - logger.Lock() - defer logger.Unlock() - logger.formatter = f -} - -// NewPackageLogger creates a package logger object. -// This should be defined as a global var in your package, referencing your repo. -func NewPackageLogger(repo string, pkg string) (p *PackageLogger) { - logger.Lock() - defer logger.Unlock() - if logger.repoMap == nil { - logger.repoMap = make(map[string]RepoLogger) - } - r, rok := logger.repoMap[repo] - if !rok { - logger.repoMap[repo] = make(RepoLogger) - r = logger.repoMap[repo] - } - p, pok := r[pkg] - if !pok { - r[pkg] = &PackageLogger{ - pkg: pkg, - level: INFO, - } - p = r[pkg] - } - return -} diff --git a/vendor/github.com/coreos/pkg/capnslog/pkg_logger.go b/vendor/github.com/coreos/pkg/capnslog/pkg_logger.go deleted file mode 100644 index 612d55c66c..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/pkg_logger.go +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import ( - "fmt" - "os" -) - -type PackageLogger struct { - pkg string - level LogLevel -} - -const calldepth = 2 - -func (p *PackageLogger) internalLog(depth int, inLevel LogLevel, entries ...interface{}) { - logger.Lock() - defer logger.Unlock() - if inLevel != CRITICAL && p.level < inLevel { - return - } - if logger.formatter != nil { - logger.formatter.Format(p.pkg, inLevel, depth+1, entries...) - } -} - -func (p *PackageLogger) LevelAt(l LogLevel) bool { - logger.Lock() - defer logger.Unlock() - return p.level >= l -} - -// Log a formatted string at any level between ERROR and TRACE -func (p *PackageLogger) Logf(l LogLevel, format string, args ...interface{}) { - p.internalLog(calldepth, l, fmt.Sprintf(format, args...)) -} - -// Log a message at any level between ERROR and TRACE -func (p *PackageLogger) Log(l LogLevel, args ...interface{}) { - p.internalLog(calldepth, l, fmt.Sprint(args...)) -} - -// log stdlib compatibility - -func (p *PackageLogger) Println(args ...interface{}) { - p.internalLog(calldepth, INFO, fmt.Sprintln(args...)) -} - -func (p *PackageLogger) Printf(format string, args ...interface{}) { - p.Logf(INFO, format, args...) -} - -func (p *PackageLogger) Print(args ...interface{}) { - p.internalLog(calldepth, INFO, fmt.Sprint(args...)) -} - -// Panic and fatal - -func (p *PackageLogger) Panicf(format string, args ...interface{}) { - s := fmt.Sprintf(format, args...) - p.internalLog(calldepth, CRITICAL, s) - panic(s) -} - -func (p *PackageLogger) Panic(args ...interface{}) { - s := fmt.Sprint(args...) - p.internalLog(calldepth, CRITICAL, s) - panic(s) -} - -func (p *PackageLogger) Fatalf(format string, args ...interface{}) { - p.Logf(CRITICAL, format, args...) - os.Exit(1) -} - -func (p *PackageLogger) Fatal(args ...interface{}) { - s := fmt.Sprint(args...) - p.internalLog(calldepth, CRITICAL, s) - os.Exit(1) -} - -func (p *PackageLogger) Fatalln(args ...interface{}) { - s := fmt.Sprintln(args...) - p.internalLog(calldepth, CRITICAL, s) - os.Exit(1) -} - -// Error Functions - -func (p *PackageLogger) Errorf(format string, args ...interface{}) { - p.Logf(ERROR, format, args...) -} - -func (p *PackageLogger) Error(entries ...interface{}) { - p.internalLog(calldepth, ERROR, entries...) -} - -// Warning Functions - -func (p *PackageLogger) Warningf(format string, args ...interface{}) { - p.Logf(WARNING, format, args...) -} - -func (p *PackageLogger) Warning(entries ...interface{}) { - p.internalLog(calldepth, WARNING, entries...) -} - -// Notice Functions - -func (p *PackageLogger) Noticef(format string, args ...interface{}) { - p.Logf(NOTICE, format, args...) -} - -func (p *PackageLogger) Notice(entries ...interface{}) { - p.internalLog(calldepth, NOTICE, entries...) -} - -// Info Functions - -func (p *PackageLogger) Infof(format string, args ...interface{}) { - p.Logf(INFO, format, args...) -} - -func (p *PackageLogger) Info(entries ...interface{}) { - p.internalLog(calldepth, INFO, entries...) -} - -// Debug Functions - -func (p *PackageLogger) Debugf(format string, args ...interface{}) { - if p.level < DEBUG { - return - } - p.Logf(DEBUG, format, args...) -} - -func (p *PackageLogger) Debug(entries ...interface{}) { - if p.level < DEBUG { - return - } - p.internalLog(calldepth, DEBUG, entries...) -} - -// Trace Functions - -func (p *PackageLogger) Tracef(format string, args ...interface{}) { - if p.level < TRACE { - return - } - p.Logf(TRACE, format, args...) -} - -func (p *PackageLogger) Trace(entries ...interface{}) { - if p.level < TRACE { - return - } - p.internalLog(calldepth, TRACE, entries...) -} - -func (p *PackageLogger) Flush() { - logger.Lock() - defer logger.Unlock() - logger.formatter.Flush() -} diff --git a/vendor/github.com/coreos/pkg/capnslog/syslog_formatter.go b/vendor/github.com/coreos/pkg/capnslog/syslog_formatter.go deleted file mode 100644 index 4be5a1f2de..0000000000 --- a/vendor/github.com/coreos/pkg/capnslog/syslog_formatter.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 capnslog - -import ( - "fmt" - "log/syslog" -) - -func NewSyslogFormatter(w *syslog.Writer) Formatter { - return &syslogFormatter{w} -} - -func NewDefaultSyslogFormatter(tag string) (Formatter, error) { - w, err := syslog.New(syslog.LOG_DEBUG, tag) - if err != nil { - return nil, err - } - return NewSyslogFormatter(w), nil -} - -type syslogFormatter struct { - w *syslog.Writer -} - -func (s *syslogFormatter) Format(pkg string, l LogLevel, _ int, entries ...interface{}) { - for _, entry := range entries { - str := fmt.Sprint(entry) - switch l { - case CRITICAL: - s.w.Crit(str) - case ERROR: - s.w.Err(str) - case WARNING: - s.w.Warning(str) - case NOTICE: - s.w.Notice(str) - case INFO: - s.w.Info(str) - case DEBUG: - s.w.Debug(str) - case TRACE: - s.w.Debug(str) - default: - panic("Unhandled loglevel") - } - } -} - -func (s *syslogFormatter) Flush() { -} diff --git a/vendor/github.com/go-ini/ini/ini.go b/vendor/github.com/go-ini/ini/ini.go index c343dedc43..8a448d7a2e 100644 --- a/vendor/github.com/go-ini/ini/ini.go +++ b/vendor/github.com/go-ini/ini/ini.go @@ -37,7 +37,7 @@ const ( // Maximum allowed depth when recursively substituing variable names. _DEPTH_VALUES = 99 - _VERSION = "1.24.0" + _VERSION = "1.25.2" ) // Version returns current package version literal. @@ -176,6 +176,8 @@ type LoadOptions struct { // AllowBooleanKeys indicates whether to allow boolean type keys or treat as value is missing. // This type of keys are mostly used in my.cnf. AllowBooleanKeys bool + // AllowShadows indicates whether to keep track of keys with same name under same section. + AllowShadows bool // Some INI formats allow group blocks that store a block of raw content that doesn't otherwise // conform to key/value pairs. Specify the names of those blocks here. UnparseableSections []string @@ -219,6 +221,12 @@ func InsensitiveLoad(source interface{}, others ...interface{}) (*File, error) { return LoadSources(LoadOptions{Insensitive: true}, source, others...) } +// InsensitiveLoad has exactly same functionality as Load function +// except it allows have shadow keys. +func ShadowLoad(source interface{}, others ...interface{}) (*File, error) { + return LoadSources(LoadOptions{AllowShadows: true}, source, others...) +} + // Empty returns an empty file object. func Empty() *File { // Ignore error here, we sure our data is good. @@ -441,6 +449,7 @@ func (f *File) WriteToIndent(w io.Writer, indent string) (n int64, err error) { } alignSpaces := bytes.Repeat([]byte(" "), alignLength) + KEY_LIST: for _, kname := range sec.keyList { key := sec.Key(kname) if len(key.Comment) > 0 { @@ -467,31 +476,33 @@ func (f *File) WriteToIndent(w io.Writer, indent string) (n int64, err error) { case strings.Contains(kname, "`"): kname = `"""` + kname + `"""` } - if _, err = buf.WriteString(kname); err != nil { - return 0, err - } - if key.isBooleanType { - if kname != sec.keyList[len(sec.keyList)-1] { - buf.WriteString(LineBreak) + for _, val := range key.ValueWithShadows() { + if _, err = buf.WriteString(kname); err != nil { + return 0, err } - continue - } - // Write out alignment spaces before "=" sign - if PrettyFormat { - buf.Write(alignSpaces[:alignLength-len(kname)]) - } + if key.isBooleanType { + if kname != sec.keyList[len(sec.keyList)-1] { + buf.WriteString(LineBreak) + } + continue KEY_LIST + } - val := key.value - // In case key value contains "\n", "`", "\"", "#" or ";" - if strings.ContainsAny(val, "\n`") { - val = `"""` + val + `"""` - } else if strings.ContainsAny(val, "#;") { - val = "`" + val + "`" - } - if _, err = buf.WriteString(equalSign + val + LineBreak); err != nil { - return 0, err + // Write out alignment spaces before "=" sign + if PrettyFormat { + buf.Write(alignSpaces[:alignLength-len(kname)]) + } + + // In case key value contains "\n", "`", "\"", "#" or ";" + if strings.ContainsAny(val, "\n`") { + val = `"""` + val + `"""` + } else if strings.ContainsAny(val, "#;") { + val = "`" + val + "`" + } + if _, err = buf.WriteString(equalSign + val + LineBreak); err != nil { + return 0, err + } } } diff --git a/vendor/github.com/go-ini/ini/key.go b/vendor/github.com/go-ini/ini/key.go index 9738c55a21..7058dc99e4 100644 --- a/vendor/github.com/go-ini/ini/key.go +++ b/vendor/github.com/go-ini/ini/key.go @@ -15,6 +15,7 @@ package ini import ( + "errors" "fmt" "strconv" "strings" @@ -29,9 +30,42 @@ type Key struct { isAutoIncrement bool isBooleanType bool + isShadow bool + shadows []*Key + Comment string } +// newKey simply return a key object with given values. +func newKey(s *Section, name, val string) *Key { + return &Key{ + s: s, + name: name, + value: val, + } +} + +func (k *Key) addShadow(val string) error { + if k.isShadow { + return errors.New("cannot add shadow to another shadow key") + } else if k.isAutoIncrement || k.isBooleanType { + return errors.New("cannot add shadow to auto-increment or boolean key") + } + + shadow := newKey(k.s, k.name, val) + shadow.isShadow = true + k.shadows = append(k.shadows, shadow) + return nil +} + +// AddShadow adds a new shadow key to itself. +func (k *Key) AddShadow(val string) error { + if !k.s.f.options.AllowShadows { + return errors.New("shadow key is not allowed") + } + return k.addShadow(val) +} + // ValueMapper represents a mapping function for values, e.g. os.ExpandEnv type ValueMapper func(string) string @@ -45,6 +79,19 @@ func (k *Key) Value() string { return k.value } +// ValueWithShadows returns raw values of key and its shadows if any. +func (k *Key) ValueWithShadows() []string { + if len(k.shadows) == 0 { + return []string{k.value} + } + vals := make([]string, len(k.shadows)+1) + vals[0] = k.value + for i := range k.shadows { + vals[i+1] = k.shadows[i].value + } + return vals +} + // String returns string representation of value. func (k *Key) String() string { val := k.value diff --git a/vendor/github.com/go-ini/ini/parser.go b/vendor/github.com/go-ini/ini/parser.go index 01ff20a983..673ef80ca2 100644 --- a/vendor/github.com/go-ini/ini/parser.go +++ b/vendor/github.com/go-ini/ini/parser.go @@ -341,17 +341,16 @@ func (f *File) parse(reader io.Reader) (err error) { p.count++ } - key, err := section.NewKey(kname, "") - if err != nil { - return err - } - key.isAutoIncrement = isAutoIncr - value, err := p.readValue(line[offset:], f.options.IgnoreContinuation) if err != nil { return err } - key.SetValue(value) + + key, err := section.NewKey(kname, value) + if err != nil { + return err + } + key.isAutoIncrement = isAutoIncr key.Comment = strings.TrimSpace(p.comment.String()) p.comment.Reset() } diff --git a/vendor/github.com/go-ini/ini/section.go b/vendor/github.com/go-ini/ini/section.go index 806f149709..c9fa27e9ca 100644 --- a/vendor/github.com/go-ini/ini/section.go +++ b/vendor/github.com/go-ini/ini/section.go @@ -68,16 +68,18 @@ func (s *Section) NewKey(name, val string) (*Key, error) { } if inSlice(name, s.keyList) { - s.keys[name].value = val + if s.f.options.AllowShadows { + if err := s.keys[name].addShadow(val); err != nil { + return nil, err + } + } else { + s.keys[name].value = val + } return s.keys[name], nil } s.keyList = append(s.keyList, name) - s.keys[name] = &Key{ - s: s, - name: name, - value: val, - } + s.keys[name] = newKey(s, name, val) s.keysHash[name] = val return s.keys[name], nil } diff --git a/vendor/github.com/google/go-github/LICENSE b/vendor/github.com/google/go-github/LICENSE index 0a756594f6..53d5374a71 100644 --- a/vendor/github.com/google/go-github/LICENSE +++ b/vendor/github.com/google/go-github/LICENSE @@ -29,7 +29,7 @@ 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 +, 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. diff --git a/vendor/github.com/google/go-github/github/activity.go b/vendor/github.com/google/go-github/github/activity.go index d719ebb839..d6c992c7f5 100644 --- a/vendor/github.com/google/go-github/github/activity.go +++ b/vendor/github.com/google/go-github/github/activity.go @@ -5,10 +5,12 @@ package github +import "context" + // ActivityService handles communication with the activity related // methods of the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/activity/ +// GitHub API docs: https://developer.github.com/v3/activity/ type ActivityService service // FeedLink represents a link to a related resource. @@ -51,14 +53,14 @@ type Feeds struct { // // 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() (*Feeds, *Response, error) { +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(req, f) + resp, err := s.client.Do(ctx, req, f) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/activity_events.go b/vendor/github.com/google/go-github/github/activity_events.go index 5cdcabe656..4e64785951 100644 --- a/vendor/github.com/google/go-github/github/activity_events.go +++ b/vendor/github.com/google/go-github/github/activity_events.go @@ -6,6 +6,7 @@ package github import ( + "context" "encoding/json" "fmt" "time" @@ -49,8 +50,6 @@ func (e *Event) Payload() (payload interface{}) { payload = &IntegrationInstallationEvent{} case "IntegrationInstallationRepositoriesEvent": payload = &IntegrationInstallationRepositoriesEvent{} - case "IssueActivityEvent": - payload = &IssueActivityEvent{} case "IssueCommentEvent": payload = &IssueCommentEvent{} case "IssuesEvent": @@ -98,8 +97,8 @@ func (e *Event) Payload() (payload interface{}) { // ListEvents drinks from the firehose of all public events across GitHub. // -// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events -func (s *ActivityService) ListEvents(opt *ListOptions) ([]*Event, *Response, error) { +// 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 @@ -111,7 +110,7 @@ func (s *ActivityService) ListEvents(opt *ListOptions) ([]*Event, *Response, err } var events []*Event - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -121,8 +120,8 @@ func (s *ActivityService) ListEvents(opt *ListOptions) ([]*Event, *Response, err // ListRepositoryEvents lists events for a repository. // -// GitHub API docs: http://developer.github.com/v3/activity/events/#list-repository-events -func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) { +// 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 { @@ -135,7 +134,7 @@ func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOpti } var events []*Event - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -145,8 +144,8 @@ func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOpti // ListIssueEventsForRepository lists issue events for a repository. // -// GitHub API docs: http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository -func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) { +// 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 { @@ -159,7 +158,7 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt * } var events []*IssueEvent - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -169,8 +168,8 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt * // ListEventsForRepoNetwork lists public events for a network of repositories. // -// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories -func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) { +// 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 { @@ -183,7 +182,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *List } var events []*Event - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -193,8 +192,8 @@ func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *List // ListEventsForOrganization lists public events for an organization. // -// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-an-organization -func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions) ([]*Event, *Response, error) { +// 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 { @@ -207,7 +206,7 @@ func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions } var events []*Event - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -218,8 +217,8 @@ func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions // ListEventsPerformedByUser lists the events performed by a user. If publicOnly is // true, only public events will be returned. // -// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user -func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) { +// 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) @@ -237,7 +236,7 @@ func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool } var events []*Event - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -248,8 +247,8 @@ func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool // ListEventsReceivedByUser lists the events received by a user. If publicOnly is // true, only public events will be returned. // -// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received -func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) { +// 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) @@ -267,7 +266,7 @@ func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool, } var events []*Event - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -278,8 +277,8 @@ func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool, // ListUserEventsForOrganization provides the user’s organization dashboard. You // must be authenticated as the user to view this. // -// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-for-an-organization -func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *ListOptions) ([]*Event, *Response, error) { +// 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 { @@ -292,7 +291,7 @@ func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *L } var events []*Event - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/activity_notifications.go b/vendor/github.com/google/go-github/github/activity_notifications.go index 5ae80ad6ce..45c8b2aece 100644 --- a/vendor/github.com/google/go-github/github/activity_notifications.go +++ b/vendor/github.com/google/go-github/github/activity_notifications.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -18,7 +19,7 @@ type Notification struct { // Reason identifies the event that triggered the notification. // - // GitHub API Docs: https://developer.github.com/v3/activity/notifications/#notification-reasons + // GitHub API docs: https://developer.github.com/v3/activity/notifications/#notification-reasons Reason *string `json:"reason,omitempty"` Unread *bool `json:"unread,omitempty"` @@ -48,8 +49,8 @@ type NotificationListOptions struct { // 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(opt *NotificationListOptions) ([]*Notification, *Response, error) { +// 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 { @@ -62,7 +63,7 @@ func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]*No } var notifications []*Notification - resp, err := s.client.Do(req, ¬ifications) + resp, err := s.client.Do(ctx, req, ¬ifications) if err != nil { return nil, resp, err } @@ -73,8 +74,8 @@ func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]*No // 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(owner, repo string, opt *NotificationListOptions) ([]*Notification, *Response, error) { +// 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 { @@ -87,7 +88,7 @@ func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *N } var notifications []*Notification - resp, err := s.client.Do(req, ¬ifications) + resp, err := s.client.Do(ctx, req, ¬ifications) if err != nil { return nil, resp, err } @@ -101,8 +102,8 @@ type markReadOptions struct { // 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(lastRead time.Time) (*Response, error) { +// 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, } @@ -111,14 +112,14 @@ func (s *ActivityService) MarkNotificationsRead(lastRead time.Time) (*Response, return nil, err } - return s.client.Do(req, nil) + 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(owner, repo string, lastRead time.Time) (*Response, error) { +// 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, } @@ -128,13 +129,13 @@ func (s *ActivityService) MarkRepositoryNotificationsRead(owner, repo string, la return nil, err } - return s.client.Do(req, nil) + 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(id string) (*Notification, *Response, error) { +// 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) @@ -143,7 +144,7 @@ func (s *ActivityService) GetThread(id string) (*Notification, *Response, error) } notification := new(Notification) - resp, err := s.client.Do(req, notification) + resp, err := s.client.Do(ctx, req, notification) if err != nil { return nil, resp, err } @@ -153,8 +154,8 @@ func (s *ActivityService) GetThread(id string) (*Notification, *Response, error) // 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(id string) (*Response, error) { +// 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) @@ -162,14 +163,14 @@ func (s *ActivityService) MarkThreadRead(id string) (*Response, error) { return nil, err } - return s.client.Do(req, nil) + 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(id string) (*Subscription, *Response, error) { +// 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) @@ -178,7 +179,7 @@ func (s *ActivityService) GetThreadSubscription(id string) (*Subscription, *Resp } sub := new(Subscription) - resp, err := s.client.Do(req, sub) + resp, err := s.client.Do(ctx, req, sub) if err != nil { return nil, resp, err } @@ -189,8 +190,8 @@ func (s *ActivityService) GetThreadSubscription(id string) (*Subscription, *Resp // 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(id string, subscription *Subscription) (*Subscription, *Response, error) { +// 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) @@ -199,7 +200,7 @@ func (s *ActivityService) SetThreadSubscription(id string, subscription *Subscri } sub := new(Subscription) - resp, err := s.client.Do(req, sub) + resp, err := s.client.Do(ctx, req, sub) if err != nil { return nil, resp, err } @@ -210,13 +211,13 @@ func (s *ActivityService) SetThreadSubscription(id string, subscription *Subscri // 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(id string) (*Response, error) { +// 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(req, nil) + 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 index 2d5becfaf7..d5b067127c 100644 --- a/vendor/github.com/google/go-github/github/activity_star.go +++ b/vendor/github.com/google/go-github/github/activity_star.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // StarredRepository is returned by ListStarred. type StarredRepository struct { @@ -21,8 +24,8 @@ type Stargazer struct { // 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(owner, repo string, opt *ListOptions) ([]*Stargazer, *Response, error) { +// 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 { @@ -38,7 +41,7 @@ func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) ( req.Header.Set("Accept", mediaTypeStarringPreview) var stargazers []*Stargazer - resp, err := s.client.Do(req, &stargazers) + resp, err := s.client.Do(ctx, req, &stargazers) if err != nil { return nil, resp, err } @@ -63,8 +66,8 @@ type ActivityListStarredOptions struct { // 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: http://developer.github.com/v3/activity/starring/#list-repositories-being-starred -func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) { +// 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) @@ -85,7 +88,7 @@ func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptio req.Header.Set("Accept", mediaTypeStarringPreview) var repos []*StarredRepository - resp, err := s.client.Do(req, &repos) + resp, err := s.client.Do(ctx, req, &repos) if err != nil { return nil, resp, err } @@ -96,13 +99,13 @@ func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptio // 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(owner, repo string) (bool, *Response, error) { +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(req, nil) + resp, err := s.client.Do(ctx, req, nil) starred, err := parseBoolResponse(err) return starred, resp, err } @@ -110,23 +113,23 @@ func (s *ActivityService) IsStarred(owner, repo string) (bool, *Response, error) // Star a repository as the authenticated user. // // GitHub API docs: https://developer.github.com/v3/activity/starring/#star-a-repository -func (s *ActivityService) Star(owner, repo string) (*Response, error) { +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(req, nil) + 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(owner, repo string) (*Response, error) { +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(req, nil) + 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 index 22d56c54f4..c749ca86e7 100644 --- a/vendor/github.com/google/go-github/github/activity_watching.go +++ b/vendor/github.com/google/go-github/github/activity_watching.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Subscription identifies a repository or thread subscription. type Subscription struct { @@ -24,8 +27,8 @@ type Subscription struct { // ListWatchers lists watchers of a particular repo. // -// GitHub API Docs: http://developer.github.com/v3/activity/watching/#list-watchers -func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]*User, *Response, error) { +// 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 { @@ -38,7 +41,7 @@ func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([] } var watchers []*User - resp, err := s.client.Do(req, &watchers) + resp, err := s.client.Do(ctx, req, &watchers) if err != nil { return nil, resp, err } @@ -49,8 +52,8 @@ func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([] // 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(user string, opt *ListOptions) ([]*Repository, *Response, error) { +// 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) @@ -68,7 +71,7 @@ func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]*Reposit } var watched []*Repository - resp, err := s.client.Do(req, &watched) + resp, err := s.client.Do(ctx, req, &watched) if err != nil { return nil, resp, err } @@ -80,8 +83,8 @@ func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]*Reposit // 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(owner, repo string) (*Subscription, *Response, error) { +// 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) @@ -90,7 +93,7 @@ func (s *ActivityService) GetRepositorySubscription(owner, repo string) (*Subscr } sub := new(Subscription) - resp, err := s.client.Do(req, sub) + 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) @@ -107,8 +110,8 @@ func (s *ActivityService) GetRepositorySubscription(owner, repo string) (*Subscr // 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(owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { +// 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) @@ -117,7 +120,7 @@ func (s *ActivityService) SetRepositorySubscription(owner, repo string, subscrip } sub := new(Subscription) - resp, err := s.client.Do(req, sub) + resp, err := s.client.Do(ctx, req, sub) if err != nil { return nil, resp, err } @@ -131,13 +134,13 @@ func (s *ActivityService) SetRepositorySubscription(owner, repo string, subscrip // 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(owner, repo string) (*Response, error) { +// 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(req, nil) + 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 index f77b2a23fc..d0f055bcfa 100644 --- a/vendor/github.com/google/go-github/github/admin.go +++ b/vendor/github.com/google/go-github/github/admin.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // AdminService handles communication with the admin related methods of the // GitHub API. These API routes are normally only accessible for GitHub @@ -62,7 +65,7 @@ func (m UserLDAPMapping) String() string { // 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(user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { +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 { @@ -70,7 +73,7 @@ func (s *AdminService) UpdateUserLDAPMapping(user string, mapping *UserLDAPMappi } m := new(UserLDAPMapping) - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -81,7 +84,7 @@ func (s *AdminService) UpdateUserLDAPMapping(user string, mapping *UserLDAPMappi // 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(team int, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { +func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int, 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 { @@ -89,7 +92,7 @@ func (s *AdminService) UpdateTeamLDAPMapping(team int, mapping *TeamLDAPMapping) } m := new(TeamLDAPMapping) - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/authorizations.go b/vendor/github.com/google/go-github/github/authorizations.go index b50de5eec7..181e83dfe5 100644 --- a/vendor/github.com/google/go-github/github/authorizations.go +++ b/vendor/github.com/google/go-github/github/authorizations.go @@ -5,11 +5,14 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Scope models a GitHub authorization scope. // -// GitHub API docs:https://developer.github.com/v3/oauth/#scopes +// GitHub API docs: https://developer.github.com/v3/oauth/#scopes type Scope string // This is the set of scopes for GitHub API V3 @@ -134,7 +137,7 @@ func (a AuthorizationUpdateRequest) String() string { // List the authorizations for the authenticated user. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations -func (s *AuthorizationsService) List(opt *ListOptions) ([]*Authorization, *Response, error) { +func (s *AuthorizationsService) List(ctx context.Context, opt *ListOptions) ([]*Authorization, *Response, error) { u := "authorizations" u, err := addOptions(u, opt) if err != nil { @@ -147,7 +150,7 @@ func (s *AuthorizationsService) List(opt *ListOptions) ([]*Authorization, *Respo } var auths []*Authorization - resp, err := s.client.Do(req, &auths) + resp, err := s.client.Do(ctx, req, &auths) if err != nil { return nil, resp, err } @@ -157,7 +160,7 @@ func (s *AuthorizationsService) List(opt *ListOptions) ([]*Authorization, *Respo // Get a single authorization. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-authorization -func (s *AuthorizationsService) Get(id int) (*Authorization, *Response, error) { +func (s *AuthorizationsService) Get(ctx context.Context, id int) (*Authorization, *Response, error) { u := fmt.Sprintf("authorizations/%d", id) req, err := s.client.NewRequest("GET", u, nil) @@ -166,7 +169,7 @@ func (s *AuthorizationsService) Get(id int) (*Authorization, *Response, error) { } a := new(Authorization) - resp, err := s.client.Do(req, a) + resp, err := s.client.Do(ctx, req, a) if err != nil { return nil, resp, err } @@ -176,7 +179,7 @@ func (s *AuthorizationsService) Get(id int) (*Authorization, *Response, error) { // 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(auth *AuthorizationRequest) (*Authorization, *Response, error) { +func (s *AuthorizationsService) Create(ctx context.Context, auth *AuthorizationRequest) (*Authorization, *Response, error) { u := "authorizations" req, err := s.client.NewRequest("POST", u, auth) @@ -185,7 +188,7 @@ func (s *AuthorizationsService) Create(auth *AuthorizationRequest) (*Authorizati } a := new(Authorization) - resp, err := s.client.Do(req, a) + resp, err := s.client.Do(ctx, req, a) if err != nil { return nil, resp, err } @@ -204,9 +207,9 @@ func (s *AuthorizationsService) Create(auth *AuthorizationRequest) (*Authorizati // 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(clientID string, auth *AuthorizationRequest) (*Authorization, *Response, error) { +// 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) @@ -220,7 +223,7 @@ func (s *AuthorizationsService) GetOrCreateForApp(clientID string, auth *Authori } a := new(Authorization) - resp, err := s.client.Do(req, a) + resp, err := s.client.Do(ctx, req, a) if err != nil { return nil, resp, err } @@ -231,7 +234,7 @@ func (s *AuthorizationsService) GetOrCreateForApp(clientID string, auth *Authori // Edit a single authorization. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization -func (s *AuthorizationsService) Edit(id int, auth *AuthorizationUpdateRequest) (*Authorization, *Response, error) { +func (s *AuthorizationsService) Edit(ctx context.Context, id int, auth *AuthorizationUpdateRequest) (*Authorization, *Response, error) { u := fmt.Sprintf("authorizations/%d", id) req, err := s.client.NewRequest("PATCH", u, auth) @@ -240,7 +243,7 @@ func (s *AuthorizationsService) Edit(id int, auth *AuthorizationUpdateRequest) ( } a := new(Authorization) - resp, err := s.client.Do(req, a) + resp, err := s.client.Do(ctx, req, a) if err != nil { return nil, resp, err } @@ -251,7 +254,7 @@ func (s *AuthorizationsService) Edit(id int, auth *AuthorizationUpdateRequest) ( // Delete a single authorization. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization -func (s *AuthorizationsService) Delete(id int) (*Response, error) { +func (s *AuthorizationsService) Delete(ctx context.Context, id int) (*Response, error) { u := fmt.Sprintf("authorizations/%d", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -259,7 +262,7 @@ func (s *AuthorizationsService) Delete(id int) (*Response, error) { return nil, err } - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // Check if an OAuth token is valid for a specific app. @@ -271,7 +274,7 @@ func (s *AuthorizationsService) Delete(id int) (*Response, error) { // 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(clientID string, token string) (*Authorization, *Response, error) { +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) @@ -280,7 +283,7 @@ func (s *AuthorizationsService) Check(clientID string, token string) (*Authoriza } a := new(Authorization) - resp, err := s.client.Do(req, a) + resp, err := s.client.Do(ctx, req, a) if err != nil { return nil, resp, err } @@ -299,7 +302,7 @@ func (s *AuthorizationsService) Check(clientID string, token string) (*Authoriza // 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(clientID string, token string) (*Authorization, *Response, error) { +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) @@ -308,7 +311,7 @@ func (s *AuthorizationsService) Reset(clientID string, token string) (*Authoriza } a := new(Authorization) - resp, err := s.client.Do(req, a) + resp, err := s.client.Do(ctx, req, a) if err != nil { return nil, resp, err } @@ -323,7 +326,7 @@ func (s *AuthorizationsService) Reset(clientID string, token string) (*Authoriza // 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(clientID string, token string) (*Response, error) { +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) @@ -331,7 +334,7 @@ func (s *AuthorizationsService) Revoke(clientID string, token string) (*Response return nil, err } - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // ListGrants lists the set of OAuth applications that have been granted @@ -340,14 +343,14 @@ func (s *AuthorizationsService) Revoke(clientID string, token string) (*Response // 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() ([]*Grant, *Response, error) { +func (s *AuthorizationsService) ListGrants(ctx context.Context) ([]*Grant, *Response, error) { req, err := s.client.NewRequest("GET", "applications/grants", nil) if err != nil { return nil, nil, err } grants := []*Grant{} - resp, err := s.client.Do(req, &grants) + resp, err := s.client.Do(ctx, req, &grants) if err != nil { return nil, resp, err } @@ -358,7 +361,7 @@ func (s *AuthorizationsService) ListGrants() ([]*Grant, *Response, error) { // 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(id int) (*Grant, *Response, error) { +func (s *AuthorizationsService) GetGrant(ctx context.Context, id int) (*Grant, *Response, error) { u := fmt.Sprintf("applications/grants/%d", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -366,7 +369,7 @@ func (s *AuthorizationsService) GetGrant(id int) (*Grant, *Response, error) { } grant := new(Grant) - resp, err := s.client.Do(req, grant) + resp, err := s.client.Do(ctx, req, grant) if err != nil { return nil, resp, err } @@ -379,14 +382,14 @@ func (s *AuthorizationsService) GetGrant(id int) (*Grant, *Response, error) { // the user. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-a-grant -func (s *AuthorizationsService) DeleteGrant(id int) (*Response, error) { +func (s *AuthorizationsService) DeleteGrant(ctx context.Context, id int) (*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(req, nil) + return s.client.Do(ctx, req, nil) } // CreateImpersonation creates an impersonation OAuth token. @@ -396,7 +399,7 @@ func (s *AuthorizationsService) DeleteGrant(id int) (*Response, error) { // 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(username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { +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 { @@ -404,7 +407,7 @@ func (s *AuthorizationsService) CreateImpersonation(username string, authReq *Au } a := new(Authorization) - resp, err := s.client.Do(req, a) + resp, err := s.client.Do(ctx, req, a) if err != nil { return nil, resp, err } @@ -416,12 +419,12 @@ func (s *AuthorizationsService) CreateImpersonation(username string, authReq *Au // 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(username string) (*Response, error) { +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(req, nil) + 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 index 659dd8248a..875f039648 100644 --- a/vendor/github.com/google/go-github/github/doc.go +++ b/vendor/github.com/google/go-github/github/doc.go @@ -16,7 +16,7 @@ access different parts of the GitHub API. For example: client := github.NewClient(nil) // list all organizations for user "willnorris" - orgs, _, err := client.Organizations.List("willnorris", nil) + orgs, _, err := client.Organizations.List(ctx, "willnorris", nil) Some API methods have optional parameters that can be passed. For example: @@ -24,11 +24,11 @@ Some API methods have optional parameters that can be passed. For example: // list public repositories for org "github" opt := &github.RepositoryListByOrgOptions{Type: "public"} - repos, _, err := client.Repositories.ListByOrg("github", opt) + 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 -http://developer.github.com/v3/. +https://developer.github.com/v3/. Authentication @@ -42,15 +42,16 @@ 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(oauth2.NoContext, ts) + tc := oauth2.NewClient(ctx, ts) client := github.NewClient(tc) // list all repositories for the authenticated user - repos, _, err := client.Repositories.List("", nil) + repos, _, err := client.Repositories.List(ctx, "", nil) } Note that when using an authenticated Client, all calls made by the client will @@ -78,13 +79,13 @@ 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("", nil) + 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 -http://developer.github.com/v3/#rate-limiting. +https://developer.github.com/v3/#rate-limiting. Accepted Status @@ -96,7 +97,7 @@ this behavior. To detect this condition of error, you can check if its type is *github.AcceptedError: - stats, _, err := client.Repositories.ListContributorsStats(org, repo) + stats, _, err := client.Repositories.ListContributorsStats(ctx, org, repo) if _, ok := err.(*github.AcceptedError); ok { log.Println("scheduled on GitHub side") } @@ -124,7 +125,7 @@ bool, and int values. For example: Name: github.String("foo"), Private: github.Bool(true), } - client.Repositories.Create("", repo) + client.Repositories.Create(ctx, "", repo) Users who have worked with protocol buffers should find this pattern familiar. @@ -145,7 +146,7 @@ github.Response struct. // get all pages of results var allRepos []*github.Repository for { - repos, resp, err := client.Repositories.ListByOrg("github", opt) + repos, resp, err := client.Repositories.ListByOrg(ctx, "github", opt) if err != nil { return err } diff --git a/vendor/github.com/google/go-github/github/event_types.go b/vendor/github.com/google/go-github/github/event_types.go index 6dd7fe3796..7617a31c8f 100644 --- a/vendor/github.com/google/go-github/github/event_types.go +++ b/vendor/github.com/google/go-github/github/event_types.go @@ -10,7 +10,7 @@ package github // CommitCommentEvent is triggered when a commit comment is created. // The Webhook event name is "commit_comment". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#commitcommentevent +// GitHub API docs: https://developer.github.com/v3/activity/events/types/#commitcommentevent type CommitCommentEvent struct { Comment *RepositoryComment `json:"comment,omitempty"` @@ -28,7 +28,7 @@ type CommitCommentEvent struct { // Additionally, webhooks will not receive this event for tags if more // than three tags are pushed at once. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#createevent +// 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". @@ -49,7 +49,7 @@ type CreateEvent struct { // Note: webhooks will not receive this event for tags if more than three tags // are deleted at once. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#deleteevent +// 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". @@ -67,7 +67,7 @@ type DeleteEvent struct { // // Events of this type are not visible in timelines, they are only used to trigger hooks. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#deploymentevent +// 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"` @@ -82,7 +82,7 @@ type DeploymentEvent struct { // // Events of this type are not visible in timelines, they are only used to trigger hooks. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#deploymentstatusevent +// 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"` @@ -96,7 +96,7 @@ type DeploymentStatusEvent struct { // ForkEvent is triggered when a user forks a repository. // The Webhook event name is "fork". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#forkevent +// 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"` @@ -120,7 +120,7 @@ type Page struct { // GollumEvent is triggered when a Wiki page is created or updated. // The Webhook event name is "gollum". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#gollumevent +// GitHub API docs: https://developer.github.com/v3/activity/events/types/#gollumevent type GollumEvent struct { Pages []*Page `json:"pages,omitempty"` @@ -130,19 +130,6 @@ type GollumEvent struct { Installation *Installation `json:"installation,omitempty"` } -// IssueActivityEvent represents the payload delivered by Issue webhook. -// -// Deprecated: Use IssuesEvent instead. -type IssueActivityEvent struct { - Action *string `json:"action,omitempty"` - Issue *Issue `json:"issue,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 { @@ -157,7 +144,7 @@ type EditChange struct { // IntegrationInstallationEvent is triggered when an integration is created or deleted. // The Webhook event name is "integration_installation". // -// GitHub docs: https://developer.github.com/early-access/integrations/webhooks/#integrationinstallationevent +// GitHub API docs: https://developer.github.com/early-access/integrations/webhooks/#integrationinstallationevent type IntegrationInstallationEvent struct { // The action that was performed. Possible values for an "integration_installation" // event are: "created", "deleted". @@ -169,7 +156,7 @@ type IntegrationInstallationEvent struct { // IntegrationInstallationRepositoriesEvent is triggered when an integration repository // is added or removed. The Webhook event name is "integration_installation_repositories". // -// GitHub docs: https://developer.github.com/early-access/integrations/webhooks/#integrationinstallationrepositoriesevent +// GitHub API docs: https://developer.github.com/early-access/integrations/webhooks/#integrationinstallationrepositoriesevent type IntegrationInstallationRepositoriesEvent struct { // The action that was performed. Possible values for an "integration_installation_repositories" // event are: "added", "removed". @@ -184,7 +171,7 @@ type IntegrationInstallationRepositoriesEvent struct { // or pull request. // The Webhook event name is "issue_comment". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#issuecommentevent +// 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". @@ -203,7 +190,7 @@ type IssueCommentEvent struct { // unlabeled, opened, closed, or reopened. // The Webhook event name is "issues". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#issuesevent +// 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". @@ -222,7 +209,7 @@ type IssuesEvent struct { // LabelEvent is triggered when a repository's label is created, edited, or deleted. // The Webhook event name is "label" // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#labelevent +// 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" @@ -239,7 +226,7 @@ type LabelEvent struct { // MemberEvent is triggered when a user is added as a collaborator to a repository. // The Webhook event name is "member". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#memberevent +// 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"` @@ -257,7 +244,7 @@ type MemberEvent struct { // Events of this type are not visible in timelines, they are only used to // trigger organization webhooks. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#membershipevent +// 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"` @@ -275,7 +262,7 @@ type MembershipEvent struct { // MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted. // The Webhook event name is "milestone". // -// Github docs: https://developer.github.com/v3/activity/events/types/#milestoneevent +// 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" @@ -294,7 +281,7 @@ type MilestoneEvent struct { // Events of this type are not visible in timelines. These events are only used to trigger organization hooks. // Webhook event name is "organization". // -// Github docs: https://developer.github.com/v3/activity/events/types/#organizationevent +// 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". @@ -321,7 +308,7 @@ type OrganizationEvent struct { // // Events of this type are not visible in timelines, they are only used to trigger hooks. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#pagebuildevent +// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pagebuildevent type PageBuildEvent struct { Build *PagesBuild `json:"build,omitempty"` @@ -334,7 +321,7 @@ type PageBuildEvent struct { // PingEvent is triggered when a Webhook is added to GitHub. // -// GitHub docs: https://developer.github.com/webhooks/#ping-event +// GitHub API docs: https://developer.github.com/webhooks/#ping-event type PingEvent struct { // Random string of GitHub zen. Zen *string `json:"zen,omitempty"` @@ -349,7 +336,7 @@ type PingEvent struct { // According to GitHub: "Without a doubt: the best GitHub event." // The Webhook event name is "public". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#publicevent +// 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"` @@ -361,7 +348,7 @@ type PublicEvent struct { // labeled, unlabeled, opened, closed, reopened, or synchronized. // The Webhook event name is "pull_request". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#pullrequestevent +// 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", "labeled", "unlabeled", "opened", "closed", or "reopened", @@ -383,7 +370,7 @@ type PullRequestEvent struct { // request. // The Webhook event name is "pull_request_review". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent +// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent type PullRequestReviewEvent struct { // Action is always "submitted". Action *string `json:"action,omitempty"` @@ -404,7 +391,7 @@ type PullRequestReviewEvent struct { // portion of the unified diff of a pull request. // The Webhook event name is "pull_request_review_comment". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent +// 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". @@ -421,7 +408,7 @@ type PullRequestReviewCommentEvent struct { // PushEvent represents a git push to a GitHub repository. // -// GitHub API docs: http://developer.github.com/v3/activity/events/types/#pushevent +// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pushevent type PushEvent struct { PushID *int `json:"push_id,omitempty"` Head *string `json:"head,omitempty"` @@ -517,7 +504,7 @@ type PushEventRepoOwner struct { // ReleaseEvent is triggered when a release is published. // The Webhook event name is "release". // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#releaseevent +// 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"` @@ -535,7 +522,7 @@ type ReleaseEvent struct { // Events of this type are not visible in timelines, they are only used to // trigger organization webhooks. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#repositoryevent +// 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". @@ -554,7 +541,7 @@ type RepositoryEvent struct { // Events of this type are not visible in timelines, they are only used to // trigger hooks. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#statusevent +// 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". @@ -581,7 +568,7 @@ type StatusEvent struct { // Events of this type are not visible in timelines. These events are only used // to trigger hooks. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#teamaddevent +// 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"` @@ -598,7 +585,7 @@ type TeamAddEvent struct { // The event’s actor is the user who starred a repository, and the event’s // repository is the repository that was starred. // -// GitHub docs: https://developer.github.com/v3/activity/events/types/#watchevent +// 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"` diff --git a/vendor/github.com/google/go-github/github/gists.go b/vendor/github.com/google/go-github/github/gists.go index 42771d4df9..8b84d21b0e 100644 --- a/vendor/github.com/google/go-github/github/gists.go +++ b/vendor/github.com/google/go-github/github/gists.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -13,7 +14,7 @@ import ( // GistsService handles communication with the Gist related // methods of the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/gists/ +// GitHub API docs: https://developer.github.com/v3/gists/ type GistsService service // Gist represents a GitHub's gist. @@ -92,8 +93,8 @@ type GistListOptions struct { // is authenticated, it will returns all gists for the authenticated // user. // -// GitHub API docs: http://developer.github.com/v3/gists/#list-gists -func (s *GistsService) List(user string, opt *GistListOptions) ([]*Gist, *Response, error) { +// 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) @@ -111,7 +112,7 @@ func (s *GistsService) List(user string, opt *GistListOptions) ([]*Gist, *Respon } var gists []*Gist - resp, err := s.client.Do(req, &gists) + resp, err := s.client.Do(ctx, req, &gists) if err != nil { return nil, resp, err } @@ -121,8 +122,8 @@ func (s *GistsService) List(user string, opt *GistListOptions) ([]*Gist, *Respon // ListAll lists all public gists. // -// GitHub API docs: http://developer.github.com/v3/gists/#list-gists -func (s *GistsService) ListAll(opt *GistListOptions) ([]*Gist, *Response, error) { +// 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 @@ -134,7 +135,7 @@ func (s *GistsService) ListAll(opt *GistListOptions) ([]*Gist, *Response, error) } var gists []*Gist - resp, err := s.client.Do(req, &gists) + resp, err := s.client.Do(ctx, req, &gists) if err != nil { return nil, resp, err } @@ -144,8 +145,8 @@ func (s *GistsService) ListAll(opt *GistListOptions) ([]*Gist, *Response, error) // ListStarred lists starred gists of authenticated user. // -// GitHub API docs: http://developer.github.com/v3/gists/#list-gists -func (s *GistsService) ListStarred(opt *GistListOptions) ([]*Gist, *Response, error) { +// 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 @@ -157,7 +158,7 @@ func (s *GistsService) ListStarred(opt *GistListOptions) ([]*Gist, *Response, er } var gists []*Gist - resp, err := s.client.Do(req, &gists) + resp, err := s.client.Do(ctx, req, &gists) if err != nil { return nil, resp, err } @@ -167,15 +168,15 @@ func (s *GistsService) ListStarred(opt *GistListOptions) ([]*Gist, *Response, er // Get a single gist. // -// GitHub API docs: http://developer.github.com/v3/gists/#get-a-single-gist -func (s *GistsService) Get(id string) (*Gist, *Response, error) { +// 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 } gist := new(Gist) - resp, err := s.client.Do(req, gist) + resp, err := s.client.Do(ctx, req, gist) if err != nil { return nil, resp, err } @@ -186,14 +187,14 @@ func (s *GistsService) Get(id string) (*Gist, *Response, error) { // 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(id, sha string) (*Gist, *Response, error) { +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 } gist := new(Gist) - resp, err := s.client.Do(req, gist) + resp, err := s.client.Do(ctx, req, gist) if err != nil { return nil, resp, err } @@ -203,15 +204,15 @@ func (s *GistsService) GetRevision(id, sha string) (*Gist, *Response, error) { // Create a gist for authenticated user. // -// GitHub API docs: http://developer.github.com/v3/gists/#create-a-gist -func (s *GistsService) Create(gist *Gist) (*Gist, *Response, error) { +// 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 } g := new(Gist) - resp, err := s.client.Do(req, g) + resp, err := s.client.Do(ctx, req, g) if err != nil { return nil, resp, err } @@ -221,15 +222,15 @@ func (s *GistsService) Create(gist *Gist) (*Gist, *Response, error) { // Edit a gist. // -// GitHub API docs: http://developer.github.com/v3/gists/#edit-a-gist -func (s *GistsService) Edit(id string, gist *Gist) (*Gist, *Response, error) { +// 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 } g := new(Gist) - resp, err := s.client.Do(req, g) + resp, err := s.client.Do(ctx, req, g) if err != nil { return nil, resp, err } @@ -239,8 +240,8 @@ func (s *GistsService) Edit(id string, gist *Gist) (*Gist, *Response, error) { // ListCommits lists commits of a gist. // -// Github API docs: https://developer.github.com/v3/gists/#list-gist-commits -func (s *GistsService) ListCommits(id string) ([]*GistCommit, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/gists/#list-gist-commits +func (s *GistsService) ListCommits(ctx context.Context, id string) ([]*GistCommit, *Response, error) { u := fmt.Sprintf("gists/%v/commits", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -248,7 +249,7 @@ func (s *GistsService) ListCommits(id string) ([]*GistCommit, *Response, error) } var gistCommits []*GistCommit - resp, err := s.client.Do(req, &gistCommits) + resp, err := s.client.Do(ctx, req, &gistCommits) if err != nil { return nil, resp, err } @@ -258,58 +259,58 @@ func (s *GistsService) ListCommits(id string) ([]*GistCommit, *Response, error) // Delete a gist. // -// GitHub API docs: http://developer.github.com/v3/gists/#delete-a-gist -func (s *GistsService) Delete(id string) (*Response, error) { +// 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(req, nil) + return s.client.Do(ctx, req, nil) } // Star a gist on behalf of authenticated user. // -// GitHub API docs: http://developer.github.com/v3/gists/#star-a-gist -func (s *GistsService) Star(id string) (*Response, error) { +// 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(req, nil) + return s.client.Do(ctx, req, nil) } // Unstar a gist on a behalf of authenticated user. // -// Github API docs: http://developer.github.com/v3/gists/#unstar-a-gist -func (s *GistsService) Unstar(id string) (*Response, error) { +// 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(req, nil) + return s.client.Do(ctx, req, nil) } // IsStarred checks if a gist is starred by authenticated user. // -// GitHub API docs: http://developer.github.com/v3/gists/#check-if-a-gist-is-starred -func (s *GistsService) IsStarred(id string) (bool, *Response, error) { +// 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(req, nil) + resp, err := s.client.Do(ctx, req, nil) starred, err := parseBoolResponse(err) return starred, resp, err } // Fork a gist. // -// GitHub API docs: http://developer.github.com/v3/gists/#fork-a-gist -func (s *GistsService) Fork(id string) (*Gist, *Response, error) { +// 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 { @@ -317,7 +318,7 @@ func (s *GistsService) Fork(id string) (*Gist, *Response, error) { } g := new(Gist) - resp, err := s.client.Do(req, g) + resp, err := s.client.Do(ctx, req, g) if err != nil { return nil, resp, err } @@ -327,8 +328,8 @@ func (s *GistsService) Fork(id string) (*Gist, *Response, error) { // ListForks lists forks of a gist. // -// Github API docs: https://developer.github.com/v3/gists/#list-gist-forks -func (s *GistsService) ListForks(id string) ([]*GistFork, *Response, error) { +// 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 { @@ -336,7 +337,7 @@ func (s *GistsService) ListForks(id string) ([]*GistFork, *Response, error) { } var gistForks []*GistFork - resp, err := s.client.Do(req, &gistForks) + resp, err := s.client.Do(ctx, req, &gistForks) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/gists_comments.go b/vendor/github.com/google/go-github/github/gists_comments.go index cab17e58f2..2d0722375e 100644 --- a/vendor/github.com/google/go-github/github/gists_comments.go +++ b/vendor/github.com/google/go-github/github/gists_comments.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -25,8 +26,8 @@ func (g GistComment) String() string { // ListComments lists all comments for a gist. // -// GitHub API docs: http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist -func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]*GistComment, *Response, error) { +// 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 { @@ -39,7 +40,7 @@ func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]*GistCom } var comments []*GistComment - resp, err := s.client.Do(req, &comments) + resp, err := s.client.Do(ctx, req, &comments) if err != nil { return nil, resp, err } @@ -49,8 +50,8 @@ func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]*GistCom // GetComment retrieves a single comment from a gist. // -// GitHub API docs: http://developer.github.com/v3/gists/comments/#get-a-single-comment -func (s *GistsService) GetComment(gistID string, commentID int) (*GistComment, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/gists/comments/#get-a-single-comment +func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -58,7 +59,7 @@ func (s *GistsService) GetComment(gistID string, commentID int) (*GistComment, * } c := new(GistComment) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -68,8 +69,8 @@ func (s *GistsService) GetComment(gistID string, commentID int) (*GistComment, * // CreateComment creates a comment for a gist. // -// GitHub API docs: http://developer.github.com/v3/gists/comments/#create-a-comment -func (s *GistsService) CreateComment(gistID string, comment *GistComment) (*GistComment, *Response, error) { +// 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 { @@ -77,7 +78,7 @@ func (s *GistsService) CreateComment(gistID string, comment *GistComment) (*Gist } c := new(GistComment) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -87,8 +88,8 @@ func (s *GistsService) CreateComment(gistID string, comment *GistComment) (*Gist // EditComment edits an existing gist comment. // -// GitHub API docs: http://developer.github.com/v3/gists/comments/#edit-a-comment -func (s *GistsService) EditComment(gistID string, commentID int, comment *GistComment) (*GistComment, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/gists/comments/#edit-a-comment +func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int, 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 { @@ -96,7 +97,7 @@ func (s *GistsService) EditComment(gistID string, commentID int, comment *GistCo } c := new(GistComment) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -106,13 +107,13 @@ func (s *GistsService) EditComment(gistID string, commentID int, comment *GistCo // DeleteComment deletes a gist comment. // -// GitHub API docs: http://developer.github.com/v3/gists/comments/#delete-a-comment -func (s *GistsService) DeleteComment(gistID string, commentID int) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/gists/comments/#delete-a-comment +func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int) (*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(req, nil) + 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 index c934751a9e..1ce47437bd 100644 --- a/vendor/github.com/google/go-github/github/git.go +++ b/vendor/github.com/google/go-github/github/git.go @@ -8,5 +8,5 @@ package github // GitService handles communication with the git data related // methods of the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/git/ +// 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 index 55148fdb41..67ea74a196 100644 --- a/vendor/github.com/google/go-github/github/git_blobs.go +++ b/vendor/github.com/google/go-github/github/git_blobs.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Blob represents a blob object. type Blob struct { @@ -18,8 +21,8 @@ type Blob struct { // GetBlob fetchs a blob from a repo given a SHA. // -// GitHub API docs: http://developer.github.com/v3/git/blobs/#get-a-blob -func (s *GitService) GetBlob(owner string, repo string, sha string) (*Blob, *Response, error) { +// 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 { @@ -27,14 +30,14 @@ func (s *GitService) GetBlob(owner string, repo string, sha string) (*Blob, *Res } blob := new(Blob) - resp, err := s.client.Do(req, 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(owner string, repo string, blob *Blob) (*Blob, *Response, error) { +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 { @@ -42,6 +45,6 @@ func (s *GitService) CreateBlob(owner string, repo string, blob *Blob) (*Blob, * } t := new(Blob) - resp, err := s.client.Do(req, t) + 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 index 5a9f1640ba..b0c4da7b6d 100644 --- a/vendor/github.com/google/go-github/github/git_commits.go +++ b/vendor/github.com/google/go-github/github/git_commits.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -57,8 +58,8 @@ func (c CommitAuthor) String() string { // GetCommit fetchs the Commit object for a given SHA. // -// GitHub API docs: http://developer.github.com/v3/git/commits/#get-a-commit -func (s *GitService) GetCommit(owner string, repo string, sha string) (*Commit, *Response, error) { +// 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 { @@ -69,7 +70,7 @@ func (s *GitService) GetCommit(owner string, repo string, sha string) (*Commit, req.Header.Set("Accept", mediaTypeGitSigningPreview) c := new(Commit) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -92,8 +93,8 @@ type createCommit struct { // 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: http://developer.github.com/v3/git/commits/#create-a-commit -func (s *GitService) CreateCommit(owner string, repo string, commit *Commit) (*Commit, *Response, error) { +// 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) { u := fmt.Sprintf("repos/%v/%v/git/commits", owner, repo) body := &createCommit{} @@ -118,7 +119,7 @@ func (s *GitService) CreateCommit(owner string, repo string, commit *Commit) (*C } c := new(Commit) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/git_refs.go b/vendor/github.com/google/go-github/github/git_refs.go index f8ff299646..bd5df3f72a 100644 --- a/vendor/github.com/google/go-github/github/git_refs.go +++ b/vendor/github.com/google/go-github/github/git_refs.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "strings" ) @@ -46,8 +47,8 @@ type updateRefRequest struct { // GetRef fetches the Reference object for a given Git ref. // -// GitHub API docs: http://developer.github.com/v3/git/refs/#get-a-reference -func (s *GitService) GetRef(owner string, repo string, ref string) (*Reference, *Response, error) { +// 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) @@ -56,7 +57,7 @@ func (s *GitService) GetRef(owner string, repo string, ref string) (*Reference, } r := new(Reference) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -74,8 +75,8 @@ type ReferenceListOptions struct { // ListRefs lists all refs in a repository. // -// GitHub API docs: http://developer.github.com/v3/git/refs/#get-all-references -func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) { +// 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) @@ -93,7 +94,7 @@ func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([] } var rs []*Reference - resp, err := s.client.Do(req, &rs) + resp, err := s.client.Do(ctx, req, &rs) if err != nil { return nil, resp, err } @@ -103,8 +104,8 @@ func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([] // CreateRef creates a new ref in a repository. // -// GitHub API docs: http://developer.github.com/v3/git/refs/#create-a-reference -func (s *GitService) CreateRef(owner string, repo string, ref *Reference) (*Reference, *Response, error) { +// 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 @@ -116,7 +117,7 @@ func (s *GitService) CreateRef(owner string, repo string, ref *Reference) (*Refe } r := new(Reference) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -126,8 +127,8 @@ func (s *GitService) CreateRef(owner string, repo string, ref *Reference) (*Refe // UpdateRef updates an existing ref in a repository. // -// GitHub API docs: http://developer.github.com/v3/git/refs/#update-a-reference -func (s *GitService) UpdateRef(owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) { +// 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{ @@ -139,7 +140,7 @@ func (s *GitService) UpdateRef(owner string, repo string, ref *Reference, force } r := new(Reference) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -149,8 +150,8 @@ func (s *GitService) UpdateRef(owner string, repo string, ref *Reference, force // DeleteRef deletes a ref from a repository. // -// GitHub API docs: http://developer.github.com/v3/git/refs/#delete-a-reference -func (s *GitService) DeleteRef(owner string, repo string, ref string) (*Response, error) { +// 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) @@ -158,5 +159,5 @@ func (s *GitService) DeleteRef(owner string, repo string, ref string) (*Response return nil, err } - return s.client.Do(req, nil) + 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 index 86533a8f3d..08df3d3d1b 100644 --- a/vendor/github.com/google/go-github/github/git_tags.go +++ b/vendor/github.com/google/go-github/github/git_tags.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" ) @@ -33,8 +34,8 @@ type createTagRequest struct { // GetTag fetchs a tag from a repo given a SHA. // -// GitHub API docs: http://developer.github.com/v3/git/tags/#get-a-tag -func (s *GitService) GetTag(owner string, repo string, sha string) (*Tag, *Response, error) { +// 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 { @@ -45,14 +46,14 @@ func (s *GitService) GetTag(owner string, repo string, sha string) (*Tag, *Respo req.Header.Set("Accept", mediaTypeGitSigningPreview) tag := new(Tag) - resp, err := s.client.Do(req, tag) + resp, err := s.client.Do(ctx, req, tag) return tag, resp, err } // CreateTag creates a tag object. // -// GitHub API docs: http://developer.github.com/v3/git/tags/#create-a-tag-object -func (s *GitService) CreateTag(owner string, repo string, tag *Tag) (*Tag, *Response, error) { +// 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 @@ -72,6 +73,6 @@ func (s *GitService) CreateTag(owner string, repo string, tag *Tag) (*Tag, *Resp } t := new(Tag) - resp, err := s.client.Do(req, t) + 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 index 5463c894bf..bdd481f1ee 100644 --- a/vendor/github.com/google/go-github/github/git_trees.go +++ b/vendor/github.com/google/go-github/github/git_trees.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Tree represents a GitHub tree. type Tree struct { @@ -35,8 +38,8 @@ func (t TreeEntry) String() string { // GetTree fetches the Tree object for a given sha hash from a repository. // -// GitHub API docs: http://developer.github.com/v3/git/trees/#get-a-tree -func (s *GitService) GetTree(owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) { +// 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" @@ -48,7 +51,7 @@ func (s *GitService) GetTree(owner string, repo string, sha string, recursive bo } t := new(Tree) - resp, err := s.client.Do(req, t) + resp, err := s.client.Do(ctx, req, t) if err != nil { return nil, resp, err } @@ -66,8 +69,8 @@ type createTree struct { // 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: http://developer.github.com/v3/git/trees/#create-a-tree -func (s *GitService) CreateTree(owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error) { +// 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{ @@ -80,7 +83,7 @@ func (s *GitService) CreateTree(owner string, repo string, baseTree string, entr } t := new(Tree) - resp, err := s.client.Do(req, t) + resp, err := s.client.Do(ctx, req, t) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/github.go b/vendor/github.com/google/go-github/github/github.go index 90edc52e63..f1ddd71660 100644 --- a/vendor/github.com/google/go-github/github/github.go +++ b/vendor/github.com/google/go-github/github/github.go @@ -7,6 +7,7 @@ package github import ( "bytes" + "context" "encoding/json" "errors" "fmt" @@ -24,12 +25,7 @@ import ( ) const ( - // StatusUnprocessableEntity is the status code returned when sending a request with invalid fields. - StatusUnprocessableEntity = 422 -) - -const ( - libraryVersion = "2" + libraryVersion = "3" defaultBaseURL = "https://api.github.com/" uploadBaseURL = "https://uploads.github.com/" userAgent = "go-github/" + libraryVersion @@ -119,7 +115,6 @@ type Client struct { rateMu sync.Mutex rateLimits [categories]Rate // Rate limits for the client as determined by the most recent API calls. - mostRecent rateLimitCategory common service // Reuse a single struct instead of allocating one for each service on the heap. @@ -383,26 +378,18 @@ func parseRate(r *http.Response) Rate { return rate } -// Rate specifies the current rate limit for the client as determined by the -// most recent API call. If the client is used in a multi-user application, -// this rate may not always be up-to-date. -// -// Deprecated: Use the Response.Rate returned from most recent API call instead. -// Call RateLimits() to check the current rate. -func (c *Client) Rate() Rate { - c.rateMu.Lock() - rate := c.rateLimits[c.mostRecent] - c.rateMu.Unlock() - 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. -func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { +// +// 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 = req.WithContext(ctx) + rateLimitCategory := category(req.URL.Path) // If we've hit rate limit, don't make further requests before Reset time. @@ -412,12 +399,22 @@ func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { 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 } @@ -431,7 +428,6 @@ func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { c.rateMu.Lock() c.rateLimits[rateLimitCategory] = response.Rate - c.mostRecent = rateLimitCategory c.rateMu.Unlock() err = CheckResponse(resp) @@ -485,7 +481,7 @@ func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rat /* An ErrorResponse reports one or more errors caused by an API request. -GitHub API docs: http://developer.github.com/v3/#client-errors +GitHub API docs: https://developer.github.com/v3/#client-errors */ type ErrorResponse struct { Response *http.Response // HTTP response that caused this error @@ -591,7 +587,7 @@ These are the possible validation error codes: some resources return this (e.g. github.User.CreateKey()), additional information is set in the Message field of the Error -GitHub API docs: http://developer.github.com/v3/#client-errors +GitHub API docs: https://developer.github.com/v3/#client-errors */ type Error struct { Resource string `json:"resource"` // resource on which the error occurred @@ -730,22 +726,8 @@ func category(path string) rateLimitCategory { } } -// RateLimit returns the core rate limit for the current client. -// -// Deprecated: RateLimit is deprecated, use RateLimits instead. -func (c *Client) RateLimit() (*Rate, *Response, error) { - limits, resp, err := c.RateLimits() - if err != nil { - return nil, resp, err - } - if limits == nil { - return nil, resp, errors.New("RateLimits returned nil limits and error; unable to extract Core rate limit") - } - return limits.Core, resp, nil -} - // RateLimits returns the rate limits for the current client. -func (c *Client) RateLimits() (*RateLimits, *Response, error) { +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 @@ -754,7 +736,7 @@ func (c *Client) RateLimits() (*RateLimits, *Response, error) { response := new(struct { Resources *RateLimits `json:"resources"` }) - resp, err := c.Do(req, response) + resp, err := c.Do(ctx, req, response) if err != nil { return nil, nil, err } @@ -786,7 +768,7 @@ that need to use a higher rate limit associated with your OAuth application. This will append the querystring params client_id=xxx&client_secret=yyy to all requests. -See http://developer.github.com/v3/#unauthenticated-rate-limited-requests for +See https://developer.github.com/v3/#unauthenticated-rate-limited-requests for more information. */ type UnauthenticatedRateLimitedTransport struct { diff --git a/vendor/github.com/google/go-github/github/gitignore.go b/vendor/github.com/google/go-github/github/gitignore.go index d3a9c5ba7b..2f691bc323 100644 --- a/vendor/github.com/google/go-github/github/gitignore.go +++ b/vendor/github.com/google/go-github/github/gitignore.go @@ -5,12 +5,15 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // GitignoresService provides access to the gitignore related functions in the // GitHub API. // -// GitHub API docs: http://developer.github.com/v3/gitignore/ +// GitHub API docs: https://developer.github.com/v3/gitignore/ type GitignoresService service // Gitignore represents a .gitignore file as returned by the GitHub API. @@ -25,15 +28,15 @@ func (g Gitignore) String() string { // List all available Gitignore templates. // -// http://developer.github.com/v3/gitignore/#listing-available-templates -func (s GitignoresService) List() ([]string, *Response, error) { +// 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(req, &availableTemplates) + resp, err := s.client.Do(ctx, req, &availableTemplates) if err != nil { return nil, resp, err } @@ -43,8 +46,8 @@ func (s GitignoresService) List() ([]string, *Response, error) { // Get a Gitignore by name. // -// http://developer.github.com/v3/gitignore/#get-a-single-template -func (s GitignoresService) Get(name string) (*Gitignore, *Response, error) { +// 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 { @@ -52,7 +55,7 @@ func (s GitignoresService) Get(name string) (*Gitignore, *Response, error) { } gitignore := new(Gitignore) - resp, err := s.client.Do(req, gitignore) + resp, err := s.client.Do(ctx, req, gitignore) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/integration.go b/vendor/github.com/google/go-github/github/integration.go index 033ee44aec..6d74e44f00 100644 --- a/vendor/github.com/google/go-github/github/integration.go +++ b/vendor/github.com/google/go-github/github/integration.go @@ -5,6 +5,8 @@ package github +import "context" + // IntegrationsService provides access to the installation related functions // in the GitHub API. // @@ -14,7 +16,7 @@ type IntegrationsService service // ListInstallations lists the installations that the current integration has. // // GitHub API docs: https://developer.github.com/v3/integrations/#find-installations -func (s *IntegrationsService) ListInstallations(opt *ListOptions) ([]*Installation, *Response, error) { +func (s *IntegrationsService) ListInstallations(ctx context.Context, opt *ListOptions) ([]*Installation, *Response, error) { u, err := addOptions("integration/installations", opt) if err != nil { return nil, nil, err @@ -29,7 +31,7 @@ func (s *IntegrationsService) ListInstallations(opt *ListOptions) ([]*Installati req.Header.Set("Accept", mediaTypeIntegrationPreview) var i []*Installation - resp, err := s.client.Do(req, &i) + resp, err := s.client.Do(ctx, req, &i) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/integration_installation.go b/vendor/github.com/google/go-github/github/integration_installation.go index b130470d39..933106400b 100644 --- a/vendor/github.com/google/go-github/github/integration_installation.go +++ b/vendor/github.com/google/go-github/github/integration_installation.go @@ -5,6 +5,8 @@ package github +import "context" + // Installation represents a GitHub integration installation. type Installation struct { ID *int `json:"id,omitempty"` @@ -20,7 +22,7 @@ func (i Installation) String() string { // ListRepos lists the repositories that the current installation has access to. // // GitHub API docs: https://developer.github.com/v3/integrations/installations/#list-repositories -func (s *IntegrationsService) ListRepos(opt *ListOptions) ([]*Repository, *Response, error) { +func (s *IntegrationsService) ListRepos(ctx context.Context, opt *ListOptions) ([]*Repository, *Response, error) { u, err := addOptions("installation/repositories", opt) if err != nil { return nil, nil, err @@ -37,7 +39,7 @@ func (s *IntegrationsService) ListRepos(opt *ListOptions) ([]*Repository, *Respo var r struct { Repositories []*Repository `json:"repositories"` } - resp, err := s.client.Do(req, &r) + resp, err := s.client.Do(ctx, req, &r) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/issues.go b/vendor/github.com/google/go-github/github/issues.go index eb0a716952..a25f461822 100644 --- a/vendor/github.com/google/go-github/github/issues.go +++ b/vendor/github.com/google/go-github/github/issues.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -13,7 +14,7 @@ import ( // IssuesService handles communication with the issue related // methods of the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/issues/ +// GitHub API docs: https://developer.github.com/v3/issues/ type IssuesService service // Issue represents a GitHub issue on a repository. @@ -107,27 +108,27 @@ type PullRequestLinks struct { // organization repositories; if false, list only owned and member // repositories. // -// GitHub API docs: http://developer.github.com/v3/issues/#list-issues -func (s *IssuesService) List(all bool, opt *IssueListOptions) ([]*Issue, *Response, error) { +// 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(u, opt) + return s.listIssues(ctx, u, opt) } // ListByOrg fetches the issues in the specified organization for the // authenticated user. // -// GitHub API docs: http://developer.github.com/v3/issues/#list-issues -func (s *IssuesService) ListByOrg(org string, opt *IssueListOptions) ([]*Issue, *Response, error) { +// 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(u, opt) + return s.listIssues(ctx, u, opt) } -func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]*Issue, *Response, error) { +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 @@ -142,7 +143,7 @@ func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]*Issue, * req.Header.Set("Accept", mediaTypeReactionsPreview) var issues []*Issue - resp, err := s.client.Do(req, &issues) + resp, err := s.client.Do(ctx, req, &issues) if err != nil { return nil, resp, err } @@ -192,8 +193,8 @@ type IssueListByRepoOptions struct { // ListByRepo lists the issues for the specified repository. // -// GitHub API docs: http://developer.github.com/v3/issues/#list-issues-for-a-repository -func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRepoOptions) ([]*Issue, *Response, error) { +// 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 { @@ -209,7 +210,7 @@ func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRe req.Header.Set("Accept", mediaTypeReactionsPreview) var issues []*Issue - resp, err := s.client.Do(req, &issues) + resp, err := s.client.Do(ctx, req, &issues) if err != nil { return nil, resp, err } @@ -219,8 +220,8 @@ func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRe // Get a single issue. // -// GitHub API docs: http://developer.github.com/v3/issues/#get-a-single-issue -func (s *IssuesService) Get(owner string, repo string, number int) (*Issue, *Response, error) { +// 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 { @@ -231,7 +232,7 @@ func (s *IssuesService) Get(owner string, repo string, number int) (*Issue, *Res req.Header.Set("Accept", mediaTypeReactionsPreview) issue := new(Issue) - resp, err := s.client.Do(req, issue) + resp, err := s.client.Do(ctx, req, issue) if err != nil { return nil, resp, err } @@ -241,8 +242,8 @@ func (s *IssuesService) Get(owner string, repo string, number int) (*Issue, *Res // Create a new issue on the specified repository. // -// GitHub API docs: http://developer.github.com/v3/issues/#create-an-issue -func (s *IssuesService) Create(owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) { +// 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 { @@ -250,7 +251,7 @@ func (s *IssuesService) Create(owner string, repo string, issue *IssueRequest) ( } i := new(Issue) - resp, err := s.client.Do(req, i) + resp, err := s.client.Do(ctx, req, i) if err != nil { return nil, resp, err } @@ -260,8 +261,8 @@ func (s *IssuesService) Create(owner string, repo string, issue *IssueRequest) ( // Edit an issue. // -// GitHub API docs: http://developer.github.com/v3/issues/#edit-an-issue -func (s *IssuesService) Edit(owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { +// 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 { @@ -269,7 +270,7 @@ func (s *IssuesService) Edit(owner string, repo string, number int, issue *Issue } i := new(Issue) - resp, err := s.client.Do(req, i) + resp, err := s.client.Do(ctx, req, i) if err != nil { return nil, resp, err } @@ -280,25 +281,25 @@ func (s *IssuesService) Edit(owner string, repo string, number int, issue *Issue // Lock an issue's conversation. // // GitHub API docs: https://developer.github.com/v3/issues/#lock-an-issue -func (s *IssuesService) Lock(owner string, repo string, number int) (*Response, error) { +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(req, nil) + 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(owner string, repo string, number int) (*Response, error) { +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(req, nil) + 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 index 1f061027e6..9cb366f50a 100644 --- a/vendor/github.com/google/go-github/github/issues_assignees.go +++ b/vendor/github.com/google/go-github/github/issues_assignees.go @@ -5,13 +5,16 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // ListAssignees fetches all available assignees (owners and collaborators) to // which issues may be assigned. // -// GitHub API docs: http://developer.github.com/v3/issues/assignees/#list-assignees -func (s *IssuesService) ListAssignees(owner, repo string, opt *ListOptions) ([]*User, *Response, error) { +// 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 { @@ -23,7 +26,7 @@ func (s *IssuesService) ListAssignees(owner, repo string, opt *ListOptions) ([]* return nil, nil, err } var assignees []*User - resp, err := s.client.Do(req, &assignees) + resp, err := s.client.Do(ctx, req, &assignees) if err != nil { return nil, resp, err } @@ -33,14 +36,14 @@ func (s *IssuesService) ListAssignees(owner, repo string, opt *ListOptions) ([]* // IsAssignee checks if a user is an assignee for the specified repository. // -// GitHub API docs: http://developer.github.com/v3/issues/assignees/#check-assignee -func (s *IssuesService) IsAssignee(owner, repo, user string) (bool, *Response, error) { +// 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(req, nil) + resp, err := s.client.Do(ctx, req, nil) assignee, err := parseBoolResponse(err) return assignee, resp, err } @@ -48,7 +51,7 @@ func (s *IssuesService) IsAssignee(owner, repo, user string) (bool, *Response, e // 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(owner, repo string, number int, assignees []string) (*Issue, *Response, error) { +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} @@ -59,14 +62,14 @@ func (s *IssuesService) AddAssignees(owner, repo string, number int, assignees [ } issue := &Issue{} - resp, err := s.client.Do(req, 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(owner, repo string, number int, assignees []string) (*Issue, *Response, error) { +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} @@ -77,6 +80,6 @@ func (s *IssuesService) RemoveAssignees(owner, repo string, number int, assignee } issue := &Issue{} - resp, err := s.client.Do(req, 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 index afd0ff258c..fd72657cd4 100644 --- a/vendor/github.com/google/go-github/github/issues_comments.go +++ b/vendor/github.com/google/go-github/github/issues_comments.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -45,8 +46,8 @@ type IssueListCommentsOptions struct { // 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: http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue -func (s *IssuesService) ListComments(owner string, repo string, number int, opt *IssueListCommentsOptions) ([]*IssueComment, *Response, error) { +// 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) @@ -67,7 +68,7 @@ func (s *IssuesService) ListComments(owner string, repo string, number int, opt req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*IssueComment - resp, err := s.client.Do(req, &comments) + resp, err := s.client.Do(ctx, req, &comments) if err != nil { return nil, resp, err } @@ -77,8 +78,8 @@ func (s *IssuesService) ListComments(owner string, repo string, number int, opt // GetComment fetches the specified issue comment. // -// GitHub API docs: http://developer.github.com/v3/issues/comments/#get-a-single-comment -func (s *IssuesService) GetComment(owner string, repo string, id int) (*IssueComment, *Response, error) { +// 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) @@ -90,7 +91,7 @@ func (s *IssuesService) GetComment(owner string, repo string, id int) (*IssueCom req.Header.Set("Accept", mediaTypeReactionsPreview) comment := new(IssueComment) - resp, err := s.client.Do(req, comment) + resp, err := s.client.Do(ctx, req, comment) if err != nil { return nil, resp, err } @@ -100,15 +101,15 @@ func (s *IssuesService) GetComment(owner string, repo string, id int) (*IssueCom // CreateComment creates a new comment on the specified issue. // -// GitHub API docs: http://developer.github.com/v3/issues/comments/#create-a-comment -func (s *IssuesService) CreateComment(owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { +// 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(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -118,15 +119,15 @@ func (s *IssuesService) CreateComment(owner string, repo string, number int, com // EditComment updates an issue comment. // -// GitHub API docs: http://developer.github.com/v3/issues/comments/#edit-a-comment -func (s *IssuesService) EditComment(owner string, repo string, id int, comment *IssueComment) (*IssueComment, *Response, error) { +// 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(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -136,12 +137,12 @@ func (s *IssuesService) EditComment(owner string, repo string, id int, comment * // DeleteComment deletes an issue comment. // -// GitHub API docs: http://developer.github.com/v3/issues/comments/#delete-a-comment -func (s *IssuesService) DeleteComment(owner string, repo string, id int) (*Response, error) { +// 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(req, nil) + 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 index 98f215c656..bede41901f 100644 --- a/vendor/github.com/google/go-github/github/issues_events.go +++ b/vendor/github.com/google/go-github/github/issues_events.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -73,7 +74,7 @@ type IssueEvent struct { // 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(owner, repo string, number int, opt *ListOptions) ([]*IssueEvent, *Response, error) { +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 { @@ -86,7 +87,7 @@ func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *Lis } var events []*IssueEvent - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -97,7 +98,7 @@ func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *Lis // 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(owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) { +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 { @@ -110,7 +111,7 @@ func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOption } var events []*IssueEvent - resp, err := s.client.Do(req, &events) + resp, err := s.client.Do(ctx, req, &events) if err != nil { return nil, resp, err } @@ -121,7 +122,7 @@ func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOption // GetEvent returns the specified issue event. // // GitHub API docs: https://developer.github.com/v3/issues/events/#get-a-single-event -func (s *IssuesService) GetEvent(owner, repo string, id int) (*IssueEvent, *Response, error) { +func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int) (*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -130,7 +131,7 @@ func (s *IssuesService) GetEvent(owner, repo string, id int) (*IssueEvent, *Resp } event := new(IssueEvent) - resp, err := s.client.Do(req, event) + resp, err := s.client.Do(ctx, req, event) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/issues_labels.go b/vendor/github.com/google/go-github/github/issues_labels.go index 46b2d6e2ac..5c0b821c31 100644 --- a/vendor/github.com/google/go-github/github/issues_labels.go +++ b/vendor/github.com/google/go-github/github/issues_labels.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Label represents a GitHub label on an Issue type Label struct { @@ -20,8 +23,8 @@ func (l Label) String() string { // ListLabels lists all labels for a repository. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository -func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) ([]*Label, *Response, error) { +// 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 { @@ -34,7 +37,7 @@ func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) } var labels []*Label - resp, err := s.client.Do(req, &labels) + resp, err := s.client.Do(ctx, req, &labels) if err != nil { return nil, resp, err } @@ -44,8 +47,8 @@ func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) // GetLabel gets a single label. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#get-a-single-label -func (s *IssuesService) GetLabel(owner string, repo string, name string) (*Label, *Response, error) { +// 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 { @@ -53,7 +56,7 @@ func (s *IssuesService) GetLabel(owner string, repo string, name string) (*Label } label := new(Label) - resp, err := s.client.Do(req, label) + resp, err := s.client.Do(ctx, req, label) if err != nil { return nil, resp, err } @@ -63,8 +66,8 @@ func (s *IssuesService) GetLabel(owner string, repo string, name string) (*Label // CreateLabel creates a new label on the specified repository. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#create-a-label -func (s *IssuesService) CreateLabel(owner string, repo string, label *Label) (*Label, *Response, error) { +// 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 { @@ -72,7 +75,7 @@ func (s *IssuesService) CreateLabel(owner string, repo string, label *Label) (*L } l := new(Label) - resp, err := s.client.Do(req, l) + resp, err := s.client.Do(ctx, req, l) if err != nil { return nil, resp, err } @@ -82,8 +85,8 @@ func (s *IssuesService) CreateLabel(owner string, repo string, label *Label) (*L // EditLabel edits a label. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#update-a-label -func (s *IssuesService) EditLabel(owner string, repo string, name string, label *Label) (*Label, *Response, error) { +// 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 { @@ -91,7 +94,7 @@ func (s *IssuesService) EditLabel(owner string, repo string, name string, label } l := new(Label) - resp, err := s.client.Do(req, l) + resp, err := s.client.Do(ctx, req, l) if err != nil { return nil, resp, err } @@ -101,20 +104,20 @@ func (s *IssuesService) EditLabel(owner string, repo string, name string, label // DeleteLabel deletes a label. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#delete-a-label -func (s *IssuesService) DeleteLabel(owner string, repo string, name string) (*Response, error) { +// 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(req, nil) + 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(owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) { +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 { @@ -127,7 +130,7 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, } var labels []*Label - resp, err := s.client.Do(req, &labels) + resp, err := s.client.Do(ctx, req, &labels) if err != nil { return nil, resp, err } @@ -138,7 +141,7 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, // 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(owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { +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 { @@ -146,7 +149,7 @@ func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, } var l []*Label - resp, err := s.client.Do(req, &l) + resp, err := s.client.Do(ctx, req, &l) if err != nil { return nil, resp, err } @@ -156,20 +159,20 @@ func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, // RemoveLabelForIssue removes a label for an issue. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue -func (s *IssuesService) RemoveLabelForIssue(owner string, repo string, number int, label string) (*Response, error) { +// 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(req, nil) + return s.client.Do(ctx, req, nil) } // ReplaceLabelsForIssue replaces all labels for an issue. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue -func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { +// 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 { @@ -177,7 +180,7 @@ func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number } var l []*Label - resp, err := s.client.Do(req, &l) + resp, err := s.client.Do(ctx, req, &l) if err != nil { return nil, resp, err } @@ -187,20 +190,20 @@ func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number // RemoveLabelsForIssue removes all labels for an issue. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue -func (s *IssuesService) RemoveLabelsForIssue(owner string, repo string, number int) (*Response, error) { +// 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(req, nil) + return s.client.Do(ctx, req, nil) } // ListLabelsForMilestone lists labels for every issue in a milestone. // -// GitHub API docs: http://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone -func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) { +// 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 { @@ -213,7 +216,7 @@ func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number } var labels []*Label - resp, err := s.client.Do(req, &labels) + resp, err := s.client.Do(ctx, req, &labels) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/issues_milestones.go b/vendor/github.com/google/go-github/github/issues_milestones.go index 0cc2d58c02..bc89816a64 100644 --- a/vendor/github.com/google/go-github/github/issues_milestones.go +++ b/vendor/github.com/google/go-github/github/issues_milestones.go @@ -6,11 +6,12 @@ package github import ( + "context" "fmt" "time" ) -// Milestone represents a Github repository milestone. +// Milestone represents a GitHub repository milestone. type Milestone struct { URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` @@ -54,7 +55,7 @@ type MilestoneListOptions struct { // 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(owner string, repo string, opt *MilestoneListOptions) ([]*Milestone, *Response, error) { +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 { @@ -67,7 +68,7 @@ func (s *IssuesService) ListMilestones(owner string, repo string, opt *Milestone } var milestones []*Milestone - resp, err := s.client.Do(req, &milestones) + resp, err := s.client.Do(ctx, req, &milestones) if err != nil { return nil, resp, err } @@ -78,7 +79,7 @@ func (s *IssuesService) ListMilestones(owner string, repo string, opt *Milestone // GetMilestone gets a single milestone. // // GitHub API docs: https://developer.github.com/v3/issues/milestones/#get-a-single-milestone -func (s *IssuesService) GetMilestone(owner string, repo string, number int) (*Milestone, *Response, error) { +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 { @@ -86,7 +87,7 @@ func (s *IssuesService) GetMilestone(owner string, repo string, number int) (*Mi } milestone := new(Milestone) - resp, err := s.client.Do(req, milestone) + resp, err := s.client.Do(ctx, req, milestone) if err != nil { return nil, resp, err } @@ -97,7 +98,7 @@ func (s *IssuesService) GetMilestone(owner string, repo string, number int) (*Mi // 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(owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) { +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 { @@ -105,7 +106,7 @@ func (s *IssuesService) CreateMilestone(owner string, repo string, milestone *Mi } m := new(Milestone) - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -116,7 +117,7 @@ func (s *IssuesService) CreateMilestone(owner string, repo string, milestone *Mi // EditMilestone edits a milestone. // // GitHub API docs: https://developer.github.com/v3/issues/milestones/#update-a-milestone -func (s *IssuesService) EditMilestone(owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { +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 { @@ -124,7 +125,7 @@ func (s *IssuesService) EditMilestone(owner string, repo string, number int, mil } m := new(Milestone) - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -135,12 +136,12 @@ func (s *IssuesService) EditMilestone(owner string, repo string, number int, mil // DeleteMilestone deletes a milestone. // // GitHub API docs: https://developer.github.com/v3/issues/milestones/#delete-a-milestone -func (s *IssuesService) DeleteMilestone(owner string, repo string, number int) (*Response, error) { +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(req, nil) + 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 index d20eef8f07..bc0b108990 100644 --- a/vendor/github.com/google/go-github/github/issues_timeline.go +++ b/vendor/github.com/google/go-github/github/issues_timeline.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -127,7 +128,7 @@ type Source struct { // 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(owner, repo string, number int, opt *ListOptions) ([]*Timeline, *Response, error) { +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 { @@ -143,6 +144,6 @@ func (s *IssuesService) ListIssueTimeline(owner, repo string, number int, opt *L req.Header.Set("Accept", mediaTypeTimelinePreview) var events []*Timeline - resp, err := s.client.Do(req, &events) + 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 index 5340e617c7..e9cd1777af 100644 --- a/vendor/github.com/google/go-github/github/licenses.go +++ b/vendor/github.com/google/go-github/github/licenses.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // LicensesService handles communication with the license related // methods of the GitHub API. @@ -58,7 +61,7 @@ func (l License) String() string { // List popular open source licenses. // // GitHub API docs: https://developer.github.com/v3/licenses/#list-all-licenses -func (s *LicensesService) List() ([]*License, *Response, error) { +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 @@ -68,7 +71,7 @@ func (s *LicensesService) List() ([]*License, *Response, error) { req.Header.Set("Accept", mediaTypeLicensesPreview) var licenses []*License - resp, err := s.client.Do(req, &licenses) + resp, err := s.client.Do(ctx, req, &licenses) if err != nil { return nil, resp, err } @@ -79,7 +82,7 @@ func (s *LicensesService) List() ([]*License, *Response, error) { // Get extended metadata for one license. // // GitHub API docs: https://developer.github.com/v3/licenses/#get-an-individual-license -func (s *LicensesService) Get(licenseName string) (*License, *Response, error) { +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) @@ -91,7 +94,7 @@ func (s *LicensesService) Get(licenseName string) (*License, *Response, error) { req.Header.Set("Accept", mediaTypeLicensesPreview) license := new(License) - resp, err := s.client.Do(req, license) + resp, err := s.client.Do(ctx, req, license) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/messages.go b/vendor/github.com/google/go-github/github/messages.go index 5f67ba5c78..fd9ee56295 100644 --- a/vendor/github.com/google/go-github/github/messages.go +++ b/vendor/github.com/google/go-github/github/messages.go @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file. // This file provides functions for validating payloads from GitHub Webhooks. -// GitHub docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github +// GitHub API docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github package github @@ -31,7 +31,7 @@ const ( 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 is the GitHub header key used to pass the event type. eventTypeHeader = "X-Github-Event" ) @@ -143,7 +143,7 @@ func ValidatePayload(r *http.Request, secretKey []byte) (payload []byte, err err // payload is the JSON payload sent by GitHub Webhooks. // secretKey is the GitHub Webhook secret message. // -// GitHub docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github +// 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 { diff --git a/vendor/github.com/google/go-github/github/migrations.go b/vendor/github.com/google/go-github/github/migrations.go index a7890b0a32..6793269cd3 100644 --- a/vendor/github.com/google/go-github/github/migrations.go +++ b/vendor/github.com/google/go-github/github/migrations.go @@ -6,6 +6,7 @@ package github import ( + "context" "errors" "fmt" "net/http" @@ -74,7 +75,7 @@ type startMigration struct { // 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(org string, repos []string, opt *MigrationOptions) (*Migration, *Response, error) { +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} @@ -92,7 +93,7 @@ func (s *MigrationService) StartMigration(org string, repos []string, opt *Migra req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &Migration{} - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -103,7 +104,7 @@ func (s *MigrationService) StartMigration(org string, repos []string, opt *Migra // 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(org string) ([]*Migration, *Response, error) { +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) @@ -115,7 +116,7 @@ func (s *MigrationService) ListMigrations(org string) ([]*Migration, *Response, req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*Migration - resp, err := s.client.Do(req, &m) + resp, err := s.client.Do(ctx, req, &m) if err != nil { return nil, resp, err } @@ -127,7 +128,7 @@ func (s *MigrationService) ListMigrations(org string) ([]*Migration, *Response, // 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(org string, id int) (*Migration, *Response, error) { +func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int) (*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v", org, id) req, err := s.client.NewRequest("GET", u, nil) @@ -139,7 +140,7 @@ func (s *MigrationService) MigrationStatus(org string, id int) (*Migration, *Res req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &Migration{} - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -151,7 +152,7 @@ func (s *MigrationService) MigrationStatus(org string, id int) (*Migration, *Res // id is the migration ID. // // GitHub API docs: https://developer.github.com/v3/migration/migrations/#download-a-migration-archive -func (s *MigrationService) MigrationArchiveURL(org string, id int) (url string, err error) { +func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int) (url string, err error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) req, err := s.client.NewRequest("GET", u, nil) @@ -174,7 +175,7 @@ func (s *MigrationService) MigrationArchiveURL(org string, id int) (url string, } defer func() { s.client.client.CheckRedirect = saveRedirect }() - _, err = s.client.Do(req, nil) // expect error from disable redirect + _, err = s.client.Do(ctx, req, nil) // expect error from disable redirect if err == nil { return "", errors.New("expected redirect, none provided") } @@ -188,7 +189,7 @@ func (s *MigrationService) MigrationArchiveURL(org string, id int) (url string, // id is the migration ID. // // GitHub API docs: https://developer.github.com/v3/migration/migrations/#delete-a-migration-archive -func (s *MigrationService) DeleteMigration(org string, id int) (*Response, error) { +func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -199,7 +200,7 @@ func (s *MigrationService) DeleteMigration(org string, id int) (*Response, error // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // UnlockRepo unlocks a repository that was locked for migration. @@ -208,7 +209,7 @@ func (s *MigrationService) DeleteMigration(org string, id int) (*Response, error // 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(org string, id int, repo string) (*Response, error) { +func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int, 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) @@ -219,5 +220,5 @@ func (s *MigrationService) UnlockRepo(org string, id int, repo string) (*Respons // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - return s.client.Do(req, nil) + 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 index d593e40523..aa45a5a364 100644 --- a/vendor/github.com/google/go-github/github/migrations_source_import.go +++ b/vendor/github.com/google/go-github/github/migrations_source_import.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Import represents a repository import request. type Import struct { @@ -144,7 +147,7 @@ func (f LargeFile) String() string { // StartImport initiates a repository import. // // GitHub API docs: https://developer.github.com/v3/migration/source_imports/#start-an-import -func (s *MigrationService) StartImport(owner, repo string, in *Import) (*Import, *Response, error) { +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 { @@ -155,7 +158,7 @@ func (s *MigrationService) StartImport(owner, repo string, in *Import) (*Import, req.Header.Set("Accept", mediaTypeImportPreview) out := new(Import) - resp, err := s.client.Do(req, out) + resp, err := s.client.Do(ctx, req, out) if err != nil { return nil, resp, err } @@ -166,7 +169,7 @@ func (s *MigrationService) StartImport(owner, repo string, in *Import) (*Import, // 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(owner, repo string) (*Import, *Response, error) { +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 { @@ -177,7 +180,7 @@ func (s *MigrationService) ImportProgress(owner, repo string) (*Import, *Respons req.Header.Set("Accept", mediaTypeImportPreview) out := new(Import) - resp, err := s.client.Do(req, out) + resp, err := s.client.Do(ctx, req, out) if err != nil { return nil, resp, err } @@ -188,7 +191,7 @@ func (s *MigrationService) ImportProgress(owner, repo string) (*Import, *Respons // UpdateImport initiates a repository import. // // GitHub API docs: https://developer.github.com/v3/migration/source_imports/#update-existing-import -func (s *MigrationService) UpdateImport(owner, repo string, in *Import) (*Import, *Response, error) { +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 { @@ -199,7 +202,7 @@ func (s *MigrationService) UpdateImport(owner, repo string, in *Import) (*Import req.Header.Set("Accept", mediaTypeImportPreview) out := new(Import) - resp, err := s.client.Do(req, out) + resp, err := s.client.Do(ctx, req, out) if err != nil { return nil, resp, err } @@ -220,7 +223,7 @@ func (s *MigrationService) UpdateImport(owner, repo string, in *Import) (*Import // information. // // GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors -func (s *MigrationService) CommitAuthors(owner, repo string) ([]*SourceImportAuthor, *Response, error) { +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 { @@ -231,7 +234,7 @@ func (s *MigrationService) CommitAuthors(owner, repo string) ([]*SourceImportAut req.Header.Set("Accept", mediaTypeImportPreview) var authors []*SourceImportAuthor - resp, err := s.client.Do(req, &authors) + resp, err := s.client.Do(ctx, req, &authors) if err != nil { return nil, resp, err } @@ -244,7 +247,7 @@ func (s *MigrationService) CommitAuthors(owner, repo string) ([]*SourceImportAut // commits to the repository. // // GitHub API docs: https://developer.github.com/v3/migration/source_imports/#map-a-commit-author -func (s *MigrationService) MapCommitAuthor(owner, repo string, id int, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { +func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int, 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 { @@ -255,7 +258,7 @@ func (s *MigrationService) MapCommitAuthor(owner, repo string, id int, author *S req.Header.Set("Accept", mediaTypeImportPreview) out := new(SourceImportAuthor) - resp, err := s.client.Do(req, out) + resp, err := s.client.Do(ctx, req, out) if err != nil { return nil, resp, err } @@ -268,7 +271,7 @@ func (s *MigrationService) MapCommitAuthor(owner, repo string, id int, author *S // used. // // GitHub API docs: https://developer.github.com/v3/migration/source_imports/#set-git-lfs-preference -func (s *MigrationService) SetLFSPreference(owner, repo string, in *Import) (*Import, *Response, error) { +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 { @@ -279,7 +282,7 @@ func (s *MigrationService) SetLFSPreference(owner, repo string, in *Import) (*Im req.Header.Set("Accept", mediaTypeImportPreview) out := new(Import) - resp, err := s.client.Do(req, out) + resp, err := s.client.Do(ctx, req, out) if err != nil { return nil, resp, err } @@ -290,7 +293,7 @@ func (s *MigrationService) SetLFSPreference(owner, repo string, in *Import) (*Im // 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(owner, repo string) ([]*LargeFile, *Response, error) { +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 { @@ -301,7 +304,7 @@ func (s *MigrationService) LargeFiles(owner, repo string) ([]*LargeFile, *Respon req.Header.Set("Accept", mediaTypeImportPreview) var files []*LargeFile - resp, err := s.client.Do(req, &files) + resp, err := s.client.Do(ctx, req, &files) if err != nil { return nil, resp, err } @@ -312,7 +315,7 @@ func (s *MigrationService) LargeFiles(owner, repo string) ([]*LargeFile, *Respon // 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(owner, repo string) (*Response, error) { +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 { @@ -322,5 +325,5 @@ func (s *MigrationService) CancelImport(owner, repo string) (*Response, error) { // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeImportPreview) - return s.client.Do(req, nil) + 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 index 0cdb3f7789..42d0d30339 100644 --- a/vendor/github.com/google/go-github/github/misc.go +++ b/vendor/github.com/google/go-github/github/misc.go @@ -7,6 +7,7 @@ package github import ( "bytes" + "context" "fmt" "net/url" ) @@ -39,7 +40,7 @@ type markdownRequest struct { // Markdown renders an arbitrary Markdown document. // // GitHub API docs: https://developer.github.com/v3/markdown/ -func (c *Client) Markdown(text string, opt *MarkdownOptions) (string, *Response, error) { +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 != "" { @@ -56,7 +57,7 @@ func (c *Client) Markdown(text string, opt *MarkdownOptions) (string, *Response, } buf := new(bytes.Buffer) - resp, err := c.Do(req, buf) + resp, err := c.Do(ctx, req, buf) if err != nil { return "", resp, err } @@ -67,14 +68,14 @@ func (c *Client) Markdown(text string, opt *MarkdownOptions) (string, *Response, // ListEmojis returns the emojis available to use on GitHub. // // GitHub API docs: https://developer.github.com/v3/emojis/ -func (c *Client) ListEmojis() (map[string]string, *Response, error) { +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(req, &emoji) + resp, err := c.Do(ctx, req, &emoji) if err != nil { return nil, resp, err } @@ -109,14 +110,14 @@ type APIMeta struct { // endpoint provides information about that installation. // // GitHub API docs: https://developer.github.com/v3/meta/ -func (c *Client) APIMeta() (*APIMeta, *Response, error) { +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(req, meta) + resp, err := c.Do(ctx, req, meta) if err != nil { return nil, resp, err } @@ -126,7 +127,7 @@ func (c *Client) APIMeta() (*APIMeta, *Response, error) { // 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(message string) (string, *Response, error) { +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)) @@ -138,7 +139,7 @@ func (c *Client) Octocat(message string) (string, *Response, error) { } buf := new(bytes.Buffer) - resp, err := c.Do(req, buf) + resp, err := c.Do(ctx, req, buf) if err != nil { return "", resp, err } @@ -149,14 +150,14 @@ func (c *Client) Octocat(message string) (string, *Response, error) { // Zen returns a random line from The Zen of GitHub. // // see also: http://warpspire.com/posts/taste/ -func (c *Client) Zen() (string, *Response, error) { +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(req, buf) + resp, err := c.Do(ctx, req, buf) if err != nil { return "", resp, err } @@ -180,7 +181,7 @@ func (s *ServiceHook) String() string { // ListServiceHooks lists all of the available service hooks. // // GitHub API docs: https://developer.github.com/webhooks/#services -func (c *Client) ListServiceHooks() ([]*ServiceHook, *Response, error) { +func (c *Client) ListServiceHooks(ctx context.Context) ([]*ServiceHook, *Response, error) { u := "hooks" req, err := c.NewRequest("GET", u, nil) if err != nil { @@ -188,7 +189,7 @@ func (c *Client) ListServiceHooks() ([]*ServiceHook, *Response, error) { } var hooks []*ServiceHook - resp, err := c.Do(req, &hooks) + resp, err := c.Do(ctx, req, &hooks) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/orgs.go b/vendor/github.com/google/go-github/github/orgs.go index 0f2ac965b6..8b126f00f1 100644 --- a/vendor/github.com/google/go-github/github/orgs.go +++ b/vendor/github.com/google/go-github/github/orgs.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -13,7 +14,7 @@ import ( // OrganizationsService provides access to the organization related functions // in the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/orgs/ +// GitHub API docs: https://developer.github.com/v3/orgs/ type OrganizationsService service // Organization represents a GitHub organization account. @@ -85,7 +86,7 @@ type OrganizationsListOptions struct { // 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(opt *OrganizationsListOptions) ([]*Organization, *Response, error) { +func (s *OrganizationsService) ListAll(ctx context.Context, opt *OrganizationsListOptions) ([]*Organization, *Response, error) { u, err := addOptions("organizations", opt) if err != nil { return nil, nil, err @@ -97,7 +98,7 @@ func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]*Organi } orgs := []*Organization{} - resp, err := s.client.Do(req, &orgs) + resp, err := s.client.Do(ctx, req, &orgs) if err != nil { return nil, resp, err } @@ -107,8 +108,8 @@ func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]*Organi // List the organizations for a user. Passing the empty string will list // organizations for the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/orgs/#list-user-organizations -func (s *OrganizationsService) List(user string, opt *ListOptions) ([]*Organization, *Response, error) { +// 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) @@ -126,7 +127,7 @@ func (s *OrganizationsService) List(user string, opt *ListOptions) ([]*Organizat } var orgs []*Organization - resp, err := s.client.Do(req, &orgs) + resp, err := s.client.Do(ctx, req, &orgs) if err != nil { return nil, resp, err } @@ -136,8 +137,8 @@ func (s *OrganizationsService) List(user string, opt *ListOptions) ([]*Organizat // Get fetches an organization by name. // -// GitHub API docs: http://developer.github.com/v3/orgs/#get-an-organization -func (s *OrganizationsService) Get(org string) (*Organization, *Response, error) { +// 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 { @@ -145,7 +146,7 @@ func (s *OrganizationsService) Get(org string) (*Organization, *Response, error) } organization := new(Organization) - resp, err := s.client.Do(req, organization) + resp, err := s.client.Do(ctx, req, organization) if err != nil { return nil, resp, err } @@ -155,8 +156,8 @@ func (s *OrganizationsService) Get(org string) (*Organization, *Response, error) // Edit an organization. // -// GitHub API docs: http://developer.github.com/v3/orgs/#edit-an-organization -func (s *OrganizationsService) Edit(name string, org *Organization) (*Organization, *Response, error) { +// 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 { @@ -164,7 +165,7 @@ func (s *OrganizationsService) Edit(name string, org *Organization) (*Organizati } o := new(Organization) - resp, err := s.client.Do(req, o) + resp, err := s.client.Do(ctx, req, o) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/orgs_hooks.go b/vendor/github.com/google/go-github/github/orgs_hooks.go index 6dc1052172..4fc692e0f6 100644 --- a/vendor/github.com/google/go-github/github/orgs_hooks.go +++ b/vendor/github.com/google/go-github/github/orgs_hooks.go @@ -5,12 +5,15 @@ package github -import "fmt" +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(org string, opt *ListOptions) ([]*Hook, *Response, error) { +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 { @@ -23,7 +26,7 @@ func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]*Hook, } var hooks []*Hook - resp, err := s.client.Do(req, &hooks) + resp, err := s.client.Do(ctx, req, &hooks) if err != nil { return nil, resp, err } @@ -34,14 +37,14 @@ func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]*Hook, // GetHook returns a single specified Hook. // // GitHub API docs: https://developer.github.com/v3/orgs/hooks/#get-single-hook -func (s *OrganizationsService) GetHook(org string, id int) (*Hook, *Response, error) { +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(req, hook) + resp, err := s.client.Do(ctx, req, hook) return hook, resp, err } @@ -49,7 +52,7 @@ func (s *OrganizationsService) GetHook(org string, id int) (*Hook, *Response, er // Name and Config are required fields. // // GitHub API docs: https://developer.github.com/v3/orgs/hooks/#create-a-hook -func (s *OrganizationsService) CreateHook(org string, hook *Hook) (*Hook, *Response, error) { +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 { @@ -57,7 +60,7 @@ func (s *OrganizationsService) CreateHook(org string, hook *Hook) (*Hook, *Respo } h := new(Hook) - resp, err := s.client.Do(req, h) + resp, err := s.client.Do(ctx, req, h) if err != nil { return nil, resp, err } @@ -68,37 +71,37 @@ func (s *OrganizationsService) CreateHook(org string, hook *Hook) (*Hook, *Respo // EditHook updates a specified Hook. // // GitHub API docs: https://developer.github.com/v3/orgs/hooks/#edit-a-hook -func (s *OrganizationsService) EditHook(org string, id int, hook *Hook) (*Hook, *Response, error) { +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(req, h) + 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(org string, id int) (*Response, error) { +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(req, nil) + 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(org string, id int) (*Response, error) { +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(req, nil) + 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 index f7bb88419b..58fb019153 100644 --- a/vendor/github.com/google/go-github/github/orgs_members.go +++ b/vendor/github.com/google/go-github/github/orgs_members.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Membership represents the status of a user's membership in an organization or team. type Membership struct { @@ -68,8 +71,8 @@ type ListMembersOptions struct { // 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: http://developer.github.com/v3/orgs/members/#members-list -func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions) ([]*User, *Response, error) { +// 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) @@ -87,7 +90,7 @@ func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions) } var members []*User - resp, err := s.client.Do(req, &members) + resp, err := s.client.Do(ctx, req, &members) if err != nil { return nil, resp, err } @@ -97,72 +100,72 @@ func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions) // IsMember checks if a user is a member of an organization. // -// GitHub API docs: http://developer.github.com/v3/orgs/members/#check-membership -func (s *OrganizationsService) IsMember(org, user string) (bool, *Response, error) { +// 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(req, nil) + 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: http://developer.github.com/v3/orgs/members/#check-public-membership -func (s *OrganizationsService) IsPublicMember(org, user string) (bool, *Response, error) { +// 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(req, nil) + 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: http://developer.github.com/v3/orgs/members/#remove-a-member -func (s *OrganizationsService) RemoveMember(org, user string) (*Response, error) { +// 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(req, nil) + 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: http://developer.github.com/v3/orgs/members/#publicize-a-users-membership -func (s *OrganizationsService) PublicizeMembership(org, user string) (*Response, error) { +// 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(req, nil) + return s.client.Do(ctx, req, nil) } // ConcealMembership conceals a user's membership in an organization. // -// GitHub API docs: http://developer.github.com/v3/orgs/members/#conceal-a-users-membership -func (s *OrganizationsService) ConcealMembership(org, user string) (*Response, error) { +// 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(req, nil) + return s.client.Do(ctx, req, nil) } // ListOrgMembershipsOptions specifies optional parameters to the @@ -178,7 +181,7 @@ type ListOrgMembershipsOptions struct { // 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(opt *ListOrgMembershipsOptions) ([]*Membership, *Response, error) { +func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opt *ListOrgMembershipsOptions) ([]*Membership, *Response, error) { u := "user/memberships/orgs" u, err := addOptions(u, opt) if err != nil { @@ -191,7 +194,7 @@ func (s *OrganizationsService) ListOrgMemberships(opt *ListOrgMembershipsOptions } var memberships []*Membership - resp, err := s.client.Do(req, &memberships) + resp, err := s.client.Do(ctx, req, &memberships) if err != nil { return nil, resp, err } @@ -203,9 +206,10 @@ func (s *OrganizationsService) ListOrgMemberships(opt *ListOrgMembershipsOptions // 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 -// GitHub API docs: https://developer.github.com/v3/orgs/members/#get-your-organization-membership -func (s *OrganizationsService) GetOrgMembership(user, org string) (*Membership, *Response, error) { +// 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) @@ -219,7 +223,7 @@ func (s *OrganizationsService) GetOrgMembership(user, org string) (*Membership, } membership := new(Membership) - resp, err := s.client.Do(req, membership) + resp, err := s.client.Do(ctx, req, membership) if err != nil { return nil, resp, err } @@ -233,7 +237,7 @@ func (s *OrganizationsService) GetOrgMembership(user, org string) (*Membership, // // 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(user, org string, membership *Membership) (*Membership, *Response, error) { +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) @@ -249,7 +253,7 @@ func (s *OrganizationsService) EditOrgMembership(user, org string, membership *M } m := new(Membership) - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -261,20 +265,20 @@ func (s *OrganizationsService) EditOrgMembership(user, org string, membership *M // 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(user, org string) (*Response, error) { +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(req, nil) + 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(org int, opt *ListOptions) ([]*Invitation, *Response, error) { +func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org int, opt *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations", org) u, err := addOptions(u, opt) if err != nil { @@ -290,7 +294,7 @@ func (s *OrganizationsService) ListPendingOrgInvitations(org int, opt *ListOptio req.Header.Set("Accept", mediaTypeOrgMembershipPreview) var pendingInvitations []*Invitation - resp, err := s.client.Do(req, &pendingInvitations) + resp, err := s.client.Do(ctx, req, &pendingInvitations) if err != nil { return nil, resp, err } 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 new file mode 100644 index 0000000000..10bc6f0600 --- /dev/null +++ b/vendor/github.com/google/go-github/github/orgs_outside_collaborators.go @@ -0,0 +1,53 @@ +// 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 + } + + // TODO: remove custom Accept header when this API fully launches. + req.Header.Set("Accept", mediaTypeOrgMembershipPreview) + + var members []*User + resp, err := s.client.Do(ctx, req, &members) + if err != nil { + return nil, resp, err + } + + return members, 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 index f4d668149d..5bdd66dd21 100644 --- a/vendor/github.com/google/go-github/github/orgs_teams.go +++ b/vendor/github.com/google/go-github/github/orgs_teams.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -61,8 +62,8 @@ func (i Invitation) String() string { // ListTeams lists all of the teams for an organization. // -// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-teams -func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]*Team, *Response, error) { +// 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 { @@ -75,7 +76,7 @@ func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]*Team, } var teams []*Team - resp, err := s.client.Do(req, &teams) + resp, err := s.client.Do(ctx, req, &teams) if err != nil { return nil, resp, err } @@ -85,8 +86,8 @@ func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]*Team, // GetTeam fetches a team by ID. // -// GitHub API docs: http://developer.github.com/v3/orgs/teams/#get-team -func (s *OrganizationsService) GetTeam(team int) (*Team, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team +func (s *OrganizationsService) GetTeam(ctx context.Context, team int) (*Team, *Response, error) { u := fmt.Sprintf("teams/%v", team) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -94,7 +95,7 @@ func (s *OrganizationsService) GetTeam(team int) (*Team, *Response, error) { } t := new(Team) - resp, err := s.client.Do(req, t) + resp, err := s.client.Do(ctx, req, t) if err != nil { return nil, resp, err } @@ -104,8 +105,8 @@ func (s *OrganizationsService) GetTeam(team int) (*Team, *Response, error) { // CreateTeam creates a new team within an organization. // -// GitHub API docs: http://developer.github.com/v3/orgs/teams/#create-team -func (s *OrganizationsService) CreateTeam(org string, team *Team) (*Team, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#create-team +func (s *OrganizationsService) CreateTeam(ctx context.Context, org string, team *Team) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams", org) req, err := s.client.NewRequest("POST", u, team) if err != nil { @@ -113,7 +114,7 @@ func (s *OrganizationsService) CreateTeam(org string, team *Team) (*Team, *Respo } t := new(Team) - resp, err := s.client.Do(req, t) + resp, err := s.client.Do(ctx, req, t) if err != nil { return nil, resp, err } @@ -123,8 +124,8 @@ func (s *OrganizationsService) CreateTeam(org string, team *Team) (*Team, *Respo // EditTeam edits a team. // -// GitHub API docs: http://developer.github.com/v3/orgs/teams/#edit-team -func (s *OrganizationsService) EditTeam(id int, team *Team) (*Team, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#edit-team +func (s *OrganizationsService) EditTeam(ctx context.Context, id int, team *Team) (*Team, *Response, error) { u := fmt.Sprintf("teams/%v", id) req, err := s.client.NewRequest("PATCH", u, team) if err != nil { @@ -132,7 +133,7 @@ func (s *OrganizationsService) EditTeam(id int, team *Team) (*Team, *Response, e } t := new(Team) - resp, err := s.client.Do(req, t) + resp, err := s.client.Do(ctx, req, t) if err != nil { return nil, resp, err } @@ -142,15 +143,15 @@ func (s *OrganizationsService) EditTeam(id int, team *Team) (*Team, *Response, e // DeleteTeam deletes a team. // -// GitHub API docs: http://developer.github.com/v3/orgs/teams/#delete-team -func (s *OrganizationsService) DeleteTeam(team int) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#delete-team +func (s *OrganizationsService) DeleteTeam(ctx context.Context, team int) (*Response, error) { u := fmt.Sprintf("teams/%v", team) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // OrganizationListTeamMembersOptions specifies the optional parameters to the @@ -166,8 +167,8 @@ type OrganizationListTeamMembersOptions struct { // ListTeamMembers lists all of the users who are members of the specified // team. // -// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-team-members -func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTeamMembersOptions) ([]*User, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-team-members +func (s *OrganizationsService) ListTeamMembers(ctx context.Context, team int, opt *OrganizationListTeamMembersOptions) ([]*User, *Response, error) { u := fmt.Sprintf("teams/%v/members", team) u, err := addOptions(u, opt) if err != nil { @@ -180,7 +181,7 @@ func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTe } var members []*User - resp, err := s.client.Do(req, &members) + resp, err := s.client.Do(ctx, req, &members) if err != nil { return nil, resp, err } @@ -190,23 +191,23 @@ func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTe // IsTeamMember checks if a user is a member of the specified team. // -// GitHub API docs: http://developer.github.com/v3/orgs/teams/#get-team-member -func (s *OrganizationsService) IsTeamMember(team int, user string) (bool, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team-member +func (s *OrganizationsService) IsTeamMember(ctx context.Context, team int, 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(req, nil) + 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: http://developer.github.com/v3/orgs/teams/#list-team-repos -func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]*Repository, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-team-repos +func (s *OrganizationsService) ListTeamRepos(ctx context.Context, team int, opt *ListOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("teams/%v/repos", team) u, err := addOptions(u, opt) if err != nil { @@ -219,7 +220,7 @@ func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]*Rep } var repos []*Repository - resp, err := s.client.Do(req, &repos) + resp, err := s.client.Do(ctx, req, &repos) if err != nil { return nil, resp, err } @@ -232,7 +233,7 @@ func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]*Rep // 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(team int, owner string, repo string) (*Repository, *Response, error) { +func (s *OrganizationsService) IsTeamRepo(ctx context.Context, team int, 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 { @@ -242,7 +243,7 @@ func (s *OrganizationsService) IsTeamRepo(team int, owner string, repo string) ( req.Header.Set("Accept", mediaTypeOrgPermissionRepo) repository := new(Repository) - resp, err := s.client.Do(req, repository) + resp, err := s.client.Do(ctx, req, repository) if err != nil { return nil, resp, err } @@ -267,35 +268,35 @@ type OrganizationAddTeamRepoOptions struct { // 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: http://developer.github.com/v3/orgs/teams/#add-team-repo -func (s *OrganizationsService) AddTeamRepo(team int, owner string, repo string, opt *OrganizationAddTeamRepoOptions) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#add-team-repo +func (s *OrganizationsService) AddTeamRepo(ctx context.Context, team int, 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(req, nil) + 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: http://developer.github.com/v3/orgs/teams/#remove-team-repo -func (s *OrganizationsService) RemoveTeamRepo(team int, owner string, repo string) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/orgs/teams/#remove-team-repo +func (s *OrganizationsService) RemoveTeamRepo(ctx context.Context, team int, 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(req, nil) + 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(opt *ListOptions) ([]*Team, *Response, error) { +func (s *OrganizationsService) ListUserTeams(ctx context.Context, opt *ListOptions) ([]*Team, *Response, error) { u := "user/teams" u, err := addOptions(u, opt) if err != nil { @@ -308,7 +309,7 @@ func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]*Team, *Respon } var teams []*Team - resp, err := s.client.Do(req, &teams) + resp, err := s.client.Do(ctx, req, &teams) if err != nil { return nil, resp, err } @@ -319,7 +320,7 @@ func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]*Team, *Respon // 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(team int, user string) (*Membership, *Response, error) { +func (s *OrganizationsService) GetTeamMembership(ctx context.Context, team int, 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 { @@ -327,7 +328,7 @@ func (s *OrganizationsService) GetTeamMembership(team int, user string) (*Member } t := new(Membership) - resp, err := s.client.Do(req, t) + resp, err := s.client.Do(ctx, req, t) if err != nil { return nil, resp, err } @@ -367,7 +368,7 @@ type OrganizationAddTeamMembershipOptions struct { // added as a member of the team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#add-team-membership -func (s *OrganizationsService) AddTeamMembership(team int, user string, opt *OrganizationAddTeamMembershipOptions) (*Membership, *Response, error) { +func (s *OrganizationsService) AddTeamMembership(ctx context.Context, team int, 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 { @@ -375,7 +376,7 @@ func (s *OrganizationsService) AddTeamMembership(team int, user string, opt *Org } t := new(Membership) - resp, err := s.client.Do(req, t) + resp, err := s.client.Do(ctx, req, t) if err != nil { return nil, resp, err } @@ -386,14 +387,14 @@ func (s *OrganizationsService) AddTeamMembership(team int, user string, opt *Org // RemoveTeamMembership removes a user from a team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#remove-team-membership -func (s *OrganizationsService) RemoveTeamMembership(team int, user string) (*Response, error) { +func (s *OrganizationsService) RemoveTeamMembership(ctx context.Context, team int, 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(req, nil) + return s.client.Do(ctx, req, nil) } // ListPendingTeamInvitations get pending invitaion list in team. @@ -401,7 +402,7 @@ func (s *OrganizationsService) RemoveTeamMembership(team int, user string) (*Res // 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(team int, opt *ListOptions) ([]*Invitation, *Response, error) { +func (s *OrganizationsService) ListPendingTeamInvitations(ctx context.Context, team int, opt *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("teams/%v/invitations", team) u, err := addOptions(u, opt) if err != nil { @@ -417,7 +418,7 @@ func (s *OrganizationsService) ListPendingTeamInvitations(team int, opt *ListOpt req.Header.Set("Accept", mediaTypeOrgMembershipPreview) var pendingInvitations []*Invitation - resp, err := s.client.Do(req, &pendingInvitations) + resp, err := s.client.Do(ctx, req, &pendingInvitations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/projects.go b/vendor/github.com/google/go-github/github/projects.go index 766f002801..58b638eb8c 100644 --- a/vendor/github.com/google/go-github/github/projects.go +++ b/vendor/github.com/google/go-github/github/projects.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // ProjectsService provides access to the projects functions in the // GitHub API. @@ -35,7 +38,7 @@ func (p Project) String() string { // GetProject gets a GitHub Project for a repo. // // GitHub API docs: https://developer.github.com/v3/projects/#get-a-project -func (s *ProjectsService) GetProject(id int) (*Project, *Response, error) { +func (s *ProjectsService) GetProject(ctx context.Context, id int) (*Project, *Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -46,7 +49,7 @@ func (s *ProjectsService) GetProject(id int) (*Project, *Response, error) { req.Header.Set("Accept", mediaTypeProjectsPreview) project := &Project{} - resp, err := s.client.Do(req, project) + resp, err := s.client.Do(ctx, req, project) if err != nil { return nil, resp, err } @@ -67,7 +70,7 @@ type ProjectOptions struct { // UpdateProject updates a repository project. // // GitHub API docs: https://developer.github.com/v3/projects/#update-a-project -func (s *ProjectsService) UpdateProject(id int, opt *ProjectOptions) (*Project, *Response, error) { +func (s *ProjectsService) UpdateProject(ctx context.Context, id int, opt *ProjectOptions) (*Project, *Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("PATCH", u, opt) if err != nil { @@ -78,7 +81,7 @@ func (s *ProjectsService) UpdateProject(id int, opt *ProjectOptions) (*Project, req.Header.Set("Accept", mediaTypeProjectsPreview) project := &Project{} - resp, err := s.client.Do(req, project) + resp, err := s.client.Do(ctx, req, project) if err != nil { return nil, resp, err } @@ -89,7 +92,7 @@ func (s *ProjectsService) UpdateProject(id int, opt *ProjectOptions) (*Project, // DeleteProject deletes a GitHub Project from a repository. // // GitHub API docs: https://developer.github.com/v3/projects/#delete-a-project -func (s *ProjectsService) DeleteProject(id int) (*Response, error) { +func (s *ProjectsService) DeleteProject(ctx context.Context, id int) (*Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -99,7 +102,7 @@ func (s *ProjectsService) DeleteProject(id int) (*Response, error) { // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // ProjectColumn represents a column of a GitHub Project. @@ -116,7 +119,7 @@ type ProjectColumn struct { // 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(projectID int, opt *ListOptions) ([]*ProjectColumn, *Response, error) { +func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int, opt *ListOptions) ([]*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/%v/columns", projectID) u, err := addOptions(u, opt) if err != nil { @@ -132,7 +135,7 @@ func (s *ProjectsService) ListProjectColumns(projectID int, opt *ListOptions) ([ req.Header.Set("Accept", mediaTypeProjectsPreview) columns := []*ProjectColumn{} - resp, err := s.client.Do(req, &columns) + resp, err := s.client.Do(ctx, req, &columns) if err != nil { return nil, resp, err } @@ -143,7 +146,7 @@ func (s *ProjectsService) ListProjectColumns(projectID int, opt *ListOptions) ([ // 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(id int) (*ProjectColumn, *Response, error) { +func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/columns/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -154,7 +157,7 @@ func (s *ProjectsService) GetProjectColumn(id int) (*ProjectColumn, *Response, e req.Header.Set("Accept", mediaTypeProjectsPreview) column := &ProjectColumn{} - resp, err := s.client.Do(req, column) + resp, err := s.client.Do(ctx, req, column) if err != nil { return nil, resp, err } @@ -173,7 +176,7 @@ type ProjectColumnOptions struct { // 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(projectID int, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { +func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/%v/columns", projectID) req, err := s.client.NewRequest("POST", u, opt) if err != nil { @@ -184,7 +187,7 @@ func (s *ProjectsService) CreateProjectColumn(projectID int, opt *ProjectColumnO req.Header.Set("Accept", mediaTypeProjectsPreview) column := &ProjectColumn{} - resp, err := s.client.Do(req, column) + resp, err := s.client.Do(ctx, req, column) if err != nil { return nil, resp, err } @@ -195,7 +198,7 @@ func (s *ProjectsService) CreateProjectColumn(projectID int, opt *ProjectColumnO // 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(columnID int, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { +func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/columns/%v", columnID) req, err := s.client.NewRequest("PATCH", u, opt) if err != nil { @@ -206,7 +209,7 @@ func (s *ProjectsService) UpdateProjectColumn(columnID int, opt *ProjectColumnOp req.Header.Set("Accept", mediaTypeProjectsPreview) column := &ProjectColumn{} - resp, err := s.client.Do(req, column) + resp, err := s.client.Do(ctx, req, column) if err != nil { return nil, resp, err } @@ -217,7 +220,7 @@ func (s *ProjectsService) UpdateProjectColumn(columnID int, opt *ProjectColumnOp // 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(columnID int) (*Response, error) { +func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int) (*Response, error) { u := fmt.Sprintf("projects/columns/%v", columnID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -227,7 +230,7 @@ func (s *ProjectsService) DeleteProjectColumn(columnID int) (*Response, error) { // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // ProjectColumnMoveOptions specifies the parameters to the @@ -241,7 +244,7 @@ type ProjectColumnMoveOptions struct { // 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(columnID int, opt *ProjectColumnMoveOptions) (*Response, error) { +func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int, opt *ProjectColumnMoveOptions) (*Response, error) { u := fmt.Sprintf("projects/columns/%v/moves", columnID) req, err := s.client.NewRequest("POST", u, opt) if err != nil { @@ -251,7 +254,7 @@ func (s *ProjectsService) MoveProjectColumn(columnID int, opt *ProjectColumnMove // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // ProjectCard represents a card in a column of a GitHub Project. @@ -269,7 +272,7 @@ type ProjectCard struct { // 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(columnID int, opt *ListOptions) ([]*ProjectCard, *Response, error) { +func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int, opt *ListOptions) ([]*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) u, err := addOptions(u, opt) if err != nil { @@ -285,7 +288,7 @@ func (s *ProjectsService) ListProjectCards(columnID int, opt *ListOptions) ([]*P req.Header.Set("Accept", mediaTypeProjectsPreview) cards := []*ProjectCard{} - resp, err := s.client.Do(req, &cards) + resp, err := s.client.Do(ctx, req, &cards) if err != nil { return nil, resp, err } @@ -296,7 +299,7 @@ func (s *ProjectsService) ListProjectCards(columnID int, opt *ListOptions) ([]*P // 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(columnID int) (*ProjectCard, *Response, error) { +func (s *ProjectsService) GetProjectCard(ctx context.Context, columnID int) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", columnID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -307,7 +310,7 @@ func (s *ProjectsService) GetProjectCard(columnID int) (*ProjectCard, *Response, req.Header.Set("Accept", mediaTypeProjectsPreview) card := &ProjectCard{} - resp, err := s.client.Do(req, card) + resp, err := s.client.Do(ctx, req, card) if err != nil { return nil, resp, err } @@ -331,7 +334,7 @@ type ProjectCardOptions struct { // 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(columnID int, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { +func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) req, err := s.client.NewRequest("POST", u, opt) if err != nil { @@ -342,7 +345,7 @@ func (s *ProjectsService) CreateProjectCard(columnID int, opt *ProjectCardOption req.Header.Set("Accept", mediaTypeProjectsPreview) card := &ProjectCard{} - resp, err := s.client.Do(req, card) + resp, err := s.client.Do(ctx, req, card) if err != nil { return nil, resp, err } @@ -353,7 +356,7 @@ func (s *ProjectsService) CreateProjectCard(columnID int, opt *ProjectCardOption // 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(cardID int, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { +func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("PATCH", u, opt) if err != nil { @@ -364,7 +367,7 @@ func (s *ProjectsService) UpdateProjectCard(cardID int, opt *ProjectCardOptions) req.Header.Set("Accept", mediaTypeProjectsPreview) card := &ProjectCard{} - resp, err := s.client.Do(req, card) + resp, err := s.client.Do(ctx, req, card) if err != nil { return nil, resp, err } @@ -375,7 +378,7 @@ func (s *ProjectsService) UpdateProjectCard(cardID int, opt *ProjectCardOptions) // 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(cardID int) (*Response, error) { +func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int) (*Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -385,7 +388,7 @@ func (s *ProjectsService) DeleteProjectCard(cardID int) (*Response, error) { // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // ProjectCardMoveOptions specifies the parameters to the @@ -403,7 +406,7 @@ type ProjectCardMoveOptions struct { // 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(cardID int, opt *ProjectCardMoveOptions) (*Response, error) { +func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int, opt *ProjectCardMoveOptions) (*Response, error) { u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID) req, err := s.client.NewRequest("POST", u, opt) if err != nil { @@ -413,5 +416,5 @@ func (s *ProjectsService) MoveProjectCard(cardID int, opt *ProjectCardMoveOption // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(req, nil) + 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 index 4f65e24894..ed9d11e3ba 100644 --- a/vendor/github.com/google/go-github/github/pulls.go +++ b/vendor/github.com/google/go-github/github/pulls.go @@ -7,6 +7,7 @@ package github import ( "bytes" + "context" "fmt" "time" ) @@ -14,7 +15,7 @@ import ( // PullRequestsService handles communication with the pull request related // methods of the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/pulls/ +// GitHub API docs: https://developer.github.com/v3/pulls/ type PullRequestsService service // PullRequest represents a GitHub pull request on a repository. @@ -94,8 +95,8 @@ type PullRequestListOptions struct { // List the pull requests for the specified repository. // -// GitHub API docs: http://developer.github.com/v3/pulls/#list-pull-requests -func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestListOptions) ([]*PullRequest, *Response, error) { +// 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 { @@ -108,7 +109,7 @@ func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestLi } var pulls []*PullRequest - resp, err := s.client.Do(req, &pulls) + resp, err := s.client.Do(ctx, req, &pulls) if err != nil { return nil, resp, err } @@ -119,7 +120,7 @@ func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestLi // Get a single pull request. // // GitHub API docs: https://developer.github.com/v3/pulls/#get-a-single-pull-request -func (s *PullRequestsService) Get(owner string, repo string, number int) (*PullRequest, *Response, error) { +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 { @@ -127,7 +128,7 @@ func (s *PullRequestsService) Get(owner string, repo string, number int) (*PullR } pull := new(PullRequest) - resp, err := s.client.Do(req, pull) + resp, err := s.client.Do(ctx, req, pull) if err != nil { return nil, resp, err } @@ -136,7 +137,7 @@ func (s *PullRequestsService) Get(owner string, repo string, number int) (*PullR } // GetRaw gets raw (diff or patch) format of a pull request. -func (s *PullRequestsService) GetRaw(owner string, repo string, number int, opt RawOptions) (string, *Response, error) { +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 { @@ -153,7 +154,7 @@ func (s *PullRequestsService) GetRaw(owner string, repo string, number int, opt } ret := new(bytes.Buffer) - resp, err := s.client.Do(req, ret) + resp, err := s.client.Do(ctx, req, ret) if err != nil { return "", resp, err } @@ -173,7 +174,7 @@ type NewPullRequest struct { // 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(owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { +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 { @@ -181,7 +182,7 @@ func (s *PullRequestsService) Create(owner string, repo string, pull *NewPullReq } p := new(PullRequest) - resp, err := s.client.Do(req, p) + resp, err := s.client.Do(ctx, req, p) if err != nil { return nil, resp, err } @@ -202,7 +203,7 @@ type pullRequestUpdate struct { // 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(owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { +func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) update := new(pullRequestUpdate) @@ -221,7 +222,7 @@ func (s *PullRequestsService) Edit(owner string, repo string, number int, pull * } p := new(PullRequest) - resp, err := s.client.Do(req, p) + resp, err := s.client.Do(ctx, req, p) if err != nil { return nil, resp, err } @@ -232,7 +233,7 @@ func (s *PullRequestsService) Edit(owner string, repo string, number int, pull * // 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(owner string, repo string, number int, opt *ListOptions) ([]*RepositoryCommit, *Response, error) { +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 { @@ -245,7 +246,7 @@ func (s *PullRequestsService) ListCommits(owner string, repo string, number int, } var commits []*RepositoryCommit - resp, err := s.client.Do(req, &commits) + resp, err := s.client.Do(ctx, req, &commits) if err != nil { return nil, resp, err } @@ -256,7 +257,7 @@ func (s *PullRequestsService) ListCommits(owner string, repo string, number int, // 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(owner string, repo string, number int, opt *ListOptions) ([]*CommitFile, *Response, error) { +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 { @@ -269,7 +270,7 @@ func (s *PullRequestsService) ListFiles(owner string, repo string, number int, o } var commitFiles []*CommitFile - resp, err := s.client.Do(req, &commitFiles) + resp, err := s.client.Do(ctx, req, &commitFiles) if err != nil { return nil, resp, err } @@ -280,14 +281,14 @@ func (s *PullRequestsService) ListFiles(owner string, repo string, number int, o // 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(owner string, repo string, number int) (bool, *Response, error) { +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(req, nil) + resp, err := s.client.Do(ctx, req, nil) merged, err := parseBoolResponse(err) return merged, resp, err } @@ -319,7 +320,7 @@ type pullRequestMergeRequest struct { // 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(owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) { +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} @@ -337,7 +338,7 @@ func (s *PullRequestsService) Merge(owner string, repo string, number int, commi req.Header.Set("Accept", mediaTypeSquashPreview) mergeResult := new(PullRequestMergeResult) - resp, err := s.client.Do(req, mergeResult) + resp, err := s.client.Do(ctx, req, mergeResult) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/pulls_comments.go b/vendor/github.com/google/go-github/github/pulls_comments.go index 0595389023..bc0bc2d4a2 100644 --- a/vendor/github.com/google/go-github/github/pulls_comments.go +++ b/vendor/github.com/google/go-github/github/pulls_comments.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -54,7 +55,7 @@ type PullRequestListCommentsOptions struct { // the repository. // // GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request -func (s *PullRequestsService) ListComments(owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) { +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) @@ -75,7 +76,7 @@ func (s *PullRequestsService) ListComments(owner string, repo string, number int req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*PullRequestComment - resp, err := s.client.Do(req, &comments) + resp, err := s.client.Do(ctx, req, &comments) if err != nil { return nil, resp, err } @@ -86,7 +87,7 @@ func (s *PullRequestsService) ListComments(owner string, repo string, number int // 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(owner string, repo string, number int) (*PullRequestComment, *Response, error) { +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 { @@ -97,7 +98,7 @@ func (s *PullRequestsService) GetComment(owner string, repo string, number int) req.Header.Set("Accept", mediaTypeReactionsPreview) comment := new(PullRequestComment) - resp, err := s.client.Do(req, comment) + resp, err := s.client.Do(ctx, req, comment) if err != nil { return nil, resp, err } @@ -108,7 +109,7 @@ func (s *PullRequestsService) GetComment(owner string, repo string, number int) // 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(owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { +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 { @@ -116,7 +117,7 @@ func (s *PullRequestsService) CreateComment(owner string, repo string, number in } c := new(PullRequestComment) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -127,7 +128,7 @@ func (s *PullRequestsService) CreateComment(owner string, repo string, number in // EditComment updates a pull request comment. // // GitHub API docs: https://developer.github.com/v3/pulls/comments/#edit-a-comment -func (s *PullRequestsService) EditComment(owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { +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 { @@ -135,7 +136,7 @@ func (s *PullRequestsService) EditComment(owner string, repo string, number int, } c := new(PullRequestComment) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -146,11 +147,11 @@ func (s *PullRequestsService) EditComment(owner string, repo string, number int, // DeleteComment deletes a pull request comment. // // GitHub API docs: https://developer.github.com/v3/pulls/comments/#delete-a-comment -func (s *PullRequestsService) DeleteComment(owner string, repo string, number int) (*Response, error) { +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(req, nil) + 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 index be57af88c7..c27b6a8c47 100644 --- a/vendor/github.com/google/go-github/github/pulls_reviews.go +++ b/vendor/github.com/google/go-github/github/pulls_reviews.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -64,7 +65,7 @@ func (r PullRequestReviewDismissalRequest) String() string { // 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(owner, repo string, number int) ([]*PullRequestReview, *Response, error) { +func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int) ([]*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -76,7 +77,7 @@ func (s *PullRequestsService) ListReviews(owner, repo string, number int) ([]*Pu req.Header.Set("Accept", mediaTypePullRequestReviewsPreview) var reviews []*PullRequestReview - resp, err := s.client.Do(req, &reviews) + resp, err := s.client.Do(ctx, req, &reviews) if err != nil { return nil, resp, err } @@ -91,7 +92,7 @@ func (s *PullRequestsService) ListReviews(owner, repo string, number int) ([]*Pu // 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(owner, repo string, number, reviewID int) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number, reviewID int) (*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) @@ -103,7 +104,7 @@ func (s *PullRequestsService) GetReview(owner, repo string, number, reviewID int req.Header.Set("Accept", mediaTypePullRequestReviewsPreview) review := new(PullRequestReview) - resp, err := s.client.Do(req, review) + resp, err := s.client.Do(ctx, req, review) if err != nil { return nil, resp, err } @@ -118,7 +119,7 @@ func (s *PullRequestsService) GetReview(owner, repo string, number, reviewID int // 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(owner, repo string, number, reviewID int) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number, reviewID int) (*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) @@ -130,7 +131,7 @@ func (s *PullRequestsService) DeletePendingReview(owner, repo string, number, re req.Header.Set("Accept", mediaTypePullRequestReviewsPreview) review := new(PullRequestReview) - resp, err := s.client.Do(req, review) + resp, err := s.client.Do(ctx, req, review) if err != nil { return nil, resp, err } @@ -145,7 +146,7 @@ func (s *PullRequestsService) DeletePendingReview(owner, repo string, number, re // 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-reviews-comments -func (s *PullRequestsService) ListReviewComments(owner, repo string, number, reviewID int) ([]*PullRequestComment, *Response, error) { +func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number, reviewID int) ([]*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) req, err := s.client.NewRequest("GET", u, nil) @@ -157,7 +158,7 @@ func (s *PullRequestsService) ListReviewComments(owner, repo string, number, rev req.Header.Set("Accept", mediaTypePullRequestReviewsPreview) var comments []*PullRequestComment - resp, err := s.client.Do(req, &comments) + resp, err := s.client.Do(ctx, req, &comments) if err != nil { return nil, resp, err } @@ -172,7 +173,7 @@ func (s *PullRequestsService) ListReviewComments(owner, repo string, number, rev // 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(owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { +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) @@ -184,7 +185,7 @@ func (s *PullRequestsService) CreateReview(owner, repo string, number int, revie req.Header.Set("Accept", mediaTypePullRequestReviewsPreview) r := new(PullRequestReview) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -199,7 +200,7 @@ func (s *PullRequestsService) CreateReview(owner, repo string, number int, revie // 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(owner, repo string, number, reviewID int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number, reviewID int, 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) @@ -211,7 +212,7 @@ func (s *PullRequestsService) SubmitReview(owner, repo string, number, reviewID req.Header.Set("Accept", mediaTypePullRequestReviewsPreview) r := new(PullRequestReview) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -226,7 +227,7 @@ func (s *PullRequestsService) SubmitReview(owner, repo string, number, reviewID // 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(owner, repo string, number, reviewID int, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number, reviewID int, 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) @@ -238,7 +239,7 @@ func (s *PullRequestsService) DismissReview(owner, repo string, number, reviewID req.Header.Set("Accept", mediaTypePullRequestReviewsPreview) r := new(PullRequestReview) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/reactions.go b/vendor/github.com/google/go-github/github/reactions.go index 03b131be90..739413d716 100644 --- a/vendor/github.com/google/go-github/github/reactions.go +++ b/vendor/github.com/google/go-github/github/reactions.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // ReactionsService provides access to the reactions-related functions in the // GitHub API. @@ -43,7 +46,7 @@ func (r Reaction) String() string { // 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(owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int, 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 { @@ -59,7 +62,7 @@ func (s *ReactionsService) ListCommentReactions(owner, repo string, id int, opt req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(req, &m) + resp, err := s.client.Do(ctx, req, &m) if err != nil { return nil, resp, err } @@ -72,7 +75,7 @@ func (s *ReactionsService) ListCommentReactions(owner, repo string, id int, opt // 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(owner, repo string, id int, content string) (*Reaction, *Response, error) { +func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) body := &Reaction{Content: String(content)} @@ -85,7 +88,7 @@ func (s ReactionsService) CreateCommentReaction(owner, repo string, id int, cont req.Header.Set("Accept", mediaTypeReactionsPreview) m := &Reaction{} - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -96,7 +99,7 @@ func (s ReactionsService) CreateCommentReaction(owner, repo string, id int, cont // 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(owner, repo string, number int, opt *ListOptions) ([]*Reaction, *Response, error) { +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 { @@ -112,7 +115,7 @@ func (s *ReactionsService) ListIssueReactions(owner, repo string, number int, op req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(req, &m) + resp, err := s.client.Do(ctx, req, &m) if err != nil { return nil, resp, err } @@ -125,7 +128,7 @@ func (s *ReactionsService) ListIssueReactions(owner, repo string, number int, op // 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(owner, repo string, number int, content string) (*Reaction, *Response, error) { +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)} @@ -138,7 +141,7 @@ func (s ReactionsService) CreateIssueReaction(owner, repo string, number int, co req.Header.Set("Accept", mediaTypeReactionsPreview) m := &Reaction{} - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -149,7 +152,7 @@ func (s ReactionsService) CreateIssueReaction(owner, repo string, number int, co // 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(owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int, 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 { @@ -165,7 +168,7 @@ func (s *ReactionsService) ListIssueCommentReactions(owner, repo string, id int, req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(req, &m) + resp, err := s.client.Do(ctx, req, &m) if err != nil { return nil, resp, err } @@ -178,7 +181,7 @@ func (s *ReactionsService) ListIssueCommentReactions(owner, repo string, id int, // 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(owner, repo string, id int, content string) (*Reaction, *Response, error) { +func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) body := &Reaction{Content: String(content)} @@ -191,7 +194,7 @@ func (s ReactionsService) CreateIssueCommentReaction(owner, repo string, id int, req.Header.Set("Accept", mediaTypeReactionsPreview) m := &Reaction{} - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -202,7 +205,7 @@ func (s ReactionsService) CreateIssueCommentReaction(owner, repo string, id int, // 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(owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int, 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 { @@ -218,7 +221,7 @@ func (s *ReactionsService) ListPullRequestCommentReactions(owner, repo string, i req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(req, &m) + resp, err := s.client.Do(ctx, req, &m) if err != nil { return nil, resp, err } @@ -231,7 +234,7 @@ func (s *ReactionsService) ListPullRequestCommentReactions(owner, repo string, i // 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(owner, repo string, id int, content string) (*Reaction, *Response, error) { +func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) body := &Reaction{Content: String(content)} @@ -244,7 +247,7 @@ func (s ReactionsService) CreatePullRequestCommentReaction(owner, repo string, i req.Header.Set("Accept", mediaTypeReactionsPreview) m := &Reaction{} - resp, err := s.client.Do(req, m) + resp, err := s.client.Do(ctx, req, m) if err != nil { return nil, resp, err } @@ -255,7 +258,7 @@ func (s ReactionsService) CreatePullRequestCommentReaction(owner, repo string, i // DeleteReaction deletes a reaction. // // GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive -func (s *ReactionsService) DeleteReaction(id int) (*Response, error) { +func (s *ReactionsService) DeleteReaction(ctx context.Context, id int) (*Response, error) { u := fmt.Sprintf("reactions/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -266,5 +269,5 @@ func (s *ReactionsService) DeleteReaction(id int) (*Response, error) { // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) - return s.client.Do(req, nil) + 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 index bbf4068fea..71b20b24d3 100644 --- a/vendor/github.com/google/go-github/github/repos.go +++ b/vendor/github.com/google/go-github/github/repos.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "strings" ) @@ -13,7 +14,7 @@ import ( // RepositoriesService handles communication with the repository related // methods of the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/repos/ +// GitHub API docs: https://developer.github.com/v3/repos/ type RepositoriesService service // Repository represents a GitHub repository. @@ -154,8 +155,8 @@ type RepositoryListOptions struct { // List the repositories for a user. Passing the empty string will list // repositories for the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/repos/#list-user-repositories -func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]*Repository, *Response, error) { +// 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) @@ -176,7 +177,7 @@ func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]* req.Header.Set("Accept", mediaTypeLicensesPreview) var repos []*Repository - resp, err := s.client.Do(req, &repos) + resp, err := s.client.Do(ctx, req, &repos) if err != nil { return nil, resp, err } @@ -196,8 +197,8 @@ type RepositoryListByOrgOptions struct { // ListByOrg lists the repositories for an organization. // -// GitHub API docs: http://developer.github.com/v3/repos/#list-organization-repositories -func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOptions) ([]*Repository, *Response, error) { +// 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 { @@ -213,7 +214,7 @@ func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOpti req.Header.Set("Accept", mediaTypeLicensesPreview) var repos []*Repository - resp, err := s.client.Do(req, &repos) + resp, err := s.client.Do(ctx, req, &repos) if err != nil { return nil, resp, err } @@ -232,8 +233,8 @@ type RepositoryListAllOptions struct { // ListAll lists all GitHub repositories in the order that they were created. // -// GitHub API docs: http://developer.github.com/v3/repos/#list-all-public-repositories -func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]*Repository, *Response, error) { +// 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 @@ -245,7 +246,7 @@ func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]*Reposit } var repos []*Repository - resp, err := s.client.Do(req, &repos) + resp, err := s.client.Do(ctx, req, &repos) if err != nil { return nil, resp, err } @@ -257,8 +258,8 @@ func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]*Reposit // repository will be created under that org. If the empty string is // specified, it will be created for the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/repos/#create -func (s *RepositoriesService) Create(org string, repo *Repository) (*Repository, *Response, error) { +// 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) @@ -272,7 +273,7 @@ func (s *RepositoriesService) Create(org string, repo *Repository) (*Repository, } r := new(Repository) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -282,8 +283,8 @@ func (s *RepositoriesService) Create(org string, repo *Repository) (*Repository, // Get fetches a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/#get -func (s *RepositoriesService) Get(owner, repo string) (*Repository, *Response, error) { +// 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 { @@ -296,7 +297,7 @@ func (s *RepositoriesService) Get(owner, repo string) (*Repository, *Response, e req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) repository := new(Repository) - resp, err := s.client.Do(req, repository) + resp, err := s.client.Do(ctx, req, repository) if err != nil { return nil, resp, err } @@ -307,7 +308,7 @@ func (s *RepositoriesService) Get(owner, repo string) (*Repository, *Response, e // GetByID fetches a repository. // // Note: GetByID uses the undocumented GitHub API endpoint /repositories/:id. -func (s *RepositoriesService) GetByID(id int) (*Repository, *Response, error) { +func (s *RepositoriesService) GetByID(ctx context.Context, id int) (*Repository, *Response, error) { u := fmt.Sprintf("repositories/%d", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -319,7 +320,7 @@ func (s *RepositoriesService) GetByID(id int) (*Repository, *Response, error) { req.Header.Set("Accept", mediaTypeLicensesPreview) repository := new(Repository) - resp, err := s.client.Do(req, repository) + resp, err := s.client.Do(ctx, req, repository) if err != nil { return nil, resp, err } @@ -329,8 +330,8 @@ func (s *RepositoriesService) GetByID(id int) (*Repository, *Response, error) { // Edit updates a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/#edit -func (s *RepositoriesService) Edit(owner, repo string, repository *Repository) (*Repository, *Response, error) { +// 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 { @@ -341,7 +342,7 @@ func (s *RepositoriesService) Edit(owner, repo string, repository *Repository) ( req.Header.Add("Accept", mediaTypeSquashPreview) r := new(Repository) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -352,14 +353,14 @@ func (s *RepositoriesService) Edit(owner, repo string, repository *Repository) ( // Delete a repository. // // GitHub API docs: https://developer.github.com/v3/repos/#delete-a-repository -func (s *RepositoriesService) Delete(owner, repo string) (*Response, error) { +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(req, nil) + return s.client.Do(ctx, req, nil) } // Contributor represents a repository contributor @@ -395,8 +396,8 @@ type ListContributorsOptions struct { // ListContributors lists contributors for a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/#list-contributors -func (s *RepositoriesService) ListContributors(owner string, repository string, opt *ListContributorsOptions) ([]*Contributor, *Response, error) { +// 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 { @@ -409,7 +410,7 @@ func (s *RepositoriesService) ListContributors(owner string, repository string, } var contributor []*Contributor - resp, err := s.client.Do(req, &contributor) + resp, err := s.client.Do(ctx, req, &contributor) if err != nil { return nil, nil, err } @@ -426,8 +427,8 @@ func (s *RepositoriesService) ListContributors(owner string, repository string, // "Python": 7769 // } // -// GitHub API Docs: http://developer.github.com/v3/repos/#list-languages -func (s *RepositoriesService) ListLanguages(owner string, repo string) (map[string]int, *Response, error) { +// 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 { @@ -435,7 +436,7 @@ func (s *RepositoriesService) ListLanguages(owner string, repo string) (map[stri } languages := make(map[string]int) - resp, err := s.client.Do(req, &languages) + resp, err := s.client.Do(ctx, req, &languages) if err != nil { return nil, resp, err } @@ -446,7 +447,7 @@ func (s *RepositoriesService) ListLanguages(owner string, repo string) (map[stri // ListTeams lists the teams for the specified repository. // // GitHub API docs: https://developer.github.com/v3/repos/#list-teams -func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOptions) ([]*Team, *Response, error) { +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 { @@ -459,7 +460,7 @@ func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOpti } var teams []*Team - resp, err := s.client.Do(req, &teams) + resp, err := s.client.Do(ctx, req, &teams) if err != nil { return nil, resp, err } @@ -478,7 +479,7 @@ type RepositoryTag struct { // ListTags lists tags for the specified repository. // // GitHub API docs: https://developer.github.com/v3/repos/#list-tags -func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptions) ([]*RepositoryTag, *Response, error) { +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 { @@ -491,7 +492,7 @@ func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptio } var tags []*RepositoryTag - resp, err := s.client.Do(req, &tags) + resp, err := s.client.Do(ctx, req, &tags) if err != nil { return nil, resp, err } @@ -559,8 +560,8 @@ type BranchRestrictionsRequest struct { // ListBranches lists branches for the specified repository. // -// GitHub API docs: http://developer.github.com/v3/repos/#list-branches -func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListOptions) ([]*Branch, *Response, error) { +// 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 { @@ -576,7 +577,7 @@ func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListO req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) var branches []*Branch - resp, err := s.client.Do(req, &branches) + resp, err := s.client.Do(ctx, req, &branches) if err != nil { return nil, resp, err } @@ -587,7 +588,7 @@ func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListO // GetBranch gets the specified branch for a repository. // // GitHub API docs: https://developer.github.com/v3/repos/#get-branch -func (s *RepositoriesService) GetBranch(owner, repo, branch string) (*Branch, *Response, error) { +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 { @@ -598,7 +599,7 @@ func (s *RepositoriesService) GetBranch(owner, repo, branch string) (*Branch, *R req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) b := new(Branch) - resp, err := s.client.Do(req, b) + resp, err := s.client.Do(ctx, req, b) if err != nil { return nil, resp, err } @@ -609,7 +610,7 @@ func (s *RepositoriesService) GetBranch(owner, repo, branch string) (*Branch, *R // 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(owner, repo, branch string) (*Protection, *Response, error) { +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 { @@ -620,7 +621,7 @@ func (s *RepositoriesService) GetBranchProtection(owner, repo, branch string) (* req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) p := new(Protection) - resp, err := s.client.Do(req, p) + resp, err := s.client.Do(ctx, req, p) if err != nil { return nil, resp, err } @@ -631,7 +632,7 @@ func (s *RepositoriesService) GetBranchProtection(owner, repo, branch string) (* // 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(owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) { +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 { @@ -642,7 +643,7 @@ func (s *RepositoriesService) UpdateBranchProtection(owner, repo, branch string, req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) p := new(Protection) - resp, err := s.client.Do(req, p) + resp, err := s.client.Do(ctx, req, p) if err != nil { return nil, resp, err } @@ -653,7 +654,7 @@ func (s *RepositoriesService) UpdateBranchProtection(owner, repo, branch string, // 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(owner, repo, branch string) (*Response, error) { +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 { @@ -663,13 +664,13 @@ func (s *RepositoriesService) RemoveBranchProtection(owner, repo, branch string) // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) - return s.client.Do(req, nil) + 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(owner, repo string) (*RepositoryLicense, *Response, error) { +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 { @@ -677,7 +678,7 @@ func (s *RepositoriesService) License(owner, repo string) (*RepositoryLicense, * } r := &RepositoryLicense{} - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_collaborators.go b/vendor/github.com/google/go-github/github/repos_collaborators.go index 6a6f39d519..ba89b6064a 100644 --- a/vendor/github.com/google/go-github/github/repos_collaborators.go +++ b/vendor/github.com/google/go-github/github/repos_collaborators.go @@ -5,12 +5,15 @@ package github -import "fmt" +import ( + "context" + "fmt" +) -// ListCollaborators lists the Github users that have access to the repository. +// ListCollaborators lists the GitHub users that have access to the repository. // -// GitHub API docs: http://developer.github.com/v3/repos/collaborators/#list -func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOptions) ([]*User, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#list +func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opt *ListOptions) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo) u, err := addOptions(u, opt) if err != nil { @@ -23,7 +26,7 @@ func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOpt } var users []*User - resp, err := s.client.Do(req, &users) + resp, err := s.client.Do(ctx, req, &users) if err != nil { return nil, resp, err } @@ -31,20 +34,20 @@ func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOpt return users, resp, nil } -// IsCollaborator checks whether the specified Github user has collaborator +// 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: http://developer.github.com/v3/repos/collaborators/#get -func (s *RepositoriesService) IsCollaborator(owner, repo, user string) (bool, *Response, error) { +// 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(req, nil) + resp, err := s.client.Do(ctx, req, nil) isCollab, err := parseBoolResponse(err) return isCollab, resp, err } @@ -60,7 +63,7 @@ type RepositoryPermissionLevel struct { // 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(owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) { +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 { @@ -71,7 +74,7 @@ func (s *RepositoriesService) GetPermissionLevel(owner, repo, user string) (*Rep req.Header.Set("Accept", mediaTypeOrgMembershipPreview) rpl := new(RepositoryPermissionLevel) - resp, err := s.client.Do(req, rpl) + resp, err := s.client.Do(ctx, req, rpl) if err != nil { return nil, resp, err } @@ -91,10 +94,10 @@ type RepositoryAddCollaboratorOptions struct { Permission string `json:"permission,omitempty"` } -// AddCollaborator adds the specified Github user as collaborator to the given repo. +// AddCollaborator adds the specified GitHub user as collaborator to the given repo. // // GitHub API docs: https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator -func (s *RepositoriesService) AddCollaborator(owner, repo, user string, opt *RepositoryAddCollaboratorOptions) (*Response, error) { +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 { @@ -104,18 +107,18 @@ func (s *RepositoriesService) AddCollaborator(owner, repo, user string, opt *Rep // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview) - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } -// RemoveCollaborator removes the specified Github user as collaborator from the given repo. +// 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: http://developer.github.com/v3/repos/collaborators/#remove-collaborator -func (s *RepositoriesService) RemoveCollaborator(owner, repo, user string) (*Response, error) { +// 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(req, nil) + 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 index 6efd18c650..4830ee2206 100644 --- a/vendor/github.com/google/go-github/github/repos_comments.go +++ b/vendor/github.com/google/go-github/github/repos_comments.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -34,8 +35,8 @@ func (r RepositoryComment) String() string { // ListComments lists all the comments for the repository. // -// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository -func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) ([]*RepositoryComment, *Response, error) { +// 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 { @@ -51,7 +52,7 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*RepositoryComment - resp, err := s.client.Do(req, &comments) + resp, err := s.client.Do(ctx, req, &comments) if err != nil { return nil, resp, err } @@ -61,8 +62,8 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) // ListCommitComments lists all the comments for a given commit SHA. // -// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit -func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *ListOptions) ([]*RepositoryComment, *Response, error) { +// 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 { @@ -78,7 +79,7 @@ func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *L req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*RepositoryComment - resp, err := s.client.Do(req, &comments) + resp, err := s.client.Do(ctx, req, &comments) if err != nil { return nil, resp, err } @@ -89,8 +90,8 @@ func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *L // 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: http://developer.github.com/v3/repos/comments/#create-a-commit-comment -func (s *RepositoriesService) CreateComment(owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) { +// 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 { @@ -98,7 +99,7 @@ func (s *RepositoriesService) CreateComment(owner, repo, sha string, comment *Re } c := new(RepositoryComment) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -108,8 +109,8 @@ func (s *RepositoriesService) CreateComment(owner, repo, sha string, comment *Re // GetComment gets a single comment from a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/comments/#get-a-single-commit-comment -func (s *RepositoriesService) GetComment(owner, repo string, id int) (*RepositoryComment, *Response, error) { +// 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 int) (*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 { @@ -120,7 +121,7 @@ func (s *RepositoriesService) GetComment(owner, repo string, id int) (*Repositor req.Header.Set("Accept", mediaTypeReactionsPreview) c := new(RepositoryComment) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -130,8 +131,8 @@ func (s *RepositoriesService) GetComment(owner, repo string, id int) (*Repositor // UpdateComment updates the body of a single comment. // -// GitHub API docs: http://developer.github.com/v3/repos/comments/#update-a-commit-comment -func (s *RepositoriesService) UpdateComment(owner, repo string, id int, comment *RepositoryComment) (*RepositoryComment, *Response, error) { +// 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 int, 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 { @@ -139,7 +140,7 @@ func (s *RepositoriesService) UpdateComment(owner, repo string, id int, comment } c := new(RepositoryComment) - resp, err := s.client.Do(req, c) + resp, err := s.client.Do(ctx, req, c) if err != nil { return nil, resp, err } @@ -149,12 +150,12 @@ func (s *RepositoriesService) UpdateComment(owner, repo string, id int, comment // DeleteComment deletes a single comment from a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/comments/#delete-a-commit-comment -func (s *RepositoriesService) DeleteComment(owner, repo string, id int) (*Response, error) { +// 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 int) (*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(req, nil) + 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 index 8920072c09..e516f1afd0 100644 --- a/vendor/github.com/google/go-github/github/repos_commits.go +++ b/vendor/github.com/google/go-github/github/repos_commits.go @@ -7,6 +7,7 @@ package github import ( "bytes" + "context" "fmt" "time" ) @@ -107,8 +108,8 @@ type CommitsListOptions struct { // ListCommits lists the commits of a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/commits/#list -func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOptions) ([]*RepositoryCommit, *Response, error) { +// 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 { @@ -121,7 +122,7 @@ func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOp } var commits []*RepositoryCommit - resp, err := s.client.Do(req, &commits) + resp, err := s.client.Do(ctx, req, &commits) if err != nil { return nil, resp, err } @@ -132,9 +133,9 @@ func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOp // GetCommit fetches the specified commit, including all details about it. // todo: support media formats - https://github.com/google/go-github/issues/6 // -// GitHub API docs: http://developer.github.com/v3/repos/commits/#get-a-single-commit -// See also: http://developer.github.com//v3/git/commits/#get-a-single-commit provides the same functionality -func (s *RepositoriesService) GetCommit(owner, repo, sha string) (*RepositoryCommit, *Response, error) { +// 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) @@ -146,7 +147,7 @@ func (s *RepositoriesService) GetCommit(owner, repo, sha string) (*RepositoryCom req.Header.Set("Accept", mediaTypeGitSigningPreview) commit := new(RepositoryCommit) - resp, err := s.client.Do(req, commit) + resp, err := s.client.Do(ctx, req, commit) if err != nil { return nil, resp, err } @@ -158,7 +159,7 @@ func (s *RepositoriesService) GetCommit(owner, repo, sha string) (*RepositoryCom // 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(owner, repo, ref, lastSHA string) (string, *Response, error) { +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) @@ -172,7 +173,7 @@ func (s *RepositoriesService) GetCommitSHA1(owner, repo, ref, lastSHA string) (s req.Header.Set("Accept", mediaTypeV3SHA) var buf bytes.Buffer - resp, err := s.client.Do(req, &buf) + resp, err := s.client.Do(ctx, req, &buf) if err != nil { return "", resp, err } @@ -183,8 +184,8 @@ func (s *RepositoriesService) GetCommitSHA1(owner, repo, ref, lastSHA string) (s // CompareCommits compares a range of commits with each other. // todo: support media formats - https://github.com/google/go-github/issues/6 // -// GitHub API docs: http://developer.github.com/v3/repos/commits/index.html#compare-two-commits -func (s *RepositoriesService) CompareCommits(owner, repo string, base, head string) (*CommitsComparison, *Response, error) { +// 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) @@ -193,7 +194,7 @@ func (s *RepositoriesService) CompareCommits(owner, repo string, base, head stri } comp := new(CommitsComparison) - resp, err := s.client.Do(req, comp) + resp, err := s.client.Do(ctx, req, comp) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_contents.go b/vendor/github.com/google/go-github/github/repos_contents.go index fdbc90441d..fa9fd55607 100644 --- a/vendor/github.com/google/go-github/github/repos_contents.go +++ b/vendor/github.com/google/go-github/github/repos_contents.go @@ -4,14 +4,14 @@ // license that can be found in the LICENSE file. // Repository contents API methods. -// http://developer.github.com/v3/repos/contents/ +// GitHub API docs: https://developer.github.com/v3/repos/contents/ package github import ( + "context" "encoding/base64" "encoding/json" - "errors" "fmt" "io" "net/http" @@ -64,20 +64,6 @@ func (r RepositoryContent) String() string { return Stringify(r) } -// Decode decodes the file content if it is base64 encoded. -// -// Deprecated: Use GetContent instead. -func (r *RepositoryContent) Decode() ([]byte, error) { - if *r.Encoding != "base64" { - return nil, errors.New("cannot decode non-base64") - } - o, err := base64.StdEncoding.DecodeString(*r.Content) - if err != nil { - return nil, err - } - return o, nil -} - // GetContent returns the content of r, decoding it if necessary. func (r *RepositoryContent) GetContent() (string, error) { var encoding string @@ -101,8 +87,8 @@ func (r *RepositoryContent) GetContent() (string, error) { // GetReadme gets the Readme file for the repository. // -// GitHub API docs: http://developer.github.com/v3/repos/contents/#get-the-readme -func (s *RepositoriesService) GetReadme(owner, repo string, opt *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) { +// 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 { @@ -113,7 +99,7 @@ func (s *RepositoriesService) GetReadme(owner, repo string, opt *RepositoryConte return nil, nil, err } readme := new(RepositoryContent) - resp, err := s.client.Do(req, readme) + resp, err := s.client.Do(ctx, req, readme) if err != nil { return nil, resp, err } @@ -124,10 +110,10 @@ func (s *RepositoriesService) GetReadme(owner, repo string, opt *RepositoryConte // 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(owner, repo, filepath string, opt *RepositoryContentGetOptions) (io.ReadCloser, error) { +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(owner, repo, dir, opt) + _, dirContents, _, err := s.GetContents(ctx, owner, repo, dir, opt) if err != nil { return nil, err } @@ -153,8 +139,8 @@ func (s *RepositoriesService) DownloadContents(owner, repo, filepath string, opt // as possible, both result types will be returned but only one will contain a // value and the other will be nil. // -// GitHub API docs: http://developer.github.com/v3/repos/contents/#get-contents -func (s *RepositoriesService) GetContents(owner, repo, path string, opt *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) { +// 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) @@ -166,7 +152,7 @@ func (s *RepositoriesService) GetContents(owner, repo, path string, opt *Reposit return nil, nil, nil, err } var rawJSON json.RawMessage - resp, err = s.client.Do(req, &rawJSON) + resp, err = s.client.Do(ctx, req, &rawJSON) if err != nil { return nil, nil, resp, err } @@ -184,15 +170,15 @@ func (s *RepositoriesService) GetContents(owner, repo, path string, opt *Reposit // CreateFile creates a new file in a repository at the given path and returns // the commit and file metadata. // -// GitHub API docs: http://developer.github.com/v3/repos/contents/#create-a-file -func (s *RepositoriesService) CreateFile(owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { +// 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(req, createResponse) + resp, err := s.client.Do(ctx, req, createResponse) if err != nil { return nil, resp, err } @@ -202,15 +188,15 @@ func (s *RepositoriesService) CreateFile(owner, repo, path string, opt *Reposito // 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: http://developer.github.com/v3/repos/contents/#update-a-file -func (s *RepositoriesService) UpdateFile(owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { +// 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(req, updateResponse) + resp, err := s.client.Do(ctx, req, updateResponse) if err != nil { return nil, resp, err } @@ -220,15 +206,15 @@ func (s *RepositoriesService) UpdateFile(owner, repo, path string, opt *Reposito // DeleteFile deletes a file from a repository and returns the commit. // Requires the blob SHA of the file to be deleted. // -// GitHub API docs: http://developer.github.com/v3/repos/contents/#delete-a-file -func (s *RepositoriesService) DeleteFile(owner, repo, path string, opt *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { +// 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(req, deleteResponse) + resp, err := s.client.Do(ctx, req, deleteResponse) if err != nil { return nil, resp, err } @@ -250,8 +236,8 @@ const ( // repository. The archiveFormat can be specified by either the github.Tarball // or github.Zipball constant. // -// GitHub API docs: http://developer.github.com/v3/repos/contents/#get-archive-link -func (s *RepositoriesService) GetArchiveLink(owner, repo string, archiveformat archiveFormat, opt *RepositoryContentGetOptions) (*url.URL, *Response, error) { +// 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) @@ -263,9 +249,9 @@ func (s *RepositoriesService) GetArchiveLink(owner, repo string, archiveformat a var resp *http.Response // Use http.DefaultTransport if no custom Transport is configured if s.client.client.Transport == nil { - resp, err = http.DefaultTransport.RoundTrip(req) + resp, err = http.DefaultTransport.RoundTrip(req.WithContext(ctx)) } else { - resp, err = s.client.client.Transport.RoundTrip(req) + resp, err = s.client.client.Transport.RoundTrip(req.WithContext(ctx)) } if err != nil { return nil, nil, 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 index 72dc05cb62..9054ca9472 100644 --- a/vendor/github.com/google/go-github/github/repos_deployments.go +++ b/vendor/github.com/google/go-github/github/repos_deployments.go @@ -6,6 +6,7 @@ package github import ( + "context" "encoding/json" "fmt" ) @@ -61,7 +62,7 @@ type DeploymentsListOptions struct { // ListDeployments lists the deployments of a repository. // // GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployments -func (s *RepositoriesService) ListDeployments(owner, repo string, opt *DeploymentsListOptions) ([]*Deployment, *Response, error) { +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 { @@ -74,7 +75,7 @@ func (s *RepositoriesService) ListDeployments(owner, repo string, opt *Deploymen } var deployments []*Deployment - resp, err := s.client.Do(req, &deployments) + resp, err := s.client.Do(ctx, req, &deployments) if err != nil { return nil, resp, err } @@ -85,7 +86,7 @@ func (s *RepositoriesService) ListDeployments(owner, repo string, opt *Deploymen // 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(owner, repo string, deploymentID int) (*Deployment, *Response, error) { +func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) req, err := s.client.NewRequest("GET", u, nil) @@ -94,7 +95,7 @@ func (s *RepositoriesService) GetDeployment(owner, repo string, deploymentID int } deployment := new(Deployment) - resp, err := s.client.Do(req, deployment) + resp, err := s.client.Do(ctx, req, deployment) if err != nil { return nil, resp, err } @@ -105,7 +106,7 @@ func (s *RepositoriesService) GetDeployment(owner, repo string, deploymentID int // 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(owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) { +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) @@ -117,7 +118,7 @@ func (s *RepositoriesService) CreateDeployment(owner, repo string, request *Depl req.Header.Set("Accept", mediaTypeDeploymentStatusPreview) d := new(Deployment) - resp, err := s.client.Do(req, d) + resp, err := s.client.Do(ctx, req, d) if err != nil { return nil, resp, err } @@ -144,7 +145,6 @@ type DeploymentStatus struct { // DeploymentStatusRequest represents a deployment request type DeploymentStatusRequest struct { State *string `json:"state,omitempty"` - TargetURL *string `json:"target_url,omitempty"` // Deprecated. Use LogURL instead. LogURL *string `json:"log_url,omitempty"` Description *string `json:"description,omitempty"` EnvironmentURL *string `json:"environment_url,omitempty"` @@ -154,7 +154,7 @@ type DeploymentStatusRequest struct { // 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(owner, repo string, deployment int, opt *ListOptions) ([]*DeploymentStatus, *Response, error) { +func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int, 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 { @@ -167,7 +167,7 @@ func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deploym } var statuses []*DeploymentStatus - resp, err := s.client.Do(req, &statuses) + resp, err := s.client.Do(ctx, req, &statuses) if err != nil { return nil, resp, err } @@ -178,7 +178,7 @@ func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deploym // 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(owner, repo string, deploymentID, deploymentStatusID int) (*DeploymentStatus, *Response, error) { +func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int) (*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) @@ -190,7 +190,7 @@ func (s *RepositoriesService) GetDeploymentStatus(owner, repo string, deployment req.Header.Set("Accept", mediaTypeDeploymentStatusPreview) d := new(DeploymentStatus) - resp, err := s.client.Do(req, d) + resp, err := s.client.Do(ctx, req, d) if err != nil { return nil, resp, err } @@ -201,7 +201,7 @@ func (s *RepositoriesService) GetDeploymentStatus(owner, repo string, deployment // 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(owner, repo string, deployment int, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { +func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int, 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) @@ -213,7 +213,7 @@ func (s *RepositoriesService) CreateDeploymentStatus(owner, repo string, deploym req.Header.Set("Accept", mediaTypeDeploymentStatusPreview) d := new(DeploymentStatus) - resp, err := s.client.Do(req, d) + resp, err := s.client.Do(ctx, req, d) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_forks.go b/vendor/github.com/google/go-github/github/repos_forks.go index 556308075c..6b5e4eabba 100644 --- a/vendor/github.com/google/go-github/github/repos_forks.go +++ b/vendor/github.com/google/go-github/github/repos_forks.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // RepositoryListForksOptions specifies the optional parameters to the // RepositoriesService.ListForks method. @@ -19,8 +22,8 @@ type RepositoryListForksOptions struct { // ListForks lists the forks of the specified repository. // -// GitHub API docs: http://developer.github.com/v3/repos/forks/#list-forks -func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListForksOptions) ([]*Repository, *Response, error) { +// 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 { @@ -33,7 +36,7 @@ func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListF } var repos []*Repository - resp, err := s.client.Do(req, &repos) + resp, err := s.client.Do(ctx, req, &repos) if err != nil { return nil, resp, err } @@ -57,7 +60,7 @@ type RepositoryCreateForkOptions struct { // in a successful request. // // GitHub API docs: https://developer.github.com/v3/repos/forks/#create-a-fork -func (s *RepositoriesService) CreateFork(owner, repo string, opt *RepositoryCreateForkOptions) (*Repository, *Response, error) { +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 { @@ -70,7 +73,7 @@ func (s *RepositoriesService) CreateFork(owner, repo string, opt *RepositoryCrea } fork := new(Repository) - resp, err := s.client.Do(req, fork) + resp, err := s.client.Do(ctx, req, fork) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_hooks.go b/vendor/github.com/google/go-github/github/repos_hooks.go index d7a48af77a..67ce96ac34 100644 --- a/vendor/github.com/google/go-github/github/repos_hooks.go +++ b/vendor/github.com/google/go-github/github/repos_hooks.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -85,8 +86,8 @@ func (h Hook) String() string { // CreateHook creates a Hook for the specified repository. // Name and Config are required fields. // -// GitHub API docs: http://developer.github.com/v3/repos/hooks/#create-a-hook -func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook, *Response, error) { +// 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 { @@ -94,7 +95,7 @@ func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook, } h := new(Hook) - resp, err := s.client.Do(req, h) + resp, err := s.client.Do(ctx, req, h) if err != nil { return nil, resp, err } @@ -104,8 +105,8 @@ func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook, // ListHooks lists all Hooks for the specified repository. // -// GitHub API docs: http://developer.github.com/v3/repos/hooks/#list -func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([]*Hook, *Response, error) { +// 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 { @@ -118,7 +119,7 @@ func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([ } var hooks []*Hook - resp, err := s.client.Do(req, &hooks) + resp, err := s.client.Do(ctx, req, &hooks) if err != nil { return nil, resp, err } @@ -128,69 +129,64 @@ func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([ // GetHook returns a single specified Hook. // -// GitHub API docs: http://developer.github.com/v3/repos/hooks/#get-single-hook -func (s *RepositoriesService) GetHook(owner, repo string, id int) (*Hook, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/repos/hooks/#get-single-hook +func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int) (*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(req, hook) + resp, err := s.client.Do(ctx, req, hook) return hook, resp, err } // EditHook updates a specified Hook. // -// GitHub API docs: http://developer.github.com/v3/repos/hooks/#edit-a-hook -func (s *RepositoriesService) EditHook(owner, repo string, id int, hook *Hook) (*Hook, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/repos/hooks/#edit-a-hook +func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int, 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(req, h) + resp, err := s.client.Do(ctx, req, h) return h, resp, err } // DeleteHook deletes a specified Hook. // -// GitHub API docs: http://developer.github.com/v3/repos/hooks/#delete-a-hook -func (s *RepositoriesService) DeleteHook(owner, repo string, id int) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/repos/hooks/#delete-a-hook +func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int) (*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(req, nil) + 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(owner, repo string, id int) (*Response, error) { +func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int) (*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(req, nil) + return s.client.Do(ctx, req, nil) } // TestHook triggers a test Hook by github. // -// GitHub API docs: http://developer.github.com/v3/repos/hooks/#test-a-push-hook -func (s *RepositoriesService) TestHook(owner, repo string, id int) (*Response, error) { +// 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 int) (*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(req, nil) -} - -// ListServiceHooks is deprecated. Use Client.ListServiceHooks instead. -func (s *RepositoriesService) ListServiceHooks() ([]*ServiceHook, *Response, error) { - return s.client.ListServiceHooks() + 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 index e80b946314..58c26dfa33 100644 --- a/vendor/github.com/google/go-github/github/repos_invitations.go +++ b/vendor/github.com/google/go-github/github/repos_invitations.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // RepositoryInvitation represents an invitation to collaborate on a repo. type RepositoryInvitation struct { @@ -25,7 +28,7 @@ type RepositoryInvitation struct { // 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(repoID int, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) { +func (s *RepositoriesService) ListInvitations(ctx context.Context, repoID int, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) { u := fmt.Sprintf("repositories/%v/invitations", repoID) u, err := addOptions(u, opt) if err != nil { @@ -41,7 +44,7 @@ func (s *RepositoriesService) ListInvitations(repoID int, opt *ListOptions) ([]* req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview) invites := []*RepositoryInvitation{} - resp, err := s.client.Do(req, &invites) + resp, err := s.client.Do(ctx, req, &invites) if err != nil { return nil, resp, err } @@ -52,7 +55,7 @@ func (s *RepositoriesService) ListInvitations(repoID int, opt *ListOptions) ([]* // DeleteInvitation deletes a repository invitation. // // GitHub API docs: https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation -func (s *RepositoriesService) DeleteInvitation(repoID, invitationID int) (*Response, error) { +func (s *RepositoriesService) DeleteInvitation(ctx context.Context, repoID, invitationID int) (*Response, error) { u := fmt.Sprintf("repositories/%v/invitations/%v", repoID, invitationID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -62,7 +65,7 @@ func (s *RepositoriesService) DeleteInvitation(repoID, invitationID int) (*Respo // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview) - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // UpdateInvitation updates the permissions associated with a repository @@ -72,7 +75,7 @@ func (s *RepositoriesService) DeleteInvitation(repoID, invitationID int) (*Respo // 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(repoID, invitationID int, permissions string) (*RepositoryInvitation, *Response, error) { +func (s *RepositoriesService) UpdateInvitation(ctx context.Context, repoID, invitationID int, permissions string) (*RepositoryInvitation, *Response, error) { opts := &struct { Permissions string `json:"permissions"` }{Permissions: permissions} @@ -86,6 +89,6 @@ func (s *RepositoriesService) UpdateInvitation(repoID, invitationID int, permiss req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview) invite := &RepositoryInvitation{} - resp, err := s.client.Do(req, invite) + resp, err := s.client.Do(ctx, req, invite) return invite, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_keys.go b/vendor/github.com/google/go-github/github/repos_keys.go index da628ac088..f5a865813a 100644 --- a/vendor/github.com/google/go-github/github/repos_keys.go +++ b/vendor/github.com/google/go-github/github/repos_keys.go @@ -5,14 +5,17 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // The Key type is defined in users_keys.go // ListKeys lists the deploy keys for a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/keys/#list -func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptions) ([]*Key, *Response, error) { +// 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 { @@ -25,7 +28,7 @@ func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptio } var keys []*Key - resp, err := s.client.Do(req, &keys) + resp, err := s.client.Do(ctx, req, &keys) if err != nil { return nil, resp, err } @@ -35,8 +38,8 @@ func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptio // GetKey fetches a single deploy key. // -// GitHub API docs: http://developer.github.com/v3/repos/keys/#get -func (s *RepositoriesService) GetKey(owner string, repo string, id int) (*Key, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/repos/keys/#get +func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -45,7 +48,7 @@ func (s *RepositoriesService) GetKey(owner string, repo string, id int) (*Key, * } key := new(Key) - resp, err := s.client.Do(req, key) + resp, err := s.client.Do(ctx, req, key) if err != nil { return nil, resp, err } @@ -55,8 +58,8 @@ func (s *RepositoriesService) GetKey(owner string, repo string, id int) (*Key, * // CreateKey adds a deploy key for a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/keys/#create -func (s *RepositoriesService) CreateKey(owner string, repo string, key *Key) (*Key, *Response, error) { +// 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) @@ -65,7 +68,7 @@ func (s *RepositoriesService) CreateKey(owner string, repo string, key *Key) (*K } k := new(Key) - resp, err := s.client.Do(req, k) + resp, err := s.client.Do(ctx, req, k) if err != nil { return nil, resp, err } @@ -75,8 +78,8 @@ func (s *RepositoriesService) CreateKey(owner string, repo string, key *Key) (*K // EditKey edits a deploy key. // -// GitHub API docs: http://developer.github.com/v3/repos/keys/#edit -func (s *RepositoriesService) EditKey(owner string, repo string, id int, key *Key) (*Key, *Response, error) { +// 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) @@ -85,7 +88,7 @@ func (s *RepositoriesService) EditKey(owner string, repo string, id int, key *Ke } k := new(Key) - resp, err := s.client.Do(req, k) + resp, err := s.client.Do(ctx, req, k) if err != nil { return nil, resp, err } @@ -95,8 +98,8 @@ func (s *RepositoriesService) EditKey(owner string, repo string, id int, key *Ke // DeleteKey deletes a deploy key. // -// GitHub API docs: http://developer.github.com/v3/repos/keys/#delete -func (s *RepositoriesService) DeleteKey(owner string, repo string, id int) (*Response, error) { +// 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) @@ -104,5 +107,5 @@ func (s *RepositoriesService) DeleteKey(owner string, repo string, id int) (*Res return nil, err } - return s.client.Do(req, nil) + 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 index f9aefb49b5..04383c1ae3 100644 --- a/vendor/github.com/google/go-github/github/repos_merging.go +++ b/vendor/github.com/google/go-github/github/repos_merging.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" ) @@ -20,7 +21,7 @@ type RepositoryMergeRequest struct { // Merge a branch in the specified repository. // // GitHub API docs: https://developer.github.com/v3/repos/merging/#perform-a-merge -func (s *RepositoriesService) Merge(owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { +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 { @@ -28,7 +29,7 @@ func (s *RepositoriesService) Merge(owner, repo string, request *RepositoryMerge } commit := new(RepositoryCommit) - resp, err := s.client.Do(req, commit) + resp, err := s.client.Do(ctx, req, commit) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_pages.go b/vendor/github.com/google/go-github/github/repos_pages.go index e4bb6d8811..3d19b43db5 100644 --- a/vendor/github.com/google/go-github/github/repos_pages.go +++ b/vendor/github.com/google/go-github/github/repos_pages.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Pages represents a GitHub Pages site configuration. type Pages struct { @@ -36,7 +39,7 @@ type PagesBuild struct { // 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(owner, repo string) (*Pages, *Response, error) { +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 { @@ -47,7 +50,7 @@ func (s *RepositoriesService) GetPagesInfo(owner, repo string) (*Pages, *Respons req.Header.Set("Accept", mediaTypePagesPreview) site := new(Pages) - resp, err := s.client.Do(req, site) + resp, err := s.client.Do(ctx, req, site) if err != nil { return nil, resp, err } @@ -58,7 +61,7 @@ func (s *RepositoriesService) GetPagesInfo(owner, repo string) (*Pages, *Respons // 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(owner, repo string) ([]*PagesBuild, *Response, error) { +func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string) ([]*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -66,7 +69,7 @@ func (s *RepositoriesService) ListPagesBuilds(owner, repo string) ([]*PagesBuild } var pages []*PagesBuild - resp, err := s.client.Do(req, &pages) + resp, err := s.client.Do(ctx, req, &pages) if err != nil { return nil, resp, err } @@ -77,7 +80,7 @@ func (s *RepositoriesService) ListPagesBuilds(owner, repo string) ([]*PagesBuild // 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(owner, repo string) (*PagesBuild, *Response, error) { +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 { @@ -85,7 +88,7 @@ func (s *RepositoriesService) GetLatestPagesBuild(owner, repo string) (*PagesBui } build := new(PagesBuild) - resp, err := s.client.Do(req, build) + resp, err := s.client.Do(ctx, req, build) if err != nil { return nil, resp, err } @@ -96,7 +99,7 @@ func (s *RepositoriesService) GetLatestPagesBuild(owner, repo string) (*PagesBui // 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(owner, repo string, id int) (*PagesBuild, *Response, error) { +func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int) (*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 { @@ -104,7 +107,7 @@ func (s *RepositoriesService) GetPageBuild(owner, repo string, id int) (*PagesBu } build := new(PagesBuild) - resp, err := s.client.Do(req, build) + resp, err := s.client.Do(ctx, req, build) if err != nil { return nil, resp, err } @@ -115,7 +118,7 @@ func (s *RepositoriesService) GetPageBuild(owner, repo string, id int) (*PagesBu // 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(owner, repo string) (*PagesBuild, *Response, error) { +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 { @@ -126,7 +129,7 @@ func (s *RepositoriesService) RequestPageBuild(owner, repo string) (*PagesBuild, req.Header.Set("Accept", mediaTypePagesPreview) build := new(PagesBuild) - resp, err := s.client.Do(req, build) + resp, err := s.client.Do(ctx, req, build) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_projects.go b/vendor/github.com/google/go-github/github/repos_projects.go index dc9227c389..9e1a4dbb2d 100644 --- a/vendor/github.com/google/go-github/github/repos_projects.go +++ b/vendor/github.com/google/go-github/github/repos_projects.go @@ -5,12 +5,15 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // ListProjects lists the projects for a repo. // // GitHub API docs: https://developer.github.com/v3/projects/#list-repository-projects -func (s *RepositoriesService) ListProjects(owner, repo string, opt *ListOptions) ([]*Project, *Response, error) { +func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Project, *Response, error) { u := fmt.Sprintf("repos/%v/%v/projects", owner, repo) u, err := addOptions(u, opt) if err != nil { @@ -26,7 +29,7 @@ func (s *RepositoriesService) ListProjects(owner, repo string, opt *ListOptions) req.Header.Set("Accept", mediaTypeProjectsPreview) projects := []*Project{} - resp, err := s.client.Do(req, &projects) + resp, err := s.client.Do(ctx, req, &projects) if err != nil { return nil, resp, err } @@ -37,7 +40,7 @@ func (s *RepositoriesService) ListProjects(owner, repo string, opt *ListOptions) // 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(owner, repo string, opt *ProjectOptions) (*Project, *Response, error) { +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 { @@ -48,7 +51,7 @@ func (s *RepositoriesService) CreateProject(owner, repo string, opt *ProjectOpti req.Header.Set("Accept", mediaTypeProjectsPreview) project := &Project{} - resp, err := s.client.Do(req, project) + resp, err := s.client.Do(ctx, req, project) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_releases.go b/vendor/github.com/google/go-github/github/repos_releases.go index 3c9f0e49f6..49fec8324e 100644 --- a/vendor/github.com/google/go-github/github/repos_releases.go +++ b/vendor/github.com/google/go-github/github/repos_releases.go @@ -6,6 +6,7 @@ package github import ( + "context" "errors" "fmt" "io" @@ -41,7 +42,7 @@ func (r RepositoryRelease) String() string { return Stringify(r) } -// ReleaseAsset represents a Github release asset in a repository. +// ReleaseAsset represents a GitHub release asset in a repository. type ReleaseAsset struct { ID *int `json:"id,omitempty"` URL *string `json:"url,omitempty"` @@ -63,8 +64,8 @@ func (r ReleaseAsset) String() string { // ListReleases lists the releases for a repository. // -// GitHub API docs: http://developer.github.com/v3/repos/releases/#list-releases-for-a-repository -func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions) ([]*RepositoryRelease, *Response, error) { +// 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 { @@ -77,7 +78,7 @@ func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions) } var releases []*RepositoryRelease - resp, err := s.client.Do(req, &releases) + resp, err := s.client.Do(ctx, req, &releases) if err != nil { return nil, resp, err } @@ -86,36 +87,36 @@ func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions) // GetRelease fetches a single release. // -// GitHub API docs: http://developer.github.com/v3/repos/releases/#get-a-single-release -func (s *RepositoriesService) GetRelease(owner, repo string, id int) (*RepositoryRelease, *Response, error) { +// 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 int) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) - return s.getSingleRelease(u) + 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(owner, repo string) (*RepositoryRelease, *Response, error) { +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(u) + 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(owner, repo, tag string) (*RepositoryRelease, *Response, error) { +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(u) + return s.getSingleRelease(ctx, u) } -func (s *RepositoriesService) getSingleRelease(url string) (*RepositoryRelease, *Response, error) { +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(req, release) + resp, err := s.client.Do(ctx, req, release) if err != nil { return nil, resp, err } @@ -124,8 +125,8 @@ func (s *RepositoriesService) getSingleRelease(url string) (*RepositoryRelease, // CreateRelease adds a new release for a repository. // -// GitHub API docs : http://developer.github.com/v3/repos/releases/#create-a-release -func (s *RepositoriesService) CreateRelease(owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { +// 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) @@ -134,7 +135,7 @@ func (s *RepositoriesService) CreateRelease(owner, repo string, release *Reposit } r := new(RepositoryRelease) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -143,8 +144,8 @@ func (s *RepositoriesService) CreateRelease(owner, repo string, release *Reposit // EditRelease edits a repository release. // -// GitHub API docs : http://developer.github.com/v3/repos/releases/#edit-a-release -func (s *RepositoriesService) EditRelease(owner, repo string, id int, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release +func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, release) @@ -153,7 +154,7 @@ func (s *RepositoriesService) EditRelease(owner, repo string, id int, release *R } r := new(RepositoryRelease) - resp, err := s.client.Do(req, r) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } @@ -162,21 +163,21 @@ func (s *RepositoriesService) EditRelease(owner, repo string, id int, release *R // DeleteRelease delete a single release from a repository. // -// GitHub API docs : http://developer.github.com/v3/repos/releases/#delete-a-release -func (s *RepositoriesService) DeleteRelease(owner, repo string, id int) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release +func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int) (*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(req, nil) + return s.client.Do(ctx, req, nil) } // ListReleaseAssets lists the release's assets. // -// GitHub API docs : http://developer.github.com/v3/repos/releases/#list-assets-for-a-release -func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt *ListOptions) ([]*ReleaseAsset, *Response, error) { +// 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 int, 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 { @@ -189,7 +190,7 @@ func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt } var assets []*ReleaseAsset - resp, err := s.client.Do(req, &assets) + resp, err := s.client.Do(ctx, req, &assets) if err != nil { return nil, resp, err } @@ -198,8 +199,8 @@ func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt // GetReleaseAsset fetches a single release asset. // -// GitHub API docs : http://developer.github.com/v3/repos/releases/#get-a-single-release-asset -func (s *RepositoriesService) GetReleaseAsset(owner, repo string, id int) (*ReleaseAsset, *Response, error) { +// 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 int) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -208,7 +209,7 @@ func (s *RepositoriesService) GetReleaseAsset(owner, repo string, id int) (*Rele } asset := new(ReleaseAsset) - resp, err := s.client.Do(req, asset) + resp, err := s.client.Do(ctx, req, asset) if err != nil { return nil, resp, err } @@ -222,8 +223,8 @@ func (s *RepositoriesService) GetReleaseAsset(owner, repo string, id int) (*Rele // 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 : http://developer.github.com/v3/repos/releases/#get-a-single-release-asset -func (s *RepositoriesService) DownloadReleaseAsset(owner, repo string, id int) (rc io.ReadCloser, redirectURL string, err error) { +// 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 int) (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) @@ -243,7 +244,7 @@ func (s *RepositoriesService) DownloadReleaseAsset(owner, repo string, id int) ( } defer func() { s.client.client.CheckRedirect = saveRedirect }() - resp, err := s.client.client.Do(req) + resp, err := s.client.client.Do(req.WithContext(ctx)) if err != nil { if !strings.Contains(err.Error(), "disable redirect") { return nil, "", err @@ -261,8 +262,8 @@ func (s *RepositoriesService) DownloadReleaseAsset(owner, repo string, id int) ( // EditReleaseAsset edits a repository release asset. // -// GitHub API docs : http://developer.github.com/v3/repos/releases/#edit-a-release-asset -func (s *RepositoriesService) EditReleaseAsset(owner, repo string, id int, release *ReleaseAsset) (*ReleaseAsset, *Response, error) { +// 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 int, 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) @@ -271,7 +272,7 @@ func (s *RepositoriesService) EditReleaseAsset(owner, repo string, id int, relea } asset := new(ReleaseAsset) - resp, err := s.client.Do(req, asset) + resp, err := s.client.Do(ctx, req, asset) if err != nil { return nil, resp, err } @@ -280,22 +281,22 @@ func (s *RepositoriesService) EditReleaseAsset(owner, repo string, id int, relea // DeleteReleaseAsset delete a single release asset from a repository. // -// GitHub API docs : http://developer.github.com/v3/repos/releases/#delete-a-release-asset -func (s *RepositoriesService) DeleteReleaseAsset(owner, repo string, id int) (*Response, error) { +// 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 int) (*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(req, nil) + 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 : http://developer.github.com/v3/repos/releases/#upload-a-release-asset -func (s *RepositoriesService) UploadReleaseAsset(owner, repo string, id int, opt *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { +// 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 int, 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 { @@ -317,7 +318,7 @@ func (s *RepositoriesService) UploadReleaseAsset(owner, repo string, id int, opt } asset := new(ReleaseAsset) - resp, err := s.client.Do(req, asset) + resp, err := s.client.Do(ctx, req, asset) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_stats.go b/vendor/github.com/google/go-github/github/repos_stats.go index 5ed1dec412..30fc7bd340 100644 --- a/vendor/github.com/google/go-github/github/repos_stats.go +++ b/vendor/github.com/google/go-github/github/repos_stats.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -44,8 +45,8 @@ func (w WeeklyStats) String() string { // 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(owner, repo string) ([]*ContributorStats, *Response, error) { +// 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 { @@ -53,7 +54,7 @@ func (s *RepositoriesService) ListContributorsStats(owner, repo string) ([]*Cont } var contributorStats []*ContributorStats - resp, err := s.client.Do(req, &contributorStats) + resp, err := s.client.Do(ctx, req, &contributorStats) if err != nil { return nil, resp, err } @@ -83,8 +84,8 @@ func (w WeeklyCommitActivity) String() string { // 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(owner, repo string) ([]*WeeklyCommitActivity, *Response, error) { +// 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 { @@ -92,7 +93,7 @@ func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]*WeeklyC } var weeklyCommitActivity []*WeeklyCommitActivity - resp, err := s.client.Do(req, &weeklyCommitActivity) + resp, err := s.client.Do(ctx, req, &weeklyCommitActivity) if err != nil { return nil, resp, err } @@ -110,8 +111,8 @@ func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]*WeeklyC // 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(owner, repo string) ([]*WeeklyStats, *Response, error) { +// 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 { @@ -119,7 +120,7 @@ func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]*WeeklySt } var weeks [][]int - resp, err := s.client.Do(req, &weeks) + resp, err := s.client.Do(ctx, req, &weeks) // convert int slices into WeeklyStats var stats []*WeeklyStats @@ -163,8 +164,8 @@ func (r RepositoryParticipation) String() string { // 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(owner, repo string) (*RepositoryParticipation, *Response, error) { +// 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 { @@ -172,7 +173,7 @@ func (s *RepositoriesService) ListParticipation(owner, repo string) (*Repository } participation := new(RepositoryParticipation) - resp, err := s.client.Do(req, participation) + resp, err := s.client.Do(ctx, req, participation) if err != nil { return nil, resp, err } @@ -196,8 +197,8 @@ type PunchCard struct { // 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(owner, repo string) ([]*PunchCard, *Response, error) { +// 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 { @@ -205,7 +206,7 @@ func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]*PunchCard, * } var results [][]int - resp, err := s.client.Do(req, &results) + resp, err := s.client.Do(ctx, req, &results) // convert int slices into Punchcards var cards []*PunchCard diff --git a/vendor/github.com/google/go-github/github/repos_statuses.go b/vendor/github.com/google/go-github/github/repos_statuses.go index c0b64e628d..6db501076c 100644 --- a/vendor/github.com/google/go-github/github/repos_statuses.go +++ b/vendor/github.com/google/go-github/github/repos_statuses.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -41,8 +42,8 @@ func (r RepoStatus) String() string { // 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: http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref -func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOptions) ([]*RepoStatus, *Response, error) { +// 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 { @@ -55,7 +56,7 @@ func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOpt } var statuses []*RepoStatus - resp, err := s.client.Do(req, &statuses) + resp, err := s.client.Do(ctx, req, &statuses) if err != nil { return nil, resp, err } @@ -66,8 +67,8 @@ func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOpt // 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: http://developer.github.com/v3/repos/statuses/#create-a-status -func (s *RepositoriesService) CreateStatus(owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) { +// 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 { @@ -75,7 +76,7 @@ func (s *RepositoriesService) CreateStatus(owner, repo, ref string, status *Repo } repoStatus := new(RepoStatus) - resp, err := s.client.Do(req, repoStatus) + resp, err := s.client.Do(ctx, req, repoStatus) if err != nil { return nil, resp, err } @@ -106,7 +107,7 @@ func (s CombinedStatus) String() string { // 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(owner, repo, ref string, opt *ListOptions) (*CombinedStatus, *Response, error) { +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 { @@ -119,7 +120,7 @@ func (s *RepositoriesService) GetCombinedStatus(owner, repo, ref string, opt *Li } status := new(CombinedStatus) - resp, err := s.client.Do(req, status) + resp, err := s.client.Do(ctx, req, status) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/repos_traffic.go b/vendor/github.com/google/go-github/github/repos_traffic.go index 67341b953d..fb1c97648a 100644 --- a/vendor/github.com/google/go-github/github/repos_traffic.go +++ b/vendor/github.com/google/go-github/github/repos_traffic.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // TrafficReferrer represent information about traffic from a referrer . type TrafficReferrer struct { @@ -52,7 +55,7 @@ type TrafficBreakdownOptions struct { // 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(owner, repo string) ([]*TrafficReferrer, *Response, error) { +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) @@ -61,7 +64,7 @@ func (s *RepositoriesService) ListTrafficReferrers(owner, repo string) ([]*Traff } var trafficReferrers []*TrafficReferrer - resp, err := s.client.Do(req, &trafficReferrers) + resp, err := s.client.Do(ctx, req, &trafficReferrers) if err != nil { return nil, resp, err } @@ -72,7 +75,7 @@ func (s *RepositoriesService) ListTrafficReferrers(owner, repo string) ([]*Traff // 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(owner, repo string) ([]*TrafficPath, *Response, error) { +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) @@ -81,7 +84,7 @@ func (s *RepositoriesService) ListTrafficPaths(owner, repo string) ([]*TrafficPa } var paths []*TrafficPath - resp, err := s.client.Do(req, &paths) + resp, err := s.client.Do(ctx, req, &paths) if err != nil { return nil, resp, err } @@ -92,7 +95,7 @@ func (s *RepositoriesService) ListTrafficPaths(owner, repo string) ([]*TrafficPa // 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(owner, repo string, opt *TrafficBreakdownOptions) (*TrafficViews, *Response, error) { +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 { @@ -105,7 +108,7 @@ func (s *RepositoriesService) ListTrafficViews(owner, repo string, opt *TrafficB } trafficViews := new(TrafficViews) - resp, err := s.client.Do(req, &trafficViews) + resp, err := s.client.Do(ctx, req, &trafficViews) if err != nil { return nil, resp, err } @@ -116,7 +119,7 @@ func (s *RepositoriesService) ListTrafficViews(owner, repo string, opt *TrafficB // 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(owner, repo string, opt *TrafficBreakdownOptions) (*TrafficClones, *Response, error) { +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 { @@ -129,7 +132,7 @@ func (s *RepositoriesService) ListTrafficClones(owner, repo string, opt *Traffic } trafficClones := new(TrafficClones) - resp, err := s.client.Do(req, &trafficClones) + resp, err := s.client.Do(ctx, req, &trafficClones) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/github/search.go b/vendor/github.com/google/go-github/github/search.go index c2b9827ccf..089368d98f 100644 --- a/vendor/github.com/google/go-github/github/search.go +++ b/vendor/github.com/google/go-github/github/search.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" qs "github.com/google/go-querystring/query" @@ -14,7 +15,7 @@ import ( // SearchService provides access to the search related functions // in the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/search/ +// GitHub API docs: https://developer.github.com/v3/search/ type SearchService service // SearchOptions specifies optional parameters to the SearchService methods. @@ -48,10 +49,10 @@ type RepositoriesSearchResult struct { // Repositories searches repositories via various criteria. // -// GitHub API docs: http://developer.github.com/v3/search/#search-repositories -func (s *SearchService) Repositories(query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) { +// 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("repositories", query, opt, result) + resp, err := s.search(ctx, "repositories", query, opt, result) return result, resp, err } @@ -79,10 +80,10 @@ type CommitResult struct { // Commits searches commits via various criteria. // -// GitHub API Docs: https://developer.github.com/v3/search/#search-commits -func (s *SearchService) Commits(query string, opt *SearchOptions) (*CommitsSearchResult, *Response, error) { +// 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("commits", query, opt, result) + resp, err := s.search(ctx, "commits", query, opt, result) return result, resp, err } @@ -95,10 +96,10 @@ type IssuesSearchResult struct { // Issues searches issues via various criteria. // -// GitHub API docs: http://developer.github.com/v3/search/#search-issues -func (s *SearchService) Issues(query string, opt *SearchOptions) (*IssuesSearchResult, *Response, error) { +// 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("issues", query, opt, result) + resp, err := s.search(ctx, "issues", query, opt, result) return result, resp, err } @@ -111,10 +112,10 @@ type UsersSearchResult struct { // Users searches users via various criteria. // -// GitHub API docs: http://developer.github.com/v3/search/#search-users -func (s *SearchService) Users(query string, opt *SearchOptions) (*UsersSearchResult, *Response, error) { +// 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("users", query, opt, result) + resp, err := s.search(ctx, "users", query, opt, result) return result, resp, err } @@ -160,16 +161,16 @@ func (c CodeResult) String() string { // Code searches code via various criteria. // -// GitHub API docs: http://developer.github.com/v3/search/#search-code -func (s *SearchService) Code(query string, opt *SearchOptions) (*CodeSearchResult, *Response, error) { +// 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("code", query, opt, result) + 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(searchType string, query string, opt *SearchOptions, result interface{}) (*Response, error) { +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 @@ -193,5 +194,5 @@ func (s *SearchService) search(searchType string, query string, opt *SearchOptio req.Header.Set("Accept", "application/vnd.github.v3.text-match+json") } - return s.client.Do(req, result) + return s.client.Do(ctx, req, result) } diff --git a/vendor/github.com/google/go-github/github/users.go b/vendor/github.com/google/go-github/github/users.go index f18df37df8..d74439c7b0 100644 --- a/vendor/github.com/google/go-github/github/users.go +++ b/vendor/github.com/google/go-github/github/users.go @@ -5,12 +5,15 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // UsersService handles communication with the user related // methods of the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/users/ +// GitHub API docs: https://developer.github.com/v3/users/ type UsersService service // User represents a GitHub user. @@ -71,8 +74,8 @@ func (u User) String() string { // Get fetches a user. Passing the empty string will fetch the authenticated // user. // -// GitHub API docs: http://developer.github.com/v3/users/#get-a-single-user -func (s *UsersService) Get(user string) (*User, *Response, error) { +// 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) @@ -85,7 +88,7 @@ func (s *UsersService) Get(user string) (*User, *Response, error) { } uResp := new(User) - resp, err := s.client.Do(req, uResp) + resp, err := s.client.Do(ctx, req, uResp) if err != nil { return nil, resp, err } @@ -96,7 +99,7 @@ func (s *UsersService) Get(user string) (*User, *Response, error) { // GetByID fetches a user. // // Note: GetByID uses the undocumented GitHub API endpoint /user/:id. -func (s *UsersService) GetByID(id int) (*User, *Response, error) { +func (s *UsersService) GetByID(ctx context.Context, id int) (*User, *Response, error) { u := fmt.Sprintf("user/%d", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -104,7 +107,7 @@ func (s *UsersService) GetByID(id int) (*User, *Response, error) { } user := new(User) - resp, err := s.client.Do(req, user) + resp, err := s.client.Do(ctx, req, user) if err != nil { return nil, resp, err } @@ -114,8 +117,8 @@ func (s *UsersService) GetByID(id int) (*User, *Response, error) { // Edit the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/users/#update-the-authenticated-user -func (s *UsersService) Edit(user *User) (*User, *Response, error) { +// 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 { @@ -123,7 +126,7 @@ func (s *UsersService) Edit(user *User) (*User, *Response, error) { } uResp := new(User) - resp, err := s.client.Do(req, uResp) + resp, err := s.client.Do(ctx, req, uResp) if err != nil { return nil, resp, err } @@ -144,8 +147,8 @@ type UserListOptions struct { // // To paginate through all users, populate 'Since' with the ID of the last user. // -// GitHub API docs: http://developer.github.com/v3/users/#get-all-users -func (s *UsersService) ListAll(opt *UserListOptions) ([]*User, *Response, error) { +// 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 @@ -157,7 +160,7 @@ func (s *UsersService) ListAll(opt *UserListOptions) ([]*User, *Response, error) } var users []*User - resp, err := s.client.Do(req, &users) + resp, err := s.client.Do(ctx, req, &users) if err != nil { return nil, resp, err } @@ -169,7 +172,7 @@ func (s *UsersService) ListAll(opt *UserListOptions) ([]*User, *Response, error) // authenticated user. // // GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-a-users-repository-invitations -func (s *UsersService) ListInvitations() ([]*RepositoryInvitation, *Response, error) { +func (s *UsersService) ListInvitations(ctx context.Context) ([]*RepositoryInvitation, *Response, error) { req, err := s.client.NewRequest("GET", "user/repository_invitations", nil) if err != nil { return nil, nil, err @@ -179,7 +182,7 @@ func (s *UsersService) ListInvitations() ([]*RepositoryInvitation, *Response, er req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview) invites := []*RepositoryInvitation{} - resp, err := s.client.Do(req, &invites) + resp, err := s.client.Do(ctx, req, &invites) if err != nil { return nil, resp, err } @@ -191,7 +194,7 @@ func (s *UsersService) ListInvitations() ([]*RepositoryInvitation, *Response, er // authenticated user. // // GitHub API docs: https://developer.github.com/v3/repos/invitations/#accept-a-repository-invitation -func (s *UsersService) AcceptInvitation(invitationID int) (*Response, error) { +func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) req, err := s.client.NewRequest("PATCH", u, nil) if err != nil { @@ -201,14 +204,14 @@ func (s *UsersService) AcceptInvitation(invitationID int) (*Response, error) { // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview) - return s.client.Do(req, nil) + 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(invitationID int) (*Response, error) { +func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -218,5 +221,5 @@ func (s *UsersService) DeclineInvitation(invitationID int) (*Response, error) { // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview) - return s.client.Do(req, nil) + 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 index dc1dcb8949..e042398d8c 100644 --- a/vendor/github.com/google/go-github/github/users_administration.go +++ b/vendor/github.com/google/go-github/github/users_administration.go @@ -5,12 +5,15 @@ package github -import "fmt" +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(user string) (*Response, error) { +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) @@ -18,13 +21,13 @@ func (s *UsersService) PromoteSiteAdmin(user string) (*Response, error) { return nil, err } - return s.client.Do(req, nil) + 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(user string) (*Response, error) { +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) @@ -32,13 +35,13 @@ func (s *UsersService) DemoteSiteAdmin(user string) (*Response, error) { return nil, err } - return s.client.Do(req, nil) + 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(user string) (*Response, error) { +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) @@ -46,13 +49,13 @@ func (s *UsersService) Suspend(user string) (*Response, error) { return nil, err } - return s.client.Do(req, nil) + 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(user string) (*Response, error) { +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) @@ -60,5 +63,5 @@ func (s *UsersService) Unsuspend(user string) (*Response, error) { return nil, err } - return s.client.Do(req, nil) + 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 index 4785946e16..0bbd4627e3 100644 --- a/vendor/github.com/google/go-github/github/users_emails.go +++ b/vendor/github.com/google/go-github/github/users_emails.go @@ -5,6 +5,8 @@ package github +import "context" + // UserEmail represents user's email address type UserEmail struct { Email *string `json:"email,omitempty"` @@ -14,8 +16,8 @@ type UserEmail struct { // ListEmails lists all email addresses for the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user -func (s *UsersService) ListEmails(opt *ListOptions) ([]*UserEmail, *Response, error) { +// 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 { @@ -28,7 +30,7 @@ func (s *UsersService) ListEmails(opt *ListOptions) ([]*UserEmail, *Response, er } var emails []*UserEmail - resp, err := s.client.Do(req, &emails) + resp, err := s.client.Do(ctx, req, &emails) if err != nil { return nil, resp, err } @@ -38,8 +40,8 @@ func (s *UsersService) ListEmails(opt *ListOptions) ([]*UserEmail, *Response, er // AddEmails adds email addresses of the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/users/emails/#add-email-addresses -func (s *UsersService) AddEmails(emails []string) ([]*UserEmail, *Response, error) { +// 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 { @@ -47,7 +49,7 @@ func (s *UsersService) AddEmails(emails []string) ([]*UserEmail, *Response, erro } var e []*UserEmail - resp, err := s.client.Do(req, &e) + resp, err := s.client.Do(ctx, req, &e) if err != nil { return nil, resp, err } @@ -57,13 +59,13 @@ func (s *UsersService) AddEmails(emails []string) ([]*UserEmail, *Response, erro // DeleteEmails deletes email addresses from authenticated user. // -// GitHub API docs: http://developer.github.com/v3/users/emails/#delete-email-addresses -func (s *UsersService) DeleteEmails(emails []string) (*Response, error) { +// 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(req, nil) + 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 index d5a97e2178..c2224096a6 100644 --- a/vendor/github.com/google/go-github/github/users_followers.go +++ b/vendor/github.com/google/go-github/github/users_followers.go @@ -5,13 +5,16 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // ListFollowers lists the followers for a user. Passing the empty string will // fetch followers for the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/users/followers/#list-followers-of-a-user -func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]*User, *Response, error) { +// 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) @@ -29,7 +32,7 @@ func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]*User, *R } var users []*User - resp, err := s.client.Do(req, &users) + resp, err := s.client.Do(ctx, req, &users) if err != nil { return nil, resp, err } @@ -40,8 +43,8 @@ func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]*User, *R // ListFollowing lists the people that a user is following. Passing the empty // string will list people the authenticated user is following. // -// GitHub API docs: http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user -func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]*User, *Response, error) { +// 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) @@ -59,7 +62,7 @@ func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]*User, *R } var users []*User - resp, err := s.client.Do(req, &users) + resp, err := s.client.Do(ctx, req, &users) if err != nil { return nil, resp, err } @@ -70,8 +73,8 @@ func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]*User, *R // 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: http://developer.github.com/v3/users/followers/#check-if-you-are-following-a-user -func (s *UsersService) IsFollowing(user, target string) (bool, *Response, error) { +// 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) @@ -84,33 +87,33 @@ func (s *UsersService) IsFollowing(user, target string) (bool, *Response, error) return false, nil, err } - resp, err := s.client.Do(req, nil) + 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: http://developer.github.com/v3/users/followers/#follow-a-user -func (s *UsersService) Follow(user string) (*Response, error) { +// 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(req, nil) + return s.client.Do(ctx, req, nil) } // Unfollow will cause the authenticated user to unfollow the specified user. // -// GitHub API docs: http://developer.github.com/v3/users/followers/#unfollow-a-user -func (s *UsersService) Unfollow(user string) (*Response, error) { +// 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(req, nil) + 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 index 1576365f5b..35cce02092 100644 --- a/vendor/github.com/google/go-github/github/users_gpg_keys.go +++ b/vendor/github.com/google/go-github/github/users_gpg_keys.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -43,7 +44,7 @@ type GPGEmail struct { // 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-your-gpg-keys -func (s *UsersService) ListGPGKeys() ([]*GPGKey, *Response, error) { +func (s *UsersService) ListGPGKeys(ctx context.Context) ([]*GPGKey, *Response, error) { req, err := s.client.NewRequest("GET", "user/gpg_keys", nil) if err != nil { return nil, nil, err @@ -53,7 +54,7 @@ func (s *UsersService) ListGPGKeys() ([]*GPGKey, *Response, error) { req.Header.Set("Accept", mediaTypeGitSigningPreview) var keys []*GPGKey - resp, err := s.client.Do(req, &keys) + resp, err := s.client.Do(ctx, req, &keys) if err != nil { return nil, resp, err } @@ -65,7 +66,7 @@ func (s *UsersService) ListGPGKeys() ([]*GPGKey, *Response, error) { // 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(id int) (*GPGKey, *Response, error) { +func (s *UsersService) GetGPGKey(ctx context.Context, id int) (*GPGKey, *Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -76,7 +77,7 @@ func (s *UsersService) GetGPGKey(id int) (*GPGKey, *Response, error) { req.Header.Set("Accept", mediaTypeGitSigningPreview) key := &GPGKey{} - resp, err := s.client.Do(req, key) + resp, err := s.client.Do(ctx, req, key) if err != nil { return nil, resp, err } @@ -88,7 +89,7 @@ func (s *UsersService) GetGPGKey(id int) (*GPGKey, *Response, error) { // 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(armoredPublicKey string) (*GPGKey, *Response, error) { +func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string) (*GPGKey, *Response, error) { gpgKey := &struct { ArmoredPublicKey string `json:"armored_public_key"` }{ArmoredPublicKey: armoredPublicKey} @@ -101,7 +102,7 @@ func (s *UsersService) CreateGPGKey(armoredPublicKey string) (*GPGKey, *Response req.Header.Set("Accept", mediaTypeGitSigningPreview) key := &GPGKey{} - resp, err := s.client.Do(req, key) + resp, err := s.client.Do(ctx, req, key) if err != nil { return nil, resp, err } @@ -113,7 +114,7 @@ func (s *UsersService) CreateGPGKey(armoredPublicKey string) (*GPGKey, *Response // 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(id int) (*Response, error) { +func (s *UsersService) DeleteGPGKey(ctx context.Context, id int) (*Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -123,5 +124,5 @@ func (s *UsersService) DeleteGPGKey(id int) (*Response, error) { // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeGitSigningPreview) - return s.client.Do(req, nil) + 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 index dbb8ecba83..97ed4b8611 100644 --- a/vendor/github.com/google/go-github/github/users_keys.go +++ b/vendor/github.com/google/go-github/github/users_keys.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // Key represents a public SSH key used to authenticate a user or deploy script. type Key struct { @@ -23,8 +26,8 @@ func (k Key) String() string { // ListKeys lists the verified public keys for a user. Passing the empty // string will fetch keys for the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/users/keys/#list-public-keys-for-a-user -func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]*Key, *Response, error) { +// 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) @@ -42,7 +45,7 @@ func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]*Key, *Respons } var keys []*Key - resp, err := s.client.Do(req, &keys) + resp, err := s.client.Do(ctx, req, &keys) if err != nil { return nil, resp, err } @@ -52,8 +55,8 @@ func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]*Key, *Respons // GetKey fetches a single public key. // -// GitHub API docs: http://developer.github.com/v3/users/keys/#get-a-single-public-key -func (s *UsersService) GetKey(id int) (*Key, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/users/keys/#get-a-single-public-key +func (s *UsersService) GetKey(ctx context.Context, id int) (*Key, *Response, error) { u := fmt.Sprintf("user/keys/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -62,7 +65,7 @@ func (s *UsersService) GetKey(id int) (*Key, *Response, error) { } key := new(Key) - resp, err := s.client.Do(req, key) + resp, err := s.client.Do(ctx, req, key) if err != nil { return nil, resp, err } @@ -72,8 +75,8 @@ func (s *UsersService) GetKey(id int) (*Key, *Response, error) { // CreateKey adds a public key for the authenticated user. // -// GitHub API docs: http://developer.github.com/v3/users/keys/#create-a-public-key -func (s *UsersService) CreateKey(key *Key) (*Key, *Response, error) { +// 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) @@ -82,7 +85,7 @@ func (s *UsersService) CreateKey(key *Key) (*Key, *Response, error) { } k := new(Key) - resp, err := s.client.Do(req, k) + resp, err := s.client.Do(ctx, req, k) if err != nil { return nil, resp, err } @@ -92,8 +95,8 @@ func (s *UsersService) CreateKey(key *Key) (*Key, *Response, error) { // DeleteKey deletes a public key. // -// GitHub API docs: http://developer.github.com/v3/users/keys/#delete-a-public-key -func (s *UsersService) DeleteKey(id int) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/users/keys/#delete-a-public-key +func (s *UsersService) DeleteKey(ctx context.Context, id int) (*Response, error) { u := fmt.Sprintf("user/keys/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -101,5 +104,5 @@ func (s *UsersService) DeleteKey(id int) (*Response, error) { return nil, err } - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go index c4b8148967..85d0e23612 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go @@ -4,6 +4,7 @@ import ( "fmt" "net/url" "reflect" + "strconv" "strings" "time" @@ -39,13 +40,15 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] if m.Kind() != reflect.Ptr { return fmt.Errorf("unexpected type %T: %v", msg, msg) } + var props *proto.Properties m = m.Elem() for i, fieldName := range fieldPath { isLast := i == len(fieldPath)-1 if !isLast && m.Kind() != reflect.Struct { return fmt.Errorf("non-aggregate type in the mid of path: %s", strings.Join(fieldPath, ".")) } - f := fieldByProtoName(m, fieldName) + var f reflect.Value + f, props = fieldByProtoName(m, fieldName) if !f.IsValid() { grpclog.Printf("field not found in %T: %s", msg, strings.Join(fieldPath, ".")) return nil @@ -59,7 +62,7 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] if !isLast { return fmt.Errorf("unexpected repeated field in %s", strings.Join(fieldPath, ".")) } - return populateRepeatedField(f, values) + return populateRepeatedField(f, values, props) case reflect.Ptr: if f.IsNil() { m = reflect.New(f.Type().Elem()) @@ -81,23 +84,29 @@ func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values [] default: grpclog.Printf("too many field values: %s", strings.Join(fieldPath, ".")) } - return populateField(m, values[0]) + return populateField(m, values[0], props) } // fieldByProtoName looks up a field whose corresponding protobuf field name is "name". // "m" must be a struct value. It returns zero reflect.Value if no such field found. -func fieldByProtoName(m reflect.Value, name string) reflect.Value { +func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties) { props := proto.GetProperties(m.Type()) for _, p := range props.Prop { if p.OrigName == name { - return m.FieldByName(p.Name) + return m.FieldByName(p.Name), p } } - return reflect.Value{} + return reflect.Value{}, nil } -func populateRepeatedField(f reflect.Value, values []string) error { +func populateRepeatedField(f reflect.Value, values []string, props *proto.Properties) error { elemType := f.Type().Elem() + + // is the destination field a slice of an enumeration type? + if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { + return populateFieldEnumRepeated(f, values, enumValMap) + } + conv, ok := convFromType[elemType.Kind()] if !ok { return fmt.Errorf("unsupported field type %s", elemType) @@ -113,7 +122,7 @@ func populateRepeatedField(f reflect.Value, values []string) error { return nil } -func populateField(f reflect.Value, value string) error { +func populateField(f reflect.Value, value string, props *proto.Properties) error { // Handle well known type type wkt interface { XXX_WellKnownType() string @@ -137,6 +146,11 @@ func populateField(f reflect.Value, value string) error { } } + // is the destination field an enumeration type? + if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { + return populateFieldEnum(f, value, enumValMap) + } + conv, ok := convFromType[f.Kind()] if !ok { return fmt.Errorf("unsupported field type %T", f) @@ -149,6 +163,47 @@ func populateField(f reflect.Value, value string) error { return nil } +func convertEnum(value string, t reflect.Type, enumValMap map[string]int32) (reflect.Value, error) { + // see if it's an enumeration string + if enumVal, ok := enumValMap[value]; ok { + return reflect.ValueOf(enumVal).Convert(t), nil + } + + // check for an integer that matches an enumeration value + eVal, err := strconv.Atoi(value) + if err != nil { + return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t) + } + for _, v := range enumValMap { + if v == int32(eVal) { + return reflect.ValueOf(eVal).Convert(t), nil + } + } + return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t) +} + +func populateFieldEnum(f reflect.Value, value string, enumValMap map[string]int32) error { + cval, err := convertEnum(value, f.Type(), enumValMap) + if err != nil { + return err + } + f.Set(cval) + return nil +} + +func populateFieldEnumRepeated(f reflect.Value, values []string, enumValMap map[string]int32) error { + elemType := f.Type().Elem() + f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type())) + for i, v := range values { + result, err := convertEnum(v, elemType, enumValMap) + if err != nil { + return err + } + f.Index(i).Set(result) + } + return nil +} + var ( convFromType = map[reflect.Kind]reflect.Value{ reflect.String: reflect.ValueOf(String), diff --git a/vendor/github.com/keybase/go-crypto/openpgp/keys.go b/vendor/github.com/keybase/go-crypto/openpgp/keys.go index 50eaeb7c66..d3c66c2aab 100644 --- a/vendor/github.com/keybase/go-crypto/openpgp/keys.go +++ b/vendor/github.com/keybase/go-crypto/openpgp/keys.go @@ -283,7 +283,9 @@ func (el EntityList) KeysByIdUsage(id uint64, fp []byte, requiredUsage byte) (ke usage |= packet.KeyFlagEncryptCommunications usage |= packet.KeyFlagEncryptStorage - case key.PublicKey.PubKeyAlgo == packet.PubKeyAlgoDSA: + case key.PublicKey.PubKeyAlgo == packet.PubKeyAlgoDSA || + key.PublicKey.PubKeyAlgo == packet.PubKeyAlgoECDSA || + key.PublicKey.PubKeyAlgo == packet.PubKeyAlgoEdDSA: usage |= packet.KeyFlagSign // For a primary RSA key without any key flags, be as permissiable diff --git a/vendor/github.com/mattn/go-colorable/colorable_windows.go b/vendor/github.com/mattn/go-colorable/colorable_windows.go index 628ad904e5..a79ee5f505 100644 --- a/vendor/github.com/mattn/go-colorable/colorable_windows.go +++ b/vendor/github.com/mattn/go-colorable/colorable_windows.go @@ -411,14 +411,12 @@ loop: buf.Write([]byte(string(c))) } - var csbi consoleScreenBufferInfo switch m { case 'A': n, err = strconv.Atoi(buf.String()) if err != nil { continue } - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.y -= short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'B': @@ -426,7 +424,6 @@ loop: if err != nil { continue } - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.y += short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'C': @@ -434,7 +431,6 @@ loop: if err != nil { continue } - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x -= short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'D': @@ -444,7 +440,6 @@ loop: } if n, err = strconv.Atoi(buf.String()); err == nil { var csbi consoleScreenBufferInfo - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x += short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) } @@ -453,7 +448,6 @@ loop: if err != nil { continue } - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = 0 csbi.cursorPosition.y += short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) @@ -462,7 +456,6 @@ loop: if err != nil { continue } - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = 0 csbi.cursorPosition.y -= short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) @@ -471,50 +464,66 @@ loop: if err != nil { continue } - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = short(n - 1) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'H': - token := strings.Split(buf.String(), ";") - if len(token) != 2 { - continue + if buf.Len() > 0 { + token := strings.Split(buf.String(), ";") + switch len(token) { + case 1: + n1, err := strconv.Atoi(token[0]) + if err != nil { + continue + } + csbi.cursorPosition.y = short(n1 - 1) + case 2: + n1, err := strconv.Atoi(token[0]) + if err != nil { + panic(1) + continue + } + n2, err := strconv.Atoi(token[1]) + if err != nil { + continue + } + csbi.cursorPosition.x = short(n2 - 1) + csbi.cursorPosition.y = short(n1 - 1) + } + } else { + csbi.cursorPosition.y = 0 } - n1, err := strconv.Atoi(token[0]) - if err != nil { - continue - } - n2, err := strconv.Atoi(token[1]) - if err != nil { - continue - } - csbi.cursorPosition.x = short(n2 - 1) - csbi.cursorPosition.y = short(n1 - 1) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'J': - n, err := strconv.Atoi(buf.String()) - if err != nil { - continue + n := 0 + if buf.Len() > 0 { + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } } - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + var count, written dword var cursor coord switch n { case 0: cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} + count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x) case 1: cursor = coord{x: csbi.window.left, y: csbi.window.top} + count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.window.top-csbi.cursorPosition.y)*csbi.size.x) case 2: cursor = coord{x: csbi.window.left, y: csbi.window.top} + count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x) } - var count, written dword - count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x) procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) case 'K': - n, err := strconv.Atoi(buf.String()) - if err != nil { - continue + n := 0 + if buf.Len() > 0 { + n, err = strconv.Atoi(buf.String()) + if err != nil { + continue + } } - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) var cursor coord switch n { case 0: @@ -529,7 +538,6 @@ loop: procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) case 'm': - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) attr := csbi.attributes cs := buf.String() if cs == "" { @@ -650,13 +658,13 @@ loop: procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) } case 's': - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) w.oldpos = csbi.cursorPosition case 'u': procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&w.oldpos))) } } - return len(data) - w.lastbuf.Len(), nil + + return len(data), nil } type consoleColor struct { diff --git a/vendor/github.com/mitchellh/cli/README.md b/vendor/github.com/mitchellh/cli/README.md index 1f69ccb203..dd211cf0e7 100644 --- a/vendor/github.com/mitchellh/cli/README.md +++ b/vendor/github.com/mitchellh/cli/README.md @@ -5,6 +5,7 @@ cli is the library that powers the CLI for [Packer](https://github.com/mitchellh/packer), [Serf](https://github.com/hashicorp/serf), [Consul](https://github.com/hashicorp/consul), +[Vault](https://github.com/hashicorp/vault), [Terraform](https://github.com/hashicorp/terraform), and [Nomad](https://github.com/hashicorp/nomad). diff --git a/vendor/github.com/mitchellh/cli/cli.go b/vendor/github.com/mitchellh/cli/cli.go index 353edb6c29..350575e646 100644 --- a/vendor/github.com/mitchellh/cli/cli.go +++ b/vendor/github.com/mitchellh/cli/cli.go @@ -454,7 +454,7 @@ const defaultHelpTemplate = ` {{.Help}}{{if gt (len .Subcommands) 0}} Subcommands: -{{ range $value := .Subcommands }} +{{- range $value := .Subcommands }} {{ $value.NameAligned }} {{ $value.Synopsis }}{{ end }} -{{ end }} +{{- end }} ` diff --git a/vendor/golang.org/x/net/http2/hpack/encode.go b/vendor/golang.org/x/net/http2/hpack/encode.go index 6b3b9f8b4f..395e1c2f04 100644 --- a/vendor/golang.org/x/net/http2/hpack/encode.go +++ b/vendor/golang.org/x/net/http2/hpack/encode.go @@ -89,21 +89,16 @@ func (e *Encoder) WriteField(f HeaderField) error { // becomes false. func (e *Encoder) searchTable(f HeaderField) (i uint64, nameValueMatch bool) { for idx, hf := range staticTable { - if !constantTimeStringCompare(hf.Name, f.Name) { + if hf.Name != f.Name { continue } if i == 0 { i = uint64(idx + 1) } - if f.Sensitive { + if f.Sensitive || hf.Value != f.Value { continue } - if !constantTimeStringCompare(hf.Value, f.Value) { - continue - } - i = uint64(idx + 1) - nameValueMatch = true - return + return uint64(idx + 1), true } j, nameValueMatch := e.dynTab.search(f) diff --git a/vendor/golang.org/x/net/http2/hpack/hpack.go b/vendor/golang.org/x/net/http2/hpack/hpack.go index 007bc7f45f..d18be440c5 100644 --- a/vendor/golang.org/x/net/http2/hpack/hpack.go +++ b/vendor/golang.org/x/net/http2/hpack/hpack.go @@ -199,22 +199,6 @@ func (dt *dynamicTable) evict() { } } -// constantTimeStringCompare compares string a and b in a constant -// time manner. -func constantTimeStringCompare(a, b string) bool { - if len(a) != len(b) { - return false - } - - c := byte(0) - - for i := 0; i < len(a); i++ { - c |= a[i] ^ b[i] - } - - return c == 0 -} - // Search searches f in the table. The return value i is 0 if there is // no name match. If there is name match or name/value match, i is the // index of that entry (1-based). If both name and value match, @@ -223,7 +207,7 @@ func (dt *dynamicTable) search(f HeaderField) (i uint64, nameValueMatch bool) { l := len(dt.ents) for j := l - 1; j >= 0; j-- { ent := dt.ents[j] - if !constantTimeStringCompare(ent.Name, f.Name) { + if ent.Name != f.Name { continue } if i == 0 { @@ -232,14 +216,12 @@ func (dt *dynamicTable) search(f HeaderField) (i uint64, nameValueMatch bool) { if f.Sensitive { continue } - if !constantTimeStringCompare(ent.Value, f.Value) { + if ent.Value != f.Value { continue } - i = uint64(l - j) - nameValueMatch = true - return + return uint64(l - j), true } - return + return i, false } func (d *Decoder) maxTableIndex() int { diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 374c052904..b3a34c876d 100755 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -146,6 +146,10 @@ includes_Linux=' #define PTRACE_SETREGS 0xd #endif +#ifndef SOL_NETLINK +#define SOL_NETLINK 270 +#endif + #ifdef SOL_BLUETOOTH // SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h // but it is already in bluetooth_linux.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 5759f794be..c13799fa54 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -821,6 +821,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 @@ -1260,6 +1261,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 88c6ac604b..1937e466f2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -779,6 +779,7 @@ const ( NETLINK_ADD_MEMBERSHIP = 0x1 NETLINK_AUDIT = 0x9 NETLINK_BROADCAST_ERROR = 0x4 + NETLINK_CAP_ACK = 0xa NETLINK_CONNECTOR = 0xb NETLINK_CRYPTO = 0x15 NETLINK_DNRTMSG = 0xe @@ -791,14 +792,19 @@ const ( NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 NETLINK_KOBJECT_UEVENT = 0xf + NETLINK_LISTEN_ALL_NSID = 0x8 + NETLINK_LIST_MEMBERSHIPS = 0x9 NETLINK_NETFILTER = 0xc NETLINK_NFLOG = 0x5 NETLINK_NO_ENOBUFS = 0x5 NETLINK_PKTINFO = 0x3 NETLINK_RDMA = 0x14 NETLINK_ROUTE = 0x0 + NETLINK_RX_RING = 0x6 NETLINK_SCSITRANSPORT = 0x12 NETLINK_SELINUX = 0x7 + NETLINK_SOCK_DIAG = 0x4 + NETLINK_TX_RING = 0x7 NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 @@ -821,6 +827,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 @@ -1261,6 +1268,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 2ee1536912..d64a129216 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -739,6 +739,7 @@ const ( NETLINK_AUDIT = 0x9 NETLINK_BROADCAST_ERROR = 0x4 NETLINK_CONNECTOR = 0xb + NETLINK_CRYPTO = 0x15 NETLINK_DNRTMSG = 0xe NETLINK_DROP_MEMBERSHIP = 0x2 NETLINK_ECRYPTFS = 0x13 @@ -755,8 +756,11 @@ const ( NETLINK_PKTINFO = 0x3 NETLINK_RDMA = 0x14 NETLINK_ROUTE = 0x0 + NETLINK_RX_RING = 0x6 NETLINK_SCSITRANSPORT = 0x12 NETLINK_SELINUX = 0x7 + NETLINK_SOCK_DIAG = 0x4 + NETLINK_TX_RING = 0x7 NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 @@ -779,6 +783,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 @@ -1184,6 +1189,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 767b166289..c0acbb5614 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -808,6 +808,7 @@ const ( NETLINK_ADD_MEMBERSHIP = 0x1 NETLINK_AUDIT = 0x9 NETLINK_BROADCAST_ERROR = 0x4 + NETLINK_CAP_ACK = 0xa NETLINK_CONNECTOR = 0xb NETLINK_CRYPTO = 0x15 NETLINK_DNRTMSG = 0xe @@ -820,6 +821,8 @@ const ( NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 NETLINK_KOBJECT_UEVENT = 0xf + NETLINK_LISTEN_ALL_NSID = 0x8 + NETLINK_LIST_MEMBERSHIPS = 0x9 NETLINK_NETFILTER = 0xc NETLINK_NFLOG = 0x5 NETLINK_NO_ENOBUFS = 0x5 @@ -853,6 +856,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 @@ -1307,6 +1311,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 677abd169a..6eece7e2f0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -766,6 +766,7 @@ const ( NETLINK_ADD_MEMBERSHIP = 0x1 NETLINK_AUDIT = 0x9 NETLINK_BROADCAST_ERROR = 0x4 + NETLINK_CAP_ACK = 0xa NETLINK_CONNECTOR = 0xb NETLINK_CRYPTO = 0x15 NETLINK_DNRTMSG = 0xe @@ -778,14 +779,19 @@ const ( NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 NETLINK_KOBJECT_UEVENT = 0xf + NETLINK_LISTEN_ALL_NSID = 0x8 + NETLINK_LIST_MEMBERSHIPS = 0x9 NETLINK_NETFILTER = 0xc NETLINK_NFLOG = 0x5 NETLINK_NO_ENOBUFS = 0x5 NETLINK_PKTINFO = 0x3 NETLINK_RDMA = 0x14 NETLINK_ROUTE = 0x0 + NETLINK_RX_RING = 0x6 NETLINK_SCSITRANSPORT = 0x12 NETLINK_SELINUX = 0x7 + NETLINK_SOCK_DIAG = 0x4 + NETLINK_TX_RING = 0x7 NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 @@ -808,6 +814,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 @@ -1234,6 +1241,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0xffff diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 46dba956e9..a11dbb37da 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -819,6 +819,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 @@ -1317,6 +1318,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0xffff diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index ee94a6e501..9058318c46 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -819,6 +819,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 @@ -1317,6 +1318,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0xffff diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index ce4607d874..58b13c0a0d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -798,6 +798,7 @@ const ( NETLINK_ADD_MEMBERSHIP = 0x1 NETLINK_AUDIT = 0x9 NETLINK_BROADCAST_ERROR = 0x4 + NETLINK_CAP_ACK = 0xa NETLINK_CONNECTOR = 0xb NETLINK_CRYPTO = 0x15 NETLINK_DNRTMSG = 0xe @@ -810,6 +811,8 @@ const ( NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 NETLINK_KOBJECT_UEVENT = 0xf + NETLINK_LISTEN_ALL_NSID = 0x8 + NETLINK_LIST_MEMBERSHIPS = 0x9 NETLINK_NETFILTER = 0xc NETLINK_NFLOG = 0x5 NETLINK_NO_ENOBUFS = 0x5 @@ -845,6 +848,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 @@ -1374,6 +1378,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 729ef75016..91c3ccca8b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -853,6 +853,7 @@ const ( NLM_F_ATOMIC = 0x400 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 NLM_F_DUMP_INTR = 0x10 NLM_F_ECHO = 0x8 NLM_F_EXCL = 0x200 @@ -1374,6 +1375,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 68c9ec669b..702894a89a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -1425,6 +1425,7 @@ const ( SOL_IP = 0x0 SOL_IPV6 = 0x29 SOL_IRDA = 0x10a + SOL_NETLINK = 0x10e SOL_PACKET = 0x107 SOL_RAW = 0xff SOL_SOCKET = 0x1 diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go b/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go index 9647b9ec83..7597b09e35 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go +++ b/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go @@ -1,4 +1,5 @@ // +build go1.7 +// +build !go1.8 /* * @@ -44,8 +45,6 @@ import ( // contains a mutex and must not be copied. // // If cfg is nil, a new zero tls.Config is returned. -// -// TODO replace this function with official clone function. func cloneTLSConfig(cfg *tls.Config) *tls.Config { if cfg == nil { return &tls.Config{} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go b/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go new file mode 100644 index 0000000000..0ecf342da8 --- /dev/null +++ b/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go @@ -0,0 +1,53 @@ +// +build go1.8 + +/* + * + * Copyright 2017, Google Inc. + * 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. + * + */ + +package credentials + +import ( + "crypto/tls" +) + +// cloneTLSConfig returns a shallow clone of the exported +// fields of cfg, ignoring the unexported sync.Once, which +// contains a mutex and must not be copied. +// +// If cfg is nil, a new zero tls.Config is returned. +func cloneTLSConfig(cfg *tls.Config) *tls.Config { + if cfg == nil { + return &tls.Config{} + } + + return cfg.Clone() +} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go b/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go index 09b8d12c79..cfd40dfa34 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go +++ b/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go @@ -44,8 +44,6 @@ import ( // contains a mutex and must not be copied. // // If cfg is nil, a new zero tls.Config is returned. -// -// TODO replace this function with official clone function. func cloneTLSConfig(cfg *tls.Config) *tls.Config { if cfg == nil { return &tls.Config{} diff --git a/vendor/vendor.json b/vendor/vendor.json index 91112a4c60..cea888be87 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -21,26 +21,26 @@ { "checksumSHA1": "ZLRh6zW4/DnVsGpgtt+ZiIaEFKc=", "path": "cloud.google.com/go/compute/metadata", - "revision": "0b87d14d90086b53a97dfbd66f3000f7f112b494", - "revisionTime": "2017-02-16T01:11:53Z" + "revision": "9b68cf4865e93f379a337b7e957f33de60397a48", + "revisionTime": "2017-02-23T18:50:28Z" }, { "checksumSHA1": "4iounbuF7SMZdx/MlKSUuhnV848=", "path": "cloud.google.com/go/internal", - "revision": "0b87d14d90086b53a97dfbd66f3000f7f112b494", - "revisionTime": "2017-02-16T01:11:53Z" + "revision": "9b68cf4865e93f379a337b7e957f33de60397a48", + "revisionTime": "2017-02-23T18:50:28Z" }, { "checksumSHA1": "W2xJ0+fvugRhRi1PMi64bYofBbU=", "path": "cloud.google.com/go/internal/optional", - "revision": "0b87d14d90086b53a97dfbd66f3000f7f112b494", - "revisionTime": "2017-02-16T01:11:53Z" + "revision": "9b68cf4865e93f379a337b7e957f33de60397a48", + "revisionTime": "2017-02-23T18:50:28Z" }, { "checksumSHA1": "MJSEDjd8OT7lz9wIemq8zz7R4ok=", "path": "cloud.google.com/go/storage", - "revision": "0b87d14d90086b53a97dfbd66f3000f7f112b494", - "revisionTime": "2017-02-16T01:11:53Z" + "revision": "9b68cf4865e93f379a337b7e957f33de60397a48", + "revisionTime": "2017-02-23T18:50:28Z" }, { "checksumSHA1": "rK3ght7KTtHGdm0V4+U7fv9+tUU=", @@ -115,196 +115,196 @@ "revisionTime": "2017-01-04T21:11:26Z" }, { - "checksumSHA1": "aJVyZtSrQjYG/HuVHOlthf7Ep7A=", + "checksumSHA1": "ixQyUx38QwxxAA8VOYDXB9vlIuA=", "path": "github.com/aws/aws-sdk-go/aws", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "Y9W+4GimK4Fuxq+vyIskVYFRnX4=", "path": "github.com/aws/aws-sdk-go/aws/awserr", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "yyYr41HZ1Aq0hWc3J5ijXwYEcac=", "path": "github.com/aws/aws-sdk-go/aws/awsutil", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "iThCyNRL/oQFD9CF2SYgBGl+aww=", "path": "github.com/aws/aws-sdk-go/aws/client", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "ieAJ+Cvp/PKv1LpUEnUXpc3OI6E=", "path": "github.com/aws/aws-sdk-go/aws/client/metadata", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "Fl8vRSCY0MbM04cmiz/0MID+goA=", "path": "github.com/aws/aws-sdk-go/aws/corehandlers", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "zu5C95rmCZff6NYZb62lEaT5ibE=", "path": "github.com/aws/aws-sdk-go/aws/credentials", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "u3GOAJLmdvbuNUeUEcZSEAOeL/0=", "path": "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "NUJUTWlc1sV8b7WjfiYc4JZbXl0=", "path": "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { - "checksumSHA1": "4Ipx+5xN0gso+cENC2MHMWmQlR4=", + "checksumSHA1": "6cj/zsRmcxkE1TLS+v910GbQYg0=", "path": "github.com/aws/aws-sdk-go/aws/credentials/stscreds", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "lqh3fG7wCochvB4iHAZJuhhEJW0=", "path": "github.com/aws/aws-sdk-go/aws/defaults", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "/EXbk/z2TWjWc1Hvb4QYs3Wmhb8=", "path": "github.com/aws/aws-sdk-go/aws/ec2metadata", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "JTrzEDPXL3pUUH+dMCixz9T9rLY=", "path": "github.com/aws/aws-sdk-go/aws/endpoints", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "M78rTxU55Qagqr3MYj91im2031E=", "path": "github.com/aws/aws-sdk-go/aws/request", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { - "checksumSHA1": "bYywgCKzqJQtFsL+XpuVRELYsgw=", + "checksumSHA1": "u6tKvFGcRQ1xtby1ONjgyUTgcpg=", "path": "github.com/aws/aws-sdk-go/aws/session", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "0FvPLvkBUpTElfUc/FZtPsJfuV0=", "path": "github.com/aws/aws-sdk-go/aws/signer/v4", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "wk7EyvDaHwb5qqoOP/4d3cV0708=", "path": "github.com/aws/aws-sdk-go/private/protocol", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "1QmQ3FqV37w0Zi44qv8pA1GeR0A=", "path": "github.com/aws/aws-sdk-go/private/protocol/ec2query", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "O6hcK24yI6w7FA+g4Pbr+eQ7pys=", "path": "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "R00RL5jJXRYq1iiK1+PGvMfvXyM=", "path": "github.com/aws/aws-sdk-go/private/protocol/jsonrpc", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "ZqY5RWavBLWTo6j9xqdyBEaNFRk=", "path": "github.com/aws/aws-sdk-go/private/protocol/query", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "hqTEmgtchF9SwVTW0IQId2eLUKM=", "path": "github.com/aws/aws-sdk-go/private/protocol/query/queryutil", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "szZSLm3BlYkL3vqlZhNAlYk8iwM=", "path": "github.com/aws/aws-sdk-go/private/protocol/rest", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "ODo+ko8D6unAxZuN1jGzMcN4QCc=", "path": "github.com/aws/aws-sdk-go/private/protocol/restxml", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "lZ1z4xAbT8euCzKoAsnEYic60VE=", "path": "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "Eo9yODN5U99BK0pMzoqnBm7PCrY=", "path": "github.com/aws/aws-sdk-go/private/waiter", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "nz8TKu6v2dXW8kvHln2VguNmUuw=", "path": "github.com/aws/aws-sdk-go/service/dynamodb", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { - "checksumSHA1": "JO4oie1uPoST8lsP4iWbHlOkVZc=", + "checksumSHA1": "+Dp6gjxIwrUbWBdNhCUiq4cMZIM=", "path": "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { - "checksumSHA1": "MCyzbsgz1wWscxzKT9rOLxgTFJQ=", + "checksumSHA1": "ecCVL8+SptmQlojrGtL8mQdaJ6E=", "path": "github.com/aws/aws-sdk-go/service/ec2", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "vtaKEwBXDiWg000PcDBPbnOZEoY=", "path": "github.com/aws/aws-sdk-go/service/iam", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "eEWM4wKzVbRqAwIy3MdMCDUGs2s=", "path": "github.com/aws/aws-sdk-go/service/s3", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "Knj17ZMPWkGYTm2hZxEgnuboMM4=", "path": "github.com/aws/aws-sdk-go/service/sts", - "revision": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918", - "revisionTime": "2017-02-16T22:28:40Z" + "revision": "106ddd8e308f1f57a8907b191a4ea94db104b3da", + "revisionTime": "2017-02-24T04:30:59Z" }, { "checksumSHA1": "Isa9x3nvIJ12hvgdvUUBty+yplU=", @@ -313,28 +313,28 @@ "revisionTime": "2016-10-13T10:26:35Z" }, { - "checksumSHA1": "kt/CWQprMoLxtA+ue3cZ3j+v0cY=", + "checksumSHA1": "nRYz071oypKp0bIsnN7K4kQ/Rlk=", "path": "github.com/circonus-labs/circonus-gometrics", - "revision": "61bd3320eb4dbe36c3e5d6b8de6069d719c1d05b", - "revisionTime": "2017-02-09T19:00:14Z" + "revision": "dbab9a33438e3f8317407ef5d3a51c29340541db", + "revisionTime": "2017-02-21T20:27:28Z" }, { - "checksumSHA1": "X/XSu5kveuq3fPIeArLqFUQiA9g=", + "checksumSHA1": "PDusd0EuHz0oKiQKwKxFhbETxd8=", "path": "github.com/circonus-labs/circonus-gometrics/api", - "revision": "61bd3320eb4dbe36c3e5d6b8de6069d719c1d05b", - "revisionTime": "2017-02-09T19:00:14Z" + "revision": "dbab9a33438e3f8317407ef5d3a51c29340541db", + "revisionTime": "2017-02-21T20:27:28Z" }, { "checksumSHA1": "bQhz/fcyZPmuHSH2qwC4ZtATy5c=", "path": "github.com/circonus-labs/circonus-gometrics/api/config", - "revision": "61bd3320eb4dbe36c3e5d6b8de6069d719c1d05b", - "revisionTime": "2017-02-09T19:00:14Z" + "revision": "dbab9a33438e3f8317407ef5d3a51c29340541db", + "revisionTime": "2017-02-21T20:27:28Z" }, { - "checksumSHA1": "6hvd+YFb1eWFkc3pVcnOPPa2OVw=", + "checksumSHA1": "b9sBHPSxquftpsRrrpeDDloiErs=", "path": "github.com/circonus-labs/circonus-gometrics/checkmgr", - "revision": "61bd3320eb4dbe36c3e5d6b8de6069d719c1d05b", - "revisionTime": "2017-02-09T19:00:14Z" + "revision": "dbab9a33438e3f8317407ef5d3a51c29340541db", + "revisionTime": "2017-02-21T20:27:28Z" }, { "checksumSHA1": "VbfeVqeOM+dTNxCmpvmYS0LwQn0=", @@ -345,80 +345,74 @@ { "checksumSHA1": "7uspQtEpYuBxaxrBTcxa+ZfiuJo=", "path": "github.com/coreos/etcd/auth/authpb", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "Zgqp9pp3G4cSZbepa6tzhNeHZOI=", "path": "github.com/coreos/etcd/client", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { - "checksumSHA1": "W6XuZi6mVb4FoR+L0A1z+6HqQKo=", + "checksumSHA1": "zvwzR7OOVY/HZmcS/kDhXhOsEu8=", "path": "github.com/coreos/etcd/clientv3", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "tHT9JXi1O4YtDEJJTPMDwtyf8lQ=", "path": "github.com/coreos/etcd/clientv3/concurrency", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "lY/Ca8yCqHV9cv0BQU88br59VeI=", "path": "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "LYsCyIHMs+etSiWMrtKwQT5LOpU=", "path": "github.com/coreos/etcd/etcdserver/etcdserverpb", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "PAnQN6F8iZuIfu9HHOORyVFaaOA=", "path": "github.com/coreos/etcd/mvcc/mvccpb", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" - }, - { - "checksumSHA1": "ga3jt9r+dQBMSXG0gnpNcXp2xYA=", - "path": "github.com/coreos/etcd/pkg/fileutil", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "mKIXx1kDwmVmdIpZ3pJtRBuUKso=", "path": "github.com/coreos/etcd/pkg/pathutil", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "rMyIh9PsSvPs6Yd+YgKITQzQJx8=", "path": "github.com/coreos/etcd/pkg/tlsutil", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { - "checksumSHA1": "HBfN6B8eoiy/zsUr74DaRkcyFmg=", + "checksumSHA1": "45jhT/Qs5OuOJYSO9v27kQSKwWk=", "path": "github.com/coreos/etcd/pkg/transport", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "gx1gJIMU6T0UNQ0bPZ/drQ8cpCI=", "path": "github.com/coreos/etcd/pkg/types", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "sp2FkEyaIGiQFOEZCTDkBZgyHOs=", "path": "github.com/coreos/etcd/version", - "revision": "a5cf7fdc87304f079769055792e0e9137c72952b", - "revisionTime": "2017-02-16T21:42:49Z" + "revision": "833aa518d840b5d58fa79f7f4ce570526f4e22fe", + "revisionTime": "2017-02-24T01:42:35Z" }, { "checksumSHA1": "nux9tCYmTA5bOCVODF3Rqzcu60U=", @@ -426,18 +420,6 @@ "revision": "5e3acbb5668c4c3deb4842615c4098eb61fb6b1e", "revisionTime": "2017-02-09T20:17:57Z" }, - { - "checksumSHA1": "d50/+u/LFlXvEV10HiEoXB9OsGg=", - "path": "github.com/coreos/go-systemd/journal", - "revision": "e97b35f834b17eaa82afe3d44715c34736bfa12b", - "revisionTime": "2017-02-01T10:47:36Z" - }, - { - "checksumSHA1": "wqEybhAfMhCq2uOu4bT737mqu6U=", - "path": "github.com/coreos/pkg/capnslog", - "revision": "1c941d73110817a80b9fa6e14d5d2b00d977ce2a", - "revisionTime": "2017-02-06T20:20:45Z" - }, { "checksumSHA1": "HG4+dlJq5h+07VI1rOlpc5KBlfg=", "path": "github.com/denisenkom/go-mssqldb", @@ -481,10 +463,10 @@ "revisionTime": "2016-12-05T22:32:45Z" }, { - "checksumSHA1": "Tql4AI8dMzK1TFtT9fqHpmowxh8=", + "checksumSHA1": "Cu67hH9Sg86TBZb4An5owwfzEN0=", "path": "github.com/go-ini/ini", - "revision": "ee900ca565931451fe4e4409bcbd4316331cec1c", - "revisionTime": "2017-02-09T04:24:15Z" + "revision": "c437d20015c2ab6454b7a66a13109ff0fb99e17a", + "revisionTime": "2017-02-23T22:22:15Z" }, { "checksumSHA1": "ezktpcI0As/fZ0rN7BnBNtUfIsQ=", @@ -525,14 +507,14 @@ { "checksumSHA1": "APDDi2ohrU7OkChQCekD9tSVUhs=", "path": "github.com/golang/protobuf/jsonpb", - "revision": "8ee79997227bf9b34611aee7946ae64735e6fd93", - "revisionTime": "2016-11-17T03:31:26Z" + "revision": "69b215d01a5606c843240eab4937eab3acee6530", + "revisionTime": "2017-02-17T23:44:32Z" }, { "checksumSHA1": "kBeNcaKk56FguvPSUCEaH6AxpRc=", "path": "github.com/golang/protobuf/proto", - "revision": "8ee79997227bf9b34611aee7946ae64735e6fd93", - "revisionTime": "2016-11-17T03:31:26Z" + "revision": "69b215d01a5606c843240eab4937eab3acee6530", + "revisionTime": "2017-02-17T23:44:32Z" }, { "checksumSHA1": "p/8vSviYF91gFflhrt5vkyksroo=", @@ -541,10 +523,10 @@ "revisionTime": "2017-02-15T23:32:05Z" }, { - "checksumSHA1": "6Yh1CCJastWomA9rnAtQNbh8seQ=", + "checksumSHA1": "5418jsN59UajTA7Ib9TYiq/XJIo=", "path": "github.com/google/go-github/github", - "revision": "dfd20fd7fa6edec56447fcb049acd5e17a78ec2e", - "revisionTime": "2017-02-15T21:36:29Z" + "revision": "b59d3a6479bd00374a1523ad032da4621d9dd84a", + "revisionTime": "2017-02-23T16:22:02Z" }, { "checksumSHA1": "p3IB18uJRs4dL2K5yx24MrLYE9A=", @@ -559,22 +541,22 @@ "revisionTime": "2016-11-07T00:24:06Z" }, { - "checksumSHA1": "CGKObIoG0JzwczJ9vOFtG0F93Nc=", + "checksumSHA1": "SeAuuufiXeiMVlYi/j8YT9kPrCM=", "path": "github.com/grpc-ecosystem/grpc-gateway/runtime", - "revision": "686368427ddb9a51628d63db6c74fbc96a206e1f", - "revisionTime": "2017-01-27T20:12:19Z" + "revision": "f3aa758b8ae01abecf727dba035444545dbe41de", + "revisionTime": "2017-02-24T19:04:31Z" }, { "checksumSHA1": "x396LPNfci/5x8aVJbliQHH11HQ=", "path": "github.com/grpc-ecosystem/grpc-gateway/runtime/internal", - "revision": "686368427ddb9a51628d63db6c74fbc96a206e1f", - "revisionTime": "2017-01-27T20:12:19Z" + "revision": "f3aa758b8ae01abecf727dba035444545dbe41de", + "revisionTime": "2017-02-24T19:04:31Z" }, { "checksumSHA1": "vqiK5r5dntV7JNZ+ZsGlD0Samos=", "path": "github.com/grpc-ecosystem/grpc-gateway/utilities", - "revision": "686368427ddb9a51628d63db6c74fbc96a206e1f", - "revisionTime": "2017-01-27T20:12:19Z" + "revision": "f3aa758b8ae01abecf727dba035444545dbe41de", + "revisionTime": "2017-02-24T19:04:31Z" }, { "checksumSHA1": "O0r0hj4YL+jSRNjnshkeH4GY+4s=", @@ -585,14 +567,14 @@ { "checksumSHA1": "AQMAS0aD5VifN0ugbv8xNTt7mM4=", "path": "github.com/hashicorp/consul/api", - "revision": "4e380758b6bdcaa0e0df85bba85b04e7ddbec177", - "revisionTime": "2017-02-16T22:07:44Z" + "revision": "f5fe659497cecbc6947e0ad06af295e4633a3c30", + "revisionTime": "2017-02-24T17:54:33Z" }, { "checksumSHA1": "HDRi8BjyCm/zCYGA8l/40GMuWN8=", "path": "github.com/hashicorp/consul/lib", - "revision": "4e380758b6bdcaa0e0df85bba85b04e7ddbec177", - "revisionTime": "2017-02-16T22:07:44Z" + "revision": "f5fe659497cecbc6947e0ad06af295e4633a3c30", + "revisionTime": "2017-02-24T17:54:33Z" }, { "checksumSHA1": "cdOCt0Yb+hdErz8NAQqayxPmRsY=", @@ -657,56 +639,56 @@ { "checksumSHA1": "Ok3Csn6Voou7pQT6Dv2mkwpqFtw=", "path": "github.com/hashicorp/hcl", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=", "path": "github.com/hashicorp/hcl/hcl/ast", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "MGYzZActhzSs9AnCx3wrEYVbKFg=", "path": "github.com/hashicorp/hcl/hcl/parser", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "z6wdP4mRw4GVjShkNHDaOWkbxS0=", "path": "github.com/hashicorp/hcl/hcl/scanner", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "oS3SCN9Wd6D8/LG0Yx1fu84a7gI=", "path": "github.com/hashicorp/hcl/hcl/strconv", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=", "path": "github.com/hashicorp/hcl/hcl/token", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "138aCV5n8n7tkGYMsMVQQnnLq+0=", "path": "github.com/hashicorp/hcl/json/parser", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=", "path": "github.com/hashicorp/hcl/json/scanner", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=", "path": "github.com/hashicorp/hcl/json/token", - "revision": "372e8ddaa16fd67e371e9323807d056b799360af", - "revisionTime": "2017-02-02T00:05:34Z" + "revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", + "revisionTime": "2017-02-17T16:47:38Z" }, { "checksumSHA1": "qnlqWJYV81ENr61SZk9c65R1mDo=", @@ -729,8 +711,8 @@ { "checksumSHA1": "E3Xcanc9ouQwL+CZGOUyA/+giLg=", "path": "github.com/hashicorp/serf/coordinate", - "revision": "050c56d31a1ff2ebc50e3f4810fdff7e7563f6c8", - "revisionTime": "2017-02-16T21:32:28Z" + "revision": "838c422c419776dd868ade08da6b11be7a71bf99", + "revisionTime": "2017-02-23T17:44:37Z" }, { "checksumSHA1": "ZhK6IO2XN81Y+3RAjTcVm1Ic7oU=", @@ -753,68 +735,68 @@ { "checksumSHA1": "VJk3rOWfxEV9Ilig5lgzH1qg8Ss=", "path": "github.com/keybase/go-crypto/brainpool", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "rnRjEJs5luF+DIXp2J6LFcQk8Gg=", "path": "github.com/keybase/go-crypto/cast5", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "F5++ZQS5Vt7hd6lxPCKTffvph1A=", "path": "github.com/keybase/go-crypto/curve25519", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { - "checksumSHA1": "w2xCoKHxu0Ccg4Ebxqo3YN9ysGI=", + "checksumSHA1": "tU/72BMqzPlbK6qMeq7cklYwLWY=", "path": "github.com/keybase/go-crypto/openpgp", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "y61I7+hCekP1Rk0qxgUQ+iozXak=", "path": "github.com/keybase/go-crypto/openpgp/armor", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "nWhmwjBJqPSvkCWqaap2Z9EiS1k=", "path": "github.com/keybase/go-crypto/openpgp/ecdh", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "uxXG9IC/XF8jwwvZUbW65+x8/+M=", "path": "github.com/keybase/go-crypto/openpgp/elgamal", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "EyUf82Yknzc75m8RcA21CNQINw0=", "path": "github.com/keybase/go-crypto/openpgp/errors", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "esp0WrWFo5Ohk/bXhjC5NrzWnS0=", "path": "github.com/keybase/go-crypto/openpgp/packet", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "BGDxg1Xtsz0DSPzdQGJLLQqfYc8=", "path": "github.com/keybase/go-crypto/openpgp/s2k", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "rE3pp7b3gfcmBregzpIvN5IdFhY=", "path": "github.com/keybase/go-crypto/rsa", - "revision": "e721397a850bd2d1433ecf6fbbb5dcfcd58131de", - "revisionTime": "2017-02-06T19:27:00Z" + "revision": "95833b1d77cdcc574fa3f0c85fd216598f289ab5", + "revisionTime": "2017-02-24T12:24:59Z" }, { "checksumSHA1": "FZem1OXCd+ogu1yeG11GMlGiGVA=", @@ -829,10 +811,10 @@ "revisionTime": "2017-02-13T22:10:49Z" }, { - "checksumSHA1": "I4njd26dG5hxFT2nawuByM4pxzY=", + "checksumSHA1": "QPtwwLkTyoqQoigevgprwudIdXk=", "path": "github.com/mattn/go-colorable", - "revision": "5411d3eea5978e6cdc258b30de592b60df6aba96", - "revisionTime": "2017-02-10T17:28:01Z" + "revision": "d898aa9fb31c91f35dd28ca75db377eff023c076", + "revisionTime": "2017-02-21T00:41:37Z" }, { "checksumSHA1": "Jyv1TH1YHrCVewmVE8FgSh1+92s=", @@ -859,10 +841,10 @@ "revisionTime": "2017-02-02T07:45:48Z" }, { - "checksumSHA1": "W6WsJ7dtBT0coA3S5FpGR0k4IEU=", + "checksumSHA1": "PfnjkP75J4WIemUueJcrH2VbRHY=", "path": "github.com/mitchellh/cli", - "revision": "494eb006fe29e9dc75fea6da4df4818f7e046b73", - "revisionTime": "2017-02-08T07:23:55Z" + "revision": "4e26b972666dd9db4e1ffee38c8dd0c675bd245d", + "revisionTime": "2017-02-22T21:41:24Z" }, { "checksumSHA1": "kSmDazz+cokgcHQT7q56Na+IBe0=", @@ -897,8 +879,8 @@ { "checksumSHA1": "wJWRH5ORhyIO29LxvA/Sug1skF0=", "path": "github.com/ory-am/common/env", - "revision": "40fb0fd742247e3b54ebd9ebed09c35185663ba3", - "revisionTime": "2016-12-29T21:13:11Z" + "revision": "c6ab75d78d2c26a3cbfb37d742155cfc3ad74e23", + "revisionTime": "2017-02-20T09:14:30Z" }, { "checksumSHA1": "Se195FlZ160eaEk/uVx4KdTPSxU=", @@ -999,50 +981,50 @@ { "checksumSHA1": "Y+HGqEkYM15ir+J93MEaHdyFy0c=", "path": "golang.org/x/net/context", - "revision": "b4690f45fa1cafc47b1c280c2e75116efe40cc13", - "revisionTime": "2017-02-15T08:41:58Z" + "revision": "dd2d9a67c97da0afa00d5726e28086007a0acce5", + "revisionTime": "2017-02-23T02:43:42Z" }, { "checksumSHA1": "WHc3uByvGaMcnSoI21fhzYgbOgg=", "path": "golang.org/x/net/context/ctxhttp", - "revision": "b4690f45fa1cafc47b1c280c2e75116efe40cc13", - "revisionTime": "2017-02-15T08:41:58Z" + "revision": "dd2d9a67c97da0afa00d5726e28086007a0acce5", + "revisionTime": "2017-02-23T02:43:42Z" }, { "checksumSHA1": "LC+mzxnIrUS9Kr4s7shpY+A9J2o=", "path": "golang.org/x/net/http2", - "revision": "b4690f45fa1cafc47b1c280c2e75116efe40cc13", - "revisionTime": "2017-02-15T08:41:58Z" + "revision": "dd2d9a67c97da0afa00d5726e28086007a0acce5", + "revisionTime": "2017-02-23T02:43:42Z" }, { - "checksumSHA1": "G3e2/HrQjRy2Ml9lfX0e3AGRWWE=", + "checksumSHA1": "pRzVTCg66HpHQxHxOlLvISSJFh4=", "path": "golang.org/x/net/http2/hpack", - "revision": "b4690f45fa1cafc47b1c280c2e75116efe40cc13", - "revisionTime": "2017-02-15T08:41:58Z" + "revision": "dd2d9a67c97da0afa00d5726e28086007a0acce5", + "revisionTime": "2017-02-23T02:43:42Z" }, { "checksumSHA1": "GIGmSrYACByf5JDIP9ByBZksY80=", "path": "golang.org/x/net/idna", - "revision": "b4690f45fa1cafc47b1c280c2e75116efe40cc13", - "revisionTime": "2017-02-15T08:41:58Z" + "revision": "dd2d9a67c97da0afa00d5726e28086007a0acce5", + "revisionTime": "2017-02-23T02:43:42Z" }, { "checksumSHA1": "UxahDzW2v4mf/+aFxruuupaoIwo=", "path": "golang.org/x/net/internal/timeseries", - "revision": "b4690f45fa1cafc47b1c280c2e75116efe40cc13", - "revisionTime": "2017-02-15T08:41:58Z" + "revision": "dd2d9a67c97da0afa00d5726e28086007a0acce5", + "revisionTime": "2017-02-23T02:43:42Z" }, { "checksumSHA1": "3xyuaSNmClqG4YWC7g0isQIbUTc=", "path": "golang.org/x/net/lex/httplex", - "revision": "b4690f45fa1cafc47b1c280c2e75116efe40cc13", - "revisionTime": "2017-02-15T08:41:58Z" + "revision": "dd2d9a67c97da0afa00d5726e28086007a0acce5", + "revisionTime": "2017-02-23T02:43:42Z" }, { "checksumSHA1": "GQHKESPeCcAsnerZPtHadvKUIzs=", "path": "golang.org/x/net/trace", - "revision": "b4690f45fa1cafc47b1c280c2e75116efe40cc13", - "revisionTime": "2017-02-15T08:41:58Z" + "revision": "dd2d9a67c97da0afa00d5726e28086007a0acce5", + "revisionTime": "2017-02-23T02:43:42Z" }, { "checksumSHA1": "Zt7DIRCaUg5qfhfxyR1wCA+EjCE=", @@ -1075,208 +1057,208 @@ "revisionTime": "2017-02-14T22:24:16Z" }, { - "checksumSHA1": "ruEvGIBt119UK7KTkoNaYnYhZuI=", + "checksumSHA1": "oVd5OHIvNHR5bhUvnBMPLVjaL6E=", "path": "golang.org/x/sys/unix", - "revision": "075e574b89e4c2d22f2286a7e2b919519c6f3547", - "revisionTime": "2017-02-16T21:06:26Z" + "revision": "e4594059fe4cde2daf423055a596c2cd1e6c9adf", + "revisionTime": "2017-02-23T22:36:15Z" }, { "checksumSHA1": "C7k1pbU/WU4CBoBwA4EBUnV/iek=", "path": "google.golang.org/api/gensupport", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "BWKmb7kGYbfbvXO6E7tCpTh9zKE=", "path": "google.golang.org/api/googleapi", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "1K0JxrUfDqAB3MyRiU1LKjfHyf4=", "path": "google.golang.org/api/googleapi/internal/uritemplates", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "Mr2fXhMRzlQCgANFm91s536pG7E=", "path": "google.golang.org/api/googleapi/transport", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "GAKy8Id2Qx7BI0kZPRjGn1RjVQo=", "path": "google.golang.org/api/internal", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "slcGOTGSdukEPPSN81Q5WZGmhog=", "path": "google.golang.org/api/iterator", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "hZ9zds+/FPwSGEiti5lGaZL3e6w=", "path": "google.golang.org/api/option", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "fxbPUw1XvbSMz6Atx6OOMkRdJ0g=", "path": "google.golang.org/api/storage/v1", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "VRcIlsL2liHgqTdy5ad7gqdARHU=", "path": "google.golang.org/api/transport", - "revision": "bc20c61134e1d25265dd60049f5735381e79b631", - "revisionTime": "2017-02-10T21:56:36Z" + "revision": "64485db7e8c8be51e572801d06cdbcfadd3546c1", + "revisionTime": "2017-02-23T23:41:36Z" }, { "checksumSHA1": "8K4KAebYh3WnPh0swPzOgl1pRD0=", "path": "google.golang.org/appengine", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "R8rc2A/LgT4IRS6TzUZfhkUVQzQ=", "path": "google.golang.org/appengine/internal", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "x6Thdfyasqd68dWZWqzWWeIfAfI=", "path": "google.golang.org/appengine/internal/app_identity", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "TsNO8P0xUlLNyh3Ic/tzSp/fDWM=", "path": "google.golang.org/appengine/internal/base", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "5QsV5oLGSfKZqTCVXP6NRz5T4Tw=", "path": "google.golang.org/appengine/internal/datastore", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "Gep2T9zmVYV8qZfK2gu3zrmG6QE=", "path": "google.golang.org/appengine/internal/log", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "eLZVX1EHLclFtQnjDIszsdyWRHo=", "path": "google.golang.org/appengine/internal/modules", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "a1XY7rz3BieOVqVI2Et6rKiwQCk=", "path": "google.golang.org/appengine/internal/remote_api", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "VA88sOHmVuIslrbHaWx9yEvjGjM=", "path": "google.golang.org/appengine/internal/socket", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "QtAbHtHmDzcf6vOV9eqlCpKgjiw=", "path": "google.golang.org/appengine/internal/urlfetch", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "MharNMGnQusRPdmBYXDxz2cCHPU=", "path": "google.golang.org/appengine/socket", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "akOV9pYnCbcPA8wJUutSQVibdyg=", "path": "google.golang.org/appengine/urlfetch", - "revision": "2e4a801b39fc199db615bfca7d0b9f8cd9580599", - "revisionTime": "2017-02-06T20:30:24Z" + "revision": "3a452f9e00122ead39586d68ffdb9c6e1326af3c", + "revisionTime": "2017-02-22T22:47:31Z" }, { "checksumSHA1": "8Z43m+zNTbxHUHQPMUNirEp1BLg=", "path": "google.golang.org/grpc", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "08icuA15HRkdYCt6H+Cs90RPQsY=", "path": "google.golang.org/grpc/codes", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { - "checksumSHA1": "AGkvu7gY1jWK7v5s9a8qLlH2gcQ=", + "checksumSHA1": "GHCDufYjDX7weDH2udXY1pkyvEo=", "path": "google.golang.org/grpc/credentials", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "bg3wIPzajKt3QZfTG70EPaxDtpk=", "path": "google.golang.org/grpc/credentials/oauth", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "3Lt5hNAG8qJAYSsNghR5uA1zQns=", "path": "google.golang.org/grpc/grpclog", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "T3Q0p8kzvXFnRkMaK/G8mCv6mc0=", "path": "google.golang.org/grpc/internal", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "T05Mzg3hEv2Vxao9hZn0Kv+nwUQ=", "path": "google.golang.org/grpc/metadata", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "4GSUFhOQ0kdFlBH4D5OTeKy78z0=", "path": "google.golang.org/grpc/naming", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "3RRoLeH6X2//7tVClOVzxW2bY+E=", "path": "google.golang.org/grpc/peer", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "wzkOAxlah+y75EpH0QVgzb8hdfc=", "path": "google.golang.org/grpc/stats", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "N0TftT6/CyWqp6VRi2DqDx60+Fo=", "path": "google.golang.org/grpc/tap", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "b9RDUPOmWBfHe9cM8UVilfyF/vE=", "path": "google.golang.org/grpc/transport", - "revision": "d0c32ee6a441117d49856d6120ca9552af413ee0", - "revisionTime": "2017-02-16T00:36:43Z" + "revision": "34384f34de585705f1a6783a158d2ec8af29f618", + "revisionTime": "2017-02-24T00:04:25Z" }, { "checksumSHA1": "wSu8owMAP7GixsYoSZ4CmKUVhnU=",