convox / convox

Use net.JoinHostPort instead of fmt.Sprintf(...) GO-S1027
Security
Major
11 days agoa year old
Use net.JoinHostPort instead of: fmt.Sprintf("%s:%d", host, port)
13)
14
15func (p *Provider) Proxy(host string, port int, rw io.ReadWriter, opts structs.ProxyOptions) error {
16	cn, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", host, port), 3*time.Second)17	if err != nil {
18		return errors.WithStack(err)
19	}
Use net.JoinHostPort instead of: fmt.Sprintf("%s:%d", addr, port)
 83func (p *apiProxy) ListenAndServe(addr string, port int) error {
 84	s := http.Server{Handler: p.handler}
 85
 86	ln, err := net.Listen("tcp", fmt.Sprintf("%s:%d", addr, port)) 87	if err != nil {
 88		return fmt.Errorf("error: could not create kubernetes proxy listener: %v", err)
 89	}