diff --git a/Canvas.go b/Canvas.go index 92b7442f..a24270b0 100644 --- a/Canvas.go +++ b/Canvas.go @@ -141,8 +141,8 @@ func (c *Canvas) PathStroke(col color.Color, flags DrawFlags, thickness float32) c.DrawList.PathStrokeV(ColorToUint(col), imgui.DrawFlags(flags), thickness) } -func (c *Canvas) PathArcTo(center image.Point, radius, min, max float32, numSegments int32) { - c.DrawList.PathArcToV(ToVec2(center), radius, min, max, numSegments) +func (c *Canvas) PathArcTo(center image.Point, radius, minV, maxV float32, numSegments int32) { + c.DrawList.PathArcToV(ToVec2(center), radius, minV, maxV, numSegments) } func (c *Canvas) PathArcToFast(center image.Point, radius float32, min12, max12 int32) { diff --git a/CodeEditor.go b/CodeEditor.go index 3af1f704..de38cb99 100644 --- a/CodeEditor.go +++ b/CodeEditor.go @@ -1,3 +1,4 @@ +//nolint:gocritic // this file is TODO. We don't want commentedOutCode linter issues here yet. package giu import ( @@ -70,10 +71,10 @@ func (ce *CodeEditorWidget) TabSize(size int) *CodeEditorWidget { func (ce *CodeEditorWidget) LanguageDefinition(definition LanguageDefinition) *CodeEditorWidget { // s := ce.getState() lookup := map[LanguageDefinition]func(){ - //LanguageDefinitionSQL: s.editor.SetLanguageDefinitionSQL, - //LanguageDefinitionCPP: s.editor.SetLanguageDefinitionCPP, - //LanguageDefinitionLua: s.editor.SetLanguageDefinitionLua, - //LanguageDefinitionC: s.editor.SetLanguageDefinitionC, + // LanguageDefinitionSQL: s.editor.SetLanguageDefinitionSQL, + // LanguageDefinitionCPP: s.editor.SetLanguageDefinitionCPP, + // LanguageDefinitionLua: s.editor.SetLanguageDefinitionLua, + // LanguageDefinitionC: s.editor.SetLanguageDefinitionC, } setter, correctDefinition := lookup[definition] @@ -216,7 +217,7 @@ func (ce *CodeEditorWidget) Build() { func (ce *CodeEditorWidget) getState() (state *codeEditorState) { if state = GetState[codeEditorState](Context, ce.title); state == nil { state = &codeEditorState{ - //editor: imgui.NewTextEditor(), + // editor: imgui.NewTextEditor(), } SetState(Context, ce.title, state) diff --git a/Markdown.go b/Markdown.go index ca331f79..e42c4233 100644 --- a/Markdown.go +++ b/Markdown.go @@ -1,3 +1,4 @@ +//nolint:gocritic // this file is TODO. We don't want commentedOutCode lint issues here. package giu // MarkdownWidget implements DearImGui markdown extension diff --git a/Plot.go b/Plot.go index 3c42a2c4..64cfb4a8 100644 --- a/Plot.go +++ b/Plot.go @@ -290,7 +290,7 @@ func (p *BarPlot) Plot() { p.shift, 0, // TODO: implement int32(p.offset), - 8, // sizeof(double) = 8 + 8, // in fact this is sizeof(double) = 8 ) } @@ -404,7 +404,7 @@ func (p *LinePlot) Plot() { p.x0, 0, // flags int32(p.offset), - 8, // sizeof(double) = 8 + 8, // in fact this is sizeof(double) = 8 ) } @@ -448,7 +448,7 @@ func (p *LineXYPlot) Plot() { int32(len(p.xs)), 0, // flags int32(p.offset), - 8, // sizeof(double) = 8 + 8, // in fact this is sizeof(double) = 8 ) } @@ -548,7 +548,7 @@ func (p *ScatterPlot) Plot() { p.x0, 0, // TODO: implement flags int32(p.offset), - 8, // sizeof(double) = 8 + 8, // in fact this is sizeof(double) = 8 ) } @@ -580,6 +580,6 @@ func (p *ScatterXYPlot) Plot() { int32(len(p.xs)), 0, // TODO: implement int32(p.offset), - 8, // sizeof(double) = 8 + 8, // in fact this is sizeof(double) = 8 ) } diff --git a/ProgressIndicator.go b/ProgressIndicator.go index dba0ae88..02448aea 100644 --- a/ProgressIndicator.go +++ b/ProgressIndicator.go @@ -115,7 +115,7 @@ func (p *ProgressIndicatorWidget) Build() { canvas.AddCircleFilled(centerPt2, p.radius/5, rgba) // Draw text - if len(p.label) > 0 { + if p.label != "" { labelWidth, _ := CalcTextSize(Context.FontAtlas.RegisterString(p.label)) labelPos := centerPt.Add(image.Pt(-1*int(labelWidth/2), int(p.radius+p.radius/5+8))) canvas.AddText(labelPos, rgba, p.label) diff --git a/SliderWidgets.go b/SliderWidgets.go index 53478257..489f4f45 100644 --- a/SliderWidgets.go +++ b/SliderWidgets.go @@ -12,20 +12,20 @@ var _ Widget = &SliderIntWidget{} type SliderIntWidget struct { label string value *int32 - min int32 - max int32 + minValue int32 + maxValue int32 format string width float32 onChange func() } // SliderInt constructs new SliderIntWidget. -func SliderInt(value *int32, min, max int32) *SliderIntWidget { +func SliderInt(value *int32, minValue, maxValue int32) *SliderIntWidget { return &SliderIntWidget{ label: GenAutoID("##SliderInt"), value: value, - min: min, - max: max, + minValue: minValue, + maxValue: maxValue, format: "%d", width: 0, onChange: nil, @@ -72,7 +72,7 @@ func (s *SliderIntWidget) Build() { defer PopItemWidth() } - if imgui.SliderIntV(Context.FontAtlas.RegisterString(s.label), s.value, s.min, s.max, s.format, 0) && s.onChange != nil { + if imgui.SliderIntV(Context.FontAtlas.RegisterString(s.label), s.value, s.minValue, s.maxValue, s.format, 0) && s.onChange != nil { s.onChange() } } @@ -85,24 +85,24 @@ type VSliderIntWidget struct { width float32 height float32 value *int32 - min int32 - max int32 + minValue int32 + maxValue int32 format string flags SliderFlags onChange func() } // VSliderInt creates new vslider int. -func VSliderInt(value *int32, min, max int32) *VSliderIntWidget { +func VSliderInt(value *int32, minValue, maxValue int32) *VSliderIntWidget { return &VSliderIntWidget{ - label: GenAutoID("##VSliderInt"), - width: 18, - height: 60, - value: value, - min: min, - max: max, - format: "%d", - flags: SliderFlagsNone, + label: GenAutoID("##VSliderInt"), + width: 18, + height: 60, + value: value, + minValue: minValue, + maxValue: maxValue, + format: "%d", + flags: SliderFlagsNone, } } @@ -147,8 +147,8 @@ func (vs *VSliderIntWidget) Build() { Context.FontAtlas.RegisterString(vs.label), imgui.Vec2{X: vs.width, Y: vs.height}, vs.value, - vs.min, - vs.max, + vs.minValue, + vs.maxValue, vs.format, imgui.SliderFlags(vs.flags), ) && vs.onChange != nil { @@ -163,20 +163,20 @@ var _ Widget = &SliderFloatWidget{} type SliderFloatWidget struct { label string value *float32 - min float32 - max float32 + minValue float32 + maxValue float32 format string width float32 onChange func() } // SliderFloat creates new slider float widget. -func SliderFloat(value *float32, min, max float32) *SliderFloatWidget { +func SliderFloat(value *float32, minValue, maxValue float32) *SliderFloatWidget { return &SliderFloatWidget{ label: GenAutoID("##SliderFloat"), value: value, - min: min, - max: max, + minValue: minValue, + maxValue: maxValue, format: "%.3f", width: 0, onChange: nil, @@ -222,7 +222,7 @@ func (sf *SliderFloatWidget) Build() { defer PopItemWidth() } - if imgui.SliderFloatV(Context.FontAtlas.RegisterString(sf.label), sf.value, sf.min, sf.max, sf.format, 1.0) && sf.onChange != nil { + if imgui.SliderFloatV(Context.FontAtlas.RegisterString(sf.label), sf.value, sf.minValue, sf.maxValue, sf.format, 1.0) && sf.onChange != nil { sf.onChange() } } diff --git a/cmd/gmdeploy/main.go b/cmd/gmdeploy/main.go index bdf5d4dc..08636a75 100644 --- a/cmd/gmdeploy/main.go +++ b/cmd/gmdeploy/main.go @@ -104,7 +104,7 @@ func main() { // Prepare PkgInfo save(filepath.Join(contentsPath, "PkgInfo"), darwinPkginfo()) - if len(iconPath) > 0 && filepath.Ext(iconPath) == iconExtension { + if iconPath != "" && filepath.Ext(iconPath) == iconExtension { // Prepare icon resourcesPath := filepath.Join(contentsPath, "Resources") mkdirAll(resourcesPath)