Migrating to v2
How to migrate to v2 (currently incomplete)
Breaking Changes
Goki-wide
- Import paths have been changed from
github.com/goki/*togoki.dev/*(for example,github.com/goki/gichanged togoki.dev/gi). All repositories with a changed import URL that were on version 1 are now on version 2 and have a major version URL suffix (for example,goki.dev/gi/v2) KiT_*global variables have been renamed toType*(for example,KiT_Buttonchanged toTypeButton); fixing this should be a simple find and replace forKiT_=>TypeAddNew*functions and methods have been renamed toNew*(for example,AddNewButtonchanged toNewButton); fixing this should be a simple find a replace forAddNew=>New
goki/ki
- Package
kihas been moved into the root directory of ki, so it is now imported as justgoki.dev/ki/v2 - Support for automatic Ki field children has been removed, so you now have to manage that yourself (see https://github.com/goki/ki/issues/17)
goki/gi/gi
Defaults()method removed on several widgets (slider, spinbox, scrollbar, etc); it is no longer needed and all calls of it can be deleted.MenuButtonwidget removed; useButtoninstead, as you can put a menu on any button. If you want the arrow indicator again, putbutton.Indicator = icons.KeyboardArrowDownActionandButtonBaseremoved; useButtoninstead.Inactiverenamed toDisabledandActivetoEnabled. Many node flag functions (eg,SetInactive,IsActive, etc) as well as the actual enum constants must be renamed.ClearActfield onTextFieldconverted toLeadingIconandTrailingIcon; useAddClearAction()to easily replicate the same functionality.gi.IconNameremoved and replaced withicons.Icon; many functions and fields have changed types that must be updated; also, previous icon names may be broken or have changed to new icons, and it is strongly recommended that you use the new icon constants instead of untyped string literals.- Prop-based styling and configuration removed; set the
Stylefield usingAddStyleFuncfor styling and directly set the configuration struct fields in your code for configuration. - Prefs colors removed; use
gi.ColorSchemeinstead.
goki/gi/gist
- Color transformation functions like
Highlightnow take non-pointer receivers to support function chaining.
goki/gi/units
units.New*functions have been renamed tounits.*(for example,units.NewPxchanged tounits.Px); fixing this should be a simple find and replace forunits.New(although if you useunits.NewValue, which is unchanged, you will have to avoid changing that).- Renamed
(units.Context).ToDotsFactorto(units.Context).Dots - Removed
units.Pctand related things (replaced withunits.Ew,units.Eh,units.Pw,units.Ph, and related things) - Renamed
units.ContextfieldsElW,ElH,VpW, andVpHtoEw,Eh,Vw, andVhrespectively. - Setter functions for
units.Contextnow also take parent size. units.Valuecontains aDotsFuncfunction (you should use keyed struct literals).
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified January 22, 2024: removed old deps from go mod (0b4edcc)