Skip to content

Commit

Permalink
Fix method syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed Jan 11, 2024
1 parent 09a7ca8 commit 5d80d93
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 65 deletions.
15 changes: 3 additions & 12 deletions app/di/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/external/cloudfront.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
)

// NewCloudFrontClient returns a new CloudFront client.
func NewCloudFrontClient(cfg *model.AWSConfig) (*cloudfront.Client, error) {
return cloudfront.NewFromConfig(*cfg.Config), nil
func NewCloudFrontClient(cfg *model.AWSConfig) *cloudfront.Client {
return cloudfront.NewFromConfig(*cfg.Config)
}

// CloudFrontCreatorSet is a provider set for CloudFrontCreator.
Expand Down
4 changes: 2 additions & 2 deletions app/external/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (

// NewS3Client creates a new S3 service client.
// If profile is empty, the default profile is used.
func NewS3Client(cfg *model.AWSConfig) (*s3.Client, error) {
return s3.NewFromConfig(*cfg.Config), nil
func NewS3Client(cfg *model.AWSConfig) *s3.Client {
return s3.NewFromConfig(*cfg.Config)
}

// S3BucketCreator implements the S3BucketCreator interface.
Expand Down
6 changes: 1 addition & 5 deletions app/external/s3_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ func S3Client(t *testing.T) *s3.Client {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
return client
return NewS3Client(config)
}

// CreateS3Buckets creates S3 buckets. Region is fixed to ap-northeast-1.
Expand Down
56 changes: 12 additions & 44 deletions app/external/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ func TestS3BucketCreator_CreateS3Bucket(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketCreator := NewS3BucketCreator(client)
input := &service.S3BucketCreatorInput{
Expand All @@ -47,10 +44,7 @@ func TestS3BucketCreator_CreateS3Bucket(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketCreator := NewS3BucketCreator(client)
input := &service.S3BucketCreatorInput{
Expand All @@ -74,10 +68,7 @@ func TestS3BucketCreator_CreateS3Bucket(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketCreator := NewS3BucketCreator(client)
input := &service.S3BucketCreatorInput{
Expand All @@ -97,10 +88,7 @@ func TestS3BucketCreator_CreateS3Bucket(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketCreator := NewS3BucketCreator(client)
input := &service.S3BucketCreatorInput{
Expand All @@ -120,10 +108,7 @@ func TestS3BucketCreator_CreateS3Bucket(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketCreator := NewS3BucketCreator(client)
input := &service.S3BucketCreatorInput{
Expand All @@ -147,10 +132,7 @@ func TestS3BucketLister_ListS3Buckets(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

CreateS3Buckets(t, client, []model.Bucket{
model.Bucket("test-bucket-3"),
Expand Down Expand Up @@ -191,10 +173,7 @@ func TestS3BucketLister_ListS3Buckets(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketLister := NewS3BucketLister(client)
got, err := s3BucketLister.ListS3Buckets(context.Background(), &service.S3BucketListerInput{})
Expand All @@ -220,10 +199,7 @@ func TestS3BucketLocationGetter_GetS3BucketLocation(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

CreateS3Buckets(t, client, []model.Bucket{
model.Bucket("test-bucket-1"),
Expand Down Expand Up @@ -253,10 +229,7 @@ func TestS3BucketLocationGetter_GetS3BucketLocation(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketLocationGetter := NewS3BucketLocationGetter(client)
_, got := s3BucketLocationGetter.GetS3BucketLocation(context.Background(), &service.S3BucketLocationGetterInput{
Expand All @@ -274,10 +247,7 @@ func TestS3BucketLocationGetter_GetS3BucketLocation(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketCreator := NewS3BucketCreator(client)
input := &service.S3BucketCreatorInput{
Expand Down Expand Up @@ -327,10 +297,8 @@ func TestS3BucketDeleter_DeleteS3Bucket(t *testing.T) {
if err != nil {
t.Fatal(err)
}
client, err := NewS3Client(config)
if err != nil {
t.Fatal(err)
}
client := NewS3Client(config)

s3BucketCreator := NewS3BucketCreator(client)
input := &service.S3BucketCreatorInput{
Bucket: model.Bucket("test-bucket"),
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/aws/aws-sdk-go-v2 v1.24.1
github.com/aws/aws-sdk-go-v2/config v1.26.3
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.6
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.32.6
github.com/aws/aws-sdk-go-v2/service/s3 v1.48.0
github.com/charmbracelet/bubbles v0.17.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 h1:GrSw8s0Gs/5zZ0SX+gX4zQjRnRsM
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.10 h1:5oE2WzJE56/mVveuDZPJESKlg/00AaS2pY2QZcnxg4M=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.10/go.mod h1:FHbKWQtRBYUz4vO5WBWjzMD2by126ny5y/1EoaWoLfI=
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.6 h1:XdEBz/eAB4K5QyQ9fx3sgbthOW3WiNOSomnhFXk6R+g=
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.6/go.mod h1:3+AceTAg/X5AUM/SkAbgxzviOBmsGaf9POso/Ymz5vc=
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.32.6 h1:xKbFXea2CIF/Wskauz1TMr//wZ6FyzEafMdSBIQqn80=
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.32.6/go.mod h1:iB6PQSb3ULRrrlEiuFfVE318JiBOdk4k46BbuzrrgXc=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw=
Expand Down

0 comments on commit 5d80d93

Please sign in to comment.