go fmt
diff --git a/acceptance/openstack/compute_test.go b/acceptance/openstack/compute_test.go
index 3cccbc1..3781d38 100644
--- a/acceptance/openstack/compute_test.go
+++ b/acceptance/openstack/compute_test.go
@@ -1,12 +1,12 @@
package openstack
import (
- "testing"
"fmt"
- "github.com/rackspace/gophercloud/openstack/compute/servers"
- "github.com/rackspace/gophercloud/openstack/compute/images"
"github.com/rackspace/gophercloud/openstack/compute/flavors"
+ "github.com/rackspace/gophercloud/openstack/compute/images"
+ "github.com/rackspace/gophercloud/openstack/compute/servers"
"os"
+ "testing"
)
func TestListServers(t *testing.T) {
@@ -182,4 +182,3 @@
return
}
}
-
diff --git a/acceptance/openstack/identity_test.go b/acceptance/openstack/identity_test.go
index edb24ab..5bd9355 100644
--- a/acceptance/openstack/identity_test.go
+++ b/acceptance/openstack/identity_test.go
@@ -1,11 +1,11 @@
package openstack
import (
- "testing"
"fmt"
- "os"
"github.com/rackspace/gophercloud/openstack/identity"
"github.com/rackspace/gophercloud/openstack/utils"
+ "os"
+ "testing"
"text/tabwriter"
)
@@ -106,4 +106,3 @@
fmt.Printf(" %s\n", alias)
}
}
-
diff --git a/acceptance/openstack/tools_test.go b/acceptance/openstack/tools_test.go
index dc2cde8..9b4f1ae 100644
--- a/acceptance/openstack/tools_test.go
+++ b/acceptance/openstack/tools_test.go
@@ -1,6 +1,7 @@
package openstack
import (
+ "crypto/rand"
"fmt"
"github.com/rackspace/gophercloud/openstack/compute/servers"
"github.com/rackspace/gophercloud/openstack/identity"
@@ -8,26 +9,25 @@
"os"
"text/tabwriter"
"time"
- "crypto/rand"
)
var errTimeout = fmt.Errorf("Timeout.")
type testState struct {
- o identity.AuthOptions
- a identity.AuthResults
- sc *identity.ServiceCatalog
- eps []identity.Endpoint
- w *tabwriter.Writer
- imageId string
- flavorId string
- region string
- ep string
- client *servers.Client
+ o identity.AuthOptions
+ a identity.AuthResults
+ sc *identity.ServiceCatalog
+ eps []identity.Endpoint
+ w *tabwriter.Writer
+ imageId string
+ flavorId string
+ region string
+ ep string
+ client *servers.Client
createdServer *servers.Server
- gottenServer *servers.Server
+ gottenServer *servers.Server
updatedServer *servers.Server
- serverName string
+ serverName string
alternateName string
}
@@ -143,8 +143,8 @@
cr, err := servers.Create(ts.client, map[string]interface{}{
"flavorRef": ts.flavorId,
- "imageRef": ts.imageId,
- "name": ts.serverName,
+ "imageRef": ts.imageId,
+ "name": ts.serverName,
})
if err != nil {
return err
@@ -157,11 +157,11 @@
func waitForStatus(ts *testState, s string) error {
var (
inProgress bool
- timeout int
- err error
+ timeout int
+ err error
)
- for inProgress, timeout, err = countDown(ts, 300) ; inProgress ; inProgress, timeout, err = countDown(ts, timeout) {
+ for inProgress, timeout, err = countDown(ts, 300); inProgress; inProgress, timeout, err = countDown(ts, timeout) {
if ts.gottenServer.Id != ts.createdServer.Id {
return fmt.Errorf("created server id (%s) != gotten server id (%s)", ts.createdServer.Id, ts.gottenServer.Id)
}
@@ -183,7 +183,7 @@
func changeServerName(ts *testState) error {
var (
inProgress bool
- timeout int
+ timeout int
)
ts.alternateName = randomString("ACPTTEST", 16)
@@ -208,7 +208,7 @@
return fmt.Errorf("Expected updated and created server to share the same ID")
}
- for inProgress, timeout, err = countDown(ts, 300) ; inProgress ; inProgress, timeout, err = countDown(ts, timeout) {
+ for inProgress, timeout, err = countDown(ts, 300); inProgress; inProgress, timeout, err = countDown(ts, timeout) {
if ts.gottenServer.Id != ts.updatedServer.Id {
return fmt.Errorf("Updated server ID (%s) != gotten server ID (%s)", ts.updatedServer.Id, ts.gottenServer.Id)
}
@@ -240,4 +240,3 @@
}
return prefix + string(bytes)
}
-
diff --git a/openstack/compute/flavors/client.go b/openstack/compute/flavors/client.go
index 5ad97af..60c7cd1 100644
--- a/openstack/compute/flavors/client.go
+++ b/openstack/compute/flavors/client.go
@@ -5,16 +5,16 @@
)
type Client struct {
- endpoint string
+ endpoint string
authority identity.AuthResults
- options identity.AuthOptions
+ options identity.AuthOptions
}
func NewClient(e string, a identity.AuthResults, ao identity.AuthOptions) *Client {
return &Client{
- endpoint: e,
+ endpoint: e,
authority: a,
- options: ao,
+ options: ao,
}
}
@@ -32,4 +32,3 @@
"X-Auth-Token": t.Id,
}, nil
}
-
diff --git a/openstack/compute/flavors/flavors.go b/openstack/compute/flavors/flavors.go
index b66115f..81996a5 100644
--- a/openstack/compute/flavors/flavors.go
+++ b/openstack/compute/flavors/flavors.go
@@ -5,7 +5,6 @@
"reflect"
)
-
// Flavor records represent (virtual) hardware configurations for server resources in a region.
//
// The Id field contains the flavor's unique identifier.
@@ -20,13 +19,13 @@
//
// VCpus indicates how many (virtual) CPUs are available for this flavor.
type Flavor struct {
- Disk int
- Id string
- Name string
- Ram int
- RxTxFactor float64 `mapstructure:"rxtx_factor"`
- Swap int
- VCpus int
+ Disk int
+ Id string
+ Name string
+ Ram int
+ RxTxFactor float64 `mapstructure:"rxtx_factor"`
+ Swap int
+ VCpus int
}
func defaulter(from, to reflect.Kind, v interface{}) (interface{}, error) {
@@ -48,7 +47,7 @@
flavorObj := fm.(map[string]interface{})
cfg := &mapstructure.DecoderConfig{
DecodeHook: defaulter,
- Result: &flavors[i],
+ Result: &flavors[i],
}
decoder, err := mapstructure.NewDecoder(cfg)
if err != nil {
@@ -61,4 +60,3 @@
}
return flavors, nil
}
-
diff --git a/openstack/compute/flavors/requests.go b/openstack/compute/flavors/requests.go
index c76e5af..f4dd072 100644
--- a/openstack/compute/flavors/requests.go
+++ b/openstack/compute/flavors/requests.go
@@ -5,7 +5,6 @@
"github.com/racker/perigee"
)
-
var ErrNotImplemented = fmt.Errorf("Flavors functionality not implemented.")
type ListResults map[string]interface{}
@@ -19,9 +18,8 @@
}
err = perigee.Get(c.getListUrl(), perigee.Options{
- Results: &lr,
+ Results: &lr,
MoreHeaders: h,
})
return lr, err
}
-
diff --git a/openstack/compute/images/client.go b/openstack/compute/images/client.go
index a7466bb..c5f1897 100644
--- a/openstack/compute/images/client.go
+++ b/openstack/compute/images/client.go
@@ -5,16 +5,16 @@
)
type Client struct {
- endpoint string
+ endpoint string
authority identity.AuthResults
- options identity.AuthOptions
+ options identity.AuthOptions
}
func NewClient(e string, a identity.AuthResults, ao identity.AuthOptions) *Client {
return &Client{
- endpoint: e,
+ endpoint: e,
authority: a,
- options: ao,
+ options: ao,
}
}
@@ -32,4 +32,3 @@
"X-Auth-Token": t.Id,
}, nil
}
-
diff --git a/openstack/compute/images/images.go b/openstack/compute/images/images.go
index d53edce..cc08589 100644
--- a/openstack/compute/images/images.go
+++ b/openstack/compute/images/images.go
@@ -17,14 +17,14 @@
//
// The Updated field indicates the last time this image was changed.
type Image struct {
- Created string
- Id string
- MinDisk int
- MinRam int
- Name string
- Progress int
- Status string
- Updated string
+ Created string
+ Id string
+ MinDisk int
+ MinRam int
+ Name string
+ Progress int
+ Status string
+ Updated string
}
func GetImages(lr ListResults) ([]Image, error) {
@@ -44,4 +44,3 @@
}
return images, nil
}
-
diff --git a/openstack/compute/images/requests.go b/openstack/compute/images/requests.go
index 2aa4723..ff875c9 100644
--- a/openstack/compute/images/requests.go
+++ b/openstack/compute/images/requests.go
@@ -5,7 +5,6 @@
"github.com/racker/perigee"
)
-
var ErrNotImplemented = fmt.Errorf("Images functionality not implemented.")
type ListResults map[string]interface{}
@@ -19,9 +18,8 @@
}
err = perigee.Get(c.getListUrl(), perigee.Options{
- Results: &lr,
+ Results: &lr,
MoreHeaders: h,
})
return lr, err
}
-
diff --git a/openstack/compute/servers/client.go b/openstack/compute/servers/client.go
index 03c5c15..3d51dd8 100644
--- a/openstack/compute/servers/client.go
+++ b/openstack/compute/servers/client.go
@@ -7,18 +7,18 @@
// Client abstracts the connection information needed to make API requests for OpenStack compute endpoints.
type Client struct {
- endpoint string
- authority identity.AuthResults
- options identity.AuthOptions
- token *identity.Token
+ endpoint string
+ authority identity.AuthResults
+ options identity.AuthOptions
+ token *identity.Token
}
// NewClient creates a new Client structure to use when issuing requests to the server.
func NewClient(e string, a identity.AuthResults, o identity.AuthOptions) *Client {
return &Client{
- endpoint: e,
- authority: a,
- options: o,
+ endpoint: e,
+ authority: a,
+ options: o,
}
}
@@ -81,4 +81,3 @@
return c.token.Id, err
}
-
diff --git a/openstack/compute/servers/doc.go b/openstack/compute/servers/doc.go
index c5c6777..77a7514 100644
--- a/openstack/compute/servers/doc.go
+++ b/openstack/compute/servers/doc.go
@@ -1,3 +1,2 @@
// The servers package provides convenient access to standard, OpenStack-defined compute services.
package servers
-
diff --git a/openstack/compute/servers/requests.go b/openstack/compute/servers/requests.go
index 385e3c2..28abd1c 100644
--- a/openstack/compute/servers/requests.go
+++ b/openstack/compute/servers/requests.go
@@ -7,7 +7,7 @@
// ListResult abstracts the raw results of making a List() request against the
// API. As OpenStack extensions may freely alter the response bodies of
// structures returned to the client, you may only safely access the data
-// provided through separate, type-safe accessors or methods.
+// provided through separate, type-safe accessors or methods.
type ListResult map[string]interface{}
type ServerResult map[string]interface{}
@@ -22,7 +22,7 @@
}
err = perigee.Get(c.getListUrl(), perigee.Options{
- Results: &lr,
+ Results: &lr,
MoreHeaders: h,
})
return lr, err
@@ -39,11 +39,11 @@
err = perigee.Post(c.getCreateUrl(), perigee.Options{
Results: &sr,
- ReqBody: map[string]interface{} {
+ ReqBody: map[string]interface{}{
"server": opts,
},
MoreHeaders: h,
- OkCodes: []int{202},
+ OkCodes: []int{202},
})
return sr, err
}
@@ -57,7 +57,7 @@
err = perigee.Delete(c.getDeleteUrl(id), perigee.Options{
MoreHeaders: h,
- OkCodes: []int{204},
+ OkCodes: []int{204},
})
return err
}
@@ -72,7 +72,7 @@
}
err = perigee.Get(c.getDetailUrl(id), perigee.Options{
- Results: &sr,
+ Results: &sr,
MoreHeaders: h,
})
return sr, err
@@ -96,4 +96,3 @@
})
return sr, err
}
-
diff --git a/openstack/compute/servers/servers.go b/openstack/compute/servers/servers.go
index c02cf9f..e3bdbe3 100644
--- a/openstack/compute/servers/servers.go
+++ b/openstack/compute/servers/servers.go
@@ -1,8 +1,8 @@
package servers
import (
- "github.com/mitchellh/mapstructure"
"fmt"
+ "github.com/mitchellh/mapstructure"
)
// ErrNotImplemented indicates a failure to discover a feature of the response from the API.
@@ -37,22 +37,22 @@
//
// Links includes HTTP references to the itself, useful for passing along to other APIs that might want a server reference.
type Server struct {
- Id string
- TenantId string `mapstructure:tenant_id`
- UserId string `mapstructure:user_id`
- Name string
- Updated string
- Created string
- HostId string
- Status string
- Progress int
+ Id string
+ TenantId string `mapstructure:tenant_id`
+ UserId string `mapstructure:user_id`
+ Name string
+ Updated string
+ Created string
+ HostId string
+ Status string
+ Progress int
AccessIPv4 string
AccessIPv6 string
- Image map[string]interface{}
- Flavor map[string]interface{}
- Addresses map[string]interface{}
- Metadata map[string]interface{}
- Links []interface{}
+ Image map[string]interface{}
+ Flavor map[string]interface{}
+ Addresses map[string]interface{}
+ Metadata map[string]interface{}
+ Links []interface{}
}
// GetServers interprets the result of a List() call, producing a slice of Server entities.
@@ -86,4 +86,3 @@
err := mapstructure.Decode(serverObj, s)
return s, err
}
-
diff --git a/openstack/compute/servers/servers_test.go b/openstack/compute/servers/servers_test.go
index 8a58a46..b4a094c 100644
--- a/openstack/compute/servers/servers_test.go
+++ b/openstack/compute/servers/servers_test.go
@@ -1,8 +1,8 @@
package servers
import (
- "testing"
"encoding/json"
+ "testing"
)
// Taken from: http://docs.openstack.org/api/openstack-compute/2/content/List_Servers-d1e2078.html
@@ -186,4 +186,3 @@
return
}
}
-