From 669f55f0d85e7c3fd24e9b01bd13992349af6263 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:27:11 +0200 Subject: [PATCH] fix some lint errors --- Alignment.go | 2 +- Canvas.go | 2 +- Events.go | 2 +- Flags.go | 8 ++++---- FontAtlasProsessor.go | 4 ++-- ImageWidgets.go | 2 +- Keycode.go | 8 +++----- ListClipper.go | 4 +--- MasterWindow.go | 14 +++++++------- Plot.go | 7 ++++--- Popups.go | 2 +- ProgressIndicator.go | 2 +- SliderWidgets.go | 2 +- SplitLayout.go | 2 +- StackWidget.go | 2 +- Style.go | 2 +- StyleIDs.go | 2 +- StyleSetter.go | 2 +- TableWidgets.go | 2 +- TextWidgets.go | 2 +- Texture.go | 3 ++- Utils.go | 4 ++-- Utils_test.go | 2 +- Widgets.go | 2 +- Window.go | 2 +- 25 files changed, 42 insertions(+), 44 deletions(-) diff --git a/Alignment.go b/Alignment.go index 27f552c5..9d36a036 100644 --- a/Alignment.go +++ b/Alignment.go @@ -4,7 +4,7 @@ import ( "fmt" "image" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) // These constants holds information about where GetWidgetWidth should proceed their diff --git a/Canvas.go b/Canvas.go index 704da7fe..0f2b4828 100644 --- a/Canvas.go +++ b/Canvas.go @@ -4,7 +4,7 @@ import ( "image" "image/color" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) // Canvas represents imgui.DrawList diff --git a/Events.go b/Events.go index 14afe252..764ca782 100644 --- a/Events.go +++ b/Events.go @@ -1,6 +1,6 @@ package giu -import "github.com/AllenDang/cimgui-go" +import imgui "github.com/AllenDang/cimgui-go" // MouseButton represents imgui.MouseButton. type MouseButton imgui.MouseButton diff --git a/Flags.go b/Flags.go index a77e684d..ad1b469b 100644 --- a/Flags.go +++ b/Flags.go @@ -333,9 +333,9 @@ const ( ColorEditFlagsHDR ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsHDR) // [Display] // ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. ColorEditFlagsDisplayRGB ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDisplayRGB) - // [Display] // " + // [Display] // ". ColorEditFlagsDisplayHSV ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDisplayHSV) - // [Display] // " + // [Display] // ". ColorEditFlagsDisplayHex ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDisplayHex) // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. ColorEditFlagsUint8 ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsUint8) @@ -446,7 +446,7 @@ const ( TableColumnFlagsNoDirectResize TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoDirectResize) ) -// SliderFlags represents imgui.SliderFlags +// SliderFlags represents imgui.SliderFlags. type SliderFlags imgui.SliderFlags // slider flags. @@ -478,7 +478,7 @@ const ( PlotFlagsNoBoxSelect = PlotFlags(imgui.PlotFlagsNoBoxSelect) // PlotFlagsNoMousePos = PlotFlags(imgui.PlotFlagsNoMousePos) // PlotFlagsNoHighlight = PlotFlags(imgui.PlotFlagsNoHighlight) - // PlotFlagsNoChild = PlotFlags(imgui.PlotFlagsNoChild) + // PlotFlagsNoChild = PlotFlags(imgui.PlotFlagsNoChild). PlotFlagsEqual = PlotFlags(imgui.PlotFlagsEqual) // PlotFlagsYAxis2 = PlotFlags(imgui.PlotFlagsYAxis2) // PlotFlagsYAxis3 = PlotFlags(imgui.PlotFlagsYAxis3) diff --git a/FontAtlasProsessor.go b/FontAtlasProsessor.go index c9478079..02d3df9f 100644 --- a/FontAtlasProsessor.go +++ b/FontAtlasProsessor.go @@ -8,7 +8,7 @@ import ( "sync" "unsafe" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" "github.com/AllenDang/go-findfont" ) @@ -242,7 +242,7 @@ func (a *FontAtlas) rebuildFontAtlas() { } fonts := Context.IO().Fonts() - //fonts.Clear() /// TODO: I'm commenting this out, because it produces panic. + // fonts.Clear() /// TODO: I'm commenting this out, because it produces panic. var sb strings.Builder diff --git a/ImageWidgets.go b/ImageWidgets.go index 64f4cb18..d31590e8 100644 --- a/ImageWidgets.go +++ b/ImageWidgets.go @@ -8,7 +8,7 @@ import ( "net/http" "time" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) var _ Widget = &ImageWidget{} diff --git a/Keycode.go b/Keycode.go index 4109b92c..4f292cf4 100644 --- a/Keycode.go +++ b/Keycode.go @@ -1,8 +1,9 @@ package giu import ( - imgui "github.com/AllenDang/cimgui-go" "log" + + imgui "github.com/AllenDang/cimgui-go" ) // Key represents a imgui key. @@ -13,7 +14,6 @@ type Key imgui.Key // put in the 256+ range). const ( KeyNone Key = Key(imgui.KeyNone) - KeyUnknown = KeyNone // DEPRECATED: since cimgui-go migration use KeyNone KeySpace Key = Key(imgui.KeySpace) KeyApostrophe Key = Key(imgui.KeyApostrophe) KeyComma Key = Key(imgui.KeyComma) @@ -62,8 +62,6 @@ const ( KeyBackslash Key = Key(imgui.KeyBackslash) KeyRightBracket Key = Key(imgui.KeyRightBracket) KeyGraveAccent Key = Key(imgui.KeyGraveAccent) - //KeyWorld1 Key = Key(imgui.KeyWorld1) - //KeyWorld2 Key = Key(imgui.KeyWorld2) KeyEscape Key = Key(imgui.KeyEscape) KeyEnter Key = Key(imgui.KeyEnter) KeyTab Key = Key(imgui.KeyTab) @@ -106,7 +104,7 @@ const ( KeyMenu = Key(imgui.KeyMenu) ) -// refer glfw3.h +// refer glfw3.h. func keyFromGLFWKey(k imgui.GLFWKey) Key { data := map[imgui.GLFWKey]Key{ imgui.GLFWKeySpace: KeySpace, diff --git a/ListClipper.go b/ListClipper.go index 7ff6e6c7..55a3779d 100644 --- a/ListClipper.go +++ b/ListClipper.go @@ -1,8 +1,6 @@ package giu -import ( - "github.com/AllenDang/cimgui-go" -) +import imgui "github.com/AllenDang/cimgui-go" var _ Widget = &ListClipperWrapper{} diff --git a/MasterWindow.go b/MasterWindow.go index 32bc8564..bc2342f1 100644 --- a/MasterWindow.go +++ b/MasterWindow.go @@ -10,7 +10,7 @@ import ( "golang.org/x/image/colornames" ) -// MasterWindowFlags implements BackendWindowFlags +// MasterWindowFlags implements BackendWindowFlags. type MasterWindowFlags int // master window flags. @@ -27,7 +27,7 @@ const ( MasterWindowFlagsTransparent ) -// parseAndApply converts MasterWindowFlags to appropiate imgui.GLFWWindowFlags. +// parseAndApply converts MasterWindowFlags to appropriate imgui.GLFWWindowFlags. func (m MasterWindowFlags) parseAndApply(b imgui.Backend[imgui.GLFWWindowFlags]) { data := map[MasterWindowFlags]struct { f imgui.GLFWWindowFlags @@ -47,7 +47,7 @@ func (m MasterWindowFlags) parseAndApply(b imgui.Backend[imgui.GLFWWindowFlags]) } } -// TODO +// TODO(gucio321) implement this in cimgui-go // DontCare could be used as an argument to (*MasterWindow).SetSizeLimits. // var DontCare int = imgui.GlfwDontCare @@ -274,13 +274,13 @@ func (w *MasterWindow) SetBgColor(bgColor color.Color) { } // GetPos return position of master window. -func (w *MasterWindow) GetPos() (int, int) { - var x, y int32 +func (w *MasterWindow) GetPos() (x int, y int) { + var xResult, yResult int32 if w.backend != nil { - x, y = w.backend.GetWindowPos() + xResult, yResult = w.backend.GetWindowPos() } - return int(x), int(y) + return int(xResult), int(yResult) } // SetPos sets position of master window. diff --git a/Plot.go b/Plot.go index 01e63e3c..e64cc6d4 100644 --- a/Plot.go +++ b/Plot.go @@ -1,8 +1,9 @@ package giu import ( - "github.com/AllenDang/cimgui-go" "image" + + imgui "github.com/AllenDang/cimgui-go" ) // PlotWidget is implemented by all the particular plots, which can be used @@ -398,7 +399,7 @@ func (p *LinePlot) Plot() { ) // TODO: no idea what should it be... - //imgui.PlotDragLineX(Context.FontAtlas.RegisterString(p.title), p.values, p.xScale, p.x0, p.offset) + // imgui.PlotDragLineX(Context.FontAtlas.RegisterString(p.title), p.values, p.xScale, p.x0, p.offset) //imgui.PlotDragLineX( // Context.FontAtlas.RegisterString(p.title), // p.values, @@ -441,7 +442,7 @@ func (p *LineXYPlot) Offset(offset int) *LineXYPlot { // Plot implements Plot interface. func (p *LineXYPlot) Plot() { // TODO: migrate this - //imgui.ImPlotSetPlotYAxis(imgui.ImPlotYAxis(p.yAxis)) + // imgui.ImPlotSetPlotYAxis(imgui.ImPlotYAxis(p.yAxis)) //imgui.ImPlotLineXY(Context.FontAtlas.RegisterString(p.title), p.xs, p.ys, p.offset) } diff --git a/Popups.go b/Popups.go index 9f5d2b13..2d8446ad 100644 --- a/Popups.go +++ b/Popups.go @@ -1,7 +1,7 @@ package giu import ( - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) // OpenPopup opens a popup with specified id. diff --git a/ProgressIndicator.go b/ProgressIndicator.go index f40054b5..dba0ae88 100644 --- a/ProgressIndicator.go +++ b/ProgressIndicator.go @@ -6,7 +6,7 @@ import ( "sync" "time" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) var _ Disposable = &progressIndicatorState{} diff --git a/SliderWidgets.go b/SliderWidgets.go index 5599ff30..53478257 100644 --- a/SliderWidgets.go +++ b/SliderWidgets.go @@ -3,7 +3,7 @@ package giu import ( "fmt" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) var _ Widget = &SliderIntWidget{} diff --git a/SplitLayout.go b/SplitLayout.go index e0574bb9..87f1d002 100644 --- a/SplitLayout.go +++ b/SplitLayout.go @@ -3,7 +3,7 @@ package giu import ( "image/color" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) // SplitDirection represents a direction (vertical/horizontal) of splitting layout. diff --git a/StackWidget.go b/StackWidget.go index 7e60f464..bce8a2dd 100644 --- a/StackWidget.go +++ b/StackWidget.go @@ -1,6 +1,6 @@ package giu -import "github.com/AllenDang/cimgui-go" +import imgui "github.com/AllenDang/cimgui-go" var _ Widget = &StackWidget{} diff --git a/Style.go b/Style.go index a9a5275d..68aadf0e 100644 --- a/Style.go +++ b/Style.go @@ -3,7 +3,7 @@ package giu import ( "image/color" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) // You may want to use styles in order to make your app looking more beautiful. diff --git a/StyleIDs.go b/StyleIDs.go index 2015414a..65ef313d 100644 --- a/StyleIDs.go +++ b/StyleIDs.go @@ -1,6 +1,6 @@ package giu -import "github.com/AllenDang/cimgui-go" +import imgui "github.com/AllenDang/cimgui-go" // Here are the style IDs for styling imgui apps. // For details about each of attributes read comment above them. diff --git a/StyleSetter.go b/StyleSetter.go index 44660f48..3f9f3500 100644 --- a/StyleSetter.go +++ b/StyleSetter.go @@ -3,7 +3,7 @@ package giu import ( "image/color" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) var _ Widget = &StyleSetter{} diff --git a/TableWidgets.go b/TableWidgets.go index 9c5b83ff..d314ce44 100644 --- a/TableWidgets.go +++ b/TableWidgets.go @@ -3,7 +3,7 @@ package giu import ( "image/color" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) type TableRowWidget struct { diff --git a/TextWidgets.go b/TextWidgets.go index 2f105a9c..4053eba2 100644 --- a/TextWidgets.go +++ b/TextWidgets.go @@ -6,7 +6,7 @@ import ( "golang.org/x/image/colornames" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" "github.com/sahilm/fuzzy" ) diff --git a/Texture.go b/Texture.go index dc4cce31..955cbd80 100644 --- a/Texture.go +++ b/Texture.go @@ -1,8 +1,9 @@ package giu import ( - "github.com/AllenDang/cimgui-go" "image" + + imgui "github.com/AllenDang/cimgui-go" ) // Texture represents imgui.TextureID. diff --git a/Utils.go b/Utils.go index d0dc0d84..9edcc635 100644 --- a/Utils.go +++ b/Utils.go @@ -226,7 +226,7 @@ func OpenURL(url string) { } // ColorToUint converts GO color into Uint32 color -// it is 0xRRGGBBAA +// it is 0xRRGGBBAA. func ColorToUint(col color.Color) uint32 { r, g, b, a := col.RGBA() mask := uint32(0xff) @@ -234,7 +234,7 @@ func ColorToUint(col color.Color) uint32 { return r&mask<<24 + g&mask<<16 + b&mask<<8 + a&mask } -// UintToColor converts uint32 of form 0xRRGGBB into color.RGBA +// UintToColor converts uint32 of form 0xRRGGBB into color.RGBA. func UintToColor(col uint32) *color.RGBA { mask := 0xff r := byte(col >> 24 & uint32(mask)) diff --git a/Utils_test.go b/Utils_test.go index 1c30a71a..cf29505b 100644 --- a/Utils_test.go +++ b/Utils_test.go @@ -5,7 +5,7 @@ import ( "image/color" "testing" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" "github.com/stretchr/testify/assert" ) diff --git a/Widgets.go b/Widgets.go index e9b922ba..4631f4b5 100644 --- a/Widgets.go +++ b/Widgets.go @@ -4,7 +4,7 @@ import ( "fmt" "image/color" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) // GenAutoID automatically generates fidget's id. diff --git a/Window.go b/Window.go index 63ab377d..16d551e3 100644 --- a/Window.go +++ b/Window.go @@ -3,7 +3,7 @@ package giu import ( "fmt" - "github.com/AllenDang/cimgui-go" + imgui "github.com/AllenDang/cimgui-go" ) // SingleWindow creates one window filling all available space