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: tasks.go
    path of file: ./repos/dry/appui/swarm
    
    the code of the file until where you have to start completion: package swarm

import (
	"sort"
	"strings"
	"sync"

	gizaktermui "github.com/gizak/termui"
	"github.com/moncho/dry/appui"
	"github.com/moncho/dry/docker"
	"github.com/moncho/dry/ui/termui"
)

// TasksWidget shows a service's task information
type TasksWidget struct {
	header               *termui.TableHeader
	filteredRows         []*TaskRow
	totalRows            []*TaskRow
	filterPattern        string
	offset               int
	screen              
    
func (s *TasksWidget) updateHeader() {
	sortMode := s.sortMode

	for _, c := range s.header.Columns {
		colTitle := c.Text
		var header appui.SortableColumnHeader
		if strings.Contains(colTitle, appui.DownArrow) {
			colTitle = colTitle[appui.DownArrowLength:]
		}
		for _, h := range taskTableHeaders {
			if colTitle == h.Title {
				header = h
				break
			}
		}
		if header.Mode == appui.SortMode(sortMode) {
			c.Text = appui.DownArrow + colTitle
		} else {
			c.Text = colTitle
		}

	}

}