<commit_before>package util

import (
	"log"
	"net"
	"net/http"
	_ "net/http/pprof"
)

func LoggedHTTPServe(addr string) *http.ServeMux {
	if addr == "" {
		addr = "localhost:6061"
	}
	netAddr, err := net.ResolveTCPAddr("tcp", addr)
	if err != nil {
		log.Fatalf("error resolving http addr: %s", err)
	}
	var conn net.Listener
	for try := 0; try < 100; try++ {
		conn, err = net.ListenTCP("tcp", netAddr)
		if err == nil {
			break
		}
		netAddr.Port++
	}
	if err != nil {
		log.Fatalf("error creating http conn: %#v", err)
	}
	log.Printf("starting http server on http://%s", conn.Addr())
	mux := http.NewServeMux()
	go func() {
		defer conn.Close()
		err = (&http.Server{
			Handler: mux,
		}).Serve(conn)
		if err != nil {
			log.Fatalf("error serving http: %s", err)
		}
	}()
	return mux
}
<commit_msg>util/loghttp: Don't implicitly expose pprof<commit_after>package util

import (
	"log"
	"net"
	"net/http"
)

func LoggedHTTPServe(addr string) *http.ServeMux {
	if addr == "" {
		addr = "localhost:6061"
	}
	netAddr, err := net.ResolveTCPAddr("tcp", addr)
	if err != nil {
		log.Fatalf("error resolving http addr: %s", err)
	}
	var conn net.Listener
	for try := 0; try < 100; try++ {
		conn, err = net.ListenTCP("tcp", netAddr)
		if err == nil {
			break
		}
		netAddr.Port++
	}
	if err != nil {
		log.Fatalf("error creating http conn: %#v", err)
	}
	log.Printf("starting http server on http://%s", conn.Addr())
	mux := http.NewServeMux()
	go func() {
		defer conn.Close()
		err = (&http.Server{
			Handler: mux,
		}).Serve(conn)
		if err != nil {
			log.Fatalf("error serving http: %s", err)
		}
	}()
	return mux
}

{'fraction_non_alphanumeric': 0.17469135802469135, 'fraction_numerical': 0.009876543209876543, 'mean_word_length': 3.3226666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5539336', 'n_tokens_mistral': 693, 'n_tokens_neox': 648, 'n_words': 167}