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: int.go
    path of file: ./repos/photoprism/pkg/txt
    
    the code of the file until where you have to start completion: package txt

import (
	"errors"
	"strconv"
	"strings"
)

// Int converts a string to a signed integer or 0 if invalid.
func Int(s string) int {
	if s == "" {
		return 0
	}
    
func IntRange(s string, min, max int) (start int, end int, err error) {
	if s == "" || len(s) > 40 {
		return start, end, errors.New("invalid range")
	}

	valid := false

	p := 0
	v := [][]byte{make([]byte, 0, 20), make([]byte, 0, 20)}

	for i, r := range s {
		if r == 45 {
			if i == 0 || p == 1 {
				v[p] = append(v[p], byte(r))
			} else if p == 0 {
				p = 1
			}
		}
		if r == 46 || r >= 48 && r <= 57 {
			valid = true
			v[p] = append(v[p], byte(r))
		}
	}

	if !valid {
		return start, end, errors.New("invalid range")
	}

	if p == 0 {
		start = Int(string(v[0]))
		end = start
	} else {
		start = Int(string(v[0]))
		end = Int(string(v[1]))
	}

	if start > max {
		start = max
	} else if start < min {
		start = min
	}

	if end > max {
		end = max
	} else if end < min {
		end = min
	}

	return start, end, nil
}