migrate to go-modules

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2019-06-24 11:29:13 +02:00
parent a3211b73c6
commit d697456dc9
1000 changed files with 97470 additions and 48284 deletions

View File

@ -40,10 +40,10 @@ func (c *Client) InstallPlugins(opts InstallPluginOptions) error {
data: opts.Plugins,
context: opts.Context,
})
defer resp.Body.Close()
if err != nil {
return err
}
resp.Body.Close()
return nil
}
@ -288,7 +288,6 @@ type EnablePluginOptions struct {
func (c *Client) EnablePlugin(opts EnablePluginOptions) error {
path := "/plugins/" + opts.Name + "/enable?" + queryString(opts)
resp, err := c.do("POST", path, doOptions{context: opts.Context})
defer resp.Body.Close()
if err != nil {
return err
}
@ -312,7 +311,6 @@ type DisablePluginOptions struct {
func (c *Client) DisablePlugin(opts DisablePluginOptions) error {
path := "/plugins/" + opts.Name + "/disable"
resp, err := c.do("POST", path, doOptions{context: opts.Context})
defer resp.Body.Close()
if err != nil {
return err
}
@ -339,11 +337,12 @@ func (c *Client) CreatePlugin(opts CreatePluginOptions) (string, error) {
path := "/plugins/create?" + queryString(opts)
resp, err := c.do("POST", path, doOptions{
data: opts.Path,
context: opts.Context})
defer resp.Body.Close()
context: opts.Context,
})
if err != nil {
return "", err
}
defer resp.Body.Close()
containerNameBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
@ -367,10 +366,10 @@ type PushPluginOptions struct {
func (c *Client) PushPlugin(opts PushPluginOptions) error {
path := "/plugins/" + opts.Name + "/push"
resp, err := c.do("POST", path, doOptions{context: opts.Context})
defer resp.Body.Close()
if err != nil {
return err
}
resp.Body.Close()
return nil
}
@ -394,13 +393,13 @@ func (c *Client) ConfigurePlugin(opts ConfigurePluginOptions) error {
data: opts.Envs,
context: opts.Context,
})
defer resp.Body.Close()
if err != nil {
if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound {
return &NoSuchPlugin{ID: opts.Name}
}
return err
}
resp.Body.Close()
return nil
}