Skip to content

Contributing

Andy Williams edited this page Oct 9, 2020 · 31 revisions

If you're thinking about contributing to the Fyne project - thanks!

To help ensure consistent code and user-experience we are building this list of standards we follow and ask all contributors to consider this when working on anything to feed into the project.

Commits

  • Source control is using GitFlow - this means that develop is our default branch and master always follows our most recent release. New features should be branched from, and merge back into, develop.
  • Each commit should have 1 purpose. Fixing whitespace or refactoring should be split from feature additions or bug fixing.
  • Continuous integration is run on our main branches and any pull request must pass our standard checks

Code style

  • All new code should have tests

  • Go code will be formatted in the Go default style - this means tab indents amongst other things. Your code can be updated with "goimports -w ." before pushing code

  • Try to keep methods short, with clear naming

  • Where possible check corner cases and input errors at the top of a method and exit early

  • The main body of a function should be the least-indented code, where possible

  • All Go files should have a standardised ordering of the header (everything apart from types and functions) as follows:

    • package
    • imports
    • CGo
    • consts
    • enums
    • vars
  • File should have a single exported type (with some small exceptions) and the following grouping of contents should be followed:

    • [header - see above]
    • exported type (i.e. Widget)
      • type constructor(s)
      • exported methods
      • unexported type methods
    • additionnal unexported types (i.e. a WidgetRenderer - in the same order as above)
  • Within each grouping above methods should be in alphabetical order

  • Package functions (i.e. those functions without a type) should be in a separate file, named pkgname.go, with the following content order:

    • [header - see above]
    • exported functions
    • unexported functions
  • Packages with a main function (normally applications) should have a main.go file that follows this structure:

    • [header - see above]
    • main

More information about higher level contributions can be found on our website.

Welcome to the Fyne wiki.

Project documentation

Getting involved

Platform details

Clone this wiki locally