Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix function comments based on best practices from Effective Go #456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions customwidget.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ func (cw *CustomWidget) SizeHint() Size {
return Size{100, 100}
}

// deprecated, use PaintMode
// ClearsBackground: deprecated, use PaintMode
func (cw *CustomWidget) ClearsBackground() bool {
return cw.paintMode != PaintNormal
}

// deprecated, use SetPaintMode
// SetClearsBackground: deprecated, use SetPaintMode
func (cw *CustomWidget) SetClearsBackground(value bool) {
if value != cw.ClearsBackground() {
if value {
Expand Down
10 changes: 5 additions & 5 deletions examples/tableview/tableview.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ func NewFooModel() *FooModel {
return m
}

// Called by the TableView from SetModel and every time the model publishes a
// RowCount: Called by the TableView from SetModel and every time the model publishes a
// RowsReset event.
func (m *FooModel) RowCount() int {
return len(m.items)
}

// Called by the TableView when it needs the text to display for a given cell.
// Value: Called by the TableView when it needs the text to display for a given cell.
func (m *FooModel) Value(row, col int) interface{} {
item := m.items[row]

Expand All @@ -66,19 +66,19 @@ func (m *FooModel) Value(row, col int) interface{} {
panic("unexpected col")
}

// Called by the TableView to retrieve if a given row is checked.
// Checked: Called by the TableView to retrieve if a given row is checked.
func (m *FooModel) Checked(row int) bool {
return m.items[row].checked
}

// Called by the TableView when the user toggled the check box of a given row.
// SetChecked: Called by the TableView when the user toggled the check box of a given row.
func (m *FooModel) SetChecked(row int, checked bool) error {
m.items[row].checked = checked

return nil
}

// Called by the TableView to sort the model.
// Sort: Called by the TableView to sort the model.
func (m *FooModel) Sort(col int, order walk.SortOrder) error {
m.sortColumn, m.sortOrder = col, order

Expand Down
2 changes: 1 addition & 1 deletion notifyicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func (ni *NotifyIcon) MouseDown() *MouseEvent {
return ni.mouseDownPublisher.Event()
}

// MouseDown returns the event that is published when a mouse button is released
// MouseUp returns the event that is published when a mouse button is released
// while the cursor is over the NotifyIcon.
func (ni *NotifyIcon) MouseUp() *MouseEvent {
return ni.mouseUpPublisher.Event()
Expand Down
4 changes: 2 additions & 2 deletions numberedit.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (ne *NumberEdit) MinValue() float64 {
return ne.edit.minValue
}

// MinValue returns the maximum value the NumberEdit will accept.
// MaxValue returns the maximum value the NumberEdit will accept.
func (ne *NumberEdit) MaxValue() float64 {
return ne.edit.maxValue
}
Expand Down Expand Up @@ -355,7 +355,7 @@ func (ne *NumberEdit) TextColor() Color {
return ne.edit.TextColor()
}

// TextColor sets the Color used to draw the text of the NumberEdit.
// SetTextColor: sets the Color used to draw the text of the NumberEdit.
func (ne *NumberEdit) SetTextColor(c Color) {
ne.edit.SetTextColor(c)
}
Expand Down
2 changes: 1 addition & 1 deletion window.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ func (wb *WindowBase) path() string {
return buf.String()
}

// WindowBase simply returns the receiver.
// AsWindowBase: simply returns the receiver.
func (wb *WindowBase) AsWindowBase() *WindowBase {
return wb
}
Expand Down