Skip to content

Commit 3487737

Browse files
committed
Fix lint
1 parent 358ca2c commit 3487737

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

cmd/migrate_from_qdrant.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"github.com/qdrant/migration/pkg/refs"
2121
)
2222

23+
const HTTPS = "https"
24+
2325
type MigrateFromQdrantCmd struct {
2426
SourceUrl string `help:"Source GRPC URL, e.g. https://your-qdrant-hostname:6334" required:"true"`
2527
SourceCollection string `help:"Source collection" required:"true"`
@@ -46,7 +48,7 @@ func getPort(u *url.URL) (int, error) {
4648
return 0, fmt.Errorf("failed to parse source port: %w", err)
4749
}
4850
return sourcePort, nil
49-
} else if u.Scheme == "https" {
51+
} else if u.Scheme == HTTPS {
5052
return 443, nil
5153
}
5254

@@ -60,17 +62,23 @@ func (r *MigrateFromQdrantCmd) Parse() error {
6062
}
6163

6264
r.sourceHost = sourceUrl.Hostname()
63-
r.sourceTLS = sourceUrl.Scheme == "https"
65+
r.sourceTLS = sourceUrl.Scheme == HTTPS
6466
r.sourcePort, err = getPort(sourceUrl)
67+
if err != nil {
68+
return fmt.Errorf("failed to parse source port: %w", err)
69+
}
6570

6671
targetUrl, err := url.Parse(r.TargetUrl)
6772
if err != nil {
6873
return fmt.Errorf("failed to parse target URL: %w", err)
6974
}
7075

7176
r.targetHost = targetUrl.Hostname()
72-
r.targetTLS = targetUrl.Scheme == "https"
77+
r.targetTLS = targetUrl.Scheme == HTTPS
7378
r.targetPort, err = getPort(targetUrl)
79+
if err != nil {
80+
return fmt.Errorf("failed to parse source port: %w", err)
81+
}
7482

7583
return nil
7684
}

0 commit comments

Comments
 (0)