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: lcov.go
    path of file: ./repos/rules_go/go/tools/bzltestutil
    
    the code of the file until where you have to start completion: // Copyright 2022 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distr
    
func emitLcovLines(lcov io.StringWriter, path string, lineCounts map[uint32]uint32) error {
	_, err := lcov.WriteString(fmt.Sprintf("SF:%s\n", path))
	if err != nil {
		return err
	}

	// Emit the coverage counters for the individual source lines.
	sortedLines := make([]uint32, 0, len(lineCounts))
	for line := range lineCounts {
		sortedLines = append(sortedLines, line)
	}
	sort.Slice(sortedLines, func(i, j int) bool { return sortedLines[i] < sortedLines[j] })
	numCovered := 0
	for _, line := range sortedLines {
		count := lineCounts[line]
		if count > 0 {
			numCovered++
		}
		_, err := lcov.WriteString(fmt.Sprintf("DA:%d,%d\n", line, count))
		if err != nil {
			return err
		}
	}
	// Emit a summary containing the number of all/covered lines and end the info for the current source file.
	_, err = lcov.WriteString(fmt.Sprintf("LH:%d\nLF:%d\nend_of_record\n", numCovered, len(sortedLines)))
	if err != nil {
		return err
	}
	return nil
}