From 0191234f884cb54475dbed351da0bad3d199cf6e Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 31 Jul 2024 11:10:58 -0400 Subject: [PATCH] fix: lint --- cmd/soft/browse/browse.go | 6 ++--- cmd/soft/serve/serve.go | 2 +- pkg/access/access.go | 6 +++-- pkg/daemon/daemon.go | 7 ++---- pkg/db/migrate/migrations.go | 6 +++-- pkg/git/git.go | 6 ++--- pkg/git/lfs.go | 2 +- pkg/ssh/ui.go | 4 ++-- pkg/ui/common/style.go | 6 ++--- pkg/ui/components/code/code.go | 2 +- pkg/ui/components/footer/footer.go | 2 +- pkg/ui/components/tabs/tabs.go | 4 ++-- pkg/ui/pages/repo/filesitem.go | 7 +++--- pkg/ui/pages/repo/log.go | 2 +- pkg/ui/pages/repo/logitem.go | 2 +- pkg/ui/pages/repo/readme.go | 2 +- pkg/ui/pages/repo/refsitem.go | 4 ++-- pkg/ui/pages/repo/repo.go | 10 ++++---- pkg/ui/pages/selection/item.go | 6 ++--- pkg/ui/pages/selection/selection.go | 8 +++---- pkg/ui/styles/styles.go | 36 ++++++++++++++--------------- pkg/webhook/content_type.go | 6 +++-- pkg/webhook/event.go | 6 +++-- 23 files changed, 72 insertions(+), 70 deletions(-) diff --git a/cmd/soft/browse/browse.go b/cmd/soft/browse/browse.go index ba8ad2caa..c13fe10ab 100644 --- a/cmd/soft/browse/browse.go +++ b/cmd/soft/browse/browse.go @@ -90,7 +90,7 @@ var _ tea.Model = &model{} func (m *model) SetSize(w, h int) { m.common.SetSize(w, h) - style := m.common.Styles.App.Copy() + style := m.common.Styles.App wm := style.GetHorizontalFrameSize() hm := style.GetVerticalFrameSize() if m.showFooter { @@ -206,7 +206,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // View implements tea.Model. func (m *model) View() string { - style := m.common.Styles.App.Copy() + style := m.common.Styles.App wm, hm := style.GetHorizontalFrameSize(), style.GetVerticalFrameSize() if m.showFooter { hm += m.footer.Height() @@ -219,7 +219,7 @@ func (m *model) View() string { case errorState: err := m.common.Styles.ErrorTitle.Render("Bummer") err += m.common.Styles.ErrorBody.Render(m.error.Error()) - view = m.common.Styles.Error.Copy(). + view = m.common.Styles.Error. Width(m.common.Width - wm - m.common.Styles.ErrorBody.GetHorizontalFrameSize()). diff --git a/cmd/soft/serve/serve.go b/cmd/soft/serve/serve.go index 8d8464504..a8546abbe 100644 --- a/cmd/soft/serve/serve.go +++ b/cmd/soft/serve/serve.go @@ -109,7 +109,7 @@ var ( <-done - ctx, cancel := context.WithTimeout(ctx, 30*time.Second) + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) defer cancel() if err := s.Shutdown(ctx); err != nil { return err diff --git a/pkg/access/access.go b/pkg/access/access.go index 44ec3828e..1ca1d56f5 100644 --- a/pkg/access/access.go +++ b/pkg/access/access.go @@ -54,8 +54,10 @@ func ParseAccessLevel(s string) AccessLevel { } } -var _ encoding.TextMarshaler = AccessLevel(0) -var _ encoding.TextUnmarshaler = (*AccessLevel)(nil) +var ( + _ encoding.TextMarshaler = AccessLevel(0) + _ encoding.TextUnmarshaler = (*AccessLevel)(nil) +) // ErrInvalidAccessLevel is returned when an invalid access level is provided. var ErrInvalidAccessLevel = errors.New("invalid access level") diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 5d91565cd..ca821d261 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -37,11 +37,8 @@ var ( }, []string{"repo"}) ) -var ( - - // ErrServerClosed indicates that the server has been closed. - ErrServerClosed = fmt.Errorf("git: %w", net.ErrClosed) -) +// ErrServerClosed indicates that the server has been closed. +var ErrServerClosed = fmt.Errorf("git: %w", net.ErrClosed) // GitDaemon represents a Git daemon. type GitDaemon struct { diff --git a/pkg/db/migrate/migrations.go b/pkg/db/migrate/migrations.go index e2598b414..d134f2304 100644 --- a/pkg/db/migrate/migrations.go +++ b/pkg/db/migrate/migrations.go @@ -52,8 +52,10 @@ func migrateDown(ctx context.Context, tx *db.Tx, version int, name string) error return execMigration(ctx, tx, version, name, true) } -var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)") -var matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])") +var ( + matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)") + matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])") +) func toSnakeCase(str string) string { str = strings.ReplaceAll(str, "-", "_") diff --git a/pkg/git/git.go b/pkg/git/git.go index d6c014296..ed922e264 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -14,10 +14,8 @@ import ( "github.com/go-git/go-git/v5/plumbing/format/pktline" ) -var ( - // ErrNoBranches is returned when a repo has no branches. - ErrNoBranches = errors.New("no branches found") -) +// ErrNoBranches is returned when a repo has no branches. +var ErrNoBranches = errors.New("no branches found") // WritePktline encodes and writes a pktline to the given writer. func WritePktline(w io.Writer, v ...interface{}) error { diff --git a/pkg/git/lfs.go b/pkg/git/lfs.go index acf41468c..3d3ae6f7e 100644 --- a/pkg/git/lfs.go +++ b/pkg/git/lfs.go @@ -177,7 +177,7 @@ func (t *lfsTransfer) Upload(oid string, size int64, r io.Reader, _ transfer.Arg } // Verify implements transfer.Backend. -func (t *lfsTransfer) Verify(oid string, size int64, args transfer.Args) (transfer.Status, error) { +func (t *lfsTransfer) Verify(oid string, size int64, _ transfer.Args) (transfer.Status, error) { obj, err := t.store.GetLFSObjectByOid(t.ctx, t.dbx, t.repo.ID(), oid) if err != nil { if errors.Is(err, db.ErrRecordNotFound) { diff --git a/pkg/ssh/ui.go b/pkg/ssh/ui.go index 7394937c7..9f16f5591 100644 --- a/pkg/ssh/ui.go +++ b/pkg/ssh/ui.go @@ -65,7 +65,7 @@ func NewUI(c common.Common, initialRepo string) *UI { } func (ui *UI) getMargins() (wm, hm int) { - style := ui.common.Styles.App.Copy() + style := ui.common.Styles.App switch ui.activePage { case selectionPage: hm += ui.common.Styles.ServerName.GetHeight() + @@ -271,7 +271,7 @@ func (ui *UI) View() string { case errorState: err := ui.common.Styles.ErrorTitle.Render("Bummer") err += ui.common.Styles.ErrorBody.Render(ui.error.Error()) - view = ui.common.Styles.Error.Copy(). + view = ui.common.Styles.Error. Width(ui.common.Width - wm - ui.common.Styles.ErrorBody.GetHorizontalFrameSize()). diff --git a/pkg/ui/common/style.go b/pkg/ui/common/style.go index cdb9ed3dc..5194820cd 100644 --- a/pkg/ui/common/style.go +++ b/pkg/ui/common/style.go @@ -6,10 +6,8 @@ import ( "github.com/muesli/termenv" ) -var ( - // DefaultColorProfile is the default color profile used by the SSH server. - DefaultColorProfile = termenv.ANSI256 -) +// DefaultColorProfile is the default color profile used by the SSH server. +var DefaultColorProfile = termenv.ANSI256 func strptr(s string) *string { return &s diff --git a/pkg/ui/components/code/code.go b/pkg/ui/components/code/code.go index 3673eb4ca..7b0e3e9e7 100644 --- a/pkg/ui/components/code/code.go +++ b/pkg/ui/components/code/code.go @@ -47,7 +47,7 @@ func New(c common.Common, content, extension string) *Code { TabWidth: defaultTabWidth, SideNotePercent: defaultSideNotePercent, Viewport: vp.New(c), - NoContentStyle: c.Styles.NoContent.Copy().SetString("No Content."), + NoContentStyle: c.Styles.NoContent.SetString("No Content."), } st := common.StyleConfig() r.styleConfig = st diff --git a/pkg/ui/components/footer/footer.go b/pkg/ui/components/footer/footer.go index b65de0e2b..44c800f42 100644 --- a/pkg/ui/components/footer/footer.go +++ b/pkg/ui/components/footer/footer.go @@ -56,7 +56,7 @@ func (f *Footer) View() string { if f.keymap == nil { return "" } - s := f.common.Styles.Footer.Copy(). + s := f.common.Styles.Footer. Width(f.common.Width) helpView := f.help.View(f.keymap) return f.common.Zone.Mark( diff --git a/pkg/ui/components/tabs/tabs.go b/pkg/ui/components/tabs/tabs.go index 81dbf8709..bd3156621 100644 --- a/pkg/ui/components/tabs/tabs.go +++ b/pkg/ui/components/tabs/tabs.go @@ -90,10 +90,10 @@ func (t *Tabs) View() string { s := strings.Builder{} sep := t.TabSeparator for i, tab := range t.tabs { - style := t.TabInactive.Copy() + style := t.TabInactive prefix := " " if i == t.activeTab { - style = t.TabActive.Copy() + style = t.TabActive prefix = t.TabDot.Render("• ") } if t.UseDot { diff --git a/pkg/ui/pages/repo/filesitem.go b/pkg/ui/pages/repo/filesitem.go index eb59313db..a32fcea61 100644 --- a/pkg/ui/pages/repo/filesitem.go +++ b/pkg/ui/pages/repo/filesitem.go @@ -118,14 +118,14 @@ func (d FileItemDelegate) Render(w io.Writer, m list.Model, index int, listItem nameStyle = s.Active.FileName sizeStyle = s.Active.FileSize modeStyle = s.Active.FileMode - fmt.Fprint(w, s.Selector.Render(">")) + fmt.Fprint(w, s.Selector.Render(">")) //nolint:errcheck } else { nameStyle = s.Normal.FileName sizeStyle = s.Normal.FileSize modeStyle = s.Normal.FileMode - fmt.Fprint(w, s.Selector.Render(" ")) + fmt.Fprint(w, s.Selector.Render(" ")) //nolint:errcheck } - sizeStyle = sizeStyle.Copy(). + sizeStyle = sizeStyle. Width(8). Align(lipgloss.Right). MarginLeft(1) @@ -142,6 +142,7 @@ func (d FileItemDelegate) Render(w io.Writer, m list.Model, index int, listItem truncate := d.common.Renderer.NewStyle().MaxWidth(m.Width() - s.Selector.GetHorizontalFrameSize() - s.Selector.GetWidth()) + //nolint:errcheck fmt.Fprint(w, d.common.Zone.Mark( i.ID(), diff --git a/pkg/ui/pages/repo/log.go b/pkg/ui/pages/repo/log.go index b4acc122a..fd1850e1c 100644 --- a/pkg/ui/pages/repo/log.go +++ b/pkg/ui/pages/repo/log.go @@ -346,7 +346,7 @@ func (l *Log) View() string { msg += "s" } msg += "…" - return l.common.Styles.SpinnerContainer.Copy(). + return l.common.Styles.SpinnerContainer. Height(l.common.Height). Render(msg) } diff --git a/pkg/ui/pages/repo/logitem.go b/pkg/ui/pages/repo/logitem.go index 61fb58f8a..ec315ad76 100644 --- a/pkg/ui/pages/repo/logitem.go +++ b/pkg/ui/pages/repo/logitem.go @@ -97,7 +97,7 @@ func (d LogItemDelegate) Render(w io.Writer, m list.Model, index int, listItem l // title truncation symbol (1) 9), ) - hashStyle := styles.Hash.Copy(). + hashStyle := styles.Hash. Align(lipgloss.Right). PaddingLeft(1). Width(m.Width() - diff --git a/pkg/ui/pages/repo/readme.go b/pkg/ui/pages/repo/readme.go index e977bb916..74c5be2f4 100644 --- a/pkg/ui/pages/repo/readme.go +++ b/pkg/ui/pages/repo/readme.go @@ -33,7 +33,7 @@ type Readme struct { // NewReadme creates a new readme model. func NewReadme(common common.Common) *Readme { readme := code.New(common, "", "") - readme.NoContentStyle = readme.NoContentStyle.Copy().SetString("No readme found.") + readme.NoContentStyle = readme.NoContentStyle.SetString("No readme found.") readme.UseGlamour = true s := spinner.New(spinner.WithSpinner(spinner.Dot), spinner.WithStyle(common.Styles.Spinner)) diff --git a/pkg/ui/pages/repo/refsitem.go b/pkg/ui/pages/repo/refsitem.go index 5e071edf4..f96866d3d 100644 --- a/pkg/ui/pages/repo/refsitem.go +++ b/pkg/ui/pages/repo/refsitem.go @@ -141,7 +141,7 @@ func (d RefItemDelegate) Render(w io.Writer, m list.Model, index int, listItem l t := i.Tag if t != nil { - msgSt := st.ItemDesc.Copy().Faint(false) + msgSt := st.ItemDesc.Faint(false) msg := t.Message() nl := strings.Index(msg, "\n") if nl > 0 { @@ -186,7 +186,7 @@ func (d RefItemDelegate) Render(w io.Writer, m list.Model, index int, listItem l lipgloss.Width(sha) - 1 // 1 is for the left padding if hashMargin >= 0 { - hash = strings.Repeat(" ", hashMargin) + st.ItemHash.Copy(). + hash = strings.Repeat(" ", hashMargin) + st.ItemHash. Align(lipgloss.Right). PaddingLeft(1). Render(sha) diff --git a/pkg/ui/pages/repo/repo.go b/pkg/ui/pages/repo/repo.go index 8ae3b3e1a..97e1cf83c 100644 --- a/pkg/ui/pages/repo/repo.go +++ b/pkg/ui/pages/repo/repo.go @@ -295,10 +295,10 @@ func (r *Repo) View() string { wm, hm := r.getMargins() hm += r.common.Styles.Tabs.GetHeight() + r.common.Styles.Tabs.GetVerticalFrameSize() - s := r.common.Styles.Repo.Base.Copy(). + s := r.common.Styles.Repo.Base. Width(r.common.Width - wm). Height(r.common.Height - hm) - mainStyle := r.common.Styles.Repo.Body.Copy(). + mainStyle := r.common.Styles.Repo.Body. Height(r.common.Height - hm) var main string var statusbar string @@ -339,7 +339,7 @@ func (r *Repo) headerView() string { r.common.Styles.Repo.HeaderDesc.Render(desc), ) } - urlStyle := r.common.Styles.URLStyle.Copy(). + urlStyle := r.common.Styles.URLStyle. Width(r.common.Width - lipgloss.Width(desc) - 1). Align(lipgloss.Right) var url string @@ -354,7 +354,7 @@ func (r *Repo) headerView() string { header = lipgloss.JoinHorizontal(lipgloss.Left, header, url) - style := r.common.Styles.Repo.Header.Copy().Width(r.common.Width) + style := r.common.Styles.Repo.Header.Width(r.common.Width) return style.Render( truncate.Render(header), ) @@ -425,7 +425,7 @@ func switchTabCmd(m common.TabComponent) tea.Cmd { func renderLoading(c common.Common, s spinner.Model) string { msg := fmt.Sprintf("%s loading…", s.View()) - return c.Styles.SpinnerContainer.Copy(). + return c.Styles.SpinnerContainer. Height(c.Height). Render(msg) } diff --git a/pkg/ui/pages/selection/item.go b/pkg/ui/pages/selection/item.go index 4a6209dcf..4cd12a91d 100644 --- a/pkg/ui/pages/selection/item.go +++ b/pkg/ui/pages/selection/item.go @@ -178,7 +178,7 @@ func (d *ItemDelegate) Render(w io.Writer, m list.Model, index int, listItem lis if m.Width()-styles.Base.GetHorizontalFrameSize()-lipgloss.Width(updatedStr)-lipgloss.Width(title) <= 0 { updatedStr = "" } - updatedStyle := styles.Updated.Copy(). + updatedStyle := styles.Updated. Align(lipgloss.Right). Width(m.Width() - styles.Base.GetHorizontalFrameSize() - lipgloss.Width(title)) updated := updatedStyle.Render(updatedStr) @@ -189,8 +189,8 @@ func (d *ItemDelegate) Render(w io.Writer, m list.Model, index int, listItem lis } if isFiltered { - unmatched := styles.Title.Copy().Inline(true) - matched := unmatched.Copy().Underline(true) + unmatched := styles.Title.Inline(true) + matched := unmatched.Underline(true) title = lipgloss.StyleRunes(title, matchedRunes, matched, unmatched) } title = styles.Title.Render(title) diff --git a/pkg/ui/pages/selection/selection.go b/pkg/ui/pages/selection/selection.go index 8dd56e66c..7144244c7 100644 --- a/pkg/ui/pages/selection/selection.go +++ b/pkg/ui/pages/selection/selection.go @@ -52,9 +52,9 @@ func New(c common.Common) *Selection { } t := tabs.New(c, ts) t.TabSeparator = c.Renderer.NewStyle() - t.TabInactive = c.Styles.TopLevelNormalTab.Copy() - t.TabActive = c.Styles.TopLevelActiveTab.Copy() - t.TabDot = c.Styles.TopLevelActiveTabDot.Copy() + t.TabInactive = c.Styles.TopLevelNormalTab + t.TabActive = c.Styles.TopLevelActiveTab + t.TabDot = c.Styles.TopLevelActiveTabDot t.UseDot = true sel := &Selection{ common: c, @@ -63,7 +63,7 @@ func New(c common.Common) *Selection { } readme := code.New(c, "", "") readme.UseGlamour = true - readme.NoContentStyle = c.Styles.NoContent.Copy(). + readme.NoContentStyle = c.Styles.NoContent. SetString(defaultNoContent) selector := selector.New(c, []selector.IdentifiableItem{}, diff --git a/pkg/ui/styles/styles.go b/pkg/ui/styles/styles.go index 5874d2cdf..293b152a2 100644 --- a/pkg/ui/styles/styles.go +++ b/pkg/ui/styles/styles.go @@ -191,7 +191,7 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.TopLevelNormalTab = r.NewStyle(). MarginRight(2) - s.TopLevelActiveTab = s.TopLevelNormalTab.Copy(). + s.TopLevelActiveTab = s.TopLevelNormalTab. Foreground(lipgloss.Color("36")) s.TopLevelActiveTabDot = r.NewStyle(). @@ -213,20 +213,20 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.RepoSelector.Normal.Updated = r.NewStyle(). Foreground(lipgloss.Color("243")) - s.RepoSelector.Active.Base = s.RepoSelector.Normal.Base.Copy(). + s.RepoSelector.Active.Base = s.RepoSelector.Normal.Base. BorderStyle(lipgloss.Border{Left: "┃"}). BorderForeground(lipgloss.Color("176")) - s.RepoSelector.Active.Title = s.RepoSelector.Normal.Title.Copy(). + s.RepoSelector.Active.Title = s.RepoSelector.Normal.Title. Foreground(lipgloss.Color("212")) - s.RepoSelector.Active.Desc = s.RepoSelector.Normal.Desc.Copy(). + s.RepoSelector.Active.Desc = s.RepoSelector.Normal.Desc. Foreground(lipgloss.Color("246")) - s.RepoSelector.Active.Updated = s.RepoSelector.Normal.Updated.Copy(). + s.RepoSelector.Active.Updated = s.RepoSelector.Normal.Updated. Foreground(lipgloss.Color("212")) - s.RepoSelector.Active.Command = s.RepoSelector.Normal.Command.Copy(). + s.RepoSelector.Active.Command = s.RepoSelector.Normal.Command. Foreground(lipgloss.Color("204")) s.MenuItem = r.NewStyle(). @@ -306,13 +306,13 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { }, false, false, false, true). PaddingLeft(1) - s.LogItem.Active.Base = s.LogItem.Normal.Base.Copy(). + s.LogItem.Active.Base = s.LogItem.Normal.Base. Border(lipgloss.Border{ Left: "┃", }, false, false, false, true). BorderForeground(selectorColor) - s.LogItem.Active.Hash = s.LogItem.Normal.Hash.Copy(). + s.LogItem.Active.Hash = s.LogItem.Normal.Hash. Foreground(hashColor) s.LogItem.Active.Hash = r.NewStyle(). @@ -332,7 +332,7 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.LogItem.Active.Desc = r.NewStyle(). Foreground(lipgloss.Color("95")) - s.LogItem.Active.Keyword = s.LogItem.Active.Desc.Copy(). + s.LogItem.Active.Keyword = s.LogItem.Active.Desc. Foreground(highlightColorDim) s.LogItem.Normal.Hash = r.NewStyle(). @@ -403,18 +403,18 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { Foreground(highlightColor). Bold(true) - s.Ref.Paginator = s.Log.Paginator.Copy() + s.Ref.Paginator = s.Log.Paginator s.Ref.Selector = r.NewStyle() - s.Tree.Selector = s.Tree.Normal.FileName.Copy(). + s.Tree.Selector = s.Tree.Normal.FileName. Width(1). Foreground(selectorColor) s.Tree.Normal.FileName = r.NewStyle(). MarginLeft(1) - s.Tree.Active.FileName = s.Tree.Normal.FileName.Copy(). + s.Tree.Active.FileName = s.Tree.Normal.FileName. Bold(true). Foreground(highlightColor) @@ -424,22 +424,22 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.Tree.Active.FileDir = r.NewStyle(). Foreground(highlightColor) - s.Tree.Normal.FileMode = s.Tree.Active.FileName.Copy(). + s.Tree.Normal.FileMode = s.Tree.Active.FileName. Width(10). Foreground(lipgloss.Color("243")) - s.Tree.Active.FileMode = s.Tree.Normal.FileMode.Copy(). + s.Tree.Active.FileMode = s.Tree.Normal.FileMode. Foreground(highlightColorDim) - s.Tree.Normal.FileSize = s.Tree.Normal.FileName.Copy(). + s.Tree.Normal.FileSize = s.Tree.Normal.FileName. Foreground(lipgloss.Color("243")) - s.Tree.Active.FileSize = s.Tree.Normal.FileName.Copy(). + s.Tree.Active.FileSize = s.Tree.Normal.FileName. Foreground(highlightColorDim) s.Tree.FileContent = r.NewStyle() - s.Tree.Paginator = s.Log.Paginator.Copy() + s.Tree.Paginator = s.Log.Paginator s.Tree.Blame.Hash = r.NewStyle(). Foreground(hashColor). @@ -511,7 +511,7 @@ func DefaultStyles(r *lipgloss.Renderer) *Styles { s.Stash.Normal.Message = r.NewStyle().MarginLeft(1) - s.Stash.Active.Message = s.Stash.Normal.Message.Copy().Foreground(selectorColor) + s.Stash.Active.Message = s.Stash.Normal.Message.Foreground(selectorColor) s.Stash.Title = r.NewStyle(). Foreground(hashColor). diff --git a/pkg/webhook/content_type.go b/pkg/webhook/content_type.go index 31731d287..451b608d0 100644 --- a/pkg/webhook/content_type.go +++ b/pkg/webhook/content_type.go @@ -45,8 +45,10 @@ func ParseContentType(s string) (ContentType, error) { return -1, ErrInvalidContentType } -var _ encoding.TextMarshaler = ContentType(0) -var _ encoding.TextUnmarshaler = (*ContentType)(nil) +var ( + _ encoding.TextMarshaler = ContentType(0) + _ encoding.TextUnmarshaler = (*ContentType)(nil) +) // UnmarshalText implements encoding.TextUnmarshaler. func (c *ContentType) UnmarshalText(text []byte) error { diff --git a/pkg/webhook/event.go b/pkg/webhook/event.go index 09edb9cab..60926e300 100644 --- a/pkg/webhook/event.go +++ b/pkg/webhook/event.go @@ -76,8 +76,10 @@ func ParseEvent(s string) (Event, error) { return e, nil } -var _ encoding.TextMarshaler = Event(0) -var _ encoding.TextUnmarshaler = (*Event)(nil) +var ( + _ encoding.TextMarshaler = Event(0) + _ encoding.TextUnmarshaler = (*Event)(nil) +) // UnmarshalText implements encoding.TextUnmarshaler. func (e *Event) UnmarshalText(text []byte) error {