Skip to content

Commit

Permalink
chore: licence and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
atzoum committed Mar 8, 2024
1 parent 9641643 commit a8e7c31
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 6 deletions.
44 changes: 44 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
run:
timeout: 10m
go: '1.22'

linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- unparam
- unconvert
- bodyclose
- decorder
- makezero
- nilnil
- nilerr
- rowserrcheck
- tenv
- wastedassign
- unparam
- misspell
- unconvert
- depguard

issues:
exclude-use-default: true
exclude-case-sensitive: false
max-issues-per-linter: 50
max-same-issues: 10
new: false

linters-settings:
depguard:
rules:
main:
files:
- $all
deny:
- pkg: "github.com/gofrs/uuid"
desc: 'use github.com/google/uuid instead'
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 RudderStack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion sqlconnect/internal/base/tableadmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (db *DB) ListColumns(ctx context.Context, relation sqlconnect.RelationRef)
// ListColumnsForSqlQuery returns a list of columns for the given sql query
func (db *DB) ListColumnsForSqlQuery(ctx context.Context, sql string) ([]sqlconnect.ColumnRef, error) {
var res []sqlconnect.ColumnRef
rows, err := db.DB.QueryContext(ctx, sql)
rows, err := db.DB.QueryContext(ctx, sql) // nolint:rowserrcheck
if err != nil {
return nil, fmt.Errorf("querying list columns for sql query: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion sqlconnect/internal/bigquery/driver/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (connection *bigQueryConnection) Begin() (driver.Tx, error) {
return nil, fmt.Errorf("bigquery: transactions are not supported")
}

func (connection *bigQueryConnection) query(query string) (*bigquery.Query, error) {
func (connection *bigQueryConnection) query(query string) (*bigquery.Query, error) { // nolint: unparam
return connection.client.Query(query), nil
}

Expand Down
2 changes: 1 addition & 1 deletion sqlconnect/internal/bigquery/driver/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (statement bigQueryStatement) buildQuery(args []driver.Value) (*bigquery.Qu
return query, err
}

func (statement bigQueryStatement) buildParameters(args []driver.Value) ([]bigquery.QueryParameter, error) {
func (statement bigQueryStatement) buildParameters(args []driver.Value) ([]bigquery.QueryParameter, error) { // nolint: unparam
if args == nil {
return nil, nil
}
Expand Down
6 changes: 3 additions & 3 deletions sqlconnect/internal/bigquery/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ func jsonRowMapper(databaseTypeName string, value any) any {
return v.Num().Int64()
}
case civil.Date:
return time.Date(int(v.Year), time.Month(v.Month), int(v.Day), 0, 0, 0, 0, time.UTC)
return time.Date(v.Year, v.Month, v.Day, 0, 0, 0, 0, time.UTC)
case civil.Time:
return time.Date(0, 1, 1, int(v.Hour), int(v.Minute), int(v.Second), int(v.Nanosecond), time.UTC)
return time.Date(0, 1, 1, v.Hour, v.Minute, v.Second, v.Nanosecond, time.UTC)
case civil.DateTime:
return time.Date(int(v.Date.Year), time.Month(v.Date.Month), int(v.Date.Day), int(v.Time.Hour), int(v.Time.Minute), int(v.Time.Second), int(v.Time.Nanosecond), time.UTC)
return time.Date(v.Date.Year, v.Date.Month, v.Date.Day, v.Time.Hour, v.Time.Minute, v.Time.Second, v.Time.Nanosecond, time.UTC)
case *bigquery.IntervalValue:
return v.ToDuration()
case []uint8:
Expand Down

0 comments on commit a8e7c31

Please sign in to comment.