Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Mryashbhardwaj committed Dec 18, 2024
1 parent 1e354e1 commit 7595bee
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
3 changes: 1 addition & 2 deletions ext/scheduler/airflow/bucket/oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import (
"gocloud.dev/blob"

"github.com/goto/optimus/core/tenant"
oss "github.com/goto/optimus/ext/bucket/oss"
"github.com/goto/optimus/ext/scheduler/airflow"
"github.com/goto/optimus/ext/scheduler/airflow/bucket/ossblob"

oss "github.com/goto/optimus/ext/bucket/oss"
)

func (f *Factory) GetOSSBucket(ctx context.Context, tnnt tenant.Tenant, parsedURL *url.URL) (airflow.Bucket, error) {
Expand Down
12 changes: 6 additions & 6 deletions ext/sheets/gsheet/gsheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@ func NewGSheets(ctx context.Context, creds string) (*GSheets, error) {
return &GSheets{srv: srv}, nil
}

func (gs *GSheets) GetAsCSV(url string, range_ string) (string, error) {
func (gs *GSheets) GetAsCSV(url, sheetRange string) (string, error) {
info, err := FromURL(url)
if err != nil {
return "", err
}

if range_ == "" {
range_ = readRange
if sheetRange == "" {
sheetRange = readRange
}
content, err := gs.getSheetContent(info.SheetID, range_)
content, err := gs.getSheetContent(info.SheetID, sheetRange)
if err != nil {
return "", err
}

return csv.FromRecords(content)
}

func (gs *GSheets) getSheetContent(sheetID string, range_ string) ([][]interface{}, error) {
resp, err := gs.srv.Spreadsheets.Values.Get(sheetID, range_).Do()
func (gs *GSheets) getSheetContent(sheetID, sheetRange string) ([][]interface{}, error) {
resp, err := gs.srv.Spreadsheets.Values.Get(sheetID, sheetRange).Do()
if err != nil {
return nil, err
}
Expand Down
4 changes: 0 additions & 4 deletions ext/store/maxcompute/external_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ func (e ExternalTableHandle) Create(res *resource.Resource) error {
return err
}

//if err := e.mcSchema.Create(e.mcSQLExecutor.CurrentSchemaName(), true, ""); err != nil {
// return errors.InternalError(EntitySchema, "error while creating schema on maxcompute", err)
//}

tableSchema, err := buildExternalTableSchema(table)
if err != nil {
return errors.AddErrContext(err, EntityExternalTable, "failed to build table schema to create for "+res.FullName())
Expand Down
8 changes: 4 additions & 4 deletions ext/store/maxcompute/sheet_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import (

"github.com/goto/optimus/core/resource"
"github.com/goto/optimus/core/tenant"
"github.com/goto/optimus/ext/bucket/oss"
bucket "github.com/goto/optimus/ext/bucket/oss"
"github.com/goto/optimus/ext/sheets/gsheet"
)

const (
GsheetCredsKey = "GOOGLE_SHEETS_ACCOUNT"
OSSCredsKey = "OSS_CREDS"
ExtLocation = ""
putTimeOut = time.Duration(time.Second * 10)
putTimeOut = time.Second * 10
)

type SyncerService struct {
Expand Down Expand Up @@ -65,7 +65,7 @@ func (s *SyncerService) Sync(ctx context.Context, res *resource.Resource) error
return s.writeContentToLocation(ctx, res.Tenant(), bucketName, objectKey, content)
}

func (s *SyncerService) getGsheet(ctx context.Context, tnnt tenant.Tenant, sheetURI string, range_ string) (string, error) {
func (s *SyncerService) getGsheet(ctx context.Context, tnnt tenant.Tenant, sheetURI, sheetRange string) (string, error) {
secret, err := s.secretProvider.GetSecret(ctx, tnnt, GsheetCredsKey)
if err != nil {
return "", err
Expand All @@ -75,7 +75,7 @@ func (s *SyncerService) getGsheet(ctx context.Context, tnnt tenant.Tenant, sheet
if err != nil {
return "", err
}
return sheets.GetAsCSV(sheetURI, range_)
return sheets.GetAsCSV(sheetURI, sheetRange)
}

func (s *SyncerService) getBucketName(ctx context.Context, res *resource.Resource, et *ExternalTable) (string, error) {
Expand Down

0 comments on commit 7595bee

Please sign in to comment.