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: line_counter.go
    path of file: ./repos/kics/pkg/utils
    
    the code of the file until where you have to start completion: // Package utils contains various utility functions to use in other packages
package utils

import (
	"bufio"
	"os"
	"path/filepath"

	"github.com/rs/zerolog/log"
)

// LineCounter get the number of lines of a given file
func LineCounter(path stri
    
func LineCounter(path string) (int, error) {
	file, err := os.Open(filepath.Clean(path))
	if err != nil {
		return 0, err
	}
	defer func() {
		if err := file.Close(); err != nil {
			log.Err(err).Msgf("failed to close '%s'", filepath.Clean(path))
		}
	}()

	scanner := bufio.NewScanner(file)
	lineCount := 0
	for scanner.Scan() {
		lineCount++
	}

	if err := scanner.Err(); err != nil {
		return 0, err
	}

	return lineCount, nil
}