// MaybePrintUpdateText prints update text if needed
960207
func MaybePrintUpdateText(output io.Writer, url string, lastUpdatePath string) {
	if !shouldCheckURLVersion(lastUpdatePath) {
		return
	}
	latestVersion, err := getLatestVersionFromURL(url)
	if err != nil {
		glog.Warning(err)
		return
	}
	localVersion, err := version.GetSemverVersion()
	if err != nil {
		glog.Warning(err)
		return
	}
	if localVersion.Compare(latestVersion) < 0 {
		writeTimeToFile(lastUpdateCheckFilePath, time.Now().UTC())
		fmt.Fprintf(output, `There is a newer version of minikube available (%s%s).  Download it here:
%s%s

To disable this notification, run the following:
minikube config set WantUpdateNotification false
`,
			version.VersionPrefix, latestVersion, updateLinkPrefix, latestVersion)
	}
}
304133
func IsUpdateable(ctx context.Context) error {
	fn, err := executable(ctx)
	if err != nil {
		return err
	}
	out.Debug(ctx, "isUpdateable - File: %s", fn)
	// check if this is a test binary
	if strings.HasSuffix(filepath.Base(fn), ".test") {
		return nil
	}

	// check if we want to force updateability
	if uf := os.Getenv("GOPASS_FORCE_UPDATE"); uf != "" {
		out.Debug(ctx, "updateable due to force flag")
		return nil
	}

	// check if file is in GOPATH
	if gp := os.Getenv("GOPATH"); strings.HasPrefix(fn, gp) {
		return fmt.Errorf("use go get -u to update binary in GOPATH")
	}

	// check file
	fi, err := os.Stat(fn)
	if err != nil {
		return err
	}
	if !fi.Mode().IsRegular() {
		return fmt.Errorf("not a regular file")
	}
	if err := unix.Access(fn, unix.W_OK); err != nil {
		return err
	}

	// check dir
	fdir := filepath.Dir(fn)
	return unix.Access(fdir, unix.W_OK)
}
1140256
func SimpleUpdate(fn SimpleUpdateFunc) UpdateFunc {
	return func(input runtime.Object, _ ResponseMeta) (runtime.Object, *uint64, error) {
		out, err := fn(input)
		return out, nil, err
	}
}
650816
func printText(w io.Writer, rpt *Report) error {
	items, labels := TextItems(rpt)
	fmt.Fprintln(w, strings.Join(labels, "\n"))
	fmt.Fprintf(w, "%10s %5s%% %5s%% %10s %5s%%\n",
		"flat", "flat", "sum", "cum", "cum")
	var flatSum int64
	for _, item := range items {
		inl := item.InlineLabel
		if inl != "" {
			inl = " " + inl
		}
		flatSum += item.Flat
		fmt.Fprintf(w, "%10s %s %s %10s %s  %s%s\n",
			item.FlatFormat, measurement.Percentage(item.Flat, rpt.total),
			measurement.Percentage(flatSum, rpt.total),
			item.CumFormat, measurement.Percentage(item.Cum, rpt.total),
			item.Name, inl)
	}
	return nil
}
700799
func Print(ctx context.Context, format string, args ...interface{}) {
	if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
		return
	}
	fmt.Fprintf(Stdout, Prefix(ctx)+format+newline(ctx), args...)
}
1061561
func (s *sharedPullerState) AvailableUpdated() time.Time {
	s.mut.RLock()
	t := s.availableUpdated
	s.mut.RUnlock()
	return t
}
1278934
func (c *Context) EditMessageText(om *OutgoingMessage, text string) error {
	if om == nil {
		return errors.New("Empty message provided")
	}

	bot := c.Bot()
	if om.ParseMode == "HTML" {
		textCleared, err := sanitize.HTMLAllowing(text, []string{"a", "b", "strong", "i", "em", "a", "code", "pre"}, []string{"href"})

		if err == nil && textCleared != "" {
			text = textCleared
		}
	}
	om.Text = text
	prevTextHash := om.TextHash
	om.TextHash = om.GetTextHash()


	if om.TextHash == prevTextHash {
		c.Log().Debugf("EditMessageText – message (_id=%s botid=%v id=%v) not updated text have not changed", om.ID.Hex(), bot.ID, om.MsgID)
		return nil
	}


	_, err := bot.API.Send(tg.EditMessageTextConfig{
		BaseEdit: tg.BaseEdit{
			ChatID:      om.ChatID,
			MessageID:   om.MsgID,
			ReplyMarkup: &tg.InlineKeyboardMarkup{InlineKeyboard: om.InlineKeyboardMarkup.tg()},
		},
		ParseMode:             om.ParseMode,
		DisableWebPagePreview: !om.WebPreview,
		Text: text,
	})
	if err != nil {
		if err.(tg.Error).IsCantAccessChat() || err.(tg.Error).ChatMigrated() {
			if c.Callback != nil && c.Callback.AnsweredAt == nil {
				c.AnswerCallbackQuery("Sorry, message can be outdated. Bot can't edit messages created before converting to the Super Group", false)
			}
		} else if err.(tg.Error).IsAntiFlood() {
			c.Log().WithError(err).Warn("TG Anti flood activated")
		}
	} else {
		err = c.db.C("messages").UpdateId(om.ID, bson.M{"$set": bson.M{"texthash": om.TextHash}})
	}
	return err
}
564720
func (c *Client) ImageUpdate(imgID int, label *string, description *string) error {
	args := make(map[string]interface{})
	args["ImageID"] = imgID
	args["label"] = label
	args["description"] = description

	_, err := c.apiCall("image.update", args)
	if err != nil {
		return err
	}

	return nil
}
534583
func (c *ClickTrackingSetting) SetEnableText(enableText bool) *ClickTrackingSetting {
	setEnable := enableText
	c.EnableText = &setEnable
	return c
}
305122
func (templateInstanceStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
	curr := obj.(*templateapi.TemplateInstance)
	prev := old.(*templateapi.TemplateInstance)

	curr.Status = prev.Status
}
1004876
func (p *printer) MaybeLeadingComments(ptr interface{}) {
	comments := p.sourceCodeInfo[ptr].GetLeadingComments()
	// print comments, but insert "//" before each newline.
	for len(comments) > 0 {
		var toPrint string
		if lineEnd := strings.Index(comments, "\n"); lineEnd >= 0 {
			toPrint = comments[:lineEnd+1] // includes newline
			comments = comments[lineEnd+1:]
		} else {
			// actually this does not happen, because comments always end with
			// newline, but just in case.
			toPrint = comments + "\n"
			comments = ""
		}
		p.Printf("//%s", toPrint)
	}
}
1334525
func (u *Updater) NeedUpdate(ctx Context) (upToDate bool, err error) {
	update, err := u.checkForUpdate(ctx, ctx.UpdateOptions())
	if err != nil {
		return false, err
	}
	return update.NeedUpdate, nil
}
926750
func newUpdateStatement(table WritableTable) UpdateStatement {
	return &updateStatementImpl{
		table:        table,
		updateValues: make(map[NonAliasColumn]Expression),
		limit:        -1,
	}
}
525949
func (*IPsTable) needsUpdate(row, cfg *IP) bool {
	return row.VLANId != cfg.VLANId
}
488405
func colorizeUpdateMessage(updateString string, newerThan string) string {
	msgLine1Fmt := " You are running an older version of mc released %s "
	msgLine2Fmt := " Update: %s "

	// Calculate length *without* color coding: with ANSI terminal
	// color characters, the result is incorrect.
	line1Length := len(fmt.Sprintf(msgLine1Fmt, newerThan))
	line2Length := len(fmt.Sprintf(msgLine2Fmt, updateString))

	// Populate lines with color coding.
	line1InColor := fmt.Sprintf(msgLine1Fmt, colorYellowBold(newerThan))
	line2InColor := fmt.Sprintf(msgLine2Fmt, colorCyanBold(updateString))

	// calculate the rectangular box size.
	maxContentWidth := int(math.Max(float64(line1Length), float64(line2Length)))

	// termWidth is set to a default one to use when we are
	// not able to calculate terminal width via OS syscalls
	termWidth := 25
	if width, err := pb.GetTerminalWidth(); err == nil {
		termWidth = width
	}

	// Box cannot be printed if terminal width is small than maxContentWidth
	if maxContentWidth > termWidth {
		return "\n" + line1InColor + "\n" + line2InColor + "\n\n"
	}

	topLeftChar := "┏"
	topRightChar := "┓"
	bottomLeftChar := "┗"
	bottomRightChar := "┛"
	horizBarChar := "━"
	vertBarChar := "┃"
	// on windows terminal turn off unicode characters.
	if runtime.GOOS == "windows" {
		topLeftChar = "+"
		topRightChar = "+"
		bottomLeftChar = "+"
		bottomRightChar = "+"
		horizBarChar = "-"
		vertBarChar = "|"
	}

	lines := []string{
		colorYellowBold(topLeftChar + strings.Repeat(horizBarChar, maxContentWidth) + topRightChar),
		vertBarChar + line1InColor + strings.Repeat(" ", maxContentWidth-line1Length) + vertBarChar,
		vertBarChar + line2InColor + strings.Repeat(" ", maxContentWidth-line2Length) + vertBarChar,
		colorYellowBold(bottomLeftChar + strings.Repeat(horizBarChar, maxContentWidth) + bottomRightChar),
	}
	return "\n" + strings.Join(lines, "\n") + "\n"
}
243892
func (t *TextView) SetText(text string) *TextView {
	t.Clear()
	fmt.Fprint(t, text)
	return t
}
1216906
func (p *PrintingKubeClient) UpdateWithOptions(ns string, currentReader, modifiedReader io.Reader, opts kube.UpdateOptions) error {
	_, err := io.Copy(p.Out, modifiedReader)
	return err
}