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: runewidth.go
    path of file: ./repos/kubeedge/vendor/github.com/mattn/go-runewidth
    
    the code of the file until where you have to start completion: package runewidth

import (
	"os"
)

//go:generate go run script/generate.go

var (
	// EastAsianWidth will be
    
func (c *Condition) Truncate(s string, w int, tail string) string {
	if c.StringWidth(s) <= w {
		return s
	}
	r := []rune(s)
	tw := c.StringWidth(tail)
	w -= tw
	width := 0
	i := 0
	for ; i < len(r); i++ {
		cw := c.RuneWidth(r[i])
		if width+cw > w {
			break
		}
		width += cw
	}
	return string(r[0:i]) + tail
}