Skip to content

Commit

Permalink
go fmt changes for go 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyworld committed Sep 17, 2018
1 parent d47d7e0 commit a9e08c2
Show file tree
Hide file tree
Showing 78 changed files with 419 additions and 419 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ rebuild-dependencies:
# Install packages required to develop Juju and run tests. The stable
# PPA includes the required mongodb-server binaries.
install-dependencies:
@echo Installing go-1.10 snap
@sudo snap install go --channel=1.10/stable --classic
@echo Installing go-1.11 snap
@sudo snap install go --channel=1.11/stable --classic
@echo Adding juju PPA for mongodb
@sudo apt-add-repository --yes ppa:juju/stable
@sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion agent/agentbootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func initBootstrapMachine(c agent.ConfigSetter, st *state.State, args Initialize
Constraints: args.BootstrapMachineConstraints,
InstanceId: args.BootstrapMachineInstanceId,
HardwareCharacteristics: hardware,
Jobs: jobs,
Jobs: jobs,
})
if err != nil {
return nil, errors.Annotate(err, "cannot create bootstrap machine in state")
Expand Down
4 changes: 2 additions & 2 deletions api/common/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,8 @@ func (s *NetworkSuite) TestGetObservedNetworkConfigInterfacesError(c *gc.C) {

func (s *NetworkSuite) TestGetObservedNetworkConfigInterfaceAddressesError(c *gc.C) {
s.stubConfigSource.SetErrors(
nil, // Interfaces
nil, // DefaultRoute
nil, // Interfaces
nil, // DefaultRoute
errors.New("no addresses"), // InterfaceAddressses
)

Expand Down
4 changes: 2 additions & 2 deletions api/logstream/logstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func (s *LogReaderSuite) TestNextOneRecord(c *gc.C) {
Name: "99",
Software: logfwd.Software{
PrivateEnterpriseNumber: 28978,
Name: "jujud-machine-agent",
Version: version.Current,
Name: "jujud-machine-agent",
Version: version.Current,
},
},
Timestamp: ts,
Expand Down
8 changes: 4 additions & 4 deletions api/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func NewRelationUnitsWatcher(caller base.APICaller, result params.RelationUnitsW
w := &relationUnitsWatcher{
caller: caller,
relationUnitsWatcherId: result.RelationUnitsWatcherId,
out: make(chan watcher.RelationUnitsChange),
out: make(chan watcher.RelationUnitsChange),
}
w.tomb.Go(func() error {
return w.loop(result.Changes)
Expand Down Expand Up @@ -326,7 +326,7 @@ func NewRelationStatusWatcher(
w := &relationStatusWatcher{
caller: caller,
relationStatusWatcherId: result.RelationStatusWatcherId,
out: make(chan []watcher.RelationStatusChange),
out: make(chan []watcher.RelationStatusChange),
}
w.tomb.Go(func() error {
return w.loop(result.Changes)
Expand Down Expand Up @@ -517,9 +517,9 @@ func NewFilesystemAttachmentsWatcher(caller base.APICaller, result params.Machin

func newMachineStorageIdsWatcher(facade string, caller base.APICaller, result params.MachineStorageIdsWatchResult) watcher.MachineStorageIdsWatcher {
w := &machineAttachmentsWatcher{
caller: caller,
caller: caller,
machineAttachmentsWatcherId: result.MachineStorageIdsWatcherId,
out: make(chan []watcher.MachineStorageId),
out: make(chan []watcher.MachineStorageId),
}
w.tomb.Go(func() error {
return w.loop(facade, result.Changes)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/authentication/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ func (s *userAuthenticatorSuite) TestAuthenticateLocalLoginMacaroon(c *gc.C) {
service := mockBakeryService{}
clock := testclock.NewClock(time.Time{})
authenticator := &authentication.UserAuthenticator{
Service: &service,
Clock: clock,
Service: &service,
Clock: clock,
LocalUserIdentityLocation: "https://testing.invalid:1234/auth",
}

Expand Down
4 changes: 2 additions & 2 deletions apiserver/common/crossmodel/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func NewAuthContext(
localOfferBakeryService authentication.ExpirableStorageBakeryService,
) (*AuthContext, error) {
ctxt := &AuthContext{
pool: pool,
clock: clock.WallClock,
pool: pool,
clock: clock.WallClock,
localOfferBakeryService: localOfferBakeryService,
localOfferThirdPartyBakeryService: localOfferThirdPartyBakeryService,
}
Expand Down
8 changes: 4 additions & 4 deletions apiserver/common/modeldestroy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ func (s *destroyModelSuite) TestDestroyControllerModelErrs(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)

s.modelManager.SetErrors(
nil, // for GetBackend, 1st model
nil, // for GetBlockForType, 1st model
nil, // for GetBlockForType, 1st model
nil, // for GetBlockForType, 1st model
nil, // for GetBackend, 1st model
nil, // for GetBlockForType, 1st model
nil, // for GetBlockForType, 1st model
nil, // for GetBlockForType, 1st model
errors.New("I have a problem"), // for GetBackend, 2nd model
)
err = common.DestroyController(s.modelManager, true, nil)
Expand Down
6 changes: 3 additions & 3 deletions apiserver/common/networkingcommon/spaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ func (s *SpacesSuite) TestCreateSpacesProviderOpenError(c *gc.C) {

func (s *SpacesSuite) TestCreateSpacesNotSupportedError(c *gc.C) {
apiservertesting.SharedStub.SetErrors(
nil, // Backing.ModelConfig()
nil, // Backing.CloudSpec()
nil, // Provider.Open()
nil, // Backing.ModelConfig()
nil, // Backing.CloudSpec()
nil, // Provider.Open()
errors.NotSupportedf("spaces"), // ZonedNetworkingEnviron.SupportsSpaces()
)

Expand Down
40 changes: 20 additions & 20 deletions apiserver/common/networkingcommon/subnets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ func (s *SubnetsSuite) TestAllZonesWithNoBackingZonesAndSetFails(c *gc.C) {
apiservertesting.WithSubnets)

apiservertesting.SharedStub.SetErrors(
nil, // Backing.AvailabilityZones
nil, // Backing.ModelConfig
nil, // Backing.CloudSpec
nil, // Provider.Open
nil, // ZonedEnviron.AvailabilityZones
nil, // Backing.AvailabilityZones
nil, // Backing.ModelConfig
nil, // Backing.CloudSpec
nil, // Provider.Open
nil, // ZonedEnviron.AvailabilityZones
errors.NotSupportedf("setting"), // Backing.SetAvailabilityZones
)

Expand Down Expand Up @@ -150,10 +150,10 @@ func (s *SubnetsSuite) TestAllZonesWithNoBackingZonesAndFetchingZonesFails(c *gc
apiservertesting.WithSubnets)

apiservertesting.SharedStub.SetErrors(
nil, // Backing.AvailabilityZones
nil, // Backing.ModelConfig
nil, // Backing.CloudSpec
nil, // Provider.Open
nil, // Backing.AvailabilityZones
nil, // Backing.ModelConfig
nil, // Backing.CloudSpec
nil, // Provider.Open
errors.NotValidf("foo"), // ZonedEnviron.AvailabilityZones
)

Expand Down Expand Up @@ -184,7 +184,7 @@ func (s *SubnetsSuite) TestAllZonesWithNoBackingZonesAndModelConfigFails(c *gc.C
apiservertesting.WithSubnets)

apiservertesting.SharedStub.SetErrors(
nil, // Backing.AvailabilityZones
nil, // Backing.AvailabilityZones
errors.NotFoundf("config"), // Backing.ModelConfig
)

Expand All @@ -211,9 +211,9 @@ func (s *SubnetsSuite) TestAllZonesWithNoBackingZonesAndOpenFails(c *gc.C) {
apiservertesting.WithSubnets)

apiservertesting.SharedStub.SetErrors(
nil, // Backing.AvailabilityZones
nil, // Backing.ModelConfig
nil, // Backing.CloudSpec
nil, // Backing.AvailabilityZones
nil, // Backing.ModelConfig
nil, // Backing.CloudSpec
errors.NotValidf("config"), // Provider.Open
)

Expand Down Expand Up @@ -412,14 +412,14 @@ func (s *SubnetsSuite) TestAddSubnetsParamsCombinations(c *gc.C) {
errors.NotFoundf("config"), // BackingInstance.ModelConfig (1st call)

// caching subnets (2nd attepmt): fails
nil, // BackingInstance.ModelConfig (2nd call)
nil, // BackingInstance.CloudSpec (1st call)
nil, // BackingInstance.ModelConfig (2nd call)
nil, // BackingInstance.CloudSpec (1st call)
errors.NotFoundf("provider"), // ProviderInstance.Open (1st call)

// caching subnets (3rd attempt): fails
nil, // BackingInstance.ModelConfig (3rd call)
nil, // BackingInstance.CloudSpec (2nd call)
nil, // ProviderInstance.Open (2nd call)
nil, // BackingInstance.ModelConfig (3rd call)
nil, // BackingInstance.CloudSpec (2nd call)
nil, // ProviderInstance.Open (2nd call)
errors.NotFoundf("subnets"), // NetworkingEnvironInstance.Subnets (1st call)

// caching subnets (4th attempt): succeeds
Expand All @@ -430,11 +430,11 @@ func (s *SubnetsSuite) TestAddSubnetsParamsCombinations(c *gc.C) {

// caching spaces (1st and 2nd attempts)
errors.NotFoundf("spaces"), // BackingInstance.AllSpaces (1st call)
nil, // BackingInstance.AllSpaces (2nd call)
nil, // BackingInstance.AllSpaces (2nd call)

// cacing zones (1st and 2nd attempts)
errors.NotFoundf("zones"), // BackingInstance.AvailabilityZones (1st call)
nil, // BackingInstance.AvailabilityZones (2nd call)
nil, // BackingInstance.AvailabilityZones (2nd call)

// validation done; adding subnets to backing store
errors.NotFoundf("state"), // BackingInstance.AddSubnet (1st call)
Expand Down
8 changes: 4 additions & 4 deletions apiserver/facades/agent/provisioner/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func (s *containerProvisionerSuite) TestPrepareContainerInterfaceInfoPermission(
errors = append(errors, configResult.Error)
}
c.Check(errors, gc.DeepEquals, []*params.Error{
nil, // can touch 1/lxd/0
nil, // can touch 1/lxd/1
nil, // can touch 1/lxd/0
nil, // can touch 1/lxd/1
apiservertesting.ErrUnauthorized, // not 2/lxd/0
apiservertesting.ErrUnauthorized, // nor 2
})
Expand Down Expand Up @@ -122,8 +122,8 @@ func (s *containerProvisionerSuite) TestHostChangesForContainersPermission(c *gc
errors = append(errors, configResult.Error)
}
c.Check(errors, gc.DeepEquals, []*params.Error{
nil, // can touch 1/lxd/0
nil, // can touch 1/lxd/1
nil, // can touch 1/lxd/0
nil, // can touch 1/lxd/1
apiservertesting.ErrUnauthorized, // not 2/lxd/0
apiservertesting.ErrUnauthorized, // nor 2
})
Expand Down
6 changes: 3 additions & 3 deletions apiserver/facades/agent/provisioner/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ func (p *ProvisionerAPIV5) ContainerConfig() (params.ContainerConfigV5, error) {
}

return params.ContainerConfigV5{
ProviderType: cfg.ProviderType,
AuthorizedKeys: cfg.AuthorizedKeys,
SSLHostnameVerification: cfg.SSLHostnameVerification,
ProviderType: cfg.ProviderType,
AuthorizedKeys: cfg.AuthorizedKeys,
SSLHostnameVerification: cfg.SSLHostnameVerification,
Proxy: cfg.LegacyProxy,
AptProxy: cfg.AptProxy,
AptMirror: cfg.AptMirror,
Expand Down
10 changes: 5 additions & 5 deletions apiserver/facades/client/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,11 @@ func (c *Client) addOneMachine(p params.AddMachineParams) (*state.Machine, error
return nil, err
}
template := state.MachineTemplate{
Series: p.Series,
Constraints: p.Constraints,
InstanceId: p.InstanceId,
Jobs: jobs,
Nonce: p.Nonce,
Series: p.Series,
Constraints: p.Constraints,
InstanceId: p.InstanceId,
Jobs: jobs,
Nonce: p.Nonce,
HardwareCharacteristics: p.HardwareCharacteristics,
Addresses: params.NetworkAddresses(p.Addrs...),
Placement: placementDirective,
Expand Down
20 changes: 10 additions & 10 deletions apiserver/facades/client/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1211,11 +1211,11 @@ func (s *clientSuite) TestClientAddMachinesWithInstanceIdSomeErrors(c *gc.C) {
hc := instance.MustParseHardware("mem=4G")
for i := 0; i < 3; i++ {
apiParams[i] = params.AddMachineParams{
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id(fmt.Sprintf("1234-%d", i)),
Nonce: "foo",
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id(fmt.Sprintf("1234-%d", i)),
Nonce: "foo",
HardwareCharacteristics: hc,
Addrs: params.FromNetworkAddresses(addrs...),
Addrs: params.FromNetworkAddresses(addrs...),
}
}
// This will cause the last add-machine to fail.
Expand Down Expand Up @@ -1273,9 +1273,9 @@ func (s *clientSuite) TestProvisioningScript(c *gc.C) {
// converting it to a cloudinit.MachineConfig, and disabling
// apt_upgrade.
apiParams := params.AddMachineParams{
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id("1234"),
Nonce: "foo",
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id("1234"),
Nonce: "foo",
HardwareCharacteristics: instance.MustParseHardware("arch=amd64"),
}
machines, err := s.APIState.Client().AddMachines([]params.AddMachineParams{apiParams})
Expand Down Expand Up @@ -1311,9 +1311,9 @@ func (s *clientSuite) TestProvisioningScript(c *gc.C) {

func (s *clientSuite) TestProvisioningScriptDisablePackageCommands(c *gc.C) {
apiParams := params.AddMachineParams{
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id("1234"),
Nonce: "foo",
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id("1234"),
Nonce: "foo",
HardwareCharacteristics: instance.MustParseHardware("arch=amd64"),
}
machines, err := s.APIState.Client().AddMachines([]params.AddMachineParams{apiParams})
Expand Down
18 changes: 9 additions & 9 deletions apiserver/facades/client/client/instanceconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ func (s *machineConfigSuite) TestMachineConfig(c *gc.C) {
addrs := network.NewAddresses("1.2.3.4")
hc := instance.MustParseHardware("mem=4G arch=amd64")
apiParams := params.AddMachineParams{
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id("1234"),
Nonce: "foo",
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id("1234"),
Nonce: "foo",
HardwareCharacteristics: hc,
Addrs: params.FromNetworkAddresses(addrs...),
Addrs: params.FromNetworkAddresses(addrs...),
}
machines, err := s.APIState.Client().AddMachines([]params.AddMachineParams{apiParams})
c.Assert(err, jc.ErrorIsNil)
Expand Down Expand Up @@ -77,12 +77,12 @@ func (s *machineConfigSuite) TestMachineConfigNoTools(c *gc.C) {
addrs := network.NewAddresses("1.2.3.4")
hc := instance.MustParseHardware("mem=4G arch=amd64")
apiParams := params.AddMachineParams{
Series: "quantal",
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id("1234"),
Nonce: "foo",
Series: "quantal",
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id("1234"),
Nonce: "foo",
HardwareCharacteristics: hc,
Addrs: params.FromNetworkAddresses(addrs...),
Addrs: params.FromNetworkAddresses(addrs...),
}
machines, err := s.APIState.Client().AddMachines([]params.AddMachineParams{apiParams})
c.Assert(err, jc.ErrorIsNil)
Expand Down
10 changes: 5 additions & 5 deletions apiserver/facades/client/client/statushistory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ func (s *statusHistoryTestSuite) SetUpTest(c *gc.C) {
nil, // modelconfig API
nil, // resources
authorizer,
nil, // presence
nil, // statusSetter
nil, // toolsFinder
nil, // newEnviron
nil, // blockChecker
nil, // presence
nil, // statusSetter
nil, // toolsFinder
nil, // newEnviron
nil, // blockChecker
context.NewCloudCallContext(), // ProviderCallContext
)
c.Assert(err, jc.ErrorIsNil)
Expand Down
12 changes: 6 additions & 6 deletions apiserver/facades/client/machinemanager/machinemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ func (mm *MachineManagerAPI) addOneMachine(p params.AddMachineParams) (*state.Ma
return nil, errors.Trace(err)
}
template := state.MachineTemplate{
Series: p.Series,
Constraints: p.Constraints,
Volumes: volumes,
InstanceId: p.InstanceId,
Jobs: jobs,
Nonce: p.Nonce,
Series: p.Series,
Constraints: p.Constraints,
Volumes: volumes,
InstanceId: p.InstanceId,
Jobs: jobs,
Nonce: p.Nonce,
HardwareCharacteristics: p.HardwareCharacteristics,
Addresses: params.NetworkAddresses(p.Addrs...),
Placement: placementDirective,
Expand Down
Loading

0 comments on commit a9e08c2

Please sign in to comment.