Skip to content

Commit

Permalink
Fix conflicting package names
Browse files Browse the repository at this point in the history
...and the stuttering name linter warnings created by said fix.

Signed-off-by: Nic Cope <negz@rk0n.org>
  • Loading branch information
negz committed Jan 15, 2020
1 parent 2e53eb2 commit 96f3434
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 170 deletions.
2 changes: 1 addition & 1 deletion pkg/reconciler/claimbinding/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package claimbinding

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/claimbinding/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package claimbinding

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/claimbinding/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package claimbinding

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/claimbinding/configurator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package claimbinding

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/claimbinding/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package claimbinding

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/claimbinding/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package claimbinding

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/claimscheduling/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package claimscheduling

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/claimscheduling/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package claimscheduling

import (
"strconv"
Expand Down
28 changes: 14 additions & 14 deletions pkg/reconciler/managed/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package managed

import (
"context"
Expand All @@ -37,19 +37,19 @@ const (
errUpdateManagedStatus = "cannot update managed resource status"
)

// An APIManagedFinalizer adds and removes finalizers to and from a resource.
type APIManagedFinalizer struct {
// An APIFinalizer adds and removes finalizers to and from a resource.
type APIFinalizer struct {
client client.Client
finalizer string
}

// NewAPIManagedFinalizer returns a new APIManagedFinalizer.
func NewAPIManagedFinalizer(c client.Client, finalizer string) *APIManagedFinalizer {
return &APIManagedFinalizer{client: c, finalizer: finalizer}
// NewAPIFinalizer returns a new APIFinalizer.
func NewAPIFinalizer(c client.Client, finalizer string) *APIFinalizer {
return &APIFinalizer{client: c, finalizer: finalizer}
}

// AddFinalizer to the supplied Managed resource.
func (a *APIManagedFinalizer) AddFinalizer(ctx context.Context, mg resource.Managed) error {
func (a *APIFinalizer) AddFinalizer(ctx context.Context, mg resource.Managed) error {
if meta.FinalizerExists(mg, a.finalizer) {
return nil
}
Expand All @@ -58,23 +58,23 @@ func (a *APIManagedFinalizer) AddFinalizer(ctx context.Context, mg resource.Mana
}

// RemoveFinalizer from the supplied Managed resource.
func (a *APIManagedFinalizer) RemoveFinalizer(ctx context.Context, mg resource.Managed) error {
func (a *APIFinalizer) RemoveFinalizer(ctx context.Context, mg resource.Managed) error {
meta.RemoveFinalizer(mg, a.finalizer)
return errors.Wrap(resource.IgnoreNotFound(a.client.Update(ctx, mg)), errUpdateManaged)
}

// ManagedNameAsExternalName writes the name of the managed resource to
// NameAsExternalName writes the name of the managed resource to
// the external name annotation field in order to be used as name of
// the external resource in provider.
type ManagedNameAsExternalName struct{ client client.Client }
type NameAsExternalName struct{ client client.Client }

// NewManagedNameAsExternalName returns a new ManagedNameAsExternalName.
func NewManagedNameAsExternalName(c client.Client) *ManagedNameAsExternalName {
return &ManagedNameAsExternalName{client: c}
// NewNameAsExternalName returns a new NameAsExternalName.
func NewNameAsExternalName(c client.Client) *NameAsExternalName {
return &NameAsExternalName{client: c}
}

// Initialize the given managed resource.
func (a *ManagedNameAsExternalName) Initialize(ctx context.Context, mg resource.Managed) error {
func (a *NameAsExternalName) Initialize(ctx context.Context, mg resource.Managed) error {
if meta.GetExternalName(mg) != "" {
return nil
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/reconciler/managed/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package managed

import (
"context"
Expand All @@ -38,8 +38,8 @@ import (
)

var (
_ ManagedFinalizer = &APIManagedFinalizer{}
_ ManagedInitializer = &ManagedNameAsExternalName{}
_ Finalizer = &APIFinalizer{}
_ Initializer = &NameAsExternalName{}
)

func TestManagedRemoveFinalizer(t *testing.T) {
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestManagedRemoveFinalizer(t *testing.T) {

for name, tc := range cases {
t.Run(name, func(t *testing.T) {
api := NewAPIManagedFinalizer(tc.client, finalizer)
api := NewAPIFinalizer(tc.client, finalizer)
err := api.RemoveFinalizer(tc.args.ctx, tc.args.mg)
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
t.Errorf("api.RemoveFinalizer(...): -want error, +got error:\n%s", diff)
Expand All @@ -100,7 +100,7 @@ func TestManagedRemoveFinalizer(t *testing.T) {
}
}

func TestAPIManagedFinalizerAdder(t *testing.T) {
func TestAPIFinalizerAdder(t *testing.T) {
finalizer := "veryfinal"

type args struct {
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestAPIManagedFinalizerAdder(t *testing.T) {

for name, tc := range cases {
t.Run(name, func(t *testing.T) {
api := NewAPIManagedFinalizer(tc.client, finalizer)
api := NewAPIFinalizer(tc.client, finalizer)
err := api.AddFinalizer(tc.args.ctx, tc.args.mg)
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
t.Errorf("api.Initialize(...): -want error, +got error:\n%s", diff)
Expand All @@ -158,7 +158,7 @@ func TestAPIManagedFinalizerAdder(t *testing.T) {
}
}

func TestManagedNameAsExternalName(t *testing.T) {
func TestNameAsExternalName(t *testing.T) {
type args struct {
ctx context.Context
mg resource.Managed
Expand Down Expand Up @@ -225,7 +225,7 @@ func TestManagedNameAsExternalName(t *testing.T) {

for name, tc := range cases {
t.Run(name, func(t *testing.T) {
api := NewManagedNameAsExternalName(tc.client)
api := NewNameAsExternalName(tc.client)
err := api.Initialize(tc.args.ctx, tc.args.mg)
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
t.Errorf("api.Initialize(...): -want error, +got error:\n%s", diff)
Expand Down
8 changes: 4 additions & 4 deletions pkg/reconciler/managed/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package managed

import (
"context"
Expand All @@ -23,9 +23,9 @@ import (
)

// A PublisherChain chains multiple ManagedPublishers.
type PublisherChain []ManagedConnectionPublisher
type PublisherChain []ConnectionPublisher

// PublishConnection calls each ManagedConnectionPublisher.PublishConnection serially. It returns the first error it
// PublishConnection calls each ConnectionPublisher.PublishConnection serially. It returns the first error it
// encounters, if any.
func (pc PublisherChain) PublishConnection(ctx context.Context, mg resource.Managed, c ConnectionDetails) error {
for _, p := range pc {
Expand All @@ -36,7 +36,7 @@ func (pc PublisherChain) PublishConnection(ctx context.Context, mg resource.Mana
return nil
}

// UnpublishConnection calls each ManagedConnectionPublisher.UnpublishConnection serially. It returns the first error it
// UnpublishConnection calls each ConnectionPublisher.UnpublishConnection serially. It returns the first error it
// encounters, if any.
func (pc PublisherChain) UnpublishConnection(ctx context.Context, mg resource.Managed, c ConnectionDetails) error {
for _, p := range pc {
Expand Down
12 changes: 6 additions & 6 deletions pkg/reconciler/managed/publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package resource
package managed

import (
"context"
Expand All @@ -29,8 +29,8 @@ import (
)

var (
_ ManagedConnectionPublisher = &APISecretPublisher{}
_ ManagedConnectionPublisher = PublisherChain{}
_ ConnectionPublisher = &APISecretPublisher{}
_ ConnectionPublisher = PublisherChain{}
)

func TestPublisherChain(t *testing.T) {
Expand All @@ -43,7 +43,7 @@ func TestPublisherChain(t *testing.T) {
errBoom := errors.New("boom")

cases := map[string]struct {
p ManagedConnectionPublisher
p ConnectionPublisher
args args
want error
}{
Expand All @@ -58,7 +58,7 @@ func TestPublisherChain(t *testing.T) {
},
"SuccessfulPublisher": {
p: PublisherChain{
ManagedConnectionPublisherFns{
ConnectionPublisherFns{
PublishConnectionFn: func(_ context.Context, mg resource.Managed, c ConnectionDetails) error {
return nil
},
Expand All @@ -76,7 +76,7 @@ func TestPublisherChain(t *testing.T) {
},
"PublisherReturnsError": {
p: PublisherChain{
ManagedConnectionPublisherFns{
ConnectionPublisherFns{
PublishConnectionFn: func(_ context.Context, mg resource.Managed, c ConnectionDetails) error {
return errBoom
},
Expand Down
Loading

0 comments on commit 96f3434

Please sign in to comment.