You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: manager.go
    path of file: ./repos/rod/lib/launcher
    
    the code of the file until where you have to start completion: package launcher

import (
	"encoding/json"
	"fmt"
	"net/http"
	"net/http/httputil"
	"net/url"
	"os"
	"strings"

	"github.com/go-rod/rod/lib/cdp"
	"github.com/go-rod/rod/lib/launcher/flags"
	"github.com/go-rod/rod/lib/util
    
func NewManaged(serviceURL string) (*Launcher, error) {
	if serviceURL == "" {
		serviceURL = "ws://127.0.0.1:7317"
	}

	u, err := url.Parse(serviceURL)
	if err != nil {
		return nil, err
	}

	l := New()
	l.managed = true
	l.serviceURL = toWS(*u).String()
	l.Flags = nil

	res, err := http.Get(toHTTP(*u).String()) //nolint: noctx
	if err != nil {
		return nil, err
	}
	defer func() { _ = res.Body.Close() }()

	return l, json.NewDecoder(res.Body).Decode(l)
}