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: fgprof.go
    path of file: ./repos/buildkit/vendor/github.com/felixge/fgprof
    
    the code of the file until where you have to start completion: // fgprof is a sampling Go profiler that allows you to
    
func Start(w io.Writer, format Format) func() error {
	startTime := time.Now()

	// Go's CPU profiler uses 100hz, but 99hz might be less likely to result in
	// accidental synchronization with the program we're profiling.
	const hz = 99
	ticker := time.NewTicker(time.Second / hz)
	stopCh := make(chan struct{})

	prof := &profiler{}
	profile := newWallclockProfile()

	go func() {
		defer ticker.Stop()

		for {
			select {
			case <-ticker.C:
				stacks := prof.GoroutineProfile()
				profile.Add(stacks)
			case <-stopCh:
				return
			}
		}
	}()

	return func() error {
		stopCh <- struct{}{}
		endTime := time.Now()
		profile.Ignore(prof.SelfFrames()...)
		return profile.Export(w, format, hz, startTime, endTime)
	}
}