Skip to content

Commit

Permalink
Fix staticcheck errors
Browse files Browse the repository at this point in the history
  • Loading branch information
athoscouto committed Sep 25, 2023
1 parent d7b5eaf commit 90e1575
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 41 deletions.
25 changes: 0 additions & 25 deletions internal/cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,6 @@ func closestLocation(client *turso.Client) (string, error) {
return closest, nil
}

func isNorthAmerica(location string) bool {
switch location {
case "atl", "bos", "den", "dfw", "ewr", "iad", "lax", "mia", "ord", "sea", "sjc", "yul", "yyz":
return true
default:
return false
}
}

func suggestedLocation(mainLocation string, locations map[string]string) (string, string) {
if isNorthAmerica(mainLocation) {
return "fra", "Europe"
} else {
return "iad", "North America"
}
}

func isValidLocation(client *turso.Client, location string) bool {
locations, err := locations(client)
if err != nil {
Expand All @@ -220,14 +203,6 @@ func isValidLocation(client *turso.Client, location string) bool {
return ok
}

func locationDescription(client *turso.Client, id string) string {
locations, _ := locations(client)
if desc, ok := locations[id]; ok {
return desc
}
return fmt.Sprintf("Location ID: %s", id)
}

func formatLocation(client *turso.Client, id string) string {
locations, _ := locations(client)
if desc, ok := locations[id]; ok {
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/db_replicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var replicateCmd = &cobra.Command{

if ok, _ := canReplicate(client, dbName); !ok {
cmd := internal.Emph(fmt.Sprintf("turso group locations add %s %s", database.Group, location))
return fmt.Errorf("database %s is part of a group.\nUse %s to replicate the group instead.", internal.Emph(dbName), cmd)
return fmt.Errorf("database %s is part of a group.\nUse %s to replicate the group instead", internal.Emph(dbName), cmd)
}

instance, err := replicate(client, database, location)
Expand Down
15 changes: 0 additions & 15 deletions internal/cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,6 @@ func dbNameAndOrgArgs(cmd *cobra.Command, args []string, toComplete string) ([]s
return dbNameArg(cmd, args, toComplete)
}

func isSQLiteFile(file *os.File) (bool, error) {
defer file.Seek(0, io.SeekStart)
header := make([]byte, 16)
_, err := file.Read(header)
if err != nil && err != io.EOF {
return false, err
}

if string(header) == "SQLite format 3\000" {
return true, nil
}

return false, nil
}

func fetchLatestVersion() (string, error) {
client, err := createUnauthenticatedTursoClient()
if err != nil {
Expand Down

0 comments on commit 90e1575

Please sign in to comment.