From a9e83aa5ce412177e9fa7fd539b73428610f5b0f Mon Sep 17 00:00:00 2001 From: Joachim Hill-Grannec Date: Wed, 1 Feb 2017 13:49:26 -0800 Subject: [PATCH] gofmt modified files --- drone/server.go | 4 ++-- remote/bitbucketserver/bitbucketserver.go | 29 +++++++++++------------ router/middleware/remote.go | 12 +++++----- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/drone/server.go b/drone/server.go index 37d38cbef..eab5f13d1 100644 --- a/drone/server.go +++ b/drone/server.go @@ -263,8 +263,8 @@ var serverCmd = cli.Command{ }, cli.StringFlag{ EnvVar: "DRONE_STASH_CONSUMER_RSA_STRING", - Name: "stash-consumer-rsa-string", - Usage: "stash oauth1 private key string", + Name: "stash-consumer-rsa-string", + Usage: "stash oauth1 private key string", }, cli.StringFlag{ EnvVar: "DRONE_STASH_GIT_USERNAME", diff --git a/remote/bitbucketserver/bitbucketserver.go b/remote/bitbucketserver/bitbucketserver.go index d8cafd9db..6068e1051 100644 --- a/remote/bitbucketserver/bitbucketserver.go +++ b/remote/bitbucketserver/bitbucketserver.go @@ -27,13 +27,13 @@ const ( // Opts defines configuration options. type Opts struct { - URL string // Stash server url. - Username string // Git machine account username. - Password string // Git machine account password. - ConsumerKey string // Oauth1 consumer key. - ConsumerRSA string // Oauth1 consumer key file. + URL string // Stash server url. + Username string // Git machine account username. + Password string // Git machine account password. + ConsumerKey string // Oauth1 consumer key. + ConsumerRSA string // Oauth1 consumer key file. ConsumerRSAString string - SkipVerify bool // Skip ssl verification. + SkipVerify bool // Skip ssl verification. } type Config struct { @@ -67,9 +67,9 @@ func New(opts Opts) (remote.Remote, error) { return nil, fmt.Errorf("must have CONSUMER_RSA_KEY set to the path of a oauth1 consumer key file or CONSUMER_RSA_KEY_STRING set to the value of a oauth1 consumer key") } - var keyFileBytes []byte; + var keyFileBytes []byte if opts.ConsumerRSA != "" { - var err error; + var err error keyFileBytes, err = ioutil.ReadFile(opts.ConsumerRSA) if err != nil { return nil, err @@ -78,12 +78,11 @@ func New(opts Opts) (remote.Remote, error) { keyFileBytes = []byte(opts.ConsumerRSAString) } - block, _ := pem.Decode(keyFileBytes) - PrivateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - return nil, err - } - + block, _ := pem.Decode(keyFileBytes) + PrivateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes) + if err != nil { + return nil, err + } config.Consumer = CreateConsumer(opts.URL, opts.ConsumerKey, PrivateKey) return config, nil @@ -166,7 +165,7 @@ func (c *Config) File(u *model.User, r *model.Repo, b *model.Build, f string) ([ } // Status is not supported by the bitbucketserver driver. -func (c *Config) Status(u *model.User,r *model.Repo,b *model.Build,link string) error { +func (c *Config) Status(u *model.User, r *model.Repo, b *model.Build, link string) error { status := internal.BuildStatus{ State: convertStatus(b.Status), Desc: convertDesc(b.Status), diff --git a/router/middleware/remote.go b/router/middleware/remote.go index f832831c7..98e197037 100644 --- a/router/middleware/remote.go +++ b/router/middleware/remote.go @@ -66,13 +66,13 @@ func setupGogs(c *cli.Context) (remote.Remote, error) { // helper function to setup the Stash remote from the CLI arguments. func setupStash(c *cli.Context) (remote.Remote, error) { return bitbucketserver.New(bitbucketserver.Opts{ - URL: c.String("stash-server"), - Username: c.String("stash-git-username"), - Password: c.String("stash-git-password"), - ConsumerKey: c.String("stash-consumer-key"), - ConsumerRSA: c.String("stash-consumer-rsa"), + URL: c.String("stash-server"), + Username: c.String("stash-git-username"), + Password: c.String("stash-git-password"), + ConsumerKey: c.String("stash-consumer-key"), + ConsumerRSA: c.String("stash-consumer-rsa"), ConsumerRSAString: c.String("stash-consumer-rsa-string"), - SkipVerify: c.Bool("stash-skip-verify"), + SkipVerify: c.Bool("stash-skip-verify"), }) }