MCPcopy
hub / github.com/apache/devlake / ResolvePort

Function ResolvePort

backend/core/utils/network_helper.go:50–66  ·  view source on GitHub ↗

ResolvePort FIXME ...

(port string, schema string)

Source from the content-addressed store, hash-verified

48
49// ResolvePort FIXME ...
50func ResolvePort(port string, schema string) (string, errors.Error) {
51 var defaultPorts = map[string]string{
52 "http": "80",
53 "https": "443",
54 }
55 if port != "" {
56 return port, nil
57 }
58 if schema != "" {
59 port, ok := defaultPorts[schema]
60 if !ok {
61 return "", errors.Default.New(fmt.Sprintf("schema %s not found", schema))
62 }
63 return port, nil
64 }
65 return "", errors.Default.New("you should provide at least one of port or schema")
66}

Callers 1

TestResolvePortFunction · 0.85

Calls 1

NewMethod · 0.65

Tested by 1

TestResolvePortFunction · 0.68